From 76ea5cf024c7e0f04271402051905dc4d823d379 Mon Sep 17 00:00:00 2001 From: Levente Meszaros Date: Tue, 3 Dec 2024 18:38:08 +0100 Subject: [PATCH] Radio: Replaced 1E-12 constants with a value depending on the simulation time scale. The 1E-12 value comes from the fact that simulations run on the picosecond time scale by default. This is still not ideal but at least the lookahead can go down if the time scale is smaller than picosecond. Fixed issue #857. --- .../physicallayer/wireless/common/radio/packetlevel/Radio.cc | 2 +- .../wireless/ieee802154/bitlevel/Ieee802154UwbIrTransmitter.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inet/physicallayer/wireless/common/radio/packetlevel/Radio.cc b/src/inet/physicallayer/wireless/common/radio/packetlevel/Radio.cc index bcbe258d4a1..95240d8d50c 100644 --- a/src/inet/physicallayer/wireless/common/radio/packetlevel/Radio.cc +++ b/src/inet/physicallayer/wireless/common/radio/packetlevel/Radio.cc @@ -543,7 +543,7 @@ bool Radio::isListeningPossible() const const simtime_t now = simTime(); const Coord& position = antenna->getMobility()->getCurrentPosition(); // TODO use 2 * minInterferenceTime for lookahead? or maybe simply use 0 duration listening? - const IListening *listening = receiver->createListening(this, now, now + 1E-12, position, position); + const IListening *listening = receiver->createListening(this, now, now + SimTime::fromRaw(1), position, position); const IListeningDecision *listeningDecision = medium->listenOnMedium(this, listening); bool isListeningPossible = listeningDecision->isListeningPossible(); delete listening; diff --git a/src/inet/physicallayer/wireless/ieee802154/bitlevel/Ieee802154UwbIrTransmitter.cc b/src/inet/physicallayer/wireless/ieee802154/bitlevel/Ieee802154UwbIrTransmitter.cc index 55980941069..4245c72d302 100644 --- a/src/inet/physicallayer/wireless/ieee802154/bitlevel/Ieee802154UwbIrTransmitter.cc +++ b/src/inet/physicallayer/wireless/ieee802154/bitlevel/Ieee802154UwbIrTransmitter.cc @@ -82,7 +82,7 @@ void Ieee802154UwbIrTransmitter::generateSyncPreamble(std::map& da if (Ieee802154UwbIrMode::C31[Ieee802154UwbIrMode::Ci - 1][pos] != 0) { if (n == 0 && pos == 0) // we slide the first pulse slightly in time to get the first point "inside" the signal - time = 1E-12 + n * cfg.sync_symbol_duration + pos * cfg.spreadingdL * cfg.pulse_duration; + time = SimTime::fromRaw(1) + n * cfg.sync_symbol_duration + pos * cfg.spreadingdL * cfg.pulse_duration; else time = n * cfg.sync_symbol_duration + pos * cfg.spreadingdL * cfg.pulse_duration; // generatePulse(data, time, startTime, C31[Ci - 1][pos], IEEE802154A::maxPulse, IEEE802154A::mandatory_pulse);