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

#include <FlatReceiverBase.h>

Inheritance diagram for inet::physicallayer::FlatReceiverBase:
inet::physicallayer::NarrowbandReceiverBase inet::physicallayer::SNIRReceiverBase inet::physicallayer::ReceiverBase inet::physicallayer::IReceiver inet::physicallayer::IPrintableObject inet::physicallayer::APSKDimensionalReceiver inet::physicallayer::APSKScalarReceiver inet::physicallayer::Ieee80211ReceiverBase inet::physicallayer::Ieee802154NarrowbandScalarReceiver inet::physicallayer::Ieee80211DimensionalReceiver inet::physicallayer::Ieee80211ScalarReceiver

Public Member Functions

 FlatReceiverBase ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual W getMinReceptionPower () const override
 Returns the minimum reception power below which successful reception is definitely not possible. 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 IErrorModelgetErrorModel () const
 
virtual W getEnergyDetection () const
 
virtual void setEnergyDetection (W energyDetection)
 
virtual W getSensitivity () const
 
virtual void setSensitivity (W sensitivity)
 
- Public Member Functions inherited from inet::physicallayer::NarrowbandReceiverBase
 NarrowbandReceiverBase ()
 
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 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 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 IModulationgetModulation () const
 
virtual void setModulation (const IModulation *modulation)
 
virtual Hz getCarrierFrequency () const
 
virtual void setCarrierFrequency (Hz carrierFrequency)
 
virtual Hz getBandwidth () const
 
virtual void setBandwidth (Hz bandwidth)
 
- Public Member Functions inherited from inet::physicallayer::SNIRReceiverBase
 SNIRReceiverBase ()
 
virtual double getSNIRThreshold () const
 
- 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 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 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 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 ReceptionIndicationcomputeReceptionIndication (const ISNIR *snir) const override
 Returns the physical properties of the reception including noise and signal related measures, error probabilities, actual error counts, etc. More...
 
- Protected Member Functions inherited from inet::physicallayer::ReceiverBase
virtual int numInitStages () const override
 

Protected Attributes

const IErrorModelerrorModel
 
W energyDetection
 
W sensitivity
 
- Protected Attributes inherited from inet::physicallayer::NarrowbandReceiverBase
const IModulationmodulation
 
Hz carrierFrequency
 
Hz bandwidth
 
- Protected Attributes inherited from inet::physicallayer::SNIRReceiverBase
double snirThreshold
 

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
}
 

Constructor & Destructor Documentation

inet::physicallayer::FlatReceiverBase::FlatReceiverBase ( )
31  :
33  errorModel(nullptr),
35  sensitivity(W(NaN))
36 {
37 }
NarrowbandReceiverBase()
Definition: NarrowbandReceiverBase.cc:32
const IErrorModel * errorModel
Definition: FlatReceiverBase.h:31
compose< J, pow< s,-1 > > W
Definition: Units.h:770
#define NaN
Definition: INETMath.h:103
W sensitivity
Definition: FlatReceiverBase.h:33
W energyDetection
Definition: FlatReceiverBase.h:32

Member Function Documentation

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

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

75 {
76  if (!NarrowbandReceiverBase::computeIsReceptionPossible(listening, reception, part))
77  return false;
78  else {
79  const FlatReceptionBase *flatReception = check_and_cast<const FlatReceptionBase *>(reception);
80  W minReceptionPower = flatReception->computeMinPower(reception->getStartTime(part), reception->getEndTime(part));
81  bool isReceptionPossible = minReceptionPower >= sensitivity;
82  EV_DEBUG << "Computing whether reception is possible: minimum reception power = " << minReceptionPower << ", sensitivity = " << sensitivity << " -> reception is " << (isReceptionPossible ? "possible" : "impossible") << endl;
83  return isReceptionPossible;
84  }
85 }
compose< J, pow< s,-1 > > W
Definition: Units.h:770
W sensitivity
Definition: FlatReceiverBase.h:33
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 re...
Definition: NarrowbandReceiverBase.cc:64
bool inet::physicallayer::FlatReceiverBase::computeIsReceptionSuccessful ( const IListening listening,
const IReception reception,
IRadioSignal::SignalPart  part,
const IInterference interference,
const ISNIR snir 
) const
overrideprotectedvirtual

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.

Reimplemented from inet::physicallayer::SNIRReceiverBase.

