A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tx-duration-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Nicola Baldo <nbaldo@cttc.es>
19  * Sébastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #include <ns3/object.h>
23 #include <ns3/log.h>
24 #include <ns3/test.h>
25 #include <iostream>
26 #include "ns3/interference-helper.h"
27 #include "ns3/yans-wifi-phy.h"
28 
29 using namespace ns3;
30 
31 NS_LOG_COMPONENT_DEFINE ("InterferenceHelperTxDurationTest");
32 
33 static const double CHANNEL_1_MHZ = 2412.0; // a 2.4 GHz center frequency (MHz)
34 static const double CHANNEL_36_MHZ = 5180.0; // a 5 GHz center frequency (MHz)
35 
36 class TxDurationTest : public TestCase
37 {
38 public:
39  TxDurationTest ();
40  virtual ~TxDurationTest ();
41  virtual void DoRun (void);
42 
43 
44 private:
57  bool CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, bool isShortGuardInterval, WifiPreamble preamble, uint32_t knownDurationMicroSeconds);
58 
72  bool CheckTxDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, bool isShortGuardInterval, WifiPreamble preamble, double knownDurationMicroSeconds);
73 
74 };
75 
77  : TestCase ("Wifi TX Duration")
78 {
79 }
80 
82 {
83 }
84 
85 bool
86 TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, bool isShortGuardInterval, WifiPreamble preamble, uint32_t knownDurationMicroSeconds)
87 {
88  WifiTxVector txVector;
89  txVector.SetMode (payloadMode);
90  txVector.SetChannelWidth (channelWidth);
91  txVector.SetShortGuardInterval (isShortGuardInterval);
92  txVector.SetNss (1);
93  txVector.SetStbc (0);
94  txVector.SetNess (0);
95  double testedFrequency = CHANNEL_1_MHZ;
96  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
97  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
98  || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT
99  || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
100  {
101  testedFrequency = CHANNEL_36_MHZ;
102  }
103  double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds ();
104  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
105  {
106  std::cerr << " size=" << size
107  << " mode=" << payloadMode
108  << " datarate=" << payloadMode.GetDataRate (channelWidth, isShortGuardInterval, 1)
109  << " known=" << knownDurationMicroSeconds
110  << " calculated=" << calculatedDurationMicroSeconds
111  << std::endl;
112  return false;
113  }
114  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
115  {
116  //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
117  testedFrequency = CHANNEL_1_MHZ;
118  calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds ();
119  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
120  {
121  std::cerr << " size=" << size
122  << " mode=" << payloadMode
123  << " datarate=" << payloadMode.GetDataRate (channelWidth, isShortGuardInterval, 1)
124  << " known=" << knownDurationMicroSeconds
125  << " calculated=" << calculatedDurationMicroSeconds
126  << std::endl;
127  return false;
128  }
129  }
130  return true;
131 }
132 
133 bool
134 TxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, bool isShortGuardInterval, WifiPreamble preamble, double knownDurationMicroSeconds)
135 {
136  WifiTxVector txVector;
137  txVector.SetMode (payloadMode);
138  txVector.SetChannelWidth (channelWidth);
139  txVector.SetShortGuardInterval (isShortGuardInterval);
140  txVector.SetNss (1);
141  txVector.SetStbc (0);
142  txVector.SetNess (0);
143  double testedFrequency = CHANNEL_1_MHZ;
144  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
145  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
146  || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT
147  || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
148  {
149  testedFrequency = CHANNEL_36_MHZ;
150  }
151  double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000;
152  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
153  {
154  std::cerr << " size=" << size
155  << " mode=" << payloadMode
156  << " datarate=" << payloadMode.GetDataRate (channelWidth, isShortGuardInterval, 1)
157  << " preamble=" << preamble
158  << " known=" << knownDurationMicroSeconds
159  << " calculated=" << calculatedDurationMicroSeconds
160  << std::endl;
161  return false;
162  }
163  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
164  {
165  //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
166  testedFrequency = CHANNEL_1_MHZ;
167  calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000;
168  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
169  {
170  std::cerr << " size=" << size
171  << " mode=" << payloadMode
172  << " datarate=" << payloadMode.GetDataRate (channelWidth, isShortGuardInterval, 1)
173  << " preamble=" << preamble
174  << " known=" << knownDurationMicroSeconds
175  << " calculated=" << calculatedDurationMicroSeconds
176  << std::endl;
177  return false;
178  }
179  }
180  return true;
181 }
182 
183 void
185 {
186  bool retval = true;
187 
188  //IEEE Std 802.11-2007 Table 18-2 "Example of LENGTH calculations for CCK"
189  retval = retval
190  && CheckPayloadDuration (1023, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 744)
191  && CheckPayloadDuration (1024, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 745)
192  && CheckPayloadDuration (1025, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 746)
193  && CheckPayloadDuration (1026, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 747);
194 
195  NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11b CCK duration failed");
196 
197  //Similar, but we add PLCP preamble and header durations
198  //and we test different rates.
199  //The payload durations for modes other than 11mbb have been
200  //calculated by hand according to IEEE Std 802.11-2007 18.2.3.5
201  retval = retval
202  && CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 744 + 96)
203  && CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 745 + 96)
204  && CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 746 + 96)
205  && CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 747 + 96)
206  && CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 744 + 192)
207  && CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 745 + 192)
208  && CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 746 + 192)
209  && CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 747 + 192)
210  && CheckTxDuration (1023, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 1488 + 96)
211  && CheckTxDuration (1024, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 1490 + 96)
212  && CheckTxDuration (1025, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 1491 + 96)
213  && CheckTxDuration (1026, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 1493 + 96)
214  && CheckTxDuration (1023, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_LONG, 1488 + 192)
215  && CheckTxDuration (1024, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_LONG, 1490 + 192)
216  && CheckTxDuration (1025, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_LONG, 1491 + 192)
217  && CheckTxDuration (1026, WifiPhy::GetDsssRate5_5Mbps (), 22, false, WIFI_PREAMBLE_LONG, 1493 + 192)
218  && CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 4092 + 96)
219  && CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 4096 + 96)
220  && CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 4100 + 96)
221  && CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 4104 + 96)
222  && CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_LONG, 4092 + 192)
223  && CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_LONG, 4096 + 192)
224  && CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_LONG, 4100 + 192)
225  && CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), 22, false, WIFI_PREAMBLE_LONG, 4104 + 192)
226  && CheckTxDuration (1023, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 8184 + 192)
227  && CheckTxDuration (1024, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 8192 + 192)
228  && CheckTxDuration (1025, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 8200 + 192)
229  && CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_SHORT, 8208 + 192)
230  && CheckTxDuration (1023, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_LONG, 8184 + 192)
231  && CheckTxDuration (1024, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_LONG, 8192 + 192)
232  && CheckTxDuration (1025, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_LONG, 8200 + 192)
233  && CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_LONG, 8208 + 192);
234 
235 
236  //values from http://mailman.isi.edu/pipermail/ns-developers/2009-July/006226.html
237  retval = retval && CheckTxDuration (14, WifiPhy::GetDsssRate1Mbps (), 22, false, WIFI_PREAMBLE_LONG, 304);
238 
239  //values from http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html
240  retval = retval
241  && CheckTxDuration (1536, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 1310)
242  && CheckTxDuration (76, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 248)
243  && CheckTxDuration (14, WifiPhy::GetDsssRate11Mbps (), 22, false, WIFI_PREAMBLE_LONG, 203);
244 
245  NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11b duration failed");
246 
247  //802.11a durations
248  //values from http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html
249  retval = retval
250  && CheckTxDuration (1536, WifiPhy::GetOfdmRate54Mbps (), 20, false, WIFI_PREAMBLE_LONG, 248)
251  && CheckTxDuration (76, WifiPhy::GetOfdmRate54Mbps (), 20, false, WIFI_PREAMBLE_LONG, 32)
252  && CheckTxDuration (14, WifiPhy::GetOfdmRate54Mbps (), 20, false, WIFI_PREAMBLE_LONG, 24);
253 
254  NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11a duration failed");
255 
256  //802.11g durations are same as 802.11a durations but with 6 us signal extension
257  retval = retval
258  && CheckTxDuration (1536, WifiPhy::GetErpOfdmRate54Mbps (), 20, false, WIFI_PREAMBLE_LONG, 254)
259  && CheckTxDuration (76, WifiPhy::GetErpOfdmRate54Mbps (), 20, false, WIFI_PREAMBLE_LONG, 38)
260  && CheckTxDuration (14, WifiPhy::GetErpOfdmRate54Mbps (), 20, false, WIFI_PREAMBLE_LONG, 30);
261 
262  NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11g duration failed");
263 
264  //802.11n durations
265  retval = retval
266  && CheckTxDuration (1536, WifiPhy::GetHtMcs7 (), 20, false, WIFI_PREAMBLE_HT_MF, 228)
267  && CheckTxDuration (76, WifiPhy::GetHtMcs7 (), 20, false, WIFI_PREAMBLE_HT_MF, 48)
268  && CheckTxDuration (14, WifiPhy::GetHtMcs7 (), 20, false, WIFI_PREAMBLE_HT_MF, 40)
269  && CheckTxDuration (1536, WifiPhy::GetHtMcs7 (), 20, false, WIFI_PREAMBLE_HT_GF, 220)
270  && CheckTxDuration (76, WifiPhy::GetHtMcs7 (), 20, false, WIFI_PREAMBLE_HT_GF, 40)
271  && CheckTxDuration (14, WifiPhy::GetHtMcs7 (), 20, false, WIFI_PREAMBLE_HT_GF, 32)
272  && CheckTxDuration (1536, WifiPhy::GetHtMcs0 (), 20, true, WIFI_PREAMBLE_HT_MF, 1742.4)
273  && CheckTxDuration (76, WifiPhy::GetHtMcs0 (), 20, true, WIFI_PREAMBLE_HT_MF, 126)
274  && CheckTxDuration (14, WifiPhy::GetHtMcs0 (), 20, true, WIFI_PREAMBLE_HT_MF, 57.6)
275  && CheckTxDuration (1536,WifiPhy::GetHtMcs0 (), 20, true, WIFI_PREAMBLE_HT_GF, 1734.4)
276  && CheckTxDuration (76, WifiPhy::GetHtMcs0 (), 20, true, WIFI_PREAMBLE_HT_GF, 118)
277  && CheckTxDuration (14, WifiPhy::GetHtMcs0 (), 20, true, WIFI_PREAMBLE_HT_GF, 49.6)
278  && CheckTxDuration (1536, WifiPhy::GetHtMcs6 (), 20, true, WIFI_PREAMBLE_HT_MF, 226.8)
279  && CheckTxDuration (76, WifiPhy::GetHtMcs6 (), 20, true, WIFI_PREAMBLE_HT_MF, 46.8)
280  && CheckTxDuration (14, WifiPhy::GetHtMcs6 (), 20, true, WIFI_PREAMBLE_HT_MF, 39.6)
281  && CheckTxDuration (1536, WifiPhy::GetHtMcs6 (), 20, true, WIFI_PREAMBLE_HT_GF, 218.8)
282  && CheckTxDuration (76, WifiPhy::GetHtMcs6 (), 20, true, WIFI_PREAMBLE_HT_GF, 38.8)
283  && CheckTxDuration (14, WifiPhy::GetHtMcs6 (), 20, true, WIFI_PREAMBLE_HT_GF, 31.6)
284  && CheckTxDuration (1536, WifiPhy::GetHtMcs7 (), 40, false, WIFI_PREAMBLE_HT_MF, 128)
285  && CheckTxDuration (76, WifiPhy::GetHtMcs7 (), 40, false, WIFI_PREAMBLE_HT_MF, 44)
286  && CheckTxDuration (14, WifiPhy::GetHtMcs7 (), 40, false, WIFI_PREAMBLE_HT_MF, 40)
287  && CheckTxDuration (1536, WifiPhy::GetHtMcs7 (), 40, false, WIFI_PREAMBLE_HT_GF, 120)
288  && CheckTxDuration (76, WifiPhy::GetHtMcs7 (), 40, false, WIFI_PREAMBLE_HT_GF, 36)
289  && CheckTxDuration (14, WifiPhy::GetHtMcs7 (), 40, false, WIFI_PREAMBLE_HT_GF, 32)
290  && CheckTxDuration (1536, WifiPhy::GetHtMcs7 (), 40, true, WIFI_PREAMBLE_HT_MF, 118.8)
291  && CheckTxDuration (76, WifiPhy::GetHtMcs7 (), 40, true, WIFI_PREAMBLE_HT_MF, 43.2)
292  && CheckTxDuration (14, WifiPhy::GetHtMcs7 (), 40, true, WIFI_PREAMBLE_HT_MF, 39.6)
293  && CheckTxDuration (1536, WifiPhy::GetHtMcs7 (), 40, true, WIFI_PREAMBLE_HT_GF, 110.8)
294  && CheckTxDuration (76, WifiPhy::GetHtMcs7 (), 40, true, WIFI_PREAMBLE_HT_GF, 35.2)
295  && CheckTxDuration (14, WifiPhy::GetHtMcs7 (), 40, true, WIFI_PREAMBLE_HT_GF, 31.6);
296 
297  NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11n duration failed");
298 
299  //802.11ac durations
300  retval = retval
301  && CheckTxDuration (1536, WifiPhy::GetVhtMcs8 (), 20, false, WIFI_PREAMBLE_VHT, 200)
302  && CheckTxDuration (76, WifiPhy::GetVhtMcs8 (), 20, false, WIFI_PREAMBLE_VHT, 52)
303  && CheckTxDuration (14, WifiPhy::GetVhtMcs8 (), 20, false, WIFI_PREAMBLE_VHT, 44)
304  && CheckTxDuration (1536, WifiPhy::GetVhtMcs8 (), 20, true, WIFI_PREAMBLE_VHT, 184)
305  && CheckTxDuration (76, WifiPhy::GetVhtMcs8 (), 20, true, WIFI_PREAMBLE_VHT, 50.8)
306  && CheckTxDuration (14, WifiPhy::GetVhtMcs8 (), 20, true, WIFI_PREAMBLE_VHT, 43.6)
307  && CheckTxDuration (1536, WifiPhy::GetVhtMcs9 (), 40, false, WIFI_PREAMBLE_VHT, 112)
308  && CheckTxDuration (76, WifiPhy::GetVhtMcs9 (), 40, false, WIFI_PREAMBLE_VHT, 44)
309  && CheckTxDuration (14, WifiPhy::GetVhtMcs9 (), 40, false, WIFI_PREAMBLE_VHT, 44)
310  && CheckTxDuration (1536, WifiPhy::GetVhtMcs9 (), 40, true, WIFI_PREAMBLE_VHT, 104.8)
311  && CheckTxDuration (76, WifiPhy::GetVhtMcs9 (), 40, true, WIFI_PREAMBLE_VHT, 43.6)
312  && CheckTxDuration (14, WifiPhy::GetVhtMcs9 (), 40, true, WIFI_PREAMBLE_VHT, 43.6)
313  && CheckTxDuration (1536, WifiPhy::GetVhtMcs0 (), 80, false, WIFI_PREAMBLE_VHT, 464)
314  && CheckTxDuration (76, WifiPhy::GetVhtMcs0 (), 80, false, WIFI_PREAMBLE_VHT, 64)
315  && CheckTxDuration (14, WifiPhy::GetVhtMcs0 (), 80, false, WIFI_PREAMBLE_VHT, 48)
316  && CheckTxDuration (1536, WifiPhy::GetVhtMcs0 (), 80, true, WIFI_PREAMBLE_VHT, 421.6)
317  && CheckTxDuration (76, WifiPhy::GetVhtMcs0 (), 80, true, WIFI_PREAMBLE_VHT, 61.6)
318  && CheckTxDuration (14, WifiPhy::GetVhtMcs0 (), 80, true, WIFI_PREAMBLE_VHT, 47.2)
319  && CheckTxDuration (1536, WifiPhy::GetVhtMcs9 (), 80, false, WIFI_PREAMBLE_VHT, 72)
320  && CheckTxDuration (76, WifiPhy::GetVhtMcs9 (), 80, false, WIFI_PREAMBLE_VHT, 44)
321  && CheckTxDuration (14, WifiPhy::GetVhtMcs9 (), 80, false, WIFI_PREAMBLE_VHT, 44)
322  && CheckTxDuration (1536, WifiPhy::GetVhtMcs9 (), 80, true, WIFI_PREAMBLE_VHT, 68.8)
323  && CheckTxDuration (76, WifiPhy::GetVhtMcs9 (), 80, true, WIFI_PREAMBLE_VHT, 43.6)
324  && CheckTxDuration (14, WifiPhy::GetVhtMcs9 (), 80, true, WIFI_PREAMBLE_VHT, 43.6)
325  && CheckTxDuration (1536, WifiPhy::GetVhtMcs8 (), 160, false, WIFI_PREAMBLE_VHT, 60)
326  && CheckTxDuration (76, WifiPhy::GetVhtMcs8 (), 160, false, WIFI_PREAMBLE_VHT, 44)
327  && CheckTxDuration (14, WifiPhy::GetVhtMcs8 (), 160, false, WIFI_PREAMBLE_VHT, 44)
328  && CheckTxDuration (1536, WifiPhy::GetVhtMcs8 (), 160, true, WIFI_PREAMBLE_VHT, 58)
329  && CheckTxDuration (76, WifiPhy::GetVhtMcs8 (), 160, true, WIFI_PREAMBLE_VHT, 43.6)
330  && CheckTxDuration (14, WifiPhy::GetVhtMcs8 (), 160, true, WIFI_PREAMBLE_VHT, 43.6);
331 
332  NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11ac duration failed");
333 }
334 
335 
337 {
338 public:
340 };
341 
343  : TestSuite ("devices-wifi-tx-duration", UNIT)
344 {
345  AddTestCase (new TxDurationTest, TestCase::QUICK);
346 }
347 
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
A suite of tests to run.
Definition: test.h:1333
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...
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:384
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
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.
Definition: test.h:278
VHT PHY (Clause 22)
Definition: wifi-mode.h:64
encapsulates test code
Definition: test.h:1147
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
virtual void DoRun(void)
Implementation to actually run this TestCase.
Time GetPayloadDuration(uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
Definition: wifi-phy.cc:398
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.
Definition: wifi-preamble.h:30
virtual ~TxDurationTest()
tuple phy
Definition: third.py:86
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:349
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Definition: test.cc:297
HT PHY (Clause 20)
Definition: wifi-mode.h:62
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency)
Definition: wifi-phy.cc:717
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
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:109
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.
Definition: nstime.h:353
OFDM PHY (Clause 17)
Definition: wifi-mode.h:60
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.