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

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

#include <IdealReceiver.h>

Inheritance diagram for inet::physicallayer::IdealReceiver:
inet::physicallayer::ReceiverBase inet::physicallayer::IReceiver inet::physicallayer::IPrintableObject inet::physicallayer::Ieee80211IdealReceiver

Public Member Functions

 IdealReceiver ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) 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...
 
- 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...
 
virtual const IReceptionResultcomputeReceptionResult (const IListening *listening, const IReception *reception, const IInterference *interference, const ISNIR *snir) const override
 Returns the complete result of the reception process for the provided reception. More...
 
virtual ReceptionIndicationcreateReceptionIndication () const
 Returns an empty reception indication (control info). More...
 
- 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 Member Functions

virtual void initialize (int stage) override
 
virtual const ReceptionIndicationcomputeReceptionIndication (const ISNIR *snir) const override
 Returns the reception indication (control info) that is sent up to the MAC. More...
 
- Protected Member Functions inherited from inet::physicallayer::ReceiverBase
virtual int numInitStages () const override
 

Protected Attributes

bool ignoreInterference
 

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
}
 

Detailed Description

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

Constructor & Destructor Documentation

inet::physicallayer::IdealReceiver::IdealReceiver ( )
31  :
32  ReceiverBase(),
33  ignoreInterference(false)
34 {
35 }
bool ignoreInterference
Definition: IdealReceiver.h:33
ReceiverBase()
Definition: ReceiverBase.h:35

Member Function Documentation

bool inet::physicallayer::IdealReceiver::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.

53 {
54  auto power = check_and_cast<const IdealReception *>(reception)->getPower();
55  return power == IdealReception::POWER_RECEIVABLE;
56 }
bool inet::physicallayer::IdealReceiver::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.

59 {
60  auto power = check_and_cast<const IdealReception *>(reception)->getPower();
61  if (power == IdealReception::POWER_RECEIVABLE) {
63  return true;
64  else {
65  auto startTime = reception->getStartTime(part);
66  auto endTime = reception->getEndTime(part);
67  auto interferingReceptions = interference->getInterferingReceptions();
68  for (auto interferingReception : *interferingReceptions) {
69  auto interferingPower = check_and_cast<const IdealReception *>(interferingReception)->getPower();
70  if (interferingPower >= IdealReception::POWER_INTERFERING && startTime <= interferingReception->getEndTime() && endTime >= interferingReception->getStartTime())
71  return false;
72  }
73  return true;
74  }
75  }
76  else
77  return false;
78 }
bool ignoreInterference
Definition: IdealReceiver.h:33
const IListeningDecision * inet::physicallayer::IdealReceiver::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.

98 {
99  auto interferingReceptions = interference->getInterferingReceptions();
100  for (auto interferingReception : *interferingReceptions) {
101  auto interferingPower = check_and_cast<const IdealReception *>(interferingReception)->getPower();
102  if (interferingPower != IdealReception::POWER_UNDETECTABLE)
103  return new ListeningDecision(listening, true);
104  }
105  return new ListeningDecision(listening, false);
106 }
const ReceptionIndication * inet::physicallayer::IdealReceiver::computeReceptionIndication ( const ISNIR snir) const
overrideprotectedvirtual

Returns the reception indication (control info) that is sent up to the MAC.

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::Ieee80211IdealReceiver.

81 {
82  auto indication = new ReceptionIndication();
83  auto reception = check_and_cast<const IdealReception *>(snir->getReception());
84  auto noise = check_and_cast_nullable<const IdealNoise *>(snir->getNoise());
85  double errorRate = reception->getPower() == IdealReception::POWER_RECEIVABLE && (noise == nullptr || !noise->isInterfering()) ? 0 : 1;
86  indication->setSymbolErrorRate(errorRate);
87  indication->setBitErrorRate(errorRate);
88  indication->setPacketErrorRate(errorRate);
89  return indication;
90 }
const IListening * inet::physicallayer::IdealReceiver::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.

93 {
94  return new IdealListening(radio, startTime, endTime, startPosition, endPosition);
95 }
void inet::physicallayer::IdealReceiver::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented in inet::physicallayer::Ieee80211IdealReceiver.

38 {
39  ReceiverBase::initialize(stage);
40  if (stage == INITSTAGE_LOCAL)
41  ignoreInterference = par("ignoreInterference");
42 }
Local initializations.
Definition: InitStages.h:35
bool ignoreInterference
Definition: IdealReceiver.h:33
std::ostream & inet::physicallayer::IdealReceiver::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.

Reimplemented in inet::physicallayer::Ieee80211IdealReceiver.

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

45 {
46  stream << "IdealReceiver";
47  if (level <= PRINT_LEVEL_INFO)
48  stream << (ignoreInterference ? ", ignoring interference" : ", considering interference");
49  return stream;
50 }
bool ignoreInterference
Definition: IdealReceiver.h:33

Member Data Documentation

bool inet::physicallayer::IdealReceiver::ignoreInterference
protected

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