88 {
89  if (!SNIRReceiverBase::computeIsReceptionSuccessful(listening, reception, part, interference, snir))
90  return false;
91  else if (!errorModel)
92  return true;
93  else {
94  double packetErrorRate = errorModel->computePacketErrorRate(snir, part);
95  if (packetErrorRate == 0.0)
96  return true;
97  else if (packetErrorRate == 1.0)
98  return false;
99  else
100  return dblrand() > packetErrorRate;
101  }
102 }
const IErrorModel * errorModel
Definition: FlatReceiverBase.h:31
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...
Definition: SNIRReceiverBase.cc:46
virtual double computePacketErrorRate(const ISNIR *snir, IRadioSignal::SignalPart part) const =0
Returns the packet error rate based on SNIR, modulation, FEC encoding and any other physical layer ch...
const IListeningDecision * inet::physicallayer::FlatReceiverBase::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.

60 {
61  const IRadio *receiver = listening->getReceiver();
62  const IRadioMedium *radioMedium = receiver->getMedium();
63  const IAnalogModel *analogModel = radioMedium->getAnalogModel();
64  const INoise *noise = analogModel->computeNoise(listening, interference);
65  const NarrowbandNoiseBase *narrowbandNoise = check_and_cast<const NarrowbandNoiseBase *>(noise);
66  W maxPower = narrowbandNoise->computeMaxPower(listening->getStartTime(), listening->getEndTime());
67  bool isListeningPossible = maxPower >= energyDetection;
68  delete noise;
69  EV_DEBUG << "Computing whether listening is possible: maximum power = " << maxPower << ", energy detection = " << energyDetection << " -> listening is " << (isListeningPossible ? "possible" : "impossible") << endl;
70  return new ListeningDecision(listening, isListeningPossible);
71 }
compose< J, pow< s,-1 > > W
Definition: Units.h:770
W energyDetection
Definition: FlatReceiverBase.h:32
const ReceptionIndication * inet::physicallayer::FlatReceiverBase::computeReceptionIndication ( const ISNIR snir) const
overrideprotectedvirtual

Returns the physical properties of the reception including noise and signal related measures, error probabilities, actual error counts, etc.

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

Reimplemented from inet::physicallayer::SNIRReceiverBase.

Reimplemented in inet::physicallayer::Ieee80211ReceiverBase.

Referenced by inet::physicallayer::Ieee80211ReceiverBase::computeReceptionIndication().

105 {
106  ReceptionIndication *indication = const_cast<ReceptionIndication *>(SNIRReceiverBase::computeReceptionIndication(snir));
107  indication->setPacketErrorRate(errorModel ? errorModel->computePacketErrorRate(snir, IRadioSignal::SIGNAL_PART_WHOLE) : 0.0);
108  indication->setBitErrorRate(errorModel ? errorModel->computeBitErrorRate(snir, IRadioSignal::SIGNAL_PART_WHOLE) : 0.0);
109  indication->setSymbolErrorRate(errorModel ? errorModel->computeSymbolErrorRate(snir, IRadioSignal::SIGNAL_PART_WHOLE) : 0.0);
110  return indication;
111 }
virtual const ReceptionIndication * computeReceptionIndication(const ISNIR *snir) const override
Returns the physical properties of the reception including noise and signal related measures...
Definition: SNIRReceiverBase.cc:51
const IErrorModel * errorModel
Definition: FlatReceiverBase.h:31
virtual double computeSymbolErrorRate(const ISNIR *snir, IRadioSignal::SignalPart part) const =0
Returns the symbol error rate based on SNIR, modulation, and any other physical layer characteristics...
virtual double computeBitErrorRate(const ISNIR *snir, IRadioSignal::SignalPart part) const =0
Returns the bit error rate based on SNIR, modulation, FEC encoding and any other physical layer chara...
virtual double computePacketErrorRate(const ISNIR *snir, IRadioSignal::SignalPart part) const =0
Returns the packet error rate based on SNIR, modulation, FEC encoding and any other physical layer ch...
virtual W inet::physicallayer::FlatReceiverBase::getEnergyDetection ( ) const
inlinevirtual
54 { return energyDetection; }
W energyDetection
Definition: FlatReceiverBase.h:32
virtual const IErrorModel* inet::physicallayer::FlatReceiverBase::getErrorModel ( ) const
inlinevirtual
52 { return errorModel; }
const IErrorModel * errorModel
Definition: FlatReceiverBase.h:31
virtual W inet::physicallayer::FlatReceiverBase::getMinReceptionPower ( ) const
inlineoverridevirtual

