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

#include <Ieee80211BerTableErrorModel.h>

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

Public Member Functions

 Ieee80211BerTableErrorModel ()
 
virtual ~Ieee80211BerTableErrorModel ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) 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::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::ErrorModelBase
virtual double getScalarSnir (const ISnir *snir) const
 
virtual bool hasProbabilisticError (b length, double ber) const
 
virtual PacketcorruptBits (const Packet *packet, double ber, bool &isCorrupted) const
 
virtual PacketcorruptBytes (const Packet *packet, double ber, bool &isCorrupted) const
 
virtual PacketcorruptChunks (const Packet *packet, double ber, bool &isCorrupted) const
 
virtual PacketcorruptPacket (const Packet *packet, bool &isCorrupted) const
 
virtual PacketcomputeCorruptedPacket (const Packet *packet, double ber) const
 
virtual PacketcomputeCorruptedPacket (const ISnir *snir) const override
 

Protected Attributes

BerParseFileberTableFile
 
- Protected Attributes inherited from inet::physicallayer::ErrorModelBase
CorruptionMode corruptionMode = CorruptionMode::CM_UNDEFINED
 
SnirMode snirMode = SnirMode::SM_UNDEFINED
 
double snirOffset = NaN
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::ErrorModelBase
enum  CorruptionMode {
  CorruptionMode::CM_UNDEFINED = -1, CorruptionMode::CM_PACKET, CorruptionMode::CM_CHUNK, CorruptionMode::CM_BYTE,
  CorruptionMode::CM_BIT
}
 
enum  SnirMode { SnirMode::SM_UNDEFINED = -1, SnirMode::SM_MIN, SnirMode::SM_MEAN }
 
- 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) }
 

Constructor & Destructor Documentation

◆ Ieee80211BerTableErrorModel()

inet::physicallayer::Ieee80211BerTableErrorModel::Ieee80211BerTableErrorModel ( )
20  :
21  berTableFile(nullptr)
22 {
23 }

◆ ~Ieee80211BerTableErrorModel()

inet::physicallayer::Ieee80211BerTableErrorModel::~Ieee80211BerTableErrorModel ( )
virtual
26 {
27  delete berTableFile;
28 }

Member Function Documentation

◆ computeBitErrorRate()

double inet::physicallayer::Ieee80211BerTableErrorModel::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.

67 {
68  Enter_Method("computeBitErrorRate");
69  return NaN;
70 }

◆ computePacketErrorRate()

double inet::physicallayer::Ieee80211BerTableErrorModel::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.

57 {
58  Enter_Method("computePacketErrorRate");
59  const ITransmission *transmission = snir->getReception()->getTransmission();
60  const FlatTransmissionBase *flatTransmission = check_and_cast<const FlatTransmissionBase *>(transmission);
61  double bitrate = flatTransmission->getBitrate().get();
62  b dataLength = flatTransmission->getDataLength();
63  return berTableFile->getPer(bitrate, getScalarSnir(snir), B(dataLength).get());
64 }

◆ computeSymbolErrorRate()

double inet::physicallayer::Ieee80211BerTableErrorModel::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.

73 {
74  Enter_Method("computeSymbolErrorRate");
75  return NaN;
76 }

◆ initialize()

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

Reimplemented from inet::physicallayer::ErrorModelBase.

31 {
32  if (stage == INITSTAGE_LOCAL) {
33  const char *fname = par("berTableFile");
34  if (fname == nullptr)
35  throw cRuntimeError("BER file parameter is mandatory");
36  // TODO remove and cleanup opMode from here and also from BerParseFile, this should depend on the received signal
37  char opMode;
38  const char *opModeString = par("opMode");
39  if (!strcmp("b", opModeString))
40  opMode = 'b';
41  else if (!strcmp("g(erp)", opModeString))
42  opMode = 'g';
43  else if (!strcmp("g(mixed)", opModeString))
44  opMode = 'g';
45  else if (!strcmp("a", opModeString))
46  opMode = 'a';
47  else if (!strcmp("p", opModeString))
48  opMode = 'p';
49  else
50  throw cRuntimeError("Unknown opMode");
51  berTableFile = new BerParseFile(opMode);
52  berTableFile->parseFile(fname);
53  }
54 }

◆ printToStream()

virtual std::ostream& inet::physicallayer::Ieee80211BerTableErrorModel::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
inlineoverridevirtual

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

31 { return stream << "Ieee80211BerTableErrorModel"; }

Member Data Documentation

◆ berTableFile

BerParseFile* inet::physicallayer::Ieee80211BerTableErrorModel::berTableFile
protected

The documentation for this class was generated from the following files:
inet::physicallayer::BerParseFile::parseFile
void parseFile(const char *filename)
Definition: BerParseFile.cc:200
inet::units::units::B
intscale< b, 1, 8 > B
Definition: Units.h:1168
NaN
#define NaN
Definition: INETMath.h:91
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::physicallayer::BerParseFile::getPer
double getPer(double speed, double tsnr, int tlen)
Definition: BerParseFile.cc:77
inet::units::values::b
value< int64_t, units::b > b
Definition: Units.h:1241
inet::physicallayer::Ieee80211BerTableErrorModel::berTableFile
BerParseFile * berTableFile
Definition: Ieee80211BerTableErrorModel.h:22
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::physicallayer::ErrorModelBase::getScalarSnir
virtual double getScalarSnir(const ISnir *snir) const
Definition: ErrorModelBase.cc:41