21 #include <ns3/object.h>
25 #include "ns3/interference-helper.h"
26 #include "ns3/wifi-phy.h"
37 virtual void DoRun (
void);
68 TxDurationTest::TxDurationTest ()
74 TxDurationTest::~TxDurationTest ()
82 if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
84 std::cerr <<
" size=" << size
85 <<
" mode=" << payloadMode
86 <<
" known=" << knownDurationMicroSeconds
87 <<
" calculated=" << calculatedDurationMicroSeconds
98 if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
100 std::cerr <<
" size=" << size
101 <<
" mode=" << payloadMode
102 <<
" preamble=" << preamble
103 <<
" known=" << knownDurationMicroSeconds
104 <<
" calculated=" << calculatedDurationMicroSeconds
129 &&
CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 744 + 96)
130 &&
CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 745 + 96)
131 &&
CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 746 + 96)
132 &&
CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 747 + 96)
133 &&
CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 744 + 192)
134 &&
CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 745 + 192)
135 &&
CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 746 + 192)
136 &&
CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 747 + 192)
145 &&
CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4092 + 96)
146 &&
CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4096 + 96)
147 &&
CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4100 + 96)
148 &&
CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4104 + 96)
149 &&
CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4092 + 192)
150 &&
CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4096 + 192)
151 &&
CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4100 + 192)
152 &&
CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4104 + 192)
168 &&
CheckTxDuration (1536, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 1310)
169 &&
CheckTxDuration (76, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 248)
170 &&
CheckTxDuration (14, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 203)
171 &&
CheckTxDuration (1536, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 248)
172 &&
CheckTxDuration (76, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 32)
173 &&
CheckTxDuration (14, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 24);
177 &&
CheckTxDuration (1536, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 254)
178 &&
CheckTxDuration (76, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 38)
179 &&
CheckTxDuration (14, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 30);
188 TxDurationTestSuite::TxDurationTestSuite ()
189 :
TestSuite (
"devices-wifi-tx-duration", UNIT)
194 static TxDurationTestSuite g_txDurationTestSuite;
static WifiMode GetDsssRate1Mbps()
#define NS_LOG_COMPONENT_DEFINE(name)
bool CheckTxDuration(uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
int64_t GetMicroSeconds(void) const
static Time CalculateTxDuration(uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble)
static uint32_t GetPayloadDurationMicroSeconds(uint32_t size, WifiMode payloadMode)
static WifiMode GetDsssRate5_5Mbps()
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
bool CheckPayloadDuration(uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds)
virtual void DoRun(void)
Implementation to actually run this test case.