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

Implements the UnitDiskReceiver model, see the NED file for details. More...

#include <UnitDiskReceiver.h>

Inheritance diagram for inet::physicallayer::UnitDiskReceiver:
inet::physicallayer::ReceiverBase inet::physicallayer::IReceiver inet::IPrintableObject inet::physicallayer::Ieee80211UnitDiskReceiver

Public Member Functions

 UnitDiskReceiver ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints this object to the provided output stream. More...
 
virtual bool computeIsReceptionPossible (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part) const override
 Returns whether the reception of the provided part is possible or not. More...
 
virtual bool computeIsReceptionSuccessful (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference, const ISnir *snir) const override
 Returns whether the reception of the provided part is actually successful or failed by the receiver. More...
 
virtual const IListeningcreateListening (const IRadio *radio, const simtime_t startTime, const simtime_t endTime, const Coord &startPosition, const Coord &endPosition) const override
 Returns a description of how the receiver is listening on the medium. More...
 
virtual const IListeningDecisioncomputeListeningDecision (const IListening *listening, const IInterference *interference) const override
 Returns the result of the listening process specifying the reception state of the receiver. More...
 
virtual const IReceptionResultcomputeReceptionResult (const IListening *listening, const IReception *reception, const IInterference *interference, const ISnir *snir, const std::vector< const IReceptionDecision * > *decisions) const override
 Returns the complete result of the reception process for the provided reception. More...
 
- Public Member Functions inherited from inet::physicallayer::ReceiverBase
 ReceiverBase ()
 
virtual W getMinInterferencePower () const override
 Returns the minimum interference power below which receptions are to be ignored while computing the interference. More...
 
virtual W getMinReceptionPower () const override
 Returns the minimum reception power below which successful reception is definitely not possible. More...
 
virtual bool computeIsReceptionPossible (const IListening *listening, const ITransmission *transmission) const override
 Returns whether the reception of the provided transmission is possible or not independently of the reception conditions. More...
 
virtual bool computeIsReceptionAttempted (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference) const override
 Returns whether the reception of the provided part is actually attempted or ignored by the receiver. More...
 
virtual const IReceptionDecisioncomputeReceptionDecision (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference, const ISnir *snir) const override
 Returns the reception decision for the transmission part that specifies whether the reception is possible, attempted, and successful. More...
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Protected Member Functions

virtual void initialize (int stage) override
 
- Protected Member Functions inherited from inet::physicallayer::ReceiverBase
virtual int numInitStages () const override
 
virtual W computeSignalPower (const IListening *listening, const ISnir *snir, const IInterference *interference) const
 
virtual PacketcomputeReceivedPacket (const ISnir *snir, bool isReceptionSuccessful) const
 

Protected Attributes

bool ignoreInterference
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 

Detailed Description

Implements the UnitDiskReceiver model, see the NED file for details.

Constructor & Destructor Documentation

◆ UnitDiskReceiver()

inet::physicallayer::UnitDiskReceiver::UnitDiskReceiver ( )
22  :
23  ReceiverBase(),
24  ignoreInterference(false)
25 {
26 }

Member Function Documentation

◆ computeIsReceptionPossible()

bool inet::physicallayer::UnitDiskReceiver::computeIsReceptionPossible ( const IListening listening,
const IReception reception,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns whether the reception of the provided part is possible or not.

For example, it might check if the reception power is above sensitivity.

This function may be called before the reception actually starts at the receiver, thus it must be purely functional and support optimistic parallel computation.

Reimplemented from inet::physicallayer::ReceiverBase.

Reimplemented in inet::physicallayer::Ieee80211UnitDiskReceiver.

44 {
45  auto power = check_and_cast<const UnitDiskReception *>(reception)->getPower();
47 }

Referenced by inet::physicallayer::Ieee80211UnitDiskReceiver::computeIsReceptionPossible().

◆ computeIsReceptionSuccessful()

bool inet::physicallayer::UnitDiskReceiver::computeIsReceptionSuccessful ( const IListening listening,
const IReception reception,
IRadioSignal::SignalPart  part,
const IInterference interference,
const ISnir snir 
) const
overridevirtual

Returns whether the reception of the provided part is actually successful or failed by the receiver.

For example, it might compute the error rate and draw a random number to make the decision.

This function may be called before the reception actually starts at the receiver, thus it must be purely functional and support optimistic parallel computation.

Implements inet::physicallayer::IReceiver.

50 {
51  auto power = check_and_cast<const UnitDiskReception *>(reception)->getPower();
54  return true;
55  else {
56  auto startTime = reception->getStartTime(part);
57  auto endTime = reception->getEndTime(part);
58  auto interferingReceptions = interference->getInterferingReceptions();
59  for (auto interferingReception : *interferingReceptions) {
60  auto interferingPower = check_and_cast<const UnitDiskReception *>(interferingReception)->getPower();
61  if (interferingPower >= UnitDiskReception::POWER_INTERFERING && startTime <= interferingReception->getEndTime() && endTime >= interferingReception->getStartTime())
62  return false;
63  }
64  return true;
65  }
66  }
67  else
68  return false;
69 }

