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

A model for the error rate for different modulations. More...

#include <Ieee80211NistErrorModel.h>

Inheritance diagram for inet::physicallayer::Ieee80211NistErrorModel:
inet::physicallayer::Ieee80211ErrorModelBase inet::physicallayer::ErrorModelBase inet::physicallayer::IErrorModel inet::physicallayer::IPrintableObject

Public Member Functions

virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
- Public Member Functions inherited from inet::physicallayer::Ieee80211ErrorModelBase
 Ieee80211ErrorModelBase ()
 
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

double calculatePe (double p, uint32_t bValue) const
 
double getBpskBer (double snr) const
 
double getQpskBer (double snr) const
 
double get16QamBer (double snr) const
 
double get64QamBer (double snr) const
 
double getFecBpskBer (double snr, double nbits, uint32_t bValue) const
 
double getFecQpskBer (double snr, double nbits, uint32_t bValue) const
 
double getFec16QamBer (double snr, uint32_t nbits, uint32_t bValue) const
 
double getFec64QamBer (double snr, uint32_t nbits, uint32_t bValue) const
 
virtual double getOFDMAndERPOFDMChunkSuccessRate (const APSKModulationBase *subcarrierModulation, const ConvolutionalCode *convolutionalCode, unsigned int bitLength, double snr) const
 
virtual double getDSSSAndHrDSSSChunkSuccessRate (bps bitrate, unsigned int bitLength, double snr) const
 
virtual double getHeaderSuccessRate (const IIeee80211Mode *mode, unsigned int headerBitLength, double snr) const override
 
virtual double getDataSuccessRate (const IIeee80211Mode *mode, unsigned int bitLength, double snr) const override
 

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

A model for the error rate for different modulations.

For OFDM modulation, the model description and validation can be found in http://www.nsnam.org/~pei/80211ofdm.pdf. For DSSS modulations (802.11b), the model uses the DsssErrorRateModel.

Member Function Documentation

double inet::physicallayer::Ieee80211NistErrorModel::calculatePe ( double  p,
uint32_t  bValue 
) const
protected

Referenced by getFec16QamBer(), getFec64QamBer(), getFecBpskBer(), and getFecQpskBer().

