|
INET Framework for OMNeT++/OMNEST
|
Model the error rate for different modulations.
More...
#include <Ieee80211YansErrorModel.h>
|
| virtual std::ostream & | printToStream (std::ostream &stream, int level, int evFlags=0) const override |
| | Prints this object to the provided output stream. More...
|
| |
| | 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...
|
| |
| 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 |
| |
|
| 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 |
| |
| virtual Packet * | computeCorruptedPacket (const Packet *packet, double ber) const override |
| |
| virtual double | getDsssDbpskSuccessRate (unsigned int bitLength, double snir) const |
| |
| virtual double | getDsssDqpskSuccessRate (unsigned int bitLength, double snir) const |
| |
| virtual double | getDsssDqpskCck5_5SuccessRate (unsigned int bitLength, double snir) const |
| |
| virtual double | getDsssDqpskCck11SuccessRate (unsigned int bitLength, double snir) const |
| |
| virtual void | initialize (int stage) override |
| |
| virtual double | getScalarSnir (const ISnir *snir) const |
| |
| virtual bool | hasProbabilisticError (b length, double ber) const |
| |
| virtual Packet * | corruptBits (const Packet *packet, double ber, bool &isCorrupted) const |
| |
| virtual Packet * | corruptBytes (const Packet *packet, double ber, bool &isCorrupted) const |
| |
| virtual Packet * | corruptChunks (const Packet *packet, double ber, bool &isCorrupted) const |
| |
| virtual Packet * | corruptPacket (const Packet *packet, bool &isCorrupted) const |
| |
| virtual Packet * | computeCorruptedPacket (const ISnir *snir) const override |
| |
|
| 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
} |
| |
| 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)
} |
| |
| double | spectralEfficiency1bit = 2000000.0 / 1000000.0 |
| |
| double | spectralEfficiency2bit = 2000000.0 / 1000000.0 / 2.0 |
| |
| double | sirPerfect = 10.0 |
| |
| double | sirImpossible = 0.1 |
| |
| CorruptionMode | corruptionMode = CorruptionMode::CM_UNDEFINED |
| |
| SnirMode | snirMode = SnirMode::SM_UNDEFINED |
| |
| double | snirOffset = NaN |
| |
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
◆ binomialCoefficient()
| double inet::physicallayer::Ieee80211YansErrorModel::binomialCoefficient |
( |
uint32_t |
k, |
|
|
double |
p, |
|
|
uint32_t |
n |
|
) |
| const |
|
protected |
◆ calculatePd()
| double inet::physicallayer::Ieee80211YansErrorModel::calculatePd |
( |
double |
ber, |
|
|
unsigned int |
d |
|
) |
| const |
|
protected |
◆ calculatePdEven()
| double inet::physicallayer::Ieee80211YansErrorModel::calculatePdEven |
( |
double |
ber, |
|
|
unsigned int |
d |
|
) |
| const |
|
protected |
84 unsigned int dstart = d / 2 + 1;
85 unsigned int dend = d;
88 for (
unsigned int i = dstart; i < dend; i++) {
Referenced by calculatePd().
◆ calculatePdOdd()
| double inet::physicallayer::Ieee80211YansErrorModel::calculatePdOdd |
( |
double |
ber, |
|
|
unsigned int |
d |
|
) |
| const |
|
protected |
71 unsigned int dstart = (d + 1) / 2;
72 unsigned int dend = d;
75 for (
unsigned int i = dstart; i < dend; i++) {
Referenced by calculatePd().
◆ factorial()
| uint32_t inet::physicallayer::Ieee80211YansErrorModel::factorial |
( |
uint32_t |
k | ) |
const |
|
protected |
◆ getBpskBer()
| double inet::physicallayer::Ieee80211YansErrorModel::getBpskBer |
( |
double |
snr, |
|
|
Hz |
signalSpread, |
|
|
bps |
phyRate |
|
) |
| const |
|
protected |
34 double EbNo = snr * signalSpread.get() / phyRate.get();
35 double z =
sqrt(EbNo);
36 double ber = 0.5 * erfc(z);
37 EV <<
"bpsk snr=" << snr <<
" ber=" << ber << endl;
Referenced by getFecBpskBer().
◆ getDataSuccessRate()
| double inet::physicallayer::Ieee80211YansErrorModel::getDataSuccessRate |
( |
const IIeee80211Mode * |
mode, |
|
|
unsigned int |
bitLength, |
|
|
double |
snr |
|
) |
| const |
|
overrideprotectedvirtual |
Implements inet::physicallayer::Ieee80211ErrorModelBase.
240 double successRate = 0;
241 if (
auto ofdmMode =
dynamic_cast<const Ieee80211OfdmMode *
>(mode))
243 ofdmMode->getDataMode()->getCode()->getConvolutionalCode(),
244 bitLength +
b(ofdmMode->getHeaderMode()->getServiceFieldLength()).get(),
245 ofdmMode->getDataMode()->getGrossBitrate(),
246 ofdmMode->getHeaderMode()->getBandwidth(),
248 else if (
auto htMode =
dynamic_cast<const Ieee80211HtMode *
>(mode))
250 htMode->getDataMode()->getCode()->getForwardErrorCorrection(),
253 htMode->getDataMode()->getGrossBitrate(),
254 htMode->getDataMode()->getBandwidth(),
256 else if (
auto vhtMode =
dynamic_cast<const Ieee80211VhtMode *
>(mode))
258 vhtMode->getDataMode()->getCode()->getForwardErrorCorrection(),
261 vhtMode->getDataMode()->getGrossBitrate(),
262 vhtMode->getDataMode()->getBandwidth(),
264 else if (
auto dsssMode =
dynamic_cast<const Ieee80211DsssMode *
>(mode))
266 else if (
auto hrDsssMode =
dynamic_cast<const Ieee80211HrDsssMode *
>(mode))
269 throw cRuntimeError(
"Unsupported 802.11 mode");
270 EV_DEBUG <<
"SNIR = " << snr <<
", data bit length = " << bitLength <<
", data error rate = " << 1 - successRate << endl;
271 if (successRate >= 1)
◆ getDSSSAndHrDSSSChunkSuccessRate()
| double inet::physicallayer::Ieee80211YansErrorModel::getDSSSAndHrDSSSChunkSuccessRate |
( |
bps |
bitrate, |
|
|
unsigned int |
bitLength, |
|
|
double |
snr |
|
) |
| const |
|
protectedvirtual |
◆ getFecBpskBer()
| double inet::physicallayer::Ieee80211YansErrorModel::getFecBpskBer |
( |
double |
snr, |
|
|
double |
nbits, |
|
|
Hz |
signalSpread, |
|
|
bps |
phyRate, |
|
|
uint32_t |
dFree, |
|
|
uint32_t |
adFree |
|
) |
| const |
|
protected |
◆ getFecQamBer()
| 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 |
◆ getHeaderSuccessRate()
| double inet::physicallayer::Ieee80211YansErrorModel::getHeaderSuccessRate |
( |
const IIeee80211Mode * |
mode, |
|
|
unsigned int |
bitLength, |
|
|
double |
snr |
|
) |
| const |
|
overrideprotectedvirtual |
Implements inet::physicallayer::Ieee80211ErrorModelBase.
193 double successRate = 0;
194 if (
auto ofdmMode =
dynamic_cast<const Ieee80211OfdmMode *
>(mode)) {
195 int chunkLength = bitLength -
b(ofdmMode->getHeaderMode()->getServiceFieldLength()).get();
196 ASSERT(chunkLength == 24);
198 ofdmMode->getHeaderMode()->getCode()->getConvolutionalCode(),
200 ofdmMode->getHeaderMode()->getGrossBitrate(),
201 ofdmMode->getHeaderMode()->getBandwidth(),
204 else if (
auto htMode =
dynamic_cast<const Ieee80211HtMode *
>(mode)) {
207 int chunkLength = bitLength;
209 htMode->getHeaderMode()->getCode()->getForwardErrorCorrection(),
211 htMode->getHeaderMode()->getGrossBitrate(),
212 htMode->getHeaderMode()->getBandwidth(),
215 else if (
auto vhtMode =
dynamic_cast<const Ieee80211VhtMode *
>(mode)) {
218 int chunkLength = bitLength;
220 vhtMode->getHeaderMode()->getCode()->getForwardErrorCorrection(),
222 vhtMode->getHeaderMode()->getGrossBitrate(),
223 vhtMode->getHeaderMode()->getBandwidth(),
226 else if (
auto dsssMode =
dynamic_cast<const Ieee80211DsssMode *
>(mode))
228 else if (
auto hrDsssMode =
dynamic_cast<const Ieee80211HrDsssMode *
>(mode))
231 throw cRuntimeError(
"Unsupported 802.11 mode");
232 EV_DEBUG <<
"SNIR = " << snr <<
", header bit length = " << bitLength <<
", header error rate = " << 1 - successRate << endl;
233 if (successRate >= 1)
◆ getOFDMAndERPOFDMChunkSuccessRate()
| double inet::physicallayer::Ieee80211YansErrorModel::getOFDMAndERPOFDMChunkSuccessRate |
( |
const ApskModulationBase * |
subcarrierModulation, |
|
|
const ConvolutionalCode * |
convolutionalCode, |
|
|
unsigned int |
bitLength, |
|
|
bps |
gorssBitrate, |
|
|
Hz |
bandwidth, |
|
|
double |
snr |
|
) |
| const |
|
protectedvirtual |
141 if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
142 return getFecBpskBer(snr, bitLength, bandwidth, grossBitrate, 10, 11);
144 return getFecBpskBer(snr, bitLength, bandwidth, grossBitrate, 5, 8);
147 if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
148 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 4, 10, 11, 0);
150 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 4, 5, 8, 31);
153 if (convolutionalCode->getCodeRatePuncturingK() == 1 && convolutionalCode->getCodeRatePuncturingN() == 2)
154 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 16, 10, 11, 0);
156 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 16, 5, 8, 31);
159 if (convolutionalCode->getCodeRatePuncturingK() == 2 && convolutionalCode->getCodeRatePuncturingN() == 3)
160 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 64, 6, 1, 16);
161 else if (convolutionalCode->getCodeRatePuncturingK() == 5 && convolutionalCode->getCodeRatePuncturingN() == 6)
162 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 64, 4, 14, 69);
164 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 64, 5, 8, 31);
167 if (convolutionalCode->getCodeRatePuncturingK() == 5 && convolutionalCode->getCodeRatePuncturingN() == 6)
168 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 256, 4, 14, 69);
170 return getFecQamBer(snr, bitLength, bandwidth, grossBitrate, 256, 5, 8, 31);
173 throw cRuntimeError(
"Unknown modulation");
Referenced by getDataSuccessRate(), and getHeaderSuccessRate().
◆ getQamBer()
| double inet::physicallayer::Ieee80211YansErrorModel::getQamBer |
( |
double |
snr, |
|
|
unsigned int |
m, |
|
|
Hz |
signalSpread, |
|
|
bps |
phyRate |
|
) |
| const |
|
protected |
43 double EbNo = snr * signalSpread.get() / phyRate.get();
44 double z =
sqrt((1.5 * log2(
m) * EbNo) / (
m - 1.0));
45 double z1 = ((1.0 - 1.0 /
sqrt((
double)
m)) * erfc(z));
46 double z2 = 1 - pow((1 - z1), 2.0);
47 double ber = z2 / log2(
m);
48 EV <<
"Qam m=" <<
m <<
" rate=" << phyRate <<
" snr=" << snr <<
" ber=" << ber << endl;
Referenced by getFecQamBer().
◆ printToStream()
| virtual std::ostream& inet::physicallayer::Ieee80211YansErrorModel::printToStream |
( |
std::ostream & |
stream, |
|
|
int |
level, |
|
|
int |
evFlags = 0 |
|
) |
| const |
|
inlineoverridevirtual |
Prints this object to the provided output stream.
Reimplemented from inet::IPrintableObject.
66 {
return stream <<
"Ieee80211YansErrorModel"; }
The documentation for this class was generated from the following files:
static const QbpskModulation singleton
Definition: QbpskModulation.h:24
virtual double getDsssDqpskCck11SuccessRate(unsigned int bitLength, double snir) const
Definition: Ieee80211ErrorModelBase.cc:98
double getQamBer(double snr, unsigned int m, Hz signalSpread, bps phyRate) const
Definition: Ieee80211YansErrorModel.cc:41
virtual double getDsssDqpskCck5_5SuccessRate(unsigned int bitLength, double snir) const
Definition: Ieee80211ErrorModelBase.cc:81
static const QpskModulation singleton
Definition: QpskModulation.h:25
double calculatePd(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:96
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:272
double calculatePdOdd(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:68
static const BpskModulation singleton
Definition: BpskModulation.h:25
uint32_t factorial(uint32_t k) const
Definition: Ieee80211YansErrorModel.cc:52
double calculatePdEven(double ber, unsigned int d) const
Definition: Ieee80211YansErrorModel.cc:81
value< int64_t, units::b > b
Definition: Units.h:1241
static const Qam64Modulation singleton
Definition: Qam64Modulation.h:26
virtual double getDsssDbpskSuccessRate(unsigned int bitLength, double snir) const
Definition: Ieee80211ErrorModelBase.cc:67
const double k
Definition: Qam1024Modulation.cc:14
virtual double getDSSSAndHrDSSSChunkSuccessRate(bps bitrate, unsigned int bitLength, double snr) const
Definition: Ieee80211YansErrorModel.cc:176
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:121
double getFecBpskBer(double snr, double nbits, Hz signalSpread, bps phyRate, uint32_t dFree, uint32_t adFree) const
Definition: Ieee80211YansErrorModel.cc:108
double getBpskBer(double snr, Hz signalSpread, bps phyRate) const
Definition: Ieee80211YansErrorModel.cc:32
const T minnan(const T &a, const T &b)
This function properly and symmetrically handles NaNs in contrast with std::min and std::fmin.
Definition: INETMath.h:216
double binomialCoefficient(uint32_t k, double p, uint32_t n) const
Definition: Ieee80211YansErrorModel.cc:62
value< double, units::m > m
Definition: Units.h:1233
static const Qam16Modulation singleton
Definition: Qam16Modulation.h:26
virtual double getOFDMAndERPOFDMChunkSuccessRate(const ApskModulationBase *subcarrierModulation, const ConvolutionalCode *convolutionalCode, unsigned int bitLength, bps gorssBitrate, Hz bandwidth, double snr) const
Definition: Ieee80211YansErrorModel.cc:138
virtual double getDsssDqpskSuccessRate(unsigned int bitLength, double snir) const
Definition: Ieee80211ErrorModelBase.cc:74
static const Qam256Modulation singleton
Definition: Qam256Modulation.h:26