Skip to content

Commit

Permalink
Radio: Replaced 1E-12 constants with a value depending on the simulat…
Browse files Browse the repository at this point in the history
…ion 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.
  • Loading branch information
levy committed Dec 3, 2024
1 parent c32b786 commit 76ea5cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void Ieee802154UwbIrTransmitter::generateSyncPreamble(std::map<simsec, WpHz>& 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);
Expand Down

0 comments on commit 76ea5cf

Please sign in to comment.