93 {
94  double D = sqrt(4.0 * p * (1.0 - p));
95  double pe = 1.0;
96  if (bValue == 1) {
97  // code rate 1/2, use table 3.1.1
98  pe = 0.5
99  * (36.0 * pow(D, 10.0) + 211.0 * pow(D, 12.0) + 1404.0 * pow(D, 14.0) + 11633.0 * pow(D, 16.0)
100  + 77433.0 * pow(D, 18.0) + 502690.0 * pow(D, 20.0) + 3322763.0 * pow(D, 22.0)
101  + 21292910.0 * pow(D, 24.0) + 134365911.0 * pow(D, 26.0));
102  }
103  else if (bValue == 2) {
104  // code rate 2/3, use table 3.1.2
105  pe = 1.0 / (2.0 * bValue)
106  * (3.0 * pow(D, 6.0) + 70.0 * pow(D, 7.0) + 285.0 * pow(D, 8.0) + 1276.0 * pow(D, 9.0)
107  + 6160.0 * pow(D, 10.0) + 27128.0 * pow(D, 11.0) + 117019.0 * pow(D, 12.0)
108  + 498860.0 * pow(D, 13.0) + 2103891.0 * pow(D, 14.0) + 8784123.0 * pow(D, 15.0));
109  }
110  else if (bValue == 3) {
111  // code rate 3/4, use table 3.1.2
112  pe = 1.0 / (2.0 * bValue)
113  * (42.0 * pow(D, 5.0) + 201.0 * pow(D, 6.0) + 1492.0 * pow(D, 7.0) + 10469.0 * pow(D, 8.0)
114  + 62935.0 * pow(D, 9.0) + 379644.0 * pow(D, 10.0) + 2253373.0 * pow(D, 11.0)
115  + 13073811.0 * pow(D, 12.0) + 75152755.0 * pow(D, 13.0) + 428005675.0 * pow(D, 14.0));
116  }
117  else {
118  ASSERT(false);
119  }
120  return pe;
121 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
double inet::physicallayer::Ieee80211NistErrorModel::get16QamBer ( double  snr) const
protected

Referenced by getFec16QamBer().

53 {
54  double z = sqrt(snr / (5.0 * 2.0));
55  double ber = 0.75 * 0.5 * erfc(z);
56  EV << "16-Qam" << " snr=" << snr << " ber=" << ber << "\n";
57  return ber;
58 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
double inet::physicallayer::Ieee80211NistErrorModel::get64QamBer ( double  snr) const
protected

Referenced by getFec64QamBer().

61 {
62  double z = sqrt(snr / (21.0 * 2.0));
63  double ber = 7.0 / 12.0 * 0.5 * erfc(z);
64  EV << "64-Qam" << " snr=" << snr << " ber=" << ber << "\n";
65  return ber;
66 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
double inet::physicallayer::Ieee80211NistErrorModel::getBpskBer ( double  snr) const
protected

Referenced by getFecBpskBer().

37 {
38  double z = sqrt(snr);
39  double ber = 0.5 * erfc(z);
40  EV << "bpsk snr=" << snr << " ber=" << ber << "\n";
41  return ber;
42 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
double inet::physicallayer::Ieee80211NistErrorModel::getDataSuccessRate ( const IIeee80211Mode mode,
unsigned int  bitLength,
double  snr 
) const
overrideprotectedvirtual

Implements inet::physicallayer::Ieee80211ErrorModelBase.

209 {
210  double successRate = 0;
211  if (auto ofdmMode = dynamic_cast<const Ieee80211OFDMMode *>(mode))
212  successRate = getOFDMAndERPOFDMChunkSuccessRate(ofdmMode->getDataMode()->getModulation()->getSubcarrierModulation(),
213  ofdmMode->getDataMode()->getCode()->getConvolutionalCode(),
214  bitLength,
215  snr);
216  else if (auto dsssMode = dynamic_cast<const Ieee80211DsssMode *>(mode))
217  successRate = getDSSSAndHrDSSSChunkSuccessRate(dsssMode->getDataMode()->getNetBitrate(), bitLength, snr);
218  else if (auto hrDsssMode = dynamic_cast<const Ieee80211HrDsssMode *>(mode))
219  successRate = getDSSSAndHrDSSSChunkSuccessRate(hrDsssMode->getDataMode()->getNetBitrate(), bitLength, snr);
220  else
221  throw cRuntimeError("Unsupported 802.11 mode");
222  EV_DEBUG << "Min SNIR = " << snr << ", bit length = " << bitLength << ", data error rate = " << 1 - successRate << endl;
223  if (successRate >= 1)
224  successRate = 1;
225  return successRate;
226 }
virtual double getOFDMAndERPOFDMChunkSuccessRate(const APSKModulationBase *subcarrierModulation, const ConvolutionalCode *convolutionalCode, unsigned int bitLength, double snr) const
Definition: Ieee80211NistErrorModel.cc:147
virtual double getDSSSAndHrDSSSChunkSuccessRate(bps bitrate, unsigned int bitLength, double snr) const
Definition: Ieee80211NistErrorModel.cc:173
double inet::physicallayer::Ieee80211NistErrorModel::getDSSSAndHrDSSSChunkSuccessRate ( bps  bitrate,
unsigned int  bitLength,
double  snr 
) const
protectedvirtual

Referenced by getDataSuccessRate(), and getHeaderSuccessRate().

174 {
175  switch ((int)bitrate.get()) {
176  case 1000000:
177  return DsssErrorRateModel::GetDsssDbpskSuccessRate(snr, bitLength);
178  case 2000000:
179  return DsssErrorRateModel::GetDsssDqpskSuccessRate(snr, bitLength);
180  case 5500000:
182  case 11000000:
184  }
185  throw cRuntimeError("Unsupported bitrate");
186 }
static double GetDsssDqpskCck5_5SuccessRate(double sinr, uint32_t nbits)
Definition: dsss-error-rate-model.cc:63
static double GetDsssDqpskCck11SuccessRate(double sinr, uint32_t nbits)
Definition: dsss-error-rate-model.cc:91
static double GetDsssDqpskSuccessRate(double sinr, uint32_t nbits)
Definition: dsss-error-rate-model.cc:56
static double GetDsssDbpskSuccessRate(double sinr, uint32_t nbits)
Definition: dsss-error-rate-model.cc:49
double inet::physicallayer::Ieee80211NistErrorModel::getFec16QamBer ( double  snr,
uint32_t  nbits,
uint32_t  bValue 
) const
protected

Referenced by getOFDMAndERPOFDMChunkSuccessRate().

124 {
125  double ber = get16QamBer(snr);
126  if (ber == 0.0) {
127  return 1.0;
128  }
129  double pe = calculatePe(ber, bValue);
130  pe = std::min(pe, 1.0);
131  double pms = pow(1 - pe, (double)nbits);
132  return pms;
133 }
double get16QamBer(double snr) const
Definition: Ieee80211NistErrorModel.cc:52
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double calculatePe(double p, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:92
double inet::physicallayer::Ieee80211NistErrorModel::getFec64QamBer ( double  snr,
uint32_t  nbits,
uint32_t  bValue 
) const
protected

Referenced by getOFDMAndERPOFDMChunkSuccessRate().

136 {
137  double ber = get64QamBer(snr);
138  if (ber == 0.0) {
139  return 1.0;
140  }
141  double pe = calculatePe(ber, bValue);
142  pe = std::min(pe, 1.0);
143  double pms = pow(1 - pe, (double)nbits);
144  return pms;
145 }
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double get64QamBer(double snr) const
Definition: Ieee80211NistErrorModel.cc:60
double calculatePe(double p, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:92
double inet::physicallayer::Ieee80211NistErrorModel::getFecBpskBer ( double  snr,
double  nbits,
uint32_t  bValue 
) const
protected

Referenced by getOFDMAndERPOFDMChunkSuccessRate().

69 {
70  double ber = getBpskBer(snr);
71  if (ber == 0.0) {
72  return 1.0;
73  }
74  double pe = calculatePe(ber, bValue);
75  pe = std::min(pe, 1.0);
76  double pms = pow(1 - pe, nbits);
77  return pms;
78 }
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double calculatePe(double p, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:92
double getBpskBer(double snr) const
Definition: Ieee80211NistErrorModel.cc:36
double inet::physicallayer::Ieee80211NistErrorModel::getFecQpskBer ( double  snr,
double  nbits,
uint32_t  bValue 
) const
protected

Referenced by getOFDMAndERPOFDMChunkSuccessRate().

81 {
82  double ber = getQpskBer(snr);
83  if (ber == 0.0) {
84  return 1.0;
85  }
86  double pe = calculatePe(ber, bValue);
87  pe = std::min(pe, 1.0);
88  double pms = pow(1 - pe, nbits);
89  return pms;
90 }
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double getQpskBer(double snr) const
Definition: Ieee80211NistErrorModel.cc:44
double calculatePe(double p, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:92
double inet::physicallayer::Ieee80211NistErrorModel::getHeaderSuccessRate ( const IIeee80211Mode mode,
unsigned int  headerBitLength,
double  snr 
) const
overrideprotectedvirtual

Implements inet::physicallayer::Ieee80211ErrorModelBase.

189 {
190  double successRate = 0;
191  if (auto ofdmMode = dynamic_cast<const Ieee80211OFDMMode *>(mode))
192  successRate = getOFDMAndERPOFDMChunkSuccessRate(ofdmMode->getHeaderMode()->getModulation()->getSubcarrierModulation(),
193  ofdmMode->getHeaderMode()->getCode()->getConvolutionalCode(),
194  bitLength,
195  snr);
196  else if (auto dsssMode = dynamic_cast<const Ieee80211DsssMode *>(mode))
197  successRate = getDSSSAndHrDSSSChunkSuccessRate(dsssMode->getHeaderMode()->getNetBitrate(), bitLength, snr);
198  else if (auto hrDsssMode = dynamic_cast<const Ieee80211HrDsssMode *>(mode))
199  successRate = getDSSSAndHrDSSSChunkSuccessRate(hrDsssMode->getHeaderMode()->getNetBitrate(), bitLength, snr);
200  else
201  throw cRuntimeError("Unsupported 802.11 mode");
202  EV_DEBUG << "Min SNIR = " << snr << ", bit length = " << bitLength << ", header error rate = " << 1 - successRate << endl;
203  if (successRate >= 1)
204  successRate = 1;
205  return successRate;
206 }
virtual double getOFDMAndERPOFDMChunkSuccessRate(const APSKModulationBase *subcarrierModulation, const ConvolutionalCode *convolutionalCode, unsigned int bitLength, double snr) const
Definition: Ieee80211NistErrorModel.cc:147
virtual double getDSSSAndHrDSSSChunkSuccessRate(bps bitrate, unsigned int bitLength, double snr) const
Definition: Ieee80211NistErrorModel.cc:173
double inet::physicallayer::Ieee80211NistErrorModel::getOFDMAndERPOFDMChunkSuccessRate ( const APSKModulationBase subcarrierModulation,
const ConvolutionalCode convolutionalCode,
unsigned int  bitLength,
double  snr 
) const
protectedvirtual

Referenced by getDataSuccessRate(), and getHeaderSuccessRate().

148 {
149  if (subcarrierModulation == &BPSKModulation::singleton) {
150  if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
151  return getFecBpskBer(snr, bitLength, 1);
152  return getFecBpskBer(snr, bitLength, 3);
153  }
154  else if (subcarrierModulation == &QPSKModulation::singleton) {
155  if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
156  return getFecQpskBer(snr, bitLength, 1);
157  return getFecQpskBer(snr, bitLength, 3);
158  }
159  else if (subcarrierModulation == &QAM16Modulation::singleton) {
160  if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
161  return getFec16QamBer(snr, bitLength, 1);
162  return getFec16QamBer(snr, bitLength, 3);
163  }
164  else if (subcarrierModulation == &QAM64Modulation::singleton) {
165  if (convolutionalCode->getCodeRatePuncturingK() == 2 && convolutionalCode->getCodeRatePuncturingN() == 3)
166  return getFec64QamBer(snr, bitLength, 2);
167  return getFec64QamBer(snr, bitLength, 3);
168  }
169  else
170  throw cRuntimeError("Unknown modulation");
171 }
static const QPSKModulation singleton
Definition: QPSKModulation.h:35
double getFecBpskBer(double snr, double nbits, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:68
double getFec16QamBer(double snr, uint32_t nbits, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:123
static const QAM16Modulation singleton
Definition: QAM16Modulation.h:36
static const BPSKModulation singleton
Definition: BPSKModulation.h:35
static const QAM64Modulation singleton
Definition: QAM64Modulation.h:36
double getFec64QamBer(double snr, uint32_t nbits, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:135
double getFecQpskBer(double snr, double nbits, uint32_t bValue) const
Definition: Ieee80211NistErrorModel.cc:80
double inet::physicallayer::Ieee80211NistErrorModel::getQpskBer ( double  snr) const
protected

Referenced by getFecQpskBer().

45 {
46  double z = sqrt(snr / 2.0);
47  double ber = 0.5 * erfc(z);
48  EV << "qpsk snr=" << snr << " ber=" << ber << "\n";
49  return ber;
50 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
virtual std::ostream& inet::physicallayer::Ieee80211NistErrorModel::printToStream ( std::ostream &  stream,
int  level 
) const
inlineoverridevirtual

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.

59 { return stream << "Ieee80211NistErrorModel"; }

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