Returns the minimum reception power below which successful reception is definitely not possible.

Returns a value in the range [0, +infinity) or NaN if unspecified.

Reimplemented from inet::physicallayer::ReceiverBase.

48 { return sensitivity; }
W sensitivity
Definition: FlatReceiverBase.h:33
virtual W inet::physicallayer::FlatReceiverBase::getSensitivity ( ) const
inlinevirtual
57 { return sensitivity; }
W sensitivity
Definition: FlatReceiverBase.h:33
void inet::physicallayer::FlatReceiverBase::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::physicallayer::NarrowbandReceiverBase.

Reimplemented in inet::physicallayer::Ieee80211ReceiverBase, and inet::physicallayer::Ieee802154NarrowbandScalarReceiver.

Referenced by inet::physicallayer::Ieee802154NarrowbandScalarReceiver::initialize(), and inet::physicallayer::Ieee80211ReceiverBase::initialize().

40 {
42  if (stage == INITSTAGE_LOCAL) {
43  errorModel = dynamic_cast<IErrorModel *>(getSubmodule("errorModel"));
44  energyDetection = mW(math::dBm2mW(par("energyDetection")));
45  sensitivity = mW(math::dBm2mW(par("sensitivity")));
46  }
47 }
double dBm2mW(double dBm)
Converts a dBm value into milliwatts.
Definition: INETMath.h:176
const IErrorModel * errorModel
Definition: FlatReceiverBase.h:31
virtual void initialize(int stage) override
Definition: NarrowbandReceiverBase.cc:40
Local initializations.
Definition: InitStages.h:35
W sensitivity
Definition: FlatReceiverBase.h:33
milli< W >::type mW
Definition: Units.h:903
W energyDetection
Definition: FlatReceiverBase.h:32
std::ostream & inet::physicallayer::FlatReceiverBase::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::NarrowbandReceiverBase.

Reimplemented in inet::physicallayer::Ieee80211ReceiverBase, inet::physicallayer::Ieee802154NarrowbandScalarReceiver, inet::physicallayer::Ieee80211DimensionalReceiver, inet::physicallayer::Ieee80211ScalarReceiver, inet::physicallayer::APSKDimensionalReceiver, and inet::physicallayer::APSKScalarReceiver.

Referenced by inet::physicallayer::APSKDimensionalReceiver::printToStream(), inet::physicallayer::APSKScalarReceiver::printToStream(), inet::physicallayer::Ieee802154NarrowbandScalarReceiver::printToStream(), and inet::physicallayer::Ieee80211ReceiverBase::printToStream().

50 {
51  if (level <= PRINT_LEVEL_TRACE)
52  stream << ", errorModel = " << printObjectToString(errorModel, level + 1);
53  if (level <= PRINT_LEVEL_INFO)
54  stream << ", energyDetection = " << energyDetection
55  << ", sensitivity = " << sensitivity;
56  return NarrowbandReceiverBase::printToStream(stream, level);
57 }
std::string printObjectToString(const IPrintableObject *object, int level)
Definition: IPrintableObject.h:73
const IErrorModel * errorModel
Definition: FlatReceiverBase.h:31
W sensitivity
Definition: FlatReceiverBase.h:33
virtual std::ostream & printToStream(std::ostream &stream, int level) const override
Prints this object to the provided output stream.
Definition: NarrowbandReceiverBase.cc:50
W energyDetection
Definition: FlatReceiverBase.h:32
virtual void inet::physicallayer::FlatReceiverBase::setEnergyDetection ( W  energyDetection)
inlinevirtual
W energyDetection
Definition: FlatReceiverBase.h:32
virtual void inet::physicallayer::FlatReceiverBase::setSensitivity ( W  sensitivity)
inlinevirtual
58 { this->sensitivity = sensitivity; }
W sensitivity
Definition: FlatReceiverBase.h:33

Member Data Documentation

W inet::physicallayer::FlatReceiverBase::energyDetection
protected
const IErrorModel* inet::physicallayer::FlatReceiverBase::errorModel
protected
W inet::physicallayer::FlatReceiverBase::sensitivity
protected

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