INET Framework for OMNeT++/OMNEST
inet::physicallayer::RadioMedium Class Reference

The default implementation of the radio medium interface. More...

#include <RadioMedium.h>

Inheritance diagram for inet::physicallayer::RadioMedium:
inet::physicallayer::IRadioMedium inet::physicallayer::IPrintableObject

Public Member Functions

 RadioMedium ()
 
virtual ~RadioMedium ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual const IMaterialgetMaterial () const override
 Returns the material of the radio medium. More...
 
virtual const IPropagationgetPropagation () const override
 Returns the radio signal propagation model of this radio medium. More...
 
virtual const IPathLossgetPathLoss () const override
 Returns the radio signal path loss model of this radio medium. More...
 
virtual const IObstacleLossgetObstacleLoss () const override
 Returns the radio signal obstacle loss model of this radio medium. More...
 
virtual const IAnalogModelgetAnalogModel () const override
 Returns the radio signal analog model of this radio medium. More...
 
virtual const IBackgroundNoisegetBackgroundNoise () const override
 Returns the background noise model of this radio medium. More...
 
virtual const IPhysicalEnvironmentgetPhysicalEnvironment () const override
 Returns the physical environment model of this radio medium. More...
 
virtual const IMediumLimitCachegetMediumLimitCache () const override
 
virtual const INeighborCachegetNeighborCache () const override
 
virtual const ICommunicationCachegetCommunicationCache () const override
 
virtual void addRadio (const IRadio *radio) override
 Adds a new radio to the radio medium. More...
 
virtual void removeRadio (const IRadio *radio) override
 Removes a radio from the radio medium. More...
 
virtual void sendToRadio (IRadio *trasmitter, const IRadio *receiver, const IRadioFrame *frame)
 
virtual IRadioFrametransmitPacket (const IRadio *transmitter, cPacket *macFrame) override
 Returns a new radio frame containing the radio signal transmission that represents the provided MAC frame. More...
 
virtual cPacket * receivePacket (const IRadio *receiver, IRadioFrame *radioFrame) override
 Returns the MAC frame that was transmitted in the provided radio frame. More...
 
virtual const IListeningDecisionlistenOnMedium (const IRadio *receiver, const IListening *listening) const override
 Returns the listening decision that describes what the receiver detects on the radio medium. More...
 
virtual const IArrivalgetArrival (const IRadio *receiver, const ITransmission *transmission) const override
 Returns the space and time coordinates of the transmission arriving at the provided receiver. More...
 
virtual const IListeninggetListening (const IRadio *receiver, const ITransmission *transmission) const override
 Returns how the radio is listening on the medium when the transmission arrives at the provided receiver. More...
 
virtual const IReceptiongetReception (const IRadio *receiver, const ITransmission *transmission) const override
 Returns the reception of the transmission arriving at the provided receiver. More...
 
virtual const IInterferencegetInterference (const IRadio *receiver, const ITransmission *transmission) const override
 Returns the interference of the transmission arriving at the provided receiver. More...
 
virtual const IInterferencegetInterference (const IRadio *receiver, const IListening *listening, const ITransmission *transmission) const
 
virtual const INoisegetNoise (const IRadio *receiver, const ITransmission *transmission) const override
 Returns the total noise computed from the interference of the transmission arriving at the provided receiver. More...
 
virtual const ISNIRgetSNIR (const IRadio *receiver, const ITransmission *transmission) const override
 Returns the signal to noise and interference ratio of the transmission arriving at the provided receiver. More...
 
