From 359880fa73ade9c2636d4fa917576f5815bf80d6 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 11 Jul 2024 14:48:52 +0200 Subject: [PATCH] rfsimulator: use ceil() to calculate the integer number of chan_offset samples from the prop_delay_ms The actual propagation delay should not be smaller than the one specified. A too short propagation delay might result in too early reception of Msg1, and with that in a mis-detection of the RAPID. --- radio/rfsimulator/simulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/rfsimulator/simulator.c b/radio/rfsimulator/simulator.c index e524097898..0a2ece7d21 100644 --- a/radio/rfsimulator/simulator.c +++ b/radio/rfsimulator/simulator.c @@ -983,7 +983,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->tx_bw=openair0_cfg->tx_bw; rfsimulator_readconfig(rfsimulator); if (rfsimulator->prop_delay_ms > 0.0) - rfsimulator->chan_offset = rfsimulator->sample_rate * rfsimulator->prop_delay_ms / 1000; + rfsimulator->chan_offset = ceil(rfsimulator->sample_rate * rfsimulator->prop_delay_ms / 1000); if (rfsimulator->chan_offset != 0) { if (CirSize < minCirSize + rfsimulator->chan_offset) { CirSize = minCirSize + rfsimulator->chan_offset;