24 #include "ns3/yans-wifi-phy.h" 44 virtual void DoRun (
void);
61 bool CheckPayloadDuration (uint32_t size,
WifiMode payloadMode, uint16_t channelWidth, uint16_t guardInterval,
WifiPreamble preamble,
Time knownDuration);
76 bool CheckTxDuration (uint32_t size,
WifiMode payloadMode, uint16_t channelWidth, uint16_t guardInterval,
WifiPreamble preamble,
Time knownDuration);
109 Time calculatedDuration =
phy->GetPayloadDuration (size, txVector, testedFrequency);
110 if (calculatedDuration != knownDuration)
112 std::cerr <<
"size=" << size
113 <<
" mode=" << payloadMode
114 <<
" channelWidth=" << channelWidth
115 <<
" guardInterval=" << guardInterval
116 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
117 <<
" known=" << knownDuration
118 <<
" calculated=" << calculatedDuration
126 calculatedDuration =
phy->GetPayloadDuration (size, txVector, testedFrequency);
128 if (calculatedDuration != knownDuration)
130 std::cerr <<
"size=" << size
131 <<
" mode=" << payloadMode
132 <<
" channelWidth=" << channelWidth
133 <<
" guardInterval=" << guardInterval
134 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
135 <<
" known=" << knownDuration
136 <<
" calculated=" << calculatedDuration
148 txVector.
SetMode (payloadMode);
164 Time calculatedDuration =
phy->CalculateTxDuration (size, txVector, testedFrequency);
165 if (calculatedDuration != knownDuration)
167 std::cerr <<
"size=" << size
168 <<
" mode=" << payloadMode
169 <<
" channelWidth=" << +channelWidth
170 <<
" guardInterval=" << guardInterval
171 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
172 <<
" preamble=" << preamble
173 <<
" known=" << knownDuration
174 <<
" calculated=" << calculatedDuration
182 calculatedDuration =
phy->CalculateTxDuration (size, txVector, testedFrequency);
184 if (calculatedDuration != knownDuration)
186 std::cerr <<
"size=" << size
187 <<
" mode=" << payloadMode
188 <<
" channelWidth=" << channelWidth
189 <<
" guardInterval=" << guardInterval
190 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, guardInterval, 1)
191 <<
" preamble=" << preamble
192 <<
" known=" << knownDuration
193 <<
" calculated=" << calculatedDuration
442 :
TestSuite (
"devices-wifi-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 const uint16_t CHANNEL_36_MHZ
static TxDurationTestSuite g_txDurationTestSuite
the test suite
static const uint16_t CHANNEL_1_MHZ
#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.
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...