virtual bool isReceptionPossible (const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
 Returns true when the reception is possible of the transmission part. More...
 
virtual bool isReceptionAttempted (const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
 Returns true when the reception is attempted of the transmission part. More...
 
virtual bool isReceptionSuccessful (const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
 Returns true when the reception is successful of the transmission part. More...
 
virtual const IReceptionDecisiongetReceptionDecision (const IRadio *receiver, const IListening *listening, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
 Returns the reception decision for the transmission part that specifies whether the reception is possible, attempted, and successful. More...
 
virtual const IReceptionResultgetReceptionResult (const IRadio *receiver, const IListening *listening, const ITransmission *transmission) const override
 Returns the reception result for the transmission that describes the end result of the reception process. More...
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, long value, cObject *details) override
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Protected Types

enum  RangeFilterKind { RANGE_FILTER_ANYWHERE, RANGE_FILTER_INTERFERENCE_RANGE, RANGE_FILTER_COMMUNICATION_RANGE }
 

Protected Member Functions

Module
virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void finish () override
 
virtual void handleMessage (cMessage *message) override
 
Transmission
virtual void addTransmission (const IRadio *transmitter, const ITransmission *transmission)
 Adds a new transmission to the radio medium. More...
 
virtual IRadioFramecreateTransmitterRadioFrame (const IRadio *radio, cPacket *macFrame)
 Creates a new radio frame for the transmitter. More...
 
virtual IRadioFramecreateReceiverRadioFrame (const ITransmission *transmission)
 Creates a new radio frame for a receiver. More...
 
virtual void sendToAffectedRadios (IRadio *transmitter, const IRadioFrame *frame)
 Sends a copy of the provided radio frame to all affected receivers on the radio medium. More...
 
virtual void sendToAllRadios (IRadio *transmitter, const IRadioFrame *frame)
 Sends a copy of the provided radio frame to all receivers on the radio medium. More...
 
Reception
virtual bool isRadioMacAddress (const IRadio *radio, const MACAddress address) const
 
virtual bool isPotentialReceiver (const IRadio *receiver, const ITransmission *transmission) const
 Returns true if the radio can potentially receive the transmission successfully. More...
 
virtual bool isInCommunicationRange (const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const
 
virtual bool isInInterferenceRange (const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const
 
virtual bool isInterferingTransmission (const ITransmission *transmission, const IListening *listening) const
 
virtual bool isInterferingTransmission (const ITransmission *transmission, const IReception *reception) const
 
virtual void removeNonInterferingTransmissions ()
 Removes all cached data related to past transmissions that don't have any effect on any ongoing transmission. More...
 
virtual const std::vector< const IReception * > * computeInterferingReceptions (const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
 
virtual const std::vector< const IReception * > * computeInterferingReceptions (const IReception *reception, const std::vector< const ITransmission * > *transmissions) const
 
virtual const IReceptioncomputeReception (const IRadio *receiver, const ITransmission *transmission) const
 
virtual const IInterferencecomputeInterference (const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
 
virtual const IInterferencecomputeInterference (const IRadio *receiver, const IListening *listening, const ITransmission *transmission, const std::vector< const ITransmission * > *transmissions) const
 
virtual const IReceptionDecisioncomputeReceptionDecision (const IRadio *receiver, const IListening *listening, const ITransmission *transmission, IRadioSignal::SignalPart part, const std::vector< const ITransmission * > *transmissions) const
 
virtual const IReceptionResultcomputeReceptionResult (const IRadio *receiver, const IListening *listening, const ITransmission *transmission, const std::vector< const ITransmission * > *transmissions) const
 
virtual const IListeningDecisioncomputeListeningDecision (const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
 

Protected Attributes

Parameters and other models that control the behavior of the radio medium.
const IPropagationpropagation
 The propagation model is never nullptr. More...
 
const IPathLosspathLoss
 The path loss model is never nullptr. More...
 
const IObstacleLossobstacleLoss
 The obstacle loss model or nullptr if unused. More...
 
const IAnalogModelanalogModel
 The analog model is never nullptr. More...
 
const IBackgroundNoisebackgroundNoise
 The background noise model or nullptr if unused. More...
 
const IPhysicalEnvironmentphysicalEnvironment
 The physical environment model or nullptr if unused. More...
 
const IMaterialmaterial
 The physical material of the medium is never nullptr. More...
 
RangeFilterKind rangeFilter
 The radio medium doesn't send radio frames to a radio if it's outside the range provided by the selected range filter. More...
 
bool radioModeFilter
 True means the radio medium doesn't send radio frames to a radio if it's neither in receiver nor in transceiver mode. More...
 
bool listeningFilter
 True means the radio medium doesn't send radio frames to a radio if it listens on the medium in incompatible mode (e.g. More...
 
bool macAddressFilter
 True means the radio medium doesn't send radio frames to a radio if the mac address of the destination is different. More...
 
bool recordCommunicationLog
 Records all transmissions and receptions into a separate trace file. More...
 
Timer
cMessage * removeNonInterferingTransmissionsTimer
 The message that is used to purge the internal state of the medium. More...
 
State
std::vector< const IRadio * > radios
 The list of radios that can transmit and receive radio signals on the radio medium. More...
 
std::vector< const ITransmission * > transmissions
 The list of ongoing transmissions on the radio medium. More...
 
Cache
IMediumLimitCachemediumLimitCache
 Caches various medium limits among all radios. More...
 
INeighborCacheneighborCache
 Caches neighbors for all radios or nullptr if turned off. More...
 
ICommunicationCachecommunicationCache
 Caches intermediate results of the ongoing communication for all radios. More...
 
Logging
CommunicationLog communicationLog
 The communication log output recorder. More...
 
Statistics
long transmissionCount
 Total number of transmissions. More...
 
long radioFrameSendCount
 Total number of radio frame sends. More...
 
long receptionComputationCount
 Total number of reception computations. More...
 
long interferenceComputationCount
 Total number of interference computations. More...
 
long receptionDecisionComputationCount
 Total number of data reception decision computations. More...
 
long receptionResultComputationCount
 Total number of data reception result computations. More...
 
long listeningDecisionComputationCount
 Total number of listening decision computations. More...
 
long cacheReceptionGetCount
 Total number of reception cache queries. More...
 
long cacheReceptionHitCount
 Total number of reception cache hits. More...
 
long cacheInterferenceGetCount
 Total number of interference cache queries. More...
 
long cacheInterferenceHitCount
 Total number of interference cache hits. More...
 
long cacheNoiseGetCount
 Total number of noise cache queries. More...
 
long cacheNoiseHitCount
 Total number of noise cache hits. More...
 
long cacheSNIRGetCount
 Total number of SNIR cache queries. More...
 
long cacheSNIRHitCount
 Total number of SNIR cache hits. More...
 
long cacheDecisionGetCount
 Total number of reception decision cache queries. More...
 
long cacheDecisionHitCount
 Total number of reception decision cache hits. More...
 
long cacheResultGetCount
 Total number of reception result cache queries. More...
 
long cacheResultHitCount
 Total number of reception result cache hits. More...
 

Private Attributes

friend Radio
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
- Static Public Attributes inherited from inet::physicallayer::IRadioMedium
static simsignal_t radioAddedSignal = cComponent::registerSignal("radioAdded")
 
static simsignal_t radioRemovedSignal = cComponent::registerSignal("radioRemoved")
 
static simsignal_t transmissionAddedSignal = cComponent::registerSignal("transmissionAdded")
 
static simsignal_t transmissionRemovedSignal = cComponent::registerSignal("transmissionRemoved")
 
static simsignal_t transmissionStartedSignal = cComponent::registerSignal("transmissionStarted")
 
static simsignal_t transmissionEndedSignal = cComponent::registerSignal("transmissionEnded")
 
static simsignal_t receptionStartedSignal = cComponent::registerSignal("receptionStarted")
 
static simsignal_t receptionEndedSignal = cComponent::registerSignal("receptionEnded")
 

Detailed Description

The default implementation of the radio medium interface.

Member Enumeration Documentation

Enumerator
RANGE_FILTER_ANYWHERE 
RANGE_FILTER_INTERFERENCE_RANGE 
RANGE_FILTER_COMMUNICATION_RANGE 

Constructor & Destructor Documentation

inet::physicallayer::RadioMedium::RadioMedium ( )
33  :
34  propagation(nullptr),
35  pathLoss(nullptr),
36  obstacleLoss(nullptr),
37  analogModel(nullptr),
38  backgroundNoise(nullptr),
39  physicalEnvironment(nullptr),
40  material(nullptr),
42  radioModeFilter(false),
43  listeningFilter(false),
44  macAddressFilter(false),
47  mediumLimitCache(nullptr),
48  neighborCache(nullptr),
49  communicationCache(nullptr),
69 {
70 }
long cacheNoiseGetCount
Total number of noise cache queries.
Definition: RadioMedium.h:210
long interferenceComputationCount
Total number of interference computations.
Definition: RadioMedium.h:178
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
cMessage * removeNonInterferingTransmissionsTimer
The message that is used to purge the internal state of the medium.
Definition: RadioMedium.h:117
long cacheSNIRGetCount
Total number of SNIR cache queries.
Definition: RadioMedium.h:218
long cacheInterferenceGetCount
Total number of interference cache queries.
Definition: RadioMedium.h:202
bool macAddressFilter
True means the radio medium doesn&#39;t send radio frames to a radio if the mac address of the destinatio...
Definition: RadioMedium.h:103
const IMaterial * material
The physical material of the medium is never nullptr.
Definition: RadioMedium.h:82
bool recordCommunicationLog
Records all transmissions and receptions into a separate trace file.
Definition: RadioMedium.h:109
long listeningDecisionComputationCount
Total number of listening decision computations.
Definition: RadioMedium.h:190
const IPropagation * propagation
The propagation model is never nullptr.
Definition: RadioMedium.h:58
long cacheReceptionGetCount
Total number of reception cache queries.
Definition: RadioMedium.h:194
long receptionDecisionComputationCount
Total number of data reception decision computations.
Definition: RadioMedium.h:182
bool radioModeFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it&#39;s neither in receiver nor in t...
Definition: RadioMedium.h:92
long radioFrameSendCount
Total number of radio frame sends.
Definition: RadioMedium.h:170
long cacheInterferenceHitCount
Total number of interference cache hits.
Definition: RadioMedium.h:206
bool listeningFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it listens on the medium in incom...
Definition: RadioMedium.h:98
const IPhysicalEnvironment * physicalEnvironment
The physical environment model or nullptr if unused.
Definition: RadioMedium.h:78
long cacheNoiseHitCount
Total number of noise cache hits.
Definition: RadioMedium.h:214
long cacheSNIRHitCount
Total number of SNIR cache hits.
Definition: RadioMedium.h:222
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
RangeFilterKind rangeFilter
The radio medium doesn&#39;t send radio frames to a radio if it&#39;s outside the range provided by the selec...
Definition: RadioMedium.h:87
long receptionResultComputationCount
Total number of data reception result computations.
Definition: RadioMedium.h:186
long cacheResultGetCount
Total number of reception result cache queries.
Definition: RadioMedium.h:234
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
const IBackgroundNoise * backgroundNoise
The background noise model or nullptr if unused.
Definition: RadioMedium.h:74
const IObstacleLoss * obstacleLoss
The obstacle loss model or nullptr if unused.
Definition: RadioMedium.h:66
long receptionComputationCount
Total number of reception computations.
Definition: RadioMedium.h:174
const IPathLoss * pathLoss
The path loss model is never nullptr.
Definition: RadioMedium.h:62
long cacheDecisionHitCount
Total number of reception decision cache hits.
Definition: RadioMedium.h:230
long cacheResultHitCount
Total number of reception result cache hits.
Definition: RadioMedium.h:238
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
long transmissionCount
Total number of transmissions.
Definition: RadioMedium.h:166
long cacheDecisionGetCount
Total number of reception decision cache queries.
Definition: RadioMedium.h:226
long cacheReceptionHitCount
Total number of reception cache hits.
Definition: RadioMedium.h:198
inet::physicallayer::RadioMedium::~RadioMedium ( )
virtual
73 {
75  for (const auto transmission : transmissions) {
76  delete communicationCache->getCachedFrame(transmission);
77  delete transmission;
78  }
81 }
cMessage * removeNonInterferingTransmissionsTimer
The message that is used to purge the internal state of the medium.
Definition: RadioMedium.h:117
bool recordCommunicationLog
Records all transmissions and receptions into a separate trace file.
Definition: RadioMedium.h:109
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual void close()
Definition: CommunicationLog.cc:30
CommunicationLog communicationLog
The communication log output recorder.
Definition: RadioMedium.h:158
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
virtual const IRadioFrame * getCachedFrame(const ITransmission *transmission)=0

Member Function Documentation

void inet::physicallayer::RadioMedium::addRadio ( const IRadio radio)
overridevirtual

Adds a new radio to the radio medium.

An exception is thrown if the radio is already added. The radio may immediately start new transmissions and will potentially receive all ongoing and further transmissions.

Implements inet::physicallayer::IRadioMedium.

428 {
429  radios.push_back(radio);
431  if (neighborCache)
432  neighborCache->addRadio(radio);
433  mediumLimitCache->addRadio(radio);
434  for (const auto transmission : transmissions) {
435  const IArrival *arrival = propagation->computeArrival(transmission, radio->getAntenna()->getMobility());
436  const IListening *listening = radio->getReceiver()->createListening(radio, arrival->getStartTime(), arrival->getEndTime(), arrival->getStartPosition(), arrival->getEndPosition());
437  communicationCache->setCachedArrival(radio, transmission, arrival);
438  communicationCache->setCachedListening(radio, transmission, listening);
439  }
440  cModule *radioModule = const_cast<cModule *>(check_and_cast<const cModule *>(radio));
441  if (radioModeFilter)
442  radioModule->subscribe(IRadio::radioModeChangedSignal, this);
443  if (listeningFilter)
444  radioModule->subscribe(IRadio::listeningChangedSignal, this);
445  if (macAddressFilter)
446  getContainingNode(radioModule)->subscribe(NF_INTERFACE_CONFIG_CHANGED, this);
447  emit(radioAddedSignal, radioModule);
448 }
virtual const IArrival * computeArrival(const ITransmission *transmission, IMobility *mobility) const =0
Returns the time and space coordinates when the transmission arrives at the object that moves with th...
bool macAddressFilter
True means the radio medium doesn&#39;t send radio frames to a radio if the mac address of the destinatio...
Definition: RadioMedium.h:103
std::vector< const IRadio * > radios
The list of radios that can transmit and receive radio signals on the radio medium.
Definition: RadioMedium.h:128
const IPropagation * propagation
The propagation model is never nullptr.
Definition: RadioMedium.h:58
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
static simsignal_t radioAddedSignal
Definition: IRadioMedium.h:54
bool radioModeFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it&#39;s neither in receiver nor in t...
Definition: RadioMedium.h:92
virtual void setCachedArrival(const IRadio *receiver, const ITransmission *transmission, const IArrival *arrival)=0
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
bool listeningFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it listens on the medium in incom...
Definition: RadioMedium.h:98
virtual void addRadio(const IRadio *radio)=0
virtual void addRadio(const IRadio *radio)=0
Notifies the cache when a radio is added to the medium.
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
virtual void addRadio(const IRadio *radio)=0
virtual void setCachedListening(const IRadio *receiver, const ITransmission *transmission, const IListening *listening)=0
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
static simsignal_t radioModeChangedSignal
This signal is emitted every time the radio mode changes.
Definition: IRadio.h:54
void inet::physicallayer::RadioMedium::addTransmission ( const IRadio transmitter,
const ITransmission transmission 
)
protectedvirtual

Adds a new transmission to the radio medium.

Referenced by transmitPacket().

474 {
476  transmissions.push_back(transmission);
477  communicationCache->addTransmission(transmission);
478  simtime_t maxArrivalEndTime = transmission->getEndTime();
479  for (const auto receiverRadio : radios) {
480  if (receiverRadio != nullptr && receiverRadio != transmitterRadio) {
481  const IArrival *arrival = propagation->computeArrival(transmission, receiverRadio->getAntenna()->getMobility());
482  const Interval *interval = new Interval(arrival->getStartTime(), arrival->getEndTime(), (void *)transmission);
483  const IListening *listening = receiverRadio->getReceiver()->createListening(receiverRadio, arrival->getStartTime(), arrival->getEndTime(), arrival->getStartPosition(), arrival->getEndPosition());
484  const simtime_t arrivalEndTime = arrival->getEndTime();
485  if (arrivalEndTime > maxArrivalEndTime)
486  maxArrivalEndTime = arrivalEndTime;
487  communicationCache->setCachedArrival(receiverRadio, transmission, arrival);
488  communicationCache->setCachedInterval(receiverRadio, transmission, interval);
489  communicationCache->setCachedListening(receiverRadio, transmission, listening);
490  }
491  }
493  if (!removeNonInterferingTransmissionsTimer->isScheduled()) {
494  Enter_Method_Silent();
496  }
497  emit(transmissionAddedSignal, check_and_cast<const cObject *>(transmission));
498 }
virtual const IArrival * computeArrival(const ITransmission *transmission, IMobility *mobility) const =0
Returns the time and space coordinates when the transmission arrives at the object that moves with th...
virtual void setCachedInterval(const IRadio *receiver, const ITransmission *transmission, const Interval *interval)=0
virtual const simtime_t & getMaxTransmissionDuration() const =0
Returns the maximum possible transmission durations among the radios, the value is in the range [0...
cMessage * removeNonInterferingTransmissionsTimer
The message that is used to purge the internal state of the medium.
Definition: RadioMedium.h:117
std::vector< const IRadio * > radios
The list of radios that can transmit and receive radio signals on the radio medium.
Definition: RadioMedium.h:128
const IPropagation * propagation
The propagation model is never nullptr.
Definition: RadioMedium.h:58
virtual void setCachedArrival(const IRadio *receiver, const ITransmission *transmission, const IArrival *arrival)=0
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual void addTransmission(const ITransmission *transmission)=0
virtual void setCachedInterferenceEndTime(const ITransmission *transmission, const simtime_t interferenceEndTime)=0
static simsignal_t transmissionAddedSignal
Definition: IRadioMedium.h:57
virtual void setCachedListening(const IRadio *receiver, const ITransmission *transmission, const IListening *listening)=0
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
long transmissionCount
Total number of transmissions.
Definition: RadioMedium.h:166
virtual const simtime_t getCachedInterferenceEndTime(const ITransmission *transmission)=0
const IInterference * inet::physicallayer::RadioMedium::computeInterference ( const IRadio receiver,
const IListening listening,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual

Referenced by computeListeningDecision(), getInterference(), isReceptionAttempted(), isReceptionPossible(), and isReceptionSuccessful().

284 {
286  const INoise *noise = backgroundNoise ? backgroundNoise->computeNoise(listening) : nullptr;
287  const std::vector<const IReception *> *interferingReceptions = computeInterferingReceptions(listening, transmissions);
288  return new Interference(noise, interferingReceptions);
289 }
long interferenceComputationCount
Total number of interference computations.
Definition: RadioMedium.h:178
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual const INoise * computeNoise(const IListening *listening) const =0
virtual const std::vector< const IReception * > * computeInterferingReceptions(const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:252
const IBackgroundNoise * backgroundNoise
The background noise model or nullptr if unused.
Definition: RadioMedium.h:74
const IInterference * inet::physicallayer::RadioMedium::computeInterference ( const IRadio receiver,
const IListening listening,
const ITransmission transmission,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual
292 {
294  const IReception *reception = getReception(receiver, transmission);
295  const INoise *noise = backgroundNoise ? backgroundNoise->computeNoise(listening) : nullptr;
296  const std::vector<const IReception *> *interferingReceptions = computeInterferingReceptions(reception, transmissions);
297  return new Interference(noise, interferingReceptions);
298 }
long interferenceComputationCount
Total number of interference computations.
Definition: RadioMedium.h:178
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual const INoise * computeNoise(const IListening *listening) const =0
virtual const std::vector< const IReception * > * computeInterferingReceptions(const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:252
const IBackgroundNoise * backgroundNoise
The background noise model or nullptr if unused.
Definition: RadioMedium.h:74
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
const std::vector< const IReception * > * inet::physicallayer::RadioMedium::computeInterferingReceptions ( const IListening listening,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual

Referenced by computeInterference().

253 {
254  const IRadio *radio = listening->getReceiver();
255  std::vector<const ITransmission *> *interferingTransmissions = communicationCache->computeInterferingTransmissions(radio, listening->getStartTime(), listening->getEndTime());
256  std::vector<const IReception *> *interferingReceptions = new std::vector<const IReception *>();
257  for (const auto interferingTransmission : *interferingTransmissions)
258  if (isInterferingTransmission(interferingTransmission, listening))
259  interferingReceptions->push_back(getReception(radio, interferingTransmission));
260  delete interferingTransmissions;
261  return interferingReceptions;
262 }
virtual std::vector< const ITransmission * > * computeInterferingTransmissions(const IRadio *radio, const simtime_t startTime, const simtime_t endTime)=0
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
virtual bool isInterferingTransmission(const ITransmission *transmission, const IListening *listening) const
Definition: RadioMedium.cc:206
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
const std::vector< const IReception * > * inet::physicallayer::RadioMedium::computeInterferingReceptions ( const IReception reception,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual
265 {
266  const IRadio *radio = reception->getReceiver();
267  const ITransmission *transmission = reception->getTransmission();
268  std::vector<const ITransmission *> *interferingTransmissions = communicationCache->computeInterferingTransmissions(radio, reception->getStartTime(), reception->getEndTime());
269  std::vector<const IReception *> *interferingReceptions = new std::vector<const IReception *>();
270  for (const auto interferingTransmission : *interferingTransmissions)
271  if (transmission != interferingTransmission && isInterferingTransmission(interferingTransmission, reception))
272  interferingReceptions->push_back(getReception(radio, interferingTransmission));
273  delete interferingTransmissions;
274  return interferingReceptions;
275 }
virtual std::vector< const ITransmission * > * computeInterferingTransmissions(const IRadio *radio, const simtime_t startTime, const simtime_t endTime)=0
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
virtual bool isInterferingTransmission(const ITransmission *transmission, const IListening *listening) const
Definition: RadioMedium.cc:206
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
const IListeningDecision * inet::physicallayer::RadioMedium::computeListeningDecision ( const IRadio receiver,
const IListening listening,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual

Referenced by listenOnMedium().

319 {
321  const IInterference *interference = computeInterference(radio, listening, transmissions);
322  const IListeningDecision *decision = radio->getReceiver()->computeListeningDecision(listening, interference);
323  delete interference;
324  return decision;
325 }
long listeningDecisionComputationCount
Total number of listening decision computations.
Definition: RadioMedium.h:190
virtual const IInterference * computeInterference(const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:283
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
const IReception * inet::physicallayer::RadioMedium::computeReception ( const IRadio receiver,
const ITransmission transmission 
) const
protectedvirtual

Referenced by getReception().

278 {
280  return analogModel->computeReception(radio, transmission, getArrival(radio, transmission));
281 }
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
virtual const IReception * computeReception(const IRadio *receiver, const ITransmission *transmission, const IArrival *arrival) const =0
Returns the reception for the provided transmission at the receiver.
virtual const IArrival * getArrival(const IRadio *receiver, const ITransmission *transmission) const override
Returns the space and time coordinates of the transmission arriving at the provided receiver...
Definition: RadioMedium.cc:327
long receptionComputationCount
Total number of reception computations.
Definition: RadioMedium.h:174
const IReceptionDecision * inet::physicallayer::RadioMedium::computeReceptionDecision ( const IRadio receiver,
const IListening listening,
const ITransmission transmission,
IRadioSignal::SignalPart  part,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual

Referenced by getReceptionDecision().

301 {
303  const IReception *reception = getReception(radio, transmission);
304  const IInterference *interference = getInterference(radio, listening, transmission);
305  const ISNIR *snir = getSNIR(radio, transmission);
306  return radio->getReceiver()->computeReceptionDecision(listening, reception, part, interference, snir);
307 }
virtual const ISNIR * getSNIR(const IRadio *receiver, const ITransmission *transmission) const override
Returns the signal to noise and interference ratio of the transmission arriving at the provided recei...
Definition: RadioMedium.cc:384
long receptionDecisionComputationCount
Total number of data reception decision computations.
Definition: RadioMedium.h:182
virtual const IInterference * getInterference(const IRadio *receiver, const ITransmission *transmission) const override
Returns the interference of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:351
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
const IReceptionResult * inet::physicallayer::RadioMedium::computeReceptionResult ( const IRadio receiver,
const IListening listening,
const ITransmission transmission,
const std::vector< const ITransmission * > *  transmissions 
) const
protectedvirtual

Referenced by getReceptionResult().

310 {
312  const IReception *reception = getReception(radio, transmission);
313  const IInterference *interference = getInterference(radio, listening, transmission);
314  const ISNIR *snir = getSNIR(radio, transmission);
315  return radio->getReceiver()->computeReceptionResult(listening, reception, interference, snir);
316 }
virtual const ISNIR * getSNIR(const IRadio *receiver, const ITransmission *transmission) const override
Returns the signal to noise and interference ratio of the transmission arriving at the provided recei...
Definition: RadioMedium.cc:384
virtual const IInterference * getInterference(const IRadio *receiver, const ITransmission *transmission) const override
Returns the interference of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:351
long receptionResultComputationCount
Total number of data reception result computations.
Definition: RadioMedium.h:186
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
IRadioFrame * inet::physicallayer::RadioMedium::createReceiverRadioFrame ( const ITransmission transmission)
protectedvirtual

Creates a new radio frame for a receiver.

Referenced by receiveSignal(), and sendToRadio().

515 {
516  auto radioFrame = new RadioFrame(transmission);
517  auto phyFrame = const_cast<cPacket *>(transmission->getPhyFrame());
518  auto macFrame = const_cast<cPacket *>(transmission->getMacFrame());
519  auto encapsulatedFrame = phyFrame != nullptr ? phyFrame : macFrame;
520  radioFrame->setName(encapsulatedFrame->getName());
521  radioFrame->setDuration(transmission->getDuration());
522  radioFrame->encapsulate(encapsulatedFrame->dup());
523  return radioFrame;
524 }
IRadioFrame * inet::physicallayer::RadioMedium::createTransmitterRadioFrame ( const IRadio radio,
cPacket *  macFrame 
)
protectedvirtual

Creates a new radio frame for the transmitter.

Referenced by transmitPacket().

501 {
502  Enter_Method_Silent();
503  take(macFrame);
504  auto transmission = radio->getTransmitter()->createTransmission(radio, macFrame, simTime());
505  auto radioFrame = new RadioFrame(transmission);
506  auto phyFrame = const_cast<cPacket *>(transmission->getPhyFrame());
507  auto encapsulatedFrame = phyFrame != nullptr ? phyFrame : macFrame;
508  radioFrame->setName(encapsulatedFrame->getName());
509  radioFrame->setDuration(transmission->getDuration());
510  radioFrame->encapsulate(encapsulatedFrame);
511  return radioFrame;
512 }
void inet::physicallayer::RadioMedium::finish ( )
overrideprotectedvirtual
121 {
122  double receptionCacheHitPercentage = 100 * (double)cacheReceptionHitCount / (double)cacheReceptionGetCount;
123  double interferenceCacheHitPercentage = 100 * (double)cacheInterferenceHitCount / (double)cacheInterferenceGetCount;
124  double noiseCacheHitPercentage = 100 * (double)cacheNoiseHitCount / (double)cacheNoiseGetCount;
125  double snirCacheHitPercentage = 100 * (double)cacheSNIRHitCount / (double)cacheSNIRGetCount;
126  double decisionCacheHitPercentage = 100 * (double)cacheDecisionHitCount / (double)cacheDecisionGetCount;
127  double resultCacheHitPercentage = 100 * (double)cacheResultHitCount / (double)cacheResultGetCount;
128  EV_INFO << "Transmission count = " << transmissionCount << endl;
129  EV_INFO << "Radio frame send count = " << radioFrameSendCount << endl;
130  EV_INFO << "Reception computation count = " << receptionComputationCount << endl;
131  EV_INFO << "Interference computation count = " << interferenceComputationCount << endl;
132  EV_INFO << "Reception decision computation count = " << receptionDecisionComputationCount << endl;
133  EV_INFO << "Listening decision computation count = " << listeningDecisionComputationCount << endl;
134  EV_INFO << "Reception cache hit = " << receptionCacheHitPercentage << " %" << endl;
135  EV_INFO << "Interference cache hit = " << interferenceCacheHitPercentage << " %" << endl;
136  EV_INFO << "Noise cache hit = " << noiseCacheHitPercentage << " %" << endl;
137  EV_INFO << "SNIR cache hit = " << snirCacheHitPercentage << " %" << endl;
138  EV_INFO << "Reception decision cache hit = " << decisionCacheHitPercentage << " %" << endl;
139  EV_INFO << "Reception result cache hit = " << resultCacheHitPercentage << " %" << endl;
140  recordScalar("transmission count", transmissionCount);
141  recordScalar("radio frame send count", radioFrameSendCount);
142  recordScalar("reception computation count", receptionComputationCount);
143  recordScalar("interference computation count", interferenceComputationCount);
144  recordScalar("reception decision computation count", receptionDecisionComputationCount);
145  recordScalar("listening decision computation count", listeningDecisionComputationCount);
146  recordScalar("reception cache hit", receptionCacheHitPercentage, "%");
147  recordScalar("interference cache hit", interferenceCacheHitPercentage, "%");
148  recordScalar("noise cache hit", noiseCacheHitPercentage, "%");
149  recordScalar("snir cache hit", snirCacheHitPercentage, "%");
150  recordScalar("reception decision cache hit", decisionCacheHitPercentage, "%");
151  recordScalar("reception result cache hit", resultCacheHitPercentage, "%");
152 }
long cacheNoiseGetCount
Total number of noise cache queries.
Definition: RadioMedium.h:210
long interferenceComputationCount
Total number of interference computations.
Definition: RadioMedium.h:178
long cacheSNIRGetCount
Total number of SNIR cache queries.
Definition: RadioMedium.h:218
long cacheInterferenceGetCount
Total number of interference cache queries.
Definition: RadioMedium.h:202
long listeningDecisionComputationCount
Total number of listening decision computations.
Definition: RadioMedium.h:190
long cacheReceptionGetCount
Total number of reception cache queries.
Definition: RadioMedium.h:194
long receptionDecisionComputationCount
Total number of data reception decision computations.
Definition: RadioMedium.h:182
long radioFrameSendCount
Total number of radio frame sends.
Definition: RadioMedium.h:170
long cacheInterferenceHitCount
Total number of interference cache hits.
Definition: RadioMedium.h:206
long cacheNoiseHitCount
Total number of noise cache hits.
Definition: RadioMedium.h:214
long cacheSNIRHitCount
Total number of SNIR cache hits.
Definition: RadioMedium.h:222
long cacheResultGetCount
Total number of reception result cache queries.
Definition: RadioMedium.h:234
long receptionComputationCount
Total number of reception computations.
Definition: RadioMedium.h:174
long cacheDecisionHitCount
Total number of reception decision cache hits.
Definition: RadioMedium.h:230
long cacheResultHitCount
Total number of reception result cache hits.
Definition: RadioMedium.h:238
long transmissionCount
Total number of transmissions.
Definition: RadioMedium.h:166
long cacheDecisionGetCount
Total number of reception decision cache queries.
Definition: RadioMedium.h:226
long cacheReceptionHitCount
Total number of reception cache hits.
Definition: RadioMedium.h:198
virtual const IAnalogModel* inet::physicallayer::RadioMedium::getAnalogModel ( ) const
inlineoverridevirtual

Returns the radio signal analog model of this radio medium.

This function never returns nullptr.

Implements inet::physicallayer::IRadioMedium.

325 { return analogModel; }
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
const IArrival * inet::physicallayer::RadioMedium::getArrival ( const IRadio receiver,
const ITransmission transmission 
) const
overridevirtual

Returns the space and time coordinates of the transmission arriving at the provided receiver.

This function never returns nullptr as long as the transmission is live on the radio medium.

Implements inet::physicallayer::IRadioMedium.

Referenced by computeReception(), isInterferingTransmission(), isPotentialReceiver(), receiveSignal(), and sendToRadio().

328 {
329  return communicationCache->getCachedArrival(receiver, transmission);
330 }
virtual const IArrival * getCachedArrival(const IRadio *receiver, const ITransmission *transmission)=0
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
virtual const IBackgroundNoise* inet::physicallayer::RadioMedium::getBackgroundNoise ( ) const
inlineoverridevirtual

Returns the background noise model of this radio medium.

This function may return nullptr if there's no background noise model.

Implements inet::physicallayer::IRadioMedium.

326 { return backgroundNoise; }
const IBackgroundNoise * backgroundNoise
The background noise model or nullptr if unused.
Definition: RadioMedium.h:74
virtual const ICommunicationCache* inet::physicallayer::RadioMedium::getCommunicationCache ( ) const
inlineoverridevirtual

Implements inet::physicallayer::IRadioMedium.

330 { return communicationCache; }
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
const IInterference * inet::physicallayer::RadioMedium::getInterference ( const IRadio receiver,
const ITransmission transmission 
) const
overridevirtual

Returns the interference of the transmission arriving at the provided receiver.

This function never returns nullptr as long as the transmission is live on the radio medium.

Implements inet::physicallayer::IRadioMedium.

Referenced by computeReceptionDecision(), computeReceptionResult(), and getNoise().

352 {
353  return getInterference(receiver, communicationCache->getCachedListening(receiver, transmission), transmission);
354 }
virtual const IListening * getCachedListening(const IRadio *receiver, const ITransmission *transmission)=0
virtual const IInterference * getInterference(const IRadio *receiver, const ITransmission *transmission) const override
Returns the interference of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:351
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
const IInterference * inet::physicallayer::RadioMedium::getInterference ( const IRadio receiver,
const IListening listening,
const ITransmission transmission 
) const
virtual
357 {
359  const IInterference *interference = communicationCache->getCachedInterference(receiver, transmission);
360  if (interference)
362  else {
363  interference = computeInterference(receiver, listening, transmission, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
364  communicationCache->setCachedInterference(receiver, transmission, interference);
365  }
366  return interference;
367 }
virtual const IInterference * getCachedInterference(const IRadio *receiver, const ITransmission *transmission)=0
long cacheInterferenceGetCount
Total number of interference cache queries.
Definition: RadioMedium.h:202
virtual void setCachedInterference(const IRadio *receiver, const ITransmission *transmission, const IInterference *interference)=0
virtual const IInterference * computeInterference(const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:283
long cacheInterferenceHitCount
Total number of interference cache hits.
Definition: RadioMedium.h:206
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
const IListening * inet::physicallayer::RadioMedium::getListening ( const IRadio receiver,
const ITransmission transmission 
) const
overridevirtual

Returns how the radio is listening on the medium when the transmission arrives at the provided receiver.

This function never returns nullptr as long as the transmission is live on the radio medium.

Implements inet::physicallayer::IRadioMedium.

Referenced by isPotentialReceiver(), isReceptionAttempted(), isReceptionPossible(), and isReceptionSuccessful().

333 {
334  return communicationCache->getCachedListening(receiver, transmission);
335 }
virtual const IListening * getCachedListening(const IRadio *receiver, const ITransmission *transmission)=0
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
virtual const IMaterial* inet::physicallayer::RadioMedium::getMaterial ( ) const
inlineoverridevirtual

Returns the material of the radio medium.

This function never returns nullptr.

Implements inet::physicallayer::IRadioMedium.

321 { return material; }
const IMaterial * material
The physical material of the medium is never nullptr.
Definition: RadioMedium.h:82
virtual const INeighborCache* inet::physicallayer::RadioMedium::getNeighborCache ( ) const
inlineoverridevirtual

Implements inet::physicallayer::IRadioMedium.

329 { return neighborCache; }
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
const INoise * inet::physicallayer::RadioMedium::getNoise ( const IRadio receiver,
const ITransmission transmission 
) const
overridevirtual

Returns the total noise computed from the interference of the transmission arriving at the provided receiver.

This function never returns nullptr as long as the transmission is live on the radio medium.

Implements inet::physicallayer::IRadioMedium.

Referenced by getSNIR().

370 {
372  const INoise *noise = communicationCache->getCachedNoise(receiver, transmission);
373  if (noise)
375  else {
376  const IListening *listening = communicationCache->getCachedListening(receiver, transmission);
377  const IInterference *interference = getInterference(receiver, transmission);
378  noise = analogModel->computeNoise(listening, interference);
379  communicationCache->setCachedNoise(receiver, transmission, noise);
380  }
381  return noise;
382 }
long cacheNoiseGetCount
Total number of noise cache queries.
Definition: RadioMedium.h:210
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
virtual const IListening * getCachedListening(const IRadio *receiver, const ITransmission *transmission)=0
long cacheNoiseHitCount
Total number of noise cache hits.
Definition: RadioMedium.h:214
virtual const IInterference * getInterference(const IRadio *receiver, const ITransmission *transmission) const override
Returns the interference of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:351
virtual const INoise * getCachedNoise(const IRadio *receiver, const ITransmission *transmission)=0
virtual void setCachedNoise(const IRadio *receiver, const ITransmission *transmission, const INoise *noise)=0
virtual const INoise * computeNoise(const IListening *listening, const IInterference *interference) const =0
Returns the total noise summing up all the interfering receptions and noises.
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
virtual const IObstacleLoss* inet::physicallayer::RadioMedium::getObstacleLoss ( ) const
inlineoverridevirtual

Returns the radio signal obstacle loss model of this radio medium.

This function may return nullptr if there's no obstacle loss model.

Implements inet::physicallayer::IRadioMedium.

324 { return obstacleLoss; }
const IObstacleLoss * obstacleLoss
The obstacle loss model or nullptr if unused.
Definition: RadioMedium.h:66
virtual const IPathLoss* inet::physicallayer::RadioMedium::getPathLoss ( ) const
inlineoverridevirtual

Returns the radio signal path loss model of this radio medium.

This function never returns nullptr.

Implements inet::physicallayer::IRadioMedium.

323 { return pathLoss; }
const IPathLoss * pathLoss
The path loss model is never nullptr.
Definition: RadioMedium.h:62
virtual const IPhysicalEnvironment* inet::physicallayer::RadioMedium::getPhysicalEnvironment ( ) const
inlineoverridevirtual

Returns the physical environment model of this radio medium.

This function may return nullptr if there's no physical environment model.

Implements inet::physicallayer::IRadioMedium.

327 { return physicalEnvironment; }
const IPhysicalEnvironment * physicalEnvironment
The physical environment model or nullptr if unused.
Definition: RadioMedium.h:78
virtual const IPropagation* inet::physicallayer::RadioMedium::getPropagation ( ) const
inlineoverridevirtual

Returns the radio signal propagation model of this radio medium.

This function never returns nullptr.

Implements inet::physicallayer::IRadioMedium.

322 { return propagation; }
const IPropagation * propagation
The propagation model is never nullptr.
Definition: RadioMedium.h:58
const IReception * inet::physicallayer::RadioMedium::getReception ( const IRadio receiver,
const ITransmission transmission 
) const
overridevirtual

Returns the reception of the transmission arriving at the provided receiver.

This function never returns nullptr as long as the transmission is live on the radio medium.

Implements inet::physicallayer::IRadioMedium.

Referenced by computeInterference(), computeInterferingReceptions(), computeReceptionDecision(), computeReceptionResult(), getSNIR(), isReceptionAttempted(), isReceptionPossible(), and isReceptionSuccessful().

338 {
340  const IReception *reception = communicationCache->getCachedReception(receiver, transmission);
341  if (reception)
343  else {
344  reception = computeReception(receiver, transmission);
345  communicationCache->setCachedReception(receiver, transmission, reception);
346  EV_DEBUG << "Receiving " << transmission << " from medium by " << receiver << " arrives as " << reception << endl;
347  }
348  return reception;
349 }
virtual const IReception * computeReception(const IRadio *receiver, const ITransmission *transmission) const
Definition: RadioMedium.cc:277
long cacheReceptionGetCount
Total number of reception cache queries.
Definition: RadioMedium.h:194
virtual const IReception * getCachedReception(const IRadio *receiver, const ITransmission *transmission)=0
virtual void setCachedReception(const IRadio *receiver, const ITransmission *transmission, const IReception *reception)=0
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
long cacheReceptionHitCount
Total number of reception cache hits.
Definition: RadioMedium.h:198
const IReceptionDecision * inet::physicallayer::RadioMedium::getReceptionDecision ( const IRadio receiver,
const IListening listening,
const ITransmission transmission,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns the reception decision for the transmission part that specifies whether the reception is possible, attempted, and successful.

Implements inet::physicallayer::IRadioMedium.

400 {
402  const IReceptionDecision *decision = communicationCache->getCachedReceptionDecision(radio, transmission, part);
403  if (decision)
405  else {
406  decision = computeReceptionDecision(radio, listening, transmission, part, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
407  communicationCache->setCachedReceptionDecision(radio, transmission, part, decision);
408  EV_DEBUG << "Receiving " << transmission << " from medium by " << radio << " arrives as " << decision->getReception() << " and results in " << decision << endl;
409  }
410  return decision;
411 }
virtual const IReceptionDecision * getCachedReceptionDecision(const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part)=0
virtual const IReceptionDecision * computeReceptionDecision(const IRadio *receiver, const IListening *listening, const ITransmission *transmission, IRadioSignal::SignalPart part, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:300
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual void setCachedReceptionDecision(const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part, const IReceptionDecision *receptionDecision)=0
long cacheDecisionHitCount
Total number of reception decision cache hits.
Definition: RadioMedium.h:230
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
long cacheDecisionGetCount
Total number of reception decision cache queries.
Definition: RadioMedium.h:226
const IReceptionResult * inet::physicallayer::RadioMedium::getReceptionResult ( const IRadio receiver,
const IListening listening,
const ITransmission transmission 
) const
overridevirtual

Returns the reception result for the transmission that describes the end result of the reception process.

Implements inet::physicallayer::IRadioMedium.

Referenced by receivePacket().

414 {
416  const IReceptionResult *result = communicationCache->getCachedReceptionResult(radio, transmission);
417  if (result)
419  else {
420  result = computeReceptionResult(radio, listening, transmission, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
421  communicationCache->setCachedReceptionResult(radio, transmission, result);
422  EV_DEBUG << "Receiving " << transmission << " from medium by " << radio << " arrives as " << result->getReception() << " and results in " << result << endl;
423  }
424  return result;
425 }
virtual const IReceptionResult * computeReceptionResult(const IRadio *receiver, const IListening *listening, const ITransmission *transmission, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:309
virtual const IReceptionResult * getCachedReceptionResult(const IRadio *receiver, const ITransmission *transmission)=0
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual void setCachedReceptionResult(const IRadio *receiver, const ITransmission *transmission, const IReceptionResult *receptionResult)=0
long cacheResultGetCount
Total number of reception result cache queries.
Definition: RadioMedium.h:234
long cacheResultHitCount
Total number of reception result cache hits.
Definition: RadioMedium.h:238
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
const ISNIR * inet::physicallayer::RadioMedium::getSNIR ( const IRadio receiver,
const ITransmission transmission 
) const
overridevirtual

Returns the signal to noise and interference ratio of the transmission arriving at the provided receiver.

This function never returns nullptr as long as the transmission is live on the radio medium.

Implements inet::physicallayer::IRadioMedium.

Referenced by computeReceptionDecision(), computeReceptionResult(), and isReceptionSuccessful().

385 {
387  const ISNIR *snir = communicationCache->getCachedSNIR(receiver, transmission);
388  if (snir)
390  else {
391  const IReception *reception = getReception(receiver, transmission);
392  const INoise *noise = getNoise(receiver, transmission);
393  snir = analogModel->computeSNIR(reception, noise);
394  communicationCache->setCachedSNIR(receiver, transmission, snir);
395  }
396  return snir;
397 }
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
virtual const ISNIR * computeSNIR(const IReception *reception, const INoise *noise) const =0
Returns the signal to noise and interference ratio.
virtual void setCachedSNIR(const IRadio *receiver, const ITransmission *transmission, const ISNIR *snir)=0
virtual const INoise * getNoise(const IRadio *receiver, const ITransmission *transmission) const override
Returns the total noise computed from the interference of the transmission arriving at the provided r...
Definition: RadioMedium.cc:369
long cacheSNIRGetCount
Total number of SNIR cache queries.
Definition: RadioMedium.h:218
long cacheSNIRHitCount
Total number of SNIR cache hits.
Definition: RadioMedium.h:222
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
virtual const ISNIR * getCachedSNIR(const IRadio *receiver, const ITransmission *transmission)=0
void inet::physicallayer::RadioMedium::handleMessage ( cMessage *  message)
overrideprotectedvirtual
171 {
174  else
175  throw cRuntimeError("Unknown message");
176 }
cMessage * removeNonInterferingTransmissionsTimer
The message that is used to purge the internal state of the medium.
Definition: RadioMedium.h:117
virtual void removeNonInterferingTransmissions()
Removes all cached data related to past transmissions that don&#39;t have any effect on any ongoing trans...
Definition: RadioMedium.cc:230
void inet::physicallayer::RadioMedium::initialize ( int  stage)
overrideprotectedvirtual
84 {
85  if (stage == INITSTAGE_LOCAL) {
86  // initialize parameters
87  propagation = check_and_cast<IPropagation *>(getSubmodule("propagation"));
88  pathLoss = check_and_cast<IPathLoss *>(getSubmodule("pathLoss"));
89  obstacleLoss = dynamic_cast<IObstacleLoss *>(getSubmodule("obstacleLoss"));
90  analogModel = check_and_cast<IAnalogModel *>(getSubmodule("analogModel"));
91  backgroundNoise = dynamic_cast<IBackgroundNoise *>(getSubmodule("backgroundNoise"));
92  mediumLimitCache = check_and_cast<IMediumLimitCache *>(getSubmodule("mediumLimitCache"));
93  neighborCache = dynamic_cast<INeighborCache *>(getSubmodule("neighborCache"));
94  communicationCache = check_and_cast<ICommunicationCache *>(getSubmodule("communicationCache"));
95  physicalEnvironment = dynamic_cast<IPhysicalEnvironment *>(getModuleByPath(par("physicalEnvironmentModule")));
96  material = physicalEnvironment != nullptr ? physicalEnvironment->getMaterialRegistry()->getMaterial("air") : nullptr;
97  const char *rangeFilterString = par("rangeFilter");
98  if (!strcmp(rangeFilterString, ""))
100  else if (!strcmp(rangeFilterString, "interferenceRange"))
102  else if (!strcmp(rangeFilterString, "communicationRange"))
104  else
105  throw cRuntimeError("Unknown range filter: '%s'", rangeFilter);
106  radioModeFilter = par("radioModeFilter");
107  listeningFilter = par("listeningFilter");
108  macAddressFilter = par("macAddressFilter");
109  // initialize timers
110  removeNonInterferingTransmissionsTimer = new cMessage("removeNonInterferingTransmissions");
111  // initialize logging
112  recordCommunicationLog = par("recordCommunicationLog");
115  }
116  else if (stage == INITSTAGE_LAST)
117  EV_INFO << "Initialized " << getCompleteStringRepresentation() << endl;
118 }
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
cMessage * removeNonInterferingTransmissionsTimer
The message that is used to purge the internal state of the medium.
Definition: RadioMedium.h:117
virtual void open()
Definition: CommunicationLog.cc:25
bool macAddressFilter
True means the radio medium doesn&#39;t send radio frames to a radio if the mac address of the destinatio...
Definition: RadioMedium.h:103
const IMaterial * material
The physical material of the medium is never nullptr.
Definition: RadioMedium.h:82
bool recordCommunicationLog
Records all transmissions and receptions into a separate trace file.
Definition: RadioMedium.h:109
virtual std::string getCompleteStringRepresentation() const
Definition: IPrintableObject.h:60
const IPropagation * propagation
The propagation model is never nullptr.
Definition: RadioMedium.h:58
Operations that no other initializations can depend on, e.g.
Definition: InitStages.h:111
bool radioModeFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it&#39;s neither in receiver nor in t...
Definition: RadioMedium.h:92
bool listeningFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it listens on the medium in incom...
Definition: RadioMedium.h:98
const IPhysicalEnvironment * physicalEnvironment
The physical environment model or nullptr if unused.
Definition: RadioMedium.h:78
Local initializations.
Definition: InitStages.h:35
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
CommunicationLog communicationLog
The communication log output recorder.
Definition: RadioMedium.h:158
RangeFilterKind rangeFilter
The radio medium doesn&#39;t send radio frames to a radio if it&#39;s outside the range provided by the selec...
Definition: RadioMedium.h:87
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
const IBackgroundNoise * backgroundNoise
The background noise model or nullptr if unused.
Definition: RadioMedium.h:74
const IObstacleLoss * obstacleLoss
The obstacle loss model or nullptr if unused.
Definition: RadioMedium.h:66
const IPathLoss * pathLoss
The path loss model is never nullptr.
Definition: RadioMedium.h:62
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
bool inet::physicallayer::RadioMedium::isInCommunicationRange ( const ITransmission transmission,
const Coord  startPosition,
const Coord  endPosition 
) const
protectedvirtual

Referenced by isPotentialReceiver().

191 {
192  m maxCommunicationRange = mediumLimitCache->getMaxCommunicationRange();
193  return std::isnan(maxCommunicationRange.get()) ||
194  (transmission->getStartPosition().distance(startPosition) < maxCommunicationRange.get() &&
195  transmission->getEndPosition().distance(endPosition) < maxCommunicationRange.get());
196 }
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
virtual m getMaxCommunicationRange() const =0
Returns the maximum possible communication range among the radios, the value is in the range [0...
value< double, units::m > m
Definition: Units.h:1047
bool inet::physicallayer::RadioMedium::isInInterferenceRange ( const ITransmission transmission,
const Coord  startPosition,
const Coord  endPosition 
) const
protectedvirtual

Referenced by isInterferingTransmission(), and isPotentialReceiver().

199 {
200  m maxInterferenceRange = mediumLimitCache->getMaxInterferenceRange();
201  return std::isnan(maxInterferenceRange.get()) ||
202  (transmission->getStartPosition().distance(startPosition) < maxInterferenceRange.get() &&
203  transmission->getEndPosition().distance(endPosition) < maxInterferenceRange.get());
204 }
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
virtual m getMaxInterferenceRange() const =0
Returns the maximum possible interference range among the radios, the value is in the range [0...
value< double, units::m > m
Definition: Units.h:1047
bool inet::physicallayer::RadioMedium::isInterferingTransmission ( const ITransmission transmission,
const IListening listening 
) const
protectedvirtual

Referenced by computeInterferingReceptions().

207 {
208  const IRadio *transmitter = transmission->getTransmitter();
209  const IRadio *receiver = listening->getReceiver();
210  const IArrival *arrival = getArrival(receiver, transmission);
211  const simtime_t& minInterferenceTime = mediumLimitCache->getMinInterferenceTime();
212  return transmitter != receiver &&
213  arrival->getEndTime() >= listening->getStartTime() + minInterferenceTime &&
214  arrival->getStartTime() <= listening->getEndTime() - minInterferenceTime &&
215  isInInterferenceRange(transmission, listening->getStartPosition(), listening->getEndPosition());
216 }
virtual bool isInInterferenceRange(const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const
Definition: RadioMedium.cc:198
virtual const IArrival * getArrival(const IRadio *receiver, const ITransmission *transmission) const override
Returns the space and time coordinates of the transmission arriving at the provided receiver...
Definition: RadioMedium.cc:327
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
virtual const simtime_t & getMinInterferenceTime() const =0
Returns the minimum required signal interference time among the radios, the value is in the range [0...
bool inet::physicallayer::RadioMedium::isInterferingTransmission ( const ITransmission transmission,
const IReception reception 
) const
protectedvirtual
219 {
220  const IRadio *transmitter = transmission->getTransmitter();
221  const IRadio *receiver = reception->getReceiver();
222  const IArrival *arrival = getArrival(receiver, transmission);
223  const simtime_t& minInterferenceTime = mediumLimitCache->getMinInterferenceTime();
224  return transmitter != receiver &&
225  arrival->getEndTime() > reception->getStartTime() + minInterferenceTime &&
226  arrival->getStartTime() < reception->getEndTime() - minInterferenceTime &&
227  isInInterferenceRange(transmission, reception->getStartPosition(), reception->getEndPosition());
228 }
virtual bool isInInterferenceRange(const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const
Definition: RadioMedium.cc:198
virtual const IArrival * getArrival(const IRadio *receiver, const ITransmission *transmission) const override
Returns the space and time coordinates of the transmission arriving at the provided receiver...
Definition: RadioMedium.cc:327
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
virtual const simtime_t & getMinInterferenceTime() const =0
Returns the minimum required signal interference time among the radios, the value is in the range [0...
bool inet::physicallayer::RadioMedium::isPotentialReceiver ( const IRadio receiver,
const ITransmission transmission 
) const
protectedvirtual

Returns true if the radio can potentially receive the transmission successfully.

If this function returns false then the radio medium doesn't send a radio frame to this receiver.

Referenced by receiveSignal(), and sendToRadio().

608 {
609  const Radio *receiverRadio = check_and_cast<const Radio *>(radio);
610  if (radioModeFilter && receiverRadio->getRadioMode() != IRadio::RADIO_MODE_RECEIVER && receiverRadio->getRadioMode() != IRadio::RADIO_MODE_TRANSCEIVER)
611  return false;
612  else if (listeningFilter && !radio->getReceiver()->computeIsReceptionPossible(getListening(radio, transmission), transmission))
613  return false;
614  else if (macAddressFilter && !isRadioMacAddress(radio, check_and_cast<const IMACFrame *>(transmission->getMacFrame())->getReceiverAddress()))
615  return false;
617  const IArrival *arrival = getArrival(radio, transmission);
618  return isInInterferenceRange(transmission, arrival->getStartPosition(), arrival->getEndPosition());
619  }
621  const IArrival *arrival = getArrival(radio, transmission);
622  return isInCommunicationRange(transmission, arrival->getStartPosition(), arrival->getEndPosition());
623  }
624  else
625  return true;
626 }
virtual const IListening * getListening(const IRadio *receiver, const ITransmission *transmission) const override
Returns how the radio is listening on the medium when the transmission arrives at the provided receiv...
Definition: RadioMedium.cc:332
bool macAddressFilter
True means the radio medium doesn&#39;t send radio frames to a radio if the mac address of the destinatio...
Definition: RadioMedium.h:103
bool radioModeFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it&#39;s neither in receiver nor in t...
Definition: RadioMedium.h:92
bool listeningFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it listens on the medium in incom...
Definition: RadioMedium.h:98
The radio is prepared for frame reception, frame transmission is not possible, power consumption is l...
Definition: IRadio.h:109
virtual bool isInInterferenceRange(const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const
Definition: RadioMedium.cc:198
virtual bool isInCommunicationRange(const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const
Definition: RadioMedium.cc:190
virtual bool isRadioMacAddress(const IRadio *radio, const MACAddress address) const
Definition: RadioMedium.cc:178
The radio is prepared for simultaneous frame reception and transmission, power consumption is low whe...
Definition: IRadio.h:123
RangeFilterKind rangeFilter
The radio medium doesn&#39;t send radio frames to a radio if it&#39;s outside the range provided by the selec...
Definition: RadioMedium.h:87
virtual const IArrival * getArrival(const IRadio *receiver, const ITransmission *transmission) const override
Returns the space and time coordinates of the transmission arriving at the provided receiver...
Definition: RadioMedium.cc:327
friend Radio
Definition: RadioMedium.h:43
bool inet::physicallayer::RadioMedium::isRadioMacAddress ( const IRadio radio,
const MACAddress  address 
) const
protectedvirtual

Referenced by isPotentialReceiver().

179 {
180  cModule *host = getContainingNode(check_and_cast<const cModule *>(radio));
181  IInterfaceTable *interfaceTable = check_and_cast<IInterfaceTable *>(host->getSubmodule("interfaceTable"));
182  for (int i = 0; i < interfaceTable->getNumInterfaces(); i++) {
183  const InterfaceEntry *interface = interfaceTable->getInterface(i);
184  if (interface && interface->getMacAddress() == address)
185  return true;
186  }
187  return false;
188 }
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
bool inet::physicallayer::RadioMedium::isReceptionAttempted ( const IRadio receiver,
const ITransmission transmission,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns true when the reception is attempted of the transmission part.

Implements inet::physicallayer::IRadioMedium.

640 {
641  const IReception *reception = getReception(receiver, transmission);
642  const IListening *listening = getListening(receiver, transmission);
643  // TODO: why compute?
644  const IInterference *interference = computeInterference(receiver, listening, transmission, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
645  bool isReceptionAttempted = receiver->getReceiver()->computeIsReceptionAttempted(listening, reception, part, interference);
646  delete interference;
647  return isReceptionAttempted;
648 }
virtual const IListening * getListening(const IRadio *receiver, const ITransmission *transmission) const override
Returns how the radio is listening on the medium when the transmission arrives at the provided receiv...
Definition: RadioMedium.cc:332
virtual bool isReceptionAttempted(const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
Returns true when the reception is attempted of the transmission part.
Definition: RadioMedium.cc:639
virtual const IInterference * computeInterference(const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:283
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
bool inet::physicallayer::RadioMedium::isReceptionPossible ( const IRadio receiver,
const ITransmission transmission,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns true when the reception is possible of the transmission part.

Implements inet::physicallayer::IRadioMedium.

629 {
630  const IReception *reception = getReception(receiver, transmission);
631  const IListening *listening = getListening(receiver, transmission);
632  // TODO: why compute?
633  const IInterference *interference = computeInterference(receiver, listening, transmission, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
634  bool isReceptionPossible = receiver->getReceiver()->computeIsReceptionAttempted(listening, reception, part, interference);
635  delete interference;
636  return isReceptionPossible;
637 }
virtual const IListening * getListening(const IRadio *receiver, const ITransmission *transmission) const override
Returns how the radio is listening on the medium when the transmission arrives at the provided receiv...
Definition: RadioMedium.cc:332
virtual const IInterference * computeInterference(const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:283
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual bool isReceptionPossible(const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
Returns true when the reception is possible of the transmission part.
Definition: RadioMedium.cc:628
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
bool inet::physicallayer::RadioMedium::isReceptionSuccessful ( const IRadio receiver,
const ITransmission transmission,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns true when the reception is successful of the transmission part.

Implements inet::physicallayer::IRadioMedium.

651 {
652  const IReception *reception = getReception(receiver, transmission);
653  const IListening *listening = getListening(receiver, transmission);
654  // TODO: why compute?
655  const IInterference *interference = computeInterference(receiver, listening, transmission, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
656  const ISNIR *snir = getSNIR(receiver, transmission);
657  bool isReceptionSuccessful = receiver->getReceiver()->computeIsReceptionSuccessful(listening, reception, part, interference, snir);
658  delete interference;
659  return isReceptionSuccessful;
660 }
virtual const ISNIR * getSNIR(const IRadio *receiver, const ITransmission *transmission) const override
Returns the signal to noise and interference ratio of the transmission arriving at the provided recei...
Definition: RadioMedium.cc:384
virtual const IListening * getListening(const IRadio *receiver, const ITransmission *transmission) const override
Returns how the radio is listening on the medium when the transmission arrives at the provided receiv...
Definition: RadioMedium.cc:332
virtual bool isReceptionSuccessful(const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) const override
Returns true when the reception is successful of the transmission part.
Definition: RadioMedium.cc:650
virtual const IInterference * computeInterference(const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:283
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual const IReception * getReception(const IRadio *receiver, const ITransmission *transmission) const override
Returns the reception of the transmission arriving at the provided receiver.
Definition: RadioMedium.cc:337
const IListeningDecision * inet::physicallayer::RadioMedium::listenOnMedium ( const IRadio receiver,
const IListening listening 
) const
overridevirtual

Returns the listening decision that describes what the receiver detects on the radio medium.

Implements inet::physicallayer::IRadioMedium.

601 {
602  const IListeningDecision *decision = computeListeningDecision(radio, listening, const_cast<const std::vector<const ITransmission *> *>(&transmissions));
603  EV_DEBUG << "Listening with " << listening << " on medium by " << radio << " results in " << decision << endl;
604  return decision;
605 }
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual const IListeningDecision * computeListeningDecision(const IRadio *receiver, const IListening *listening, const std::vector< const ITransmission * > *transmissions) const
Definition: RadioMedium.cc:318
virtual int inet::physicallayer::RadioMedium::numInitStages ( ) const
inlineoverrideprotectedvirtual
244 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
std::ostream & inet::physicallayer::RadioMedium::printToStream ( std::ostream &  stream,
int  level 
) const
overridevirtual

Prints this object to the provided output stream.

Function calls to operator<< with pointers or references either const or not are all forwarded to this function.

Reimplemented from inet::physicallayer::IPrintableObject.

155 {
156  stream << static_cast<const cSimpleModule *>(this);
157  if (level <= PRINT_LEVEL_TRACE) {
158  stream << ", propagation = " << printObjectToString(propagation, level + 1)
159  << ", pathLoss = " << printObjectToString(pathLoss, level + 1)
160  << ", analogModel = " << printObjectToString(analogModel, level + 1)
161  << ", obstacleLoss = " << printObjectToString(obstacleLoss, level + 1)
162  << ", backgroundNoise = " << printObjectToString(backgroundNoise, level + 1)
163  << ", mediumLimitCache = " << printObjectToString(mediumLimitCache, level + 1)
164  << ", neighborCache = " << printObjectToString(neighborCache, level + 1)
165  << ", communicationCache = " << printObjectToString(communicationCache, level + 1) ;
166  }
167  return stream;
168 }
std::string printObjectToString(const IPrintableObject *object, int level)
Definition: IPrintableObject.h:73
const IAnalogModel * analogModel
The analog model is never nullptr.
Definition: RadioMedium.h:70
const IPropagation * propagation
The propagation model is never nullptr.
Definition: RadioMedium.h:58
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
const IBackgroundNoise * backgroundNoise
The background noise model or nullptr if unused.
Definition: RadioMedium.h:74
const IObstacleLoss * obstacleLoss
The obstacle loss model or nullptr if unused.
Definition: RadioMedium.h:66
const IPathLoss * pathLoss
The path loss model is never nullptr.
Definition: RadioMedium.h:62
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
cPacket * inet::physicallayer::RadioMedium::receivePacket ( const IRadio receiver,
IRadioFrame radioFrame 
)
overridevirtual

Returns the MAC frame that was transmitted in the provided radio frame.

The MAC frame control info will be an instance of the ReceptionIndication class.

Implements inet::physicallayer::IRadioMedium.

587 {
588  const ITransmission *transmission = radioFrame->getTransmission();
589  const IListening *listening = communicationCache->getCachedListening(radio, transmission);
591  communicationLog.writeReception(radio, radioFrame);
592  const IReceptionResult *result = getReceptionResult(radio, listening, transmission);
593  communicationCache->removeCachedReceptionResult(radio, transmission);
594  cPacket *macFrame = const_cast<cPacket *>(result->getMacFrame()->dup());
595  macFrame->setControlInfo(const_cast<ReceptionIndication *>(result->getIndication()));
596  delete result;
597  return macFrame;
598 }
bool recordCommunicationLog
Records all transmissions and receptions into a separate trace file.
Definition: RadioMedium.h:109
virtual void writeReception(const IRadio *receiver, const IRadioFrame *radioFrame)
Definition: CommunicationLog.cc:45
virtual const IListening * getCachedListening(const IRadio *receiver, const ITransmission *transmission)=0
virtual const IReceptionResult * getReceptionResult(const IRadio *receiver, const IListening *listening, const ITransmission *transmission) const override
Returns the reception result for the transmission that describes the end result of the reception proc...
Definition: RadioMedium.cc:413
CommunicationLog communicationLog
The communication log output recorder.
Definition: RadioMedium.h:158
virtual void removeCachedReceptionResult(const IRadio *receiver, const ITransmission *transmission)=0
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
void inet::physicallayer::RadioMedium::receiveSignal ( cComponent *  source,
simsignal_t  signal,
long  value,
cObject *  details 
)
overridevirtual
670 {
672  const Radio *receiverRadio = check_and_cast<const Radio *>(source);
673  for (const auto transmission : transmissions) {
674  const Radio *transmitterRadio = check_and_cast<const Radio *>(transmission->getTransmitter());
675  if (signal == IRadio::listeningChangedSignal) {
676  const IArrival *arrival = getArrival(receiverRadio, transmission);
677  const IListening *listening = receiverRadio->getReceiver()->createListening(receiverRadio, arrival->getStartTime(), arrival->getEndTime(), arrival->getStartPosition(), arrival->getEndPosition());
678  delete communicationCache->getCachedListening(receiverRadio, transmission);
679  communicationCache->setCachedListening(receiverRadio, transmission, listening);
680  }
681  if (communicationCache->getCachedFrame(receiverRadio, transmission) == nullptr &&
682  receiverRadio != transmitterRadio && isPotentialReceiver(receiverRadio, transmission))
683  {
684  const IArrival *arrival = getArrival(receiverRadio, transmission);
685  if (arrival->getEndTime() >= simTime()) {
686  cMethodCallContextSwitcher contextSwitcher(transmitterRadio);
687  contextSwitcher.methodCallSilent();
688  const cPacket *macFrame = transmission->getMacFrame();
689  EV_DEBUG << "Picking up " << macFrame << " originally sent "
690  << " from " << (IRadio *)transmitterRadio << " at " << transmission->getStartPosition()
691  << " to " << (IRadio *)receiverRadio << " at " << arrival->getStartPosition()
692  << " in " << arrival->getStartPropagationTime() * 1E+6 << " us propagation time." << endl;
693  auto radioFrame = static_cast<RadioFrame *>(createReceiverRadioFrame(transmission));
694  simtime_t delay = arrival->getStartTime() - simTime();
695  simtime_t duration = delay > 0 ? radioFrame->getDuration() : radioFrame->getDuration() + delay;
696  cGate *gate = receiverRadio->getRadioGate()->getPathStartGate();
697  ASSERT(dynamic_cast<IRadio *>(getSimulation()->getContextModule()) != nullptr);
698  const_cast<Radio *>(transmitterRadio)->sendDirect(radioFrame, delay > 0 ? delay : 0, duration, gate);
699  communicationCache->setCachedFrame(receiverRadio, transmission, radioFrame);
701  }
702  }
703  }
704  }
705 }
virtual void setCachedFrame(const ITransmission *transmission, const IRadioFrame *radioFrame)=0
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
long radioFrameSendCount
Total number of radio frame sends.
Definition: RadioMedium.h:170
virtual IRadioFrame * createReceiverRadioFrame(const ITransmission *transmission)
Creates a new radio frame for a receiver.
Definition: RadioMedium.cc:514
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual bool isPotentialReceiver(const IRadio *receiver, const ITransmission *transmission) const
Returns true if the radio can potentially receive the transmission successfully.
Definition: RadioMedium.cc:607
virtual const IListening * getCachedListening(const IRadio *receiver, const ITransmission *transmission)=0
virtual const IArrival * getArrival(const IRadio *receiver, const ITransmission *transmission) const override
Returns the space and time coordinates of the transmission arriving at the provided receiver...
Definition: RadioMedium.cc:327
virtual void setCachedListening(const IRadio *receiver, const ITransmission *transmission, const IListening *listening)=0
friend Radio
Definition: RadioMedium.h:43
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
static simsignal_t radioModeChangedSignal
This signal is emitted every time the radio mode changes.
Definition: IRadio.h:54
virtual const IRadioFrame * getCachedFrame(const ITransmission *transmission)=0
void inet::physicallayer::RadioMedium::removeNonInterferingTransmissions ( )
protectedvirtual

Removes all cached data related to past transmissions that don't have any effect on any ongoing transmission.

Note that it's possible that a transmission is in the past but it's still needed to compute the total interference for another.

Referenced by handleMessage().

231 {
232  const simtime_t now = simTime();
233  size_t transmissionIndex = 0;
234  while (transmissionIndex < transmissions.size() && communicationCache->getCachedInterferenceEndTime(transmissions[transmissionIndex]) <= now)
235  transmissionIndex++;
236  EV_DEBUG << "Removing " << transmissionIndex << " non interfering transmissions\n";
237  for (auto it = transmissions.cbegin(); it != transmissions.cbegin() + transmissionIndex; it++) {
238  const ITransmission *transmission = *it;
239  const IRadioFrame *radioFrame = communicationCache->getCachedFrame(transmission);
240  communicationCache->removeCachedFrame(transmission);
241  communicationCache->removeTransmission(transmission);
242  emit(transmissionRemovedSignal, check_and_cast<const cObject *>(transmission));
243  delete radioFrame;
244  delete transmission;
245  }
246  transmissions.erase(transmissions.begin(), transmissions.begin() + transmissionIndex);
248  if (transmissions.size() > 0)
250 }
static simsignal_t transmissionRemovedSignal
Definition: IRadioMedium.h:58
cMessage * removeNonInterferingTransmissionsTimer
The message that is used to purge the internal state of the medium.
Definition: RadioMedium.h:117
virtual void removeTransmission(const ITransmission *transmission)=0
std::vector< const ITransmission * > transmissions
The list of ongoing transmissions on the radio medium.
Definition: RadioMedium.h:134
virtual void removeNonInterferingTransmissions()=0
virtual void removeCachedFrame(const ITransmission *transmission)=0
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
virtual const simtime_t getCachedInterferenceEndTime(const ITransmission *transmission)=0
virtual const IRadioFrame * getCachedFrame(const ITransmission *transmission)=0
void inet::physicallayer::RadioMedium::removeRadio ( const IRadio radio)
overridevirtual

Removes a radio from the radio medium.

An exception is thrown if the radio is not yet added. The radio cannot start new transmissions and will not receive any further transmission including the ongoing ones.

Implements inet::physicallayer::IRadioMedium.

451 {
452  int radioIndex = radio->getId() - radios[0]->getId();
453  radios[radioIndex] = nullptr;
454  int radioCount = 0;
455  while (radios[radioCount] == nullptr && radioCount < (int)radios.size())
456  radioCount++;
457  if (radioCount != 0)
458  radios.erase(radios.begin(), radios.begin() + radioCount);
460  if (neighborCache)
461  neighborCache->removeRadio(radio);
463  cModule *radioModule = const_cast<cModule *>(check_and_cast<const cModule *>(radio));
464  if (radioModeFilter)
465  radioModule->unsubscribe(IRadio::radioModeChangedSignal, this);
466  if (listeningFilter)
467  radioModule->unsubscribe(IRadio::listeningChangedSignal, this);
468  if (macAddressFilter)
469  getContainingNode(radioModule)->unsubscribe(NF_INTERFACE_CONFIG_CHANGED, this);
470  emit(radioRemovedSignal, radioModule);
471 }
bool macAddressFilter
True means the radio medium doesn&#39;t send radio frames to a radio if the mac address of the destinatio...
Definition: RadioMedium.h:103
static simsignal_t radioRemovedSignal
Definition: IRadioMedium.h:55
virtual void removeRadio(const IRadio *radio)=0
std::vector< const IRadio * > radios
The list of radios that can transmit and receive radio signals on the radio medium.
Definition: RadioMedium.h:128
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
bool radioModeFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it&#39;s neither in receiver nor in t...
Definition: RadioMedium.h:92
bool listeningFilter
True means the radio medium doesn&#39;t send radio frames to a radio if it listens on the medium in incom...
Definition: RadioMedium.h:98
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
virtual void removeRadio(const IRadio *radio)=0
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
virtual void removeRadio(const IRadio *radio)=0
Notifies the cache when a radio is removed from the medium.
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
static simsignal_t radioModeChangedSignal
This signal is emitted every time the radio mode changes.
Definition: IRadio.h:54
void inet::physicallayer::RadioMedium::sendToAffectedRadios ( IRadio transmitter,
const IRadioFrame frame 
)
protectedvirtual

Sends a copy of the provided radio frame to all affected receivers on the radio medium.

Referenced by transmitPacket().

527 {
528  const RadioFrame *radioFrame = check_and_cast<const RadioFrame *>(frame);
529  EV_DEBUG << "Sending " << frame << " with " << radioFrame->getBitLength() << " bits in " << radioFrame->getDuration() * 1E+6 << " us transmission duration"
530  << " from " << radio << " on " << (IRadioMedium *)this << "." << endl;
532  {
533  double range;
537  range = mediumLimitCache->getMaxInterferenceRange(radio).get();
538  else
539  throw cRuntimeError("Unknown range filter %d", rangeFilter);
540  if (std::isnan(range))
541  {
542  EV_WARN << "We can't use the NeighborCache for radio " << radio->getId() << ": range is NaN" << endl;
543  sendToAllRadios(radio, frame);
544  }
545  else
546  neighborCache->sendToNeighbors(radio, frame, range);
547  }
548  else
549  sendToAllRadios(radio, frame);
550 
551 }
const value_type & get() const
Definition: Units.h:89
INeighborCache * neighborCache
Caches neighbors for all radios or nullptr if turned off.
Definition: RadioMedium.h:146
virtual void sendToAllRadios(IRadio *transmitter, const IRadioFrame *frame)
Sends a copy of the provided radio frame to all receivers on the radio medium.
Definition: RadioMedium.cc:662
RangeFilterKind rangeFilter
The radio medium doesn&#39;t send radio frames to a radio if it&#39;s outside the range provided by the selec...
Definition: RadioMedium.h:87
IMediumLimitCache * mediumLimitCache
Caches various medium limits among all radios.
Definition: RadioMedium.h:142
virtual void sendToNeighbors(IRadio *transmitter, const IRadioFrame *frame, double range) const =0
Sends the provided frame (using the radio medium) to all neighbors within the given range...
virtual m getMaxInterferenceRange() const =0
Returns the maximum possible interference range among the radios, the value is in the range [0...
virtual m getMaxCommunicationRange() const =0
Returns the maximum possible communication range among the radios, the value is in the range [0...
void inet::physicallayer::RadioMedium::sendToAllRadios ( IRadio transmitter,
const IRadioFrame frame 
)
protectedvirtual

Sends a copy of the provided radio frame to all receivers on the radio medium.

Referenced by sendToAffectedRadios().

663 {
664  for (const auto radio : radios)
665  if (radio != nullptr)
666  sendToRadio(transmitter, radio, frame);
667 }
virtual void sendToRadio(IRadio *trasmitter, const IRadio *receiver, const IRadioFrame *frame)
Definition: RadioMedium.cc:553
std::vector< const IRadio * > radios
The list of radios that can transmit and receive radio signals on the radio medium.
Definition: RadioMedium.h:128
void inet::physicallayer::RadioMedium::sendToRadio ( IRadio trasmitter,
const IRadio receiver,
const IRadioFrame frame 
)
virtual

Referenced by sendToAllRadios(), inet::physicallayer::NeighborListNeighborCache::sendToNeighbors(), inet::physicallayer::QuadTreeNeighborCache::QuadTreeNeighborCacheVisitor::visit(), and inet::physicallayer::GridNeighborCache::GridNeighborCacheVisitor::visit().

554 {
555  const Radio *transmitterRadio = check_and_cast<const Radio *>(transmitter);
556  const Radio *receiverRadio = check_and_cast<const Radio *>(receiver);
557  const ITransmission *transmission = frame->getTransmission();
558  if (receiverRadio != transmitterRadio && isPotentialReceiver(receiverRadio, transmission)) {
559  const IArrival *arrival = getArrival(receiverRadio, transmission);
560  simtime_t propagationTime = arrival->getStartPropagationTime();
561  EV_DEBUG << "Sending " << frame
562  << " from " << (IRadio *)transmitterRadio << " at " << transmission->getStartPosition()
563  << " to " << (IRadio *)receiverRadio << " at " << arrival->getStartPosition()
564  << " in " << propagationTime * 1E+6 << " us propagation time." << endl;
565  auto radioFrame = static_cast<RadioFrame *>(createReceiverRadioFrame(transmission));
566  cGate *gate = receiverRadio->getRadioGate()->getPathStartGate();
567  ASSERT(dynamic_cast<IRadio *>(getSimulation()->getContextModule()) != nullptr);
568  const_cast<Radio *>(transmitterRadio)->sendDirect(radioFrame, propagationTime, transmission->getDuration(), gate);
569  communicationCache->setCachedFrame(receiverRadio, transmission, radioFrame);
571  }
572 }
virtual void setCachedFrame(const ITransmission *transmission, const IRadioFrame *radioFrame)=0
long radioFrameSendCount
Total number of radio frame sends.
Definition: RadioMedium.h:170
virtual IRadioFrame * createReceiverRadioFrame(const ITransmission *transmission)
Creates a new radio frame for a receiver.
Definition: RadioMedium.cc:514
virtual bool isPotentialReceiver(const IRadio *receiver, const ITransmission *transmission) const
Returns true if the radio can potentially receive the transmission successfully.
Definition: RadioMedium.cc:607
virtual const IArrival * getArrival(const IRadio *receiver, const ITransmission *transmission) const override
Returns the space and time coordinates of the transmission arriving at the provided receiver...
Definition: RadioMedium.cc:327
friend Radio
Definition: RadioMedium.h:43
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150
IRadioFrame * inet::physicallayer::RadioMedium::transmitPacket ( const IRadio transmitter,
cPacket *  macFrame 
)
overridevirtual

Returns a new radio frame containing the radio signal transmission that represents the provided MAC frame.

A copy of this radio frame is sent to all affected radios. The MAC frame control info must be an instance of the TransmissionRequest class.

Implements inet::physicallayer::IRadioMedium.

575 {
576  auto radioFrame = createTransmitterRadioFrame(radio, macFrame);
577  auto transmission = radioFrame->getTransmission();
578  addTransmission(radio, transmission);
580  communicationLog.writeTransmission(radio, radioFrame);
581  sendToAffectedRadios(const_cast<IRadio *>(radio), radioFrame);
582  communicationCache->setCachedFrame(transmission, radioFrame);
583  return radioFrame;
584 }
virtual void setCachedFrame(const ITransmission *transmission, const IRadioFrame *radioFrame)=0
virtual void writeTransmission(const IRadio *transmitter, const IRadioFrame *radioFrame)
Definition: CommunicationLog.cc:35
bool recordCommunicationLog
Records all transmissions and receptions into a separate trace file.
Definition: RadioMedium.h:109
virtual void sendToAffectedRadios(IRadio *transmitter, const IRadioFrame *frame)
Sends a copy of the provided radio frame to all affected receivers on the radio medium.
Definition: RadioMedium.cc:526
virtual void addTransmission(const IRadio *transmitter, const ITransmission *transmission)
Adds a new transmission to the radio medium.
Definition: RadioMedium.cc:473
CommunicationLog communicationLog
The communication log output recorder.
Definition: RadioMedium.h:158
virtual IRadioFrame * createTransmitterRadioFrame(const IRadio *radio, cPacket *macFrame)
Creates a new radio frame for the transmitter.
Definition: RadioMedium.cc:500
ICommunicationCache * communicationCache
Caches intermediate results of the ongoing communication for all radios.
Definition: RadioMedium.h:150

Member Data Documentation

const IAnalogModel* inet::physicallayer::RadioMedium::analogModel
protected

The analog model is never nullptr.

Referenced by computeReception(), getNoise(), getSNIR(), initialize(), and printToStream().

const IBackgroundNoise* inet::physicallayer::RadioMedium::backgroundNoise
protected

The background noise model or nullptr if unused.

Referenced by computeInterference(), initialize(), and printToStream().

long inet::physicallayer::RadioMedium::cacheDecisionGetCount
mutableprotected

Total number of reception decision cache queries.

Referenced by finish(), and getReceptionDecision().

long inet::physicallayer::RadioMedium::cacheDecisionHitCount
mutableprotected

Total number of reception decision cache hits.

Referenced by finish(), and getReceptionDecision().

long inet::physicallayer::RadioMedium::cacheInterferenceGetCount
mutableprotected

Total number of interference cache queries.

Referenced by finish(), and getInterference().

long inet::physicallayer::RadioMedium::cacheInterferenceHitCount
mutableprotected

Total number of interference cache hits.

Referenced by finish(), and getInterference().

long inet::physicallayer::RadioMedium::cacheNoiseGetCount
mutableprotected

Total number of noise cache queries.

Referenced by finish(), and getNoise().

long inet::physicallayer::RadioMedium::cacheNoiseHitCount
mutableprotected

Total number of noise cache hits.

Referenced by finish(), and getNoise().

long inet::physicallayer::RadioMedium::cacheReceptionGetCount
mutableprotected

Total number of reception cache queries.

Referenced by finish(), and getReception().

long inet::physicallayer::RadioMedium::cacheReceptionHitCount
mutableprotected

Total number of reception cache hits.

Referenced by finish(), and getReception().

long inet::physicallayer::RadioMedium::cacheResultGetCount
mutableprotected

Total number of reception result cache queries.

Referenced by finish(), and getReceptionResult().

long inet::physicallayer::RadioMedium::cacheResultHitCount
mutableprotected

Total number of reception result cache hits.

Referenced by finish(), and getReceptionResult().

long inet::physicallayer::RadioMedium::cacheSNIRGetCount
mutableprotected

Total number of SNIR cache queries.

Referenced by finish(), and getSNIR().

long inet::physicallayer::RadioMedium::cacheSNIRHitCount
mutableprotected

Total number of SNIR cache hits.

Referenced by finish(), and getSNIR().

CommunicationLog inet::physicallayer::RadioMedium::communicationLog
protected

The communication log output recorder.

Referenced by initialize(), receivePacket(), transmitPacket(), and ~RadioMedium().

long inet::physicallayer::RadioMedium::interferenceComputationCount
mutableprotected

Total number of interference computations.

Referenced by computeInterference(), and finish().

long inet::physicallayer::RadioMedium::listeningDecisionComputationCount
mutableprotected

Total number of listening decision computations.

Referenced by computeListeningDecision(), and finish().

bool inet::physicallayer::RadioMedium::listeningFilter
protected

True means the radio medium doesn't send radio frames to a radio if it listens on the medium in incompatible mode (e.g.

different carrier frequency and/or bandwidth, different modulation, etc.)

Referenced by addRadio(), initialize(), isPotentialReceiver(), and removeRadio().

bool inet::physicallayer::RadioMedium::macAddressFilter
protected

True means the radio medium doesn't send radio frames to a radio if the mac address of the destination is different.

Referenced by addRadio(), initialize(), isPotentialReceiver(), and removeRadio().

const IMaterial* inet::physicallayer::RadioMedium::material
protected

The physical material of the medium is never nullptr.

Referenced by initialize().

IMediumLimitCache* inet::physicallayer::RadioMedium::mediumLimitCache
mutableprotected
INeighborCache* inet::physicallayer::RadioMedium::neighborCache
mutableprotected

Caches neighbors for all radios or nullptr if turned off.

Referenced by addRadio(), initialize(), printToStream(), removeRadio(), and sendToAffectedRadios().

const IObstacleLoss* inet::physicallayer::RadioMedium::obstacleLoss
protected

The obstacle loss model or nullptr if unused.

Referenced by initialize(), and printToStream().

const IPathLoss* inet::physicallayer::RadioMedium::pathLoss
protected

The path loss model is never nullptr.

Referenced by initialize(), and printToStream().

const IPhysicalEnvironment* inet::physicallayer::RadioMedium::physicalEnvironment
protected

The physical environment model or nullptr if unused.

Referenced by initialize().

const IPropagation* inet::physicallayer::RadioMedium::propagation
protected

The propagation model is never nullptr.

Referenced by addRadio(), addTransmission(), initialize(), and printToStream().

friend inet::physicallayer::RadioMedium::Radio
private
long inet::physicallayer::RadioMedium::radioFrameSendCount
mutableprotected

Total number of radio frame sends.

Referenced by finish(), receiveSignal(), and sendToRadio().

bool inet::physicallayer::RadioMedium::radioModeFilter
protected

True means the radio medium doesn't send radio frames to a radio if it's neither in receiver nor in transceiver mode.

Referenced by addRadio(), initialize(), isPotentialReceiver(), and removeRadio().

std::vector<const IRadio *> inet::physicallayer::RadioMedium::radios
protected

The list of radios that can transmit and receive radio signals on the radio medium.

The radios follow each other in the order of their unique id. Radios are only removed from the beginning. This list may contain nullptr values.

Referenced by addRadio(), addTransmission(), removeRadio(), and sendToAllRadios().

RangeFilterKind inet::physicallayer::RadioMedium::rangeFilter
protected

The radio medium doesn't send radio frames to a radio if it's outside the range provided by the selected range filter.

Referenced by initialize(), isPotentialReceiver(), and sendToAffectedRadios().

long inet::physicallayer::RadioMedium::receptionComputationCount
mutableprotected

Total number of reception computations.

Referenced by computeReception(), and finish().

long inet::physicallayer::RadioMedium::receptionDecisionComputationCount
mutableprotected

Total number of data reception decision computations.

Referenced by computeReceptionDecision(), and finish().

long inet::physicallayer::RadioMedium::receptionResultComputationCount
mutableprotected

Total number of data reception result computations.

Referenced by computeReceptionResult().

bool inet::physicallayer::RadioMedium::recordCommunicationLog
protected

Records all transmissions and receptions into a separate trace file.

The communication log file can be found at: ${resultdir}/${configname}-${runnumber}.tlog

Referenced by initialize(), receivePacket(), transmitPacket(), and ~RadioMedium().

cMessage* inet::physicallayer::RadioMedium::removeNonInterferingTransmissionsTimer
protected

The message that is used to purge the internal state of the medium.

Referenced by addTransmission(), handleMessage(), initialize(), removeNonInterferingTransmissions(), and ~RadioMedium().

long inet::physicallayer::RadioMedium::transmissionCount
mutableprotected

Total number of transmissions.

Referenced by addTransmission(), and finish().

std::vector<const ITransmission *> inet::physicallayer::RadioMedium::transmissions
protected

The list of ongoing transmissions on the radio medium.

The transmissions follow each other in the order of their unique id. Transmissions are only removed from the beginning. This list doesn't contain nullptr values.

Referenced by addRadio(), addTransmission(), getInterference(), getReceptionDecision(), getReceptionResult(), isReceptionAttempted(), isReceptionPossible(), isReceptionSuccessful(), listenOnMedium(), receiveSignal(), removeNonInterferingTransmissions(), and ~RadioMedium().


The documentation for this class was generated from the following files: