22 #include <ns3/object.h>
26 #include "ns3/interference-helper.h"
27 #include "ns3/yans-wifi-phy.h"
41 virtual void DoRun (
void);
57 bool CheckPayloadDuration (uint32_t size,
WifiMode payloadMode, uint32_t channelWidth,
bool isShortGuardInterval,
WifiPreamble preamble, uint32_t knownDurationMicroSeconds);
72 bool CheckTxDuration (uint32_t size,
WifiMode payloadMode, uint32_t channelWidth,
bool isShortGuardInterval,
WifiPreamble preamble,
double knownDurationMicroSeconds);
104 if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
106 std::cerr <<
" size=" << size
107 <<
" mode=" << payloadMode
108 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, isShortGuardInterval, 1)
109 <<
" known=" << knownDurationMicroSeconds
110 <<
" calculated=" << calculatedDurationMicroSeconds
119 if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
121 std::cerr <<
" size=" << size
122 <<
" mode=" << payloadMode
123 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, isShortGuardInterval, 1)
124 <<
" known=" << knownDurationMicroSeconds
125 <<
" calculated=" << calculatedDurationMicroSeconds
137 txVector.
SetMode (payloadMode);
152 if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
154 std::cerr <<
" size=" << size
155 <<
" mode=" << payloadMode
156 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, isShortGuardInterval, 1)
157 <<
" preamble=" << preamble
158 <<
" known=" << knownDurationMicroSeconds
159 <<
" calculated=" << calculatedDurationMicroSeconds
168 if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
170 std::cerr <<
" size=" << size
171 <<
" mode=" << payloadMode
172 <<
" datarate=" << payloadMode.
GetDataRate (channelWidth, isShortGuardInterval, 1)
173 <<
" preamble=" << preamble
174 <<
" known=" << knownDurationMicroSeconds
175 <<
" calculated=" << calculatedDurationMicroSeconds
343 :
TestSuite (
"devices-wifi-tx-duration", UNIT)
void SetShortGuardInterval(bool guardinterval)
Sets if short gurad interval is being used.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static TxDurationTestSuite g_txDurationTestSuite
bool CheckPayloadDuration(uint32_t size, WifiMode payloadMode, uint32_t channelWidth, bool isShortGuardInterval, WifiPreamble preamble, uint32_t knownDurationMicroSeconds)
Check if the payload tx duration returned by InterferenceHelper corresponds to a known value of the p...
Time GetPayloadDuration(uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag)
enum WifiModulationClass GetModulationClass() const
#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.
void SetChannelWidth(uint32_t channelWidth)
Sets the selected channelWidth (in MHz)
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
virtual ~TxDurationTest()
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
bool CheckTxDuration(uint32_t size, WifiMode payloadMode, uint32_t channelWidth, bool isShortGuardInterval, WifiPreamble preamble, double knownDurationMicroSeconds)
Check if the overall tx duration returned by InterferenceHelper corresponds to a known value of the p...
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
static const double CHANNEL_1_MHZ
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag)
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static const double CHANNEL_36_MHZ
void SetNess(uint8_t ness)
Sets the Ness number refer to IEEE 802.11n Table 20-6 for explanation.