39 .SetGroupName (
"Wifi")
53 double z = std::sqrt (snr);
54 double ber = 0.5 * erfc (z);
63 double z = std::sqrt (snr / 2.0);
64 double ber = 0.5 * erfc (z);
73 NS_ASSERT (std::bitset<16> (constellationSize).count () == 1);
74 double z = std::sqrt (snr / ((2 * (constellationSize - 1)) / 3));
75 uint8_t bitsPerSymbol = std::sqrt (constellationSize);
76 double ber = ((bitsPerSymbol - 1) / (bitsPerSymbol * std::log2 (bitsPerSymbol))) * erfc (z);
77 NS_LOG_INFO (constellationSize <<
"-QAM: snr=" << snr <<
" ber=" << ber);
92 double pms = std::pow (1 - pe, nbits);
107 double pms = std::pow (1 - pe, nbits);
115 double D = std::sqrt (4.0 * p * (1.0 - p));
120 pe = 0.5 * (36.0 * std::pow (D, 10)
121 + 211.0 * std::pow (D, 12)
122 + 1404.0 * std::pow (D, 14)
123 + 11633.0 * std::pow (D, 16)
124 + 77433.0 * std::pow (D, 18)
125 + 502690.0 * std::pow (D, 20)
126 + 3322763.0 * std::pow (D, 22)
127 + 21292910.0 * std::pow (D, 24)
128 + 134365911.0 * std::pow (D, 26));
130 else if (bValue == 2)
133 pe = 1.0 / (2.0 * bValue) *
134 (3.0 * std::pow (D, 6)
135 + 70.0 * std::pow (D, 7)
136 + 285.0 * std::pow (D, 8)
137 + 1276.0 * std::pow (D, 9)
138 + 6160.0 * std::pow (D, 10)
139 + 27128.0 * std::pow (D, 11)
140 + 117019.0 * std::pow (D, 12)
141 + 498860.0 * std::pow (D, 13)
142 + 2103891.0 * std::pow (D, 14)
143 + 8784123.0 * std::pow (D, 15));
145 else if (bValue == 3)
148 pe = 1.0 / (2.0 * bValue) *
149 (42.0 * std::pow (D, 5)
150 + 201.0 * std::pow (D, 6)
151 + 1492.0 * std::pow (D, 7)
152 + 10469.0 * std::pow (D, 8)
153 + 62935.0 * std::pow (D, 9)
154 + 379644.0 * std::pow (D, 10)
155 + 2253373.0 * std::pow (D, 11)
156 + 13073811.0 * std::pow (D, 12)
157 + 75152755.0 * std::pow (D, 13)
158 + 428005675.0 * std::pow (D, 14));
160 else if (bValue == 5)
164 pe = 1.0 / (2.0 * bValue) *
165 (92.0 * std::pow (D, 4.0)
166 + 528.0 * std::pow (D, 5.0)
167 + 8694.0 * std::pow (D, 6.0)
168 + 79453.0 * std::pow (D, 7.0)
169 + 792114.0 * std::pow (D, 8.0)
170 + 7375573.0 * std::pow (D, 9.0)
171 + 67884974.0 * std::pow (D, 10.0)
172 + 610875423.0 * std::pow (D, 11.0)
173 + 5427275376.0 * std::pow (D, 12.0)
174 + 47664215639.0 * std::pow (D, 13.0));
186 NS_LOG_FUNCTION (
this << constellationSize << snr << nbits << +bValue);
187 double ber =
GetQamBer (constellationSize, snr);
194 double pms = std::pow (1 - pe, nbits);
222 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.
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.
static TypeId GetTypeId(void)
Get the type ID.
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(void) const
WifiModulationClass GetModulationClass() const
WifiCodeRate GetCodeRate(void) 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