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

Model the error rate for different modulations. More...

#include <Ieee80211YansErrorModel.h>

Inheritance diagram for inet::physicallayer::Ieee80211YansErrorModel:
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 getBpskBer (double snr, Hz signalSpread, bps phyRate) const
 
double getQamBer (double snr, unsigned int m, Hz signalSpread, bps phyRate) const
 
uint32_t factorial (uint32_t k) const
 
double binomialCoefficient (uint32_t k, double p, uint32_t n) const
 
double calculatePdOdd (double ber, unsigned int d) const
 
double calculatePdEven (double ber, unsigned int d) const
 
double calculatePd (double ber, unsigned int d) const
 
double getFecBpskBer (double snr, double nbits, Hz signalSpread, bps phyRate, uint32_t dFree, uint32_t adFree) const
 
double getFecQamBer (double snr, uint32_t nbits, Hz signalSpread, bps phyRate, uint32_t m, uint32_t dfree, uint32_t adFree, uint32_t adFreePlusOne) const
 
virtual double getOFDMAndERPOFDMChunkSuccessRate (const APSKModulationBase *subcarrierModulation, const ConvolutionalCode *convolutionalCode, unsigned int bitLength, bps gorssBitrate, Hz bandwidth, double snr) const
 
virtual double getDSSSAndHrDSSSChunkSuccessRate (bps bitrate, unsigned int bitLength, double snr) const
 
