55 double EbNo = snr * signalSpread / phyRate;
56 double z = std::sqrt(EbNo);
57 double ber = 0.5 * erfc(z);
66 uint64_t phyRate)
const
69 double EbNo = snr * signalSpread / phyRate;
70 double z = std::sqrt((1.5 * log2(m) * EbNo) / (m - 1.0));
71 double z1 = ((1.0 - 1.0 / std::sqrt(m)) * erfc(z));
72 double z2 = 1 - std::pow((1 - z1), 2);
73 double ber = z2 / log2(m);
74 NS_LOG_INFO(
"Qam m=" << m <<
" rate=" << phyRate <<
" snr=" << snr <<
" ber=" << ber);
94 std::pow(p,
static_cast<double>(k)) *
95 std::pow(1 - p,
static_cast<double>(n - k));
103 unsigned int dstart = (d + 1) / 2;
104 unsigned int dend = d;
107 for (
unsigned int i = dstart; i < dend; i++)
118 unsigned int dstart = d / 2 + 1;
119 unsigned int dend = d;
122 for (
unsigned int i = dstart; i < dend; i++)
126 pd += 0.5 *
Binomial(d / 2, ber, d);
155 NS_LOG_FUNCTION(
this << snr << nbits << signalSpread << phyRate << dFree << adFree);
156 double ber =
GetBpskBer(snr, signalSpread, phyRate);
162 double pmu = adFree * pd;
163 pmu = std::min(pmu, 1.0);
164 double pms = std::pow(1 - pmu, nbits);
178 NS_LOG_FUNCTION(
this << snr << nbits << signalSpread << phyRate << m << dFree << adFree
180 double ber =
GetQamBer(snr, m, signalSpread, phyRate);
187 double pmu = adFree * pd;
190 pmu += adFreePlusOne * pd;
191 pmu = std::min(pmu, 1.0);
192 double pms = std::pow(1 - pmu, nbits);
201 uint8_t numRxAntennas,
203 uint16_t staId)
const
205 NS_LOG_FUNCTION(
this << mode << txVector << snr << nbits << +numRxAntennas << field << staId);
the interface for Wifi's error models
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
uint64_t GetPhyRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
WifiCodeRate GetCodeRate() const
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
uint16_t GetChannelWidth() const
Model the error rate for different modulations.
double GetFecBpskBer(double snr, uint64_t nbits, uint32_t signalSpread, uint64_t phyRate, uint32_t dFree, uint32_t adFree) const
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.
static TypeId GetTypeId()
Get the type ID.
double Binomial(uint32_t k, double p, uint32_t n) const
Return Binomial distribution for a given k, p, and n.
double CalculatePdEven(double ber, unsigned int d) const
double GetQamBer(double snr, unsigned int m, uint32_t signalSpread, uint64_t phyRate) const
Return BER of QAM-m with the given parameters.
uint32_t Factorial(uint32_t k) const
Return k!
double CalculatePdOdd(double ber, unsigned int d) const
double GetFecQamBer(double snr, uint64_t nbits, uint32_t signalSpread, uint64_t phyRate, uint32_t m, uint32_t dfree, uint32_t adFree, uint32_t adFreePlusOne) const
double CalculatePd(double ber, unsigned int d) const
double GetBpskBer(double snr, uint32_t signalSpread, uint64_t phyRate) const
Return BER of BPSK with the given parameters.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#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.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
@ WIFI_CODE_RATE_2_3
2/3 coding rate
@ WIFI_CODE_RATE_1_2
1/2 coding rate
@ WIFI_CODE_RATE_5_6
5/6 coding rate