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

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

#include <StochasticErrorModel.h>

Inheritance diagram for inet::physicallayer::StochasticErrorModel:
inet::physicallayer::ErrorModelBase inet::physicallayer::IErrorModel inet::physicallayer::IPrintableObject

Public Member Functions

 StochasticErrorModel ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual double computePacketErrorRate (const ISNIR *snir, IRadioSignal::SignalPart part) const override
 Returns the packet error rate based on SNIR, modulation, FEC encoding and any other physical layer characteristics. More...
 
virtual double computeBitErrorRate (const ISNIR *snir, IRadioSignal::SignalPart part) const override
 Returns the bit error rate based on SNIR, modulation, FEC encoding and any other physical layer characteristics. More...
 
virtual double computeSymbolErrorRate (const ISNIR *snir, IRadioSignal::SignalPart part) const override
 Returns the symbol error rate based on SNIR, modulation, and any other physical layer characteristics. 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
 

Protected Attributes

double packetErrorRate
 
double bitErrorRate
 
double symbolErrorRate
 

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 StochasticErrorModel model, see the NED file for details.

Constructor & Destructor Documentation

inet::physicallayer::StochasticErrorModel::StochasticErrorModel ( )
27  :
31 {
32 }
double bitErrorRate
Definition: StochasticErrorModel.h:34
double packetErrorRate
Definition: StochasticErrorModel.h:33
#define NaN
Definition: INETMath.h:103
double symbolErrorRate
Definition: StochasticErrorModel.h:35

Member Function Documentation

double inet::physicallayer::StochasticErrorModel::computeBitErrorRate ( const ISNIR snir,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns the bit error rate based on SNIR, modulation, FEC encoding and any other physical layer characteristics.

Implements inet::physicallayer::IErrorModel.

Referenced by computePacketErrorRate().

82 {
83  Enter_Method_Silent();
84  if (!std::isnan(bitErrorRate)) {
85  return bitErrorRate;
86  }
87  else {
88  // TODO: compute bit error rate based on symbol error rate and modulation
89 // const IReception *reception = snir->getReception();
90 // const NarrowbandTransmissionBase *narrowbandTransmission = check_and_cast<const NarrowbandTransmissionBase *>(reception->getTransmission());
91 // const IModulation *modulation = narrowbandTransmission->getModulation();
92 // double symbolErrorRate = computeSymbolErrorRate(snir);
93  throw cRuntimeError("Not yet implemented");
94  }
95 }
double bitErrorRate
Definition: StochasticErrorModel.h:34
double inet::physicallayer::StochasticErrorModel::computePacketErrorRate ( const ISNIR snir,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns the packet error rate based on SNIR, modulation, FEC encoding and any other physical layer characteristics.

Implements inet::physicallayer::IErrorModel.

54 {
55  Enter_Method_Silent();
56  const IReception *reception = snir->getReception();
57  if (!std::isnan(packetErrorRate)) {
58  double factor = reception->getDuration(part) / reception->getDuration();
59  return pow(packetErrorRate, factor);
60  }
61  else {
62  const FlatTransmissionBase *flatTransmission = check_and_cast<const FlatTransmissionBase *>(reception->getTransmission());
63  double bitErrorRate = computeBitErrorRate(snir, part);
64  double headerSuccessRate = pow(1.0 - bitErrorRate, flatTransmission->getHeaderBitLength());
65  double dataSuccessRate = pow(1.0 - bitErrorRate, flatTransmission->getDataBitLength());
66  switch (part) {
68  return 1.0 - headerSuccessRate * dataSuccessRate;
70  return 0;
72  return 1.0 - headerSuccessRate;
74  return 1.0 - dataSuccessRate;
75  default:
76  throw cRuntimeError("Unknown signal part: '%s'", IRadioSignal::getSignalPartName(part));
77  }
78  }
79 }
double bitErrorRate
Definition: StochasticErrorModel.h:34
static const char * getSignalPartName(SignalPart signalPart)
Returns the name of the provided signal part.
Definition: IRadioSignal.cc:33
double packetErrorRate
Definition: StochasticErrorModel.h:33
virtual double computeBitErrorRate(const ISNIR *snir, IRadioSignal::SignalPart part) const override
Returns the bit error rate based on SNIR, modulation, FEC encoding and any other physical layer chara...
Definition: StochasticErrorModel.cc:81
double inet::physicallayer::StochasticErrorModel::computeSymbolErrorRate ( const ISNIR snir,
IRadioSignal::SignalPart  part 
) const
overridevirtual

Returns the symbol error rate based on SNIR, modulation, and any other physical layer characteristics.

Implements inet::physicallayer::IErrorModel.

98 {
99  Enter_Method_Silent();
100  return symbolErrorRate;
101 }
double symbolErrorRate
Definition: StochasticErrorModel.h:35
void inet::physicallayer::StochasticErrorModel::initialize ( int  stage)
overrideprotectedvirtual
35 {
36  if (stage == INITSTAGE_LOCAL) {
37  packetErrorRate = par("packetErrorRate");
38  bitErrorRate = par("bitErrorRate");
39  symbolErrorRate = par("symbolErrorRate");
40  }
41 }
double bitErrorRate
Definition: StochasticErrorModel.h:34
double packetErrorRate
Definition: StochasticErrorModel.h:33
Local initializations.
Definition: InitStages.h:35
double symbolErrorRate
Definition: StochasticErrorModel.h:35
std::ostream & inet::physicallayer::StochasticErrorModel::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.

44 {
45  if (level <= PRINT_LEVEL_TRACE)
46  stream << "StochasticErrorModel"
47  << "packetErrorRate = " << packetErrorRate
48  << "bitErrorRate = " << bitErrorRate
49  << "symbolErrorRate = " << symbolErrorRate;
50  return stream;
51 }
double bitErrorRate
Definition: StochasticErrorModel.h:34
double packetErrorRate
Definition: StochasticErrorModel.h:33
double symbolErrorRate
Definition: StochasticErrorModel.h:35

Member Data Documentation

double inet::physicallayer::StochasticErrorModel::bitErrorRate
protected
double inet::physicallayer::StochasticErrorModel::packetErrorRate
protected
double inet::physicallayer::StochasticErrorModel::symbolErrorRate
protected

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