virtual double getHeaderSuccessRate (const IIeee80211Mode *mode, unsigned int bitLength, 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

Model the error rate for different modulations.

A packet of interest (e.g., a packet can potentially be received by the MAC) is divided into chunks. Each chunk is related to an start/end receiving event. For each chunk, it calculates the ratio (SINR) between received power of packet of interest and summation of noise and interfering power of all the other incoming packets. Then, it will calculate the success rate of the chunk based on BER of the modulation. The success reception rate of the packet is derived from the success rate of all chunks.

The 802.11b modulations:

  • 1 Mbps mode is based on DBPSK. BER is from equation 5.2-69 from John G. Proakis Digitial Communications, 2001 edition
  • 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza ELECTRONICS LETTERS, 40(20):1284-1285, September 2004
  • 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and performance of the ieee 802.11b complementarycode-key signal sets", Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS, 57(2):440-449, February 2009.
  • More detailed description and validation can be found in http://www.nsnam.org/~pei/80211b.pdf

Member Function Documentation

double inet::physicallayer::Ieee80211YansErrorModel::binomialCoefficient ( uint32_t  k,
double  p,
uint32_t  n 
) const
protected

Referenced by calculatePdEven(), and calculatePdOdd().

67 {
68  double retval = factorial(n) / (factorial(k) * factorial(n - k)) * pow(p, (int)k) * pow(1 - p, (int)(n - k));
69  return retval;
70 }
uint32_t factorial(uint32_t k) const
Definition: Ieee80211YansErrorModel.cc:56
const double k
Definition: QAM16Modulation.cc:24
double inet::physicallayer::Ieee80211YansErrorModel::calculatePd ( double  ber,
unsigned int  d 
) const
protected

Referenced by getFecBpskBer(), and getFecQamBer().

101 {
102  double pd;
103  if ((d % 2) == 0) {
104  pd = calculatePdEven(ber, d);
105  }
106  else {
107  pd = calculatePdOdd(ber, d);
108  }
109  return pd;
110 }
double calculatePdOdd(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:72
double calculatePdEven(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:85
double inet::physicallayer::Ieee80211YansErrorModel::calculatePdEven ( double  ber,
unsigned int  d 
) const
protected

Referenced by calculatePd().

86 {
87  ASSERT((d % 2) == 0);
88  unsigned int dstart = d / 2 + 1;
89  unsigned int dend = d;
90  double pd = 0;
91 
92  for (unsigned int i = dstart; i < dend; i++) {
93  pd += binomialCoefficient(i, ber, d);
94  }
95  pd += 0.5 * binomialCoefficient(d / 2, ber, d);
96 
97  return pd;
98 }
double binomialCoefficient(uint32_t k, double p, uint32_t n) const
Definition: Ieee80211YansErrorModel.cc:66
double inet::physicallayer::Ieee80211YansErrorModel::calculatePdOdd ( double  ber,
unsigned int  d 
) const
protected

Referenced by calculatePd().

73 {
74  ASSERT((d % 2) == 1);
75  unsigned int dstart = (d + 1) / 2;
76  unsigned int dend = d;
77  double pd = 0;
78 
79  for (unsigned int i = dstart; i < dend; i++) {
80  pd += binomialCoefficient(i, ber, d);
81  }
82  return pd;
83 }
double binomialCoefficient(uint32_t k, double p, uint32_t n) const
Definition: Ieee80211YansErrorModel.cc:66
uint32_t inet::physicallayer::Ieee80211YansErrorModel::factorial ( uint32_t  k) const
protected

Referenced by binomialCoefficient().

57 {
58  uint32_t fact = 1;
59  while (k > 0) {
60  fact *= k;
61  k--;
62  }
63  return fact;
64 }
const double k
Definition: QAM16Modulation.cc:24
double inet::physicallayer::Ieee80211YansErrorModel::getBpskBer ( double  snr,
Hz  signalSpread,
bps  phyRate 
) const
protected

Referenced by getFecBpskBer().

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

Implements inet::physicallayer::Ieee80211ErrorModelBase.

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

Referenced by getDataSuccessRate(), and getHeaderSuccessRate().

173 {
174  switch ((int)bitrate.get()) {
175  case 1000000:
176  return DsssErrorRateModel::GetDsssDbpskSuccessRate(snr, bitLength);
177  case 2000000:
178  return DsssErrorRateModel::GetDsssDqpskSuccessRate(snr, bitLength);
179  case 5500000:
181  case 11000000:
183  }
184  throw cRuntimeError("Unsupported bitrate");
185 }
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::Ieee80211YansErrorModel::getFecBpskBer ( double  snr,
double  nbits,
Hz  signalSpread,
bps  phyRate,
uint32_t  dFree,
uint32_t  adFree 
) const
protected

Referenced by getOFDMAndERPOFDMChunkSuccessRate().

113 {
114  double ber = getBpskBer(snr, signalSpread, phyRate);
115  if (ber == 0.0) {
116  return 1.0;
117  }
118  double pd = calculatePd(ber, dFree);
119  double pmu = adFree * pd;
120  pmu = std::min(pmu, 1.0);
121  double pms = pow(1 - pmu, nbits);
122  return pms;
123 }
double calculatePd(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:100
double getBpskBer(double snr, Hz signalSpread, bps phyRate) const
Definition: Ieee80211YansErrorModel.cc:36
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double inet::physicallayer::Ieee80211YansErrorModel::getFecQamBer ( double  snr,
uint32_t  nbits,
Hz  signalSpread,
bps  phyRate,
uint32_t  m,
uint32_t  dfree,
uint32_t  adFree,
uint32_t  adFreePlusOne 
) const
protected

Referenced by getOFDMAndERPOFDMChunkSuccessRate().

126 {
127  double ber = getQamBer(snr, m, signalSpread, phyRate);
128  if (ber == 0.0) {
129  return 1.0;
130  }
131  /* first term */
132  double pd = calculatePd(ber, dFree);
133  double pmu = adFree * pd;
134  /* second term */
135  pd = calculatePd(ber, dFree + 1);
136  pmu += adFreePlusOne * pd;
137  pmu = std::min(pmu, 1.0);
138  double pms = pow(1 - pmu, (int)nbits);
139  return pms;
140 }
double calculatePd(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:100
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double getQamBer(double snr, unsigned int m, Hz signalSpread, bps phyRate) const
Definition: Ieee80211YansErrorModel.cc:45
value< double, units::m > m
Definition: Units.h:1047
double inet::physicallayer::Ieee80211YansErrorModel::getHeaderSuccessRate ( const IIeee80211Mode mode,
unsigned int  bitLength,
double  snr 
) const
overrideprotectedvirtual

Implements inet::physicallayer::Ieee80211ErrorModelBase.

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

Referenced by getDataSuccessRate(), and getHeaderSuccessRate().

143 {
144  if (subcarrierModulation == &BPSKModulation::singleton) {
145  if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
146  return getFecBpskBer(snr, bitLength, bandwidth, grossBitrate, 10, 11);
147  else
148  return getFecBpskBer(snr, bitLength, bandwidth, grossBitrate, 5, 8 );
149  }
150  else if (subcarrierModulation == &QPSKModulation::singleton) {
151  if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
152  return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 4, 10, 11, 0 );
153  else
154  return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 4, 5, 8, 31);
155  }
156  else if (subcarrierModulation == &QAM16Modulation::singleton) {
157  if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
158  return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 16, 10, 11, 0);
159  else
160  return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 16, 5, 8, 31);
161  }
162  else if (subcarrierModulation == &QAM64Modulation::singleton) {
163  if (convolutionalCode->getCodeRatePuncturingK() == 2 && convolutionalCode->getCodeRatePuncturingN() == 3)
164  return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 64, 6, 1, 16);
165  else
166  return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 64, 5, 8, 31);
167  }
168  else
169  throw cRuntimeError("Unknown modulation");
170 }
static const QPSKModulation singleton
Definition: QPSKModulation.h:35
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 getFecBpskBer(double snr, double nbits, Hz signalSpread, bps phyRate, uint32_t dFree, uint32_t adFree) const
Definition: Ieee80211YansErrorModel.cc:112
double getFecQamBer(double snr, uint32_t nbits, Hz signalSpread, bps phyRate, uint32_t m, uint32_t dfree, uint32_t adFree, uint32_t adFreePlusOne) const
Definition: Ieee80211YansErrorModel.cc:125
double inet::physicallayer::Ieee80211YansErrorModel::getQamBer ( double  snr,
unsigned int  m,
Hz  signalSpread,
bps  phyRate 
) const
protected

Referenced by getFecQamBer().

46 {
47  double EbNo = snr * signalSpread.get() / phyRate.get();
48  double z = sqrt((1.5 * log2(m) * EbNo) / (m - 1.0));
49  double z1 = ((1.0 - 1.0 / sqrt((double)m)) * erfc(z));
50  double z2 = 1 - pow((1 - z1), 2.0);
51  double ber = z2 / log2(m);
52  EV << "Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber << endl;
53  return ber;
54 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
value< double, units::m > m
Definition: Units.h:1047
virtual std::ostream& inet::physicallayer::Ieee80211YansErrorModel::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.

75 { return stream << "Ieee80211YansErrorModel"; }

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