◆ computeListeningDecision()

const IListeningDecision * inet::physicallayer::UnitDiskReceiver::computeListeningDecision ( const IListening listening,
const IInterference interference 
) const
overridevirtual

Returns the result of the listening process specifying the reception state of the receiver.

This function must be purely functional and support optimistic parallel computation.

Implements inet::physicallayer::IReceiver.

77 {
78  auto interferingReceptions = interference->getInterferingReceptions();
79  for (auto interferingReception : *interferingReceptions) {
80  auto interferingPower = check_and_cast<const UnitDiskReception *>(interferingReception)->getPower();
81  if (interferingPower != UnitDiskReception::POWER_UNDETECTABLE)
82  return new ListeningDecision(listening, true);
83  }
84  return new ListeningDecision(listening, false);
85 }

◆ computeReceptionResult()

const IReceptionResult * inet::physicallayer::UnitDiskReceiver::computeReceptionResult ( const IListening listening,
const IReception reception,
const IInterference interference,
const ISnir snir,
const std::vector< const IReceptionDecision * > *  decisions 
) const
overridevirtual

Returns the complete result of the reception process for the provided reception.

This function may be called before the reception actually starts at the receiver, thus it must be purely functional and support optimistic parallel computation.

Reimplemented from inet::physicallayer::ReceiverBase.

Reimplemented in inet::physicallayer::Ieee80211UnitDiskReceiver.

88 {
89  auto noise = check_and_cast_nullable<const UnitDiskNoise *>(snir->getNoise());
90  double errorRate = check_and_cast<const UnitDiskReception *>(reception)->getPower() == UnitDiskReception::POWER_RECEIVABLE && (noise == nullptr || !noise->isInterfering()) ? 0 : 1;
91  auto receptionResult = ReceiverBase::computeReceptionResult(listening, reception, interference, snir, decisions);
92  auto errorRateInd = const_cast<Packet *>(receptionResult->getPacket())->addTagIfAbsent<ErrorRateInd>();
93  errorRateInd->setSymbolErrorRate(errorRate);
94  errorRateInd->setBitErrorRate(errorRate);
95  errorRateInd->setPacketErrorRate(errorRate);
96  return receptionResult;
97 }

Referenced by inet::physicallayer::Ieee80211UnitDiskReceiver::computeReceptionResult().

◆ createListening()

const IListening * inet::physicallayer::UnitDiskReceiver::createListening ( const IRadio radio,
const simtime_t  startTime,
const simtime_t  endTime,
const Coord startPosition,
const Coord endPosition 
) const
overridevirtual

Returns a description of how the receiver is listening on the medium.

Implements inet::physicallayer::IReceiver.

72 {
73  return new UnitDiskListening(radio, startTime, endTime, startPosition, endPosition);
74 }

◆ initialize()

void inet::physicallayer::UnitDiskReceiver::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented in inet::physicallayer::Ieee80211UnitDiskReceiver.

29 {
30  ReceiverBase::initialize(stage);
31  if (stage == INITSTAGE_LOCAL)
32  ignoreInterference = par("ignoreInterference");
33 }

◆ printToStream()

std::ostream & inet::physicallayer::UnitDiskReceiver::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
overridevirtual

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

Reimplemented in inet::physicallayer::Ieee80211UnitDiskReceiver.

36 {
37  stream << "UnitDiskReceiver";
38  if (level <= PRINT_LEVEL_INFO)
39  stream << (ignoreInterference ? ", ignoring interference" : ", considering interference");
40  return stream;
41 }

Referenced by inet::physicallayer::Ieee80211UnitDiskReceiver::printToStream().

Member Data Documentation

◆ ignoreInterference

bool inet::physicallayer::UnitDiskReceiver::ignoreInterference
protected

The documentation for this class was generated from the following files:
inet::IPrintableObject::PRINT_LEVEL_INFO
@ PRINT_LEVEL_INFO
Definition: IPrintableObject.h:25
inet::physicallayer::UnitDiskReceiver::ignoreInterference
bool ignoreInterference
Definition: UnitDiskReceiver.h:23
inet::physicallayer::ReceiverBase::computeReceptionResult
virtual const IReceptionResult * computeReceptionResult(const IListening *listening, const IReception *reception, const IInterference *interference, const ISnir *snir, const std::vector< const IReceptionDecision * > *decisions) const override
Returns the complete result of the reception process for the provided reception.
Definition: ReceiverBase.cc:72
inet::physicallayer::ReceiverBase::ReceiverBase
ReceiverBase()
Definition: ReceiverBase.h:29
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::physicallayer::UnitDiskReception::POWER_INTERFERING
@ POWER_INTERFERING
Definition: UnitDiskReception.h:28
inet::physicallayer::UnitDiskReception::POWER_UNDETECTABLE
@ POWER_UNDETECTABLE
Definition: UnitDiskReception.h:26
inet::physicallayer::UnitDiskReception::POWER_RECEIVABLE
@ POWER_RECEIVABLE
Definition: UnitDiskReception.h:29