55 double z = std::sqrt(snr);
56 double ber = 0.5 * erfc(z);
65 double z = std::sqrt(snr / 2.0);
66 double ber = 0.5 * erfc(z);
75 NS_ASSERT(std::bitset<16>(constellationSize).count() ==
77 double z = std::sqrt(snr / ((2 * (constellationSize - 1)) / 3));
78 uint8_t bitsPerSymbol = std::sqrt(constellationSize);
79 double ber = ((bitsPerSymbol - 1) / (bitsPerSymbol * std::log2(bitsPerSymbol))) * erfc(z);
80 NS_LOG_INFO(constellationSize <<
"-QAM: snr=" << snr <<
" ber=" << ber);
95 double pms = std::pow(1 - pe, nbits);
110 double pms = std::pow(1 - pe, nbits);
118 double D = std::sqrt(4.0 * p * (1.0 - p));
123 pe = 0.5 * (36.0 * std::pow(D, 10) + 211.0 * std::pow(D, 12) + 1404.0 * std::pow(D, 14) +
124 11633.0 * std::pow(D, 16) + 77433.0 * std::pow(D, 18) +
125 502690.0 * std::pow(D, 20) + 3322763.0 * std::pow(D, 22) +
126 21292910.0 * std::pow(D, 24) + 134365911.0 * std::pow(D, 26));
128 else if (bValue == 2)
131 pe = 1.0 / (2.0 * bValue) *
132 (3.0 * std::pow(D, 6) + 70.0 * std::pow(D, 7) + 285.0 * std::pow(D, 8) +
133 1276.0 * std::pow(D, 9) + 6160.0 * std::pow(D, 10) + 27128.0 * std::pow(D, 11) +
134 117019.0 * std::pow(D, 12) + 498860.0 * std::pow(D, 13) +
135 2103891.0 * std::pow(D, 14) + 8784123.0 * std::pow(D, 15));
137 else if (bValue == 3)
140 pe = 1.0 / (2.0 * bValue) *
141 (42.0 * std::pow(D, 5) + 201.0 * std::pow(D, 6) + 1492.0 * std::pow(D, 7) +
142 10469.0 * std::pow(D, 8) + 62935.0 * std::pow(D, 9) + 379644.0 * std::pow(D, 10) +
143 2253373.0 * std::pow(D, 11) + 13073811.0 * std::pow(D, 12) +
144 75152755.0 * std::pow(D, 13) + 428005675.0 * std::pow(D, 14));
146 else if (bValue == 5)
151 pe = 1.0 / (2.0 * bValue) *
152 (92.0 * std::pow(D, 4.0) + 528.0 * std::pow(D, 5.0) + 8694.0 * std::pow(D, 6.0) +
153 79453.0 * std::pow(D, 7.0) + 792114.0 * std::pow(D, 8.0) +
154 7375573.0 * std::pow(D, 9.0) + 67884974.0 * std::pow(D, 10.0) +
155 610875423.0 * std::pow(D, 11.0) + 5427275376.0 * std::pow(D, 12.0) +
156 47664215639.0 * std::pow(D, 13.0));
169 uint8_t bValue)
const
172 double ber =
GetQamBer(constellationSize, snr);
179 double pms = std::pow(1 - pe, nbits);
209 uint8_t numRxAntennas,
211 uint16_t staId)
const
213 NS_LOG_FUNCTION(
this << mode << snr << nbits << +numRxAntennas << field << staId);
the interface for Wifi's error models
A model for the error rate for different modulations.
static TypeId GetTypeId()
Get the type ID.
double GetQamBer(uint16_t constellationSize, double snr) const
Return BER of QAM for a given constellation size at the given SNR.
double GetBpskBer(double snr) const
Return BER of BPSK at the given SNR.
double GetFecBpskBer(double snr, uint64_t nbits, uint8_t bValue) const
Return BER of BPSK at the given SNR after applying FEC.
double CalculatePe(double p, uint8_t bValue) const
Return the coded BER for the given p and b.
double GetFecQpskBer(double snr, uint64_t nbits, uint8_t bValue) const
Return BER of QPSK at the given SNR after applying FEC.
double GetFecQamBer(uint16_t constellationSize, double snr, uint64_t nbits, uint8_t bValue) const
Return BER of QAM for a given constellation size at the given SNR after applying FEC.
uint8_t GetBValue(WifiCodeRate codeRate) const
Return the bValue such that coding rate = bValue / (bValue + 1).
double DoGetChunkSuccessRate(WifiMode mode, const WifiTxVector &txVector, double snr, uint64_t nbits, uint8_t numRxAntennas, WifiPpduField field, uint16_t staId) const override
A pure virtual method that must be implemented in the subclass.
double GetQpskBer(double snr) const
Return BER of QPSK at the given SNR.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
represent a single transmission mode
uint16_t GetConstellationSize() const
WifiModulationClass GetModulationClass() const
WifiCodeRate GetCodeRate() const
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
WifiPpduField
The type of PPDU field (grouped for convenience)
@ WIFI_MOD_CLASS_ERP_OFDM
ERP-OFDM (18.4)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const uint16_t WIFI_CODE_RATE_UNDEFINED
undefined coding rate
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
const uint16_t WIFI_CODE_RATE_1_2
1/2 coding rate
const uint16_t WIFI_CODE_RATE_2_3
2/3 coding rate
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate