24 #include "ns3/yans-wifi-phy.h" 41 virtual void DoRun (
void);
58 bool CheckPayloadDuration (uint32_t size,
WifiMode payloadMode, uint16_t channelWidth, uint16_t guardInterval,
WifiPreamble preamble,
Time knownDuration);
73 bool CheckTxDuration (uint32_t size,
WifiMode payloadMode, uint16_t channelWidth, uint16_t guardInterval,
WifiPreamble preamble,
Time knownDuration);
106 Time calculatedDuration =
phy->GetPayloadDuration (size, txVector, band);
107 if (calculatedDuration != knownDuration)
109 std::cerr <<
"size=" << size
110 <<
" mode=" << payloadMode
111 <<
" channelWidth=" << channelWidth
112 <<
" guardInterval=" << guardInterval
113 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
114 <<
" known=" << knownDuration
115 <<
" calculated=" << calculatedDuration
123 calculatedDuration =
phy->GetPayloadDuration (size, txVector, band);
125 if (calculatedDuration != knownDuration)
127 std::cerr <<
"size=" << size
128 <<
" mode=" << payloadMode
129 <<
" channelWidth=" << channelWidth
130 <<
" guardInterval=" << guardInterval
131 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
132 <<
" known=" << knownDuration
133 <<
" calculated=" << calculatedDuration
145 txVector.
SetMode (payloadMode);
161 Time calculatedDuration =
phy->CalculateTxDuration (size, txVector, band);
162 if (calculatedDuration != knownDuration)
164 std::cerr <<
"size=" << size
165 <<
" mode=" << payloadMode
166 <<
" channelWidth=" << +channelWidth
167 <<
" guardInterval=" << guardInterval
168 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
169 <<
" preamble=" << preamble
170 <<
" known=" << knownDuration
171 <<
" calculated=" << calculatedDuration
179 calculatedDuration =
phy->CalculateTxDuration (size, txVector, band);
181 if (calculatedDuration != knownDuration)
183 std::cerr <<
"size=" << size
184 <<
" mode=" << payloadMode
185 <<
" channelWidth=" << channelWidth
186 <<
" guardInterval=" << guardInterval
187 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
188 <<
" preamble=" << preamble
189 <<
" known=" << knownDuration
190 <<
" calculated=" << calculatedDuration
439 :
TestSuite (
"wifi-devices-tx-duration", UNIT)
Simulation virtual time values and global simulation resolution.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
static TxDurationTestSuite g_txDurationTestSuite
the test suite
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetStbc(bool stbc)
Sets if STBC is being used.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual void DoRun(void)
Implementation to actually run this TestCase.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
virtual ~TxDurationTest()
bool CheckTxDuration(uint32_t size, WifiMode payloadMode, uint16_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration)
Check if the overall tx duration returned by InterferenceHelper corresponds to a known value of the p...
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
WifiModulationClass GetModulationClass() const
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
WifiPhyBand
Identifies the PHY band.
void SetNess(uint8_t ness)
Sets the Ness number refer to IEEE 802.11n Table 20-6 for explanation.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
bool CheckPayloadDuration(uint32_t size, WifiMode payloadMode, uint16_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration)
Check if the payload tx duration returned by InterferenceHelper corresponds to a known value of the p...