24 #include "ns3/nist-error-rate-model.h" 25 #include "ns3/yans-error-rate-model.h" 26 #include "ns3/dsss-error-rate-model.h" 27 #include "ns3/wifi-phy.h" 28 #include "ns3/wifi-utils.h" 29 #include "ns3/table-based-error-rate-model.h" 30 #include "ns3/he-phy.h" 41 double noisePowerDbw = -100.5522786 + 7;
43 double sinrDb = rssDbw - noisePowerDbw;
45 return pow (10.0, sinrDb / 10.0);
61 void DoRun (
void)
override;
65 :
TestCase (
"WifiErrorRateModel test case DSSS")
77 uint64_t size = (1024 + 40 + 14) * 8;
82 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-105.0), size);
84 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-100.0), size);
86 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-99.0), size);
88 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-98.0), size);
90 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-97.0), size);
92 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-96.0), size);
94 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-95.0), size);
96 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (
FromRss (-90.0), size);
101 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-96.0), size);
103 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-95.0), size);
105 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-94.0), size);
107 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-93.0), size);
109 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-92.0), size);
111 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-91.0), size);
113 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-90.0), size);
115 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (
FromRss (-89.0), size);
120 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-94.0), size);
122 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-93.0), size);
124 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-92.0), size);
126 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-91.0), size);
128 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-90.0), size);
130 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-89.0), size);
132 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-88.0), size);
134 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (
FromRss (-87.0), size);
138 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-91.0), size);
140 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-90.0), size);
142 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-89.0), size);
144 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-88.0), size);
146 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-87.0), size);
148 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-86.0), size);
150 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-85.0), size);
152 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (
FromRss (-84.0), size);
170 void DoRun (
void)
override;
174 :
TestCase (
"WifiErrorRateModel test case NIST")
185 uint32_t frameSize = 2000;
302 using InterferenceHelper::InterferenceHelper;
303 using InterferenceHelper::CalculatePayloadChunkSuccessRate;
304 using InterferenceHelper::CalculateSnr;
320 void DoRun (
void)
override;
324 :
TestCase (
"WifiErrorRateModel test case MIMO")
337 WifiMode mode = HtPhy::GetHtMcs0 ();
351 double initialSnr = 4.0;
357 double sisoChunkSuccess = chunkSuccess;
464 {std::make_pair (0, 1458), {
604 {std::make_pair (0, 32), {
744 {std::make_pair (0, 1000), {
884 {std::make_pair (0, 1), {
1024 {std::make_pair (0, 2000), {
1164 {std::make_pair (7, 1500), {
1304 {std::make_pair (8, 1500), {
1465 void DoRun (
void)
override;
1474 m_testName (testName),
1496 for (
double snr = -4; snr <= 30; snr += 0.25)
1498 double expectedValue = 0;
1509 auto itValue = it->second.find (snr);
1510 if (itValue != it->second.end ())
1512 expectedValue = itValue->second;
1525 NS_LOG_INFO (
m_testName <<
": snr=" << snr <<
"dB per=" << per <<
" expectedPER=" << expectedValue);
1543 :
TestSuite (
"wifi-error-rate-models", UNIT)
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
void DoRun(void) override
Implementation to actually run this TestCase.
static double FromRss(double rssDbw)
void SetNumberOfReceiveAntennas(uint8_t rx)
Set the number of RX antennas in the receiver corresponding to this interference helper.
void DoRun(void) override
Implementation to actually run this TestCase.
WifiErrorRateModelsTestCaseNist()
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static WifiErrorRateModelsTestSuite wifiErrorRateModelsTestSuite
the test suite
TableBasedErrorRateTestCase(const std::string &testName, WifiMode mode, uint32_t size)
Constructor.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
const uint8_t ERROR_TABLE_BCC_MAX_NUM_MCS
maximum number of MCSs for BCC
handles interference calculations
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void DoRun(void) override
Implementation to actually run this TestCase.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
double CalculatePayloadChunkSuccessRate(double snir, Time duration, const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const
Calculate the success rate of the payload chunk given the SINR, duration, and TXVECTOR.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Wifi Table-based Error Rate Models Test Case.
virtual ~WifiErrorRateModelsTestCaseNist()
uint32_t m_size
The size (in bytes) to test.
double GetChunkSuccessRate(WifiMode mode, const WifiTxVector &txVector, double snr, uint64_t nbits, uint8_t numRxAntennas=1, WifiPpduField field=WIFI_PPDU_FIELD_DATA, uint16_t staId=SU_STA_ID) const
This method returns the probability that the given 'chunk' of the packet will be successfully receive...
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
std::map< std::pair< uint8_t, uint32_t >, std::map< double, double > > expectedTableValues
map of PER values that have been manually computed for a given MCS, size (in bytes) and SNR (in dB) i...
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
std::string m_testName
The name of the test to run.
void SetNss(uint8_t nss)
Sets the number of Nss.
virtual ~WifiErrorRateModelsTestCaseDsss()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiMode m_mode
The WifiMode to test.
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
double DbToRatio(double dB)
Convert from dB to ratio.
double RatioToDb(double ratio)
Convert from ratio to dB.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
virtual ~TableBasedErrorRateTestCase()
Wifi Error Rate Models Test Case MIMO.
WifiErrorRateModelsTestCaseMimo()
void SetNoiseFigure(double value)
Set the noise figure.
void DoRun(void) override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Case Nist.
double CalculateSnr(Ptr< Event > event, uint16_t channelWidth, uint8_t nss, WifiSpectrumBand band) const
Calculate the SNIR for the event (starting from now until the event end).
WifiErrorRateModelsTestCaseDsss()
uint16_t GetChannelWidth(void) const
WifiErrorRateModelsTestSuite()
Wifi Error Rate Models Test Suite.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
uint8_t GetMcsValue(void) const
Wifi Error Rate Models Test Case Dsss.
virtual ~WifiErrorRateModelsTestCaseMimo()