A Discrete-Event Network Simulator
API
wifi-ppdu.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 Orange Labs
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  * Author: Rediet <getachew.redieteab@orange.com>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/packet.h"
23 #include "wifi-ppdu.h"
24 #include "wifi-psdu.h"
25 #include "wifi-phy.h"
26 #include "wifi-utils.h"
27 
28 namespace ns3 {
29 
30 NS_LOG_COMPONENT_DEFINE ("WifiPpdu");
31 
32 WifiPpdu::WifiPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration, uint16_t frequency)
33  : m_preamble (txVector.GetPreambleType ()),
34  m_modulation (txVector.IsValid () ? txVector.GetMode ().GetModulationClass () : WIFI_MOD_CLASS_UNKNOWN),
35  m_psdu (psdu),
36  m_truncatedTx (false),
37  m_frequency (frequency),
38  m_channelWidth (txVector.GetChannelWidth ()),
39  m_txPowerLevel (txVector.GetTxPowerLevel ())
40 {
41  if (!txVector.IsValid ())
42  {
43  return;
44  }
45  NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << frequency);
46  switch (m_modulation)
47  {
50  {
51  m_dsssSig.SetRate (txVector.GetMode ().GetDataRate (22));
52  Time psduDuration = ppduDuration - WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector);
53  m_dsssSig.SetLength (psduDuration.GetMicroSeconds ());
54  break;
55  }
58  {
59  m_lSig.SetRate (txVector.GetMode ().GetDataRate (txVector), m_channelWidth);
60  m_lSig.SetLength (psdu->GetSize ());
61  break;
62  }
63  case WIFI_MOD_CLASS_HT:
64  {
65  uint8_t sigExtension = 0;
66  if (Is2_4Ghz (frequency))
67  {
68  sigExtension = 6;
69  }
70  uint16_t length = ((ceil ((static_cast<double> (ppduDuration.GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3);
71  m_lSig.SetLength (length);
72  m_htSig.SetMcs (txVector.GetMode ().GetMcsValue ());
74  m_htSig.SetHtLength (psdu->GetSize ());
75  m_htSig.SetAggregation (txVector.IsAggregation ());
76  m_htSig.SetShortGuardInterval (txVector.GetGuardInterval () == 400);
77  break;
78  }
79  case WIFI_MOD_CLASS_VHT:
80  {
81  uint16_t length = ((ceil ((static_cast<double> (ppduDuration.GetNanoSeconds () - (20 * 1000)) / 1000) / 4.0) * 3) - 3);
82  m_lSig.SetLength (length);
85  m_vhtSig.SetShortGuardInterval (txVector.GetGuardInterval () == 400);
86  uint32_t nSymbols = (static_cast<double> ((ppduDuration - WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector)).GetNanoSeconds ()) / (3200 + txVector.GetGuardInterval ()));
87  if (txVector.GetGuardInterval () == 400)
88  {
89  m_vhtSig.SetShortGuardIntervalDisambiguation ((nSymbols % 10) == 9);
90  }
91  m_vhtSig.SetSuMcs (txVector.GetMode ().GetMcsValue ());
92  m_vhtSig.SetNStreams (txVector.GetNss ());
93  break;
94  }
95  case WIFI_MOD_CLASS_HE:
96  {
97  uint8_t sigExtension = 0;
98  if (Is2_4Ghz (frequency))
99  {
100  sigExtension = 6;
101  }
102  uint8_t m = 0;
104  {
105  m = 2;
106  }
107  else if (m_preamble == WIFI_PREAMBLE_HE_MU)
108  {
109  m = 1;
110  }
111  uint16_t length = ((ceil ((static_cast<double> (ppduDuration.GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3 - m);
112  m_lSig.SetLength (length);
114  m_heSig.SetMcs (txVector.GetMode ().GetMcsValue ());
115  m_heSig.SetBssColor (txVector.GetBssColor ());
117  m_heSig.SetGuardIntervalAndLtfSize (txVector.GetGuardInterval (), 2/*NLTF currently unused*/);
118  m_heSig.SetNStreams (txVector.GetNss ());
119  break;
120  }
121  default:
122  NS_FATAL_ERROR ("unsupported modulation class");
123  break;
124  }
125 }
126 
128 {
129 }
130 
133 {
134  WifiTxVector txVector;
135  txVector.SetPreambleType (m_preamble);
136  switch (m_modulation)
137  {
138  case WIFI_MOD_CLASS_DSSS:
140  {
141  WifiMode mode;
142  switch (m_dsssSig.GetRate ())
143  {
144  case 1000000:
145  mode = WifiPhy::GetDsssRate1Mbps ();
146  break;
147  case 2000000:
148  mode = WifiPhy::GetDsssRate2Mbps ();
149  break;
150  case 5500000:
151  mode = WifiPhy::GetDsssRate5_5Mbps ();
152  break;
153  case 11000000:
154  mode = WifiPhy::GetDsssRate11Mbps ();
155  break;
156  default:
157  NS_ASSERT_MSG (false, "Invalid rate encoded in DSSS SIG header");
158  break;
159  }
160  txVector.SetMode (mode);
161  txVector.SetChannelWidth (22);
162  break;
163  }
164  case WIFI_MOD_CLASS_OFDM:
165  {
166  WifiMode mode;
167  switch (m_lSig.GetRate (m_channelWidth))
168  {
169  case 1500000:
171  break;
172  case 2250000:
174  break;
175  case 3000000:
177  break;
178  case 4500000:
180  break;
181  case 6000000:
182  if (m_channelWidth == 5)
183  {
185  }
186  else if (m_channelWidth == 10)
187  {
189  }
190  else
191  {
192  mode = WifiPhy::GetOfdmRate6Mbps ();
193  }
194  break;
195  case 9000000:
196  if (m_channelWidth == 5)
197  {
199  }
200  else if (m_channelWidth == 10)
201  {
203  }
204  else
205  {
206  mode = WifiPhy::GetOfdmRate9Mbps ();
207  }
208  break;
209  case 12000000:
210  if (m_channelWidth == 5)
211  {
213  }
214  else if (m_channelWidth == 10)
215  {
217  }
218  else
219  {
220  mode = WifiPhy::GetOfdmRate12Mbps ();
221  }
222  break;
223  case 13500000:
225  break;
226  case 18000000:
228  break;
229  case 24000000:
231  break;
232  case 27000000:
234  break;
235  case 36000000:
236  mode = WifiPhy::GetOfdmRate36Mbps ();
237  break;
238  case 48000000:
239  mode = WifiPhy::GetOfdmRate48Mbps ();
240  break;
241  case 54000000:
242  mode = WifiPhy::GetOfdmRate54Mbps ();
243  break;
244  default:
245  NS_ASSERT_MSG (false, "Invalid rate encoded in L-SIG header");
246  break;
247  }
248  txVector.SetMode (mode);
249  //OFDM uses 20 MHz, unless PHY channel width is 5 MHz or 10 MHz
250  txVector.SetChannelWidth (m_channelWidth < 20 ? m_channelWidth : 20);
251  break;
252  }
254  {
255  WifiMode mode;
256  switch (m_lSig.GetRate ())
257  {
258  case 6000000:
260  break;
261  case 9000000:
263  break;
264  case 12000000:
266  break;
267  case 18000000:
269  break;
270  case 24000000:
272  break;
273  case 36000000:
275  break;
276  case 48000000:
278  break;
279  case 54000000:
281  break;
282  default:
283  NS_ASSERT_MSG (false, "Invalid rate encoded in L-SIG header");
284  break;
285  }
286  txVector.SetMode (mode);
287  //ERP-OFDM uses 20 MHz, unless PHY channel width is 5 MHz or 10 MHz
288  txVector.SetChannelWidth (m_channelWidth < 20 ? m_channelWidth : 20);
289  break;
290  }
291  case WIFI_MOD_CLASS_HT:
292  {
293  WifiMode mode;
294  switch (m_htSig.GetMcs ())
295  {
296  case 0:
297  mode = WifiPhy::GetHtMcs0 ();
298  break;
299  case 1:
300  mode = WifiPhy::GetHtMcs1 ();
301  break;
302  case 2:
303  mode = WifiPhy::GetHtMcs2 ();
304  break;
305  case 3:
306  mode = WifiPhy::GetHtMcs3 ();
307  break;
308  case 4:
309  mode = WifiPhy::GetHtMcs4 ();
310  break;
311  case 5:
312  mode = WifiPhy::GetHtMcs5 ();
313  break;
314  case 6:
315  mode = WifiPhy::GetHtMcs6 ();
316  break;
317  case 7:
318  mode = WifiPhy::GetHtMcs7 ();
319  break;
320  case 8:
321  mode = WifiPhy::GetHtMcs8 ();
322  break;
323  case 9:
324  mode = WifiPhy::GetHtMcs9 ();
325  break;
326  case 10:
327  mode = WifiPhy::GetHtMcs10 ();
328  break;
329  case 11:
330  mode = WifiPhy::GetHtMcs11 ();
331  break;
332  case 12:
333  mode = WifiPhy::GetHtMcs12 ();
334  break;
335  case 13:
336  mode = WifiPhy::GetHtMcs13 ();
337  break;
338  case 14:
339  mode = WifiPhy::GetHtMcs14 ();
340  break;
341  case 15:
342  mode = WifiPhy::GetHtMcs15 ();
343  break;
344  case 16:
345  mode = WifiPhy::GetHtMcs16 ();
346  break;
347  case 17:
348  mode = WifiPhy::GetHtMcs17 ();
349  break;
350  case 18:
351  mode = WifiPhy::GetHtMcs18 ();
352  break;
353  case 19:
354  mode = WifiPhy::GetHtMcs19 ();
355  break;
356  case 20:
357  mode = WifiPhy::GetHtMcs20 ();
358  break;
359  case 21:
360  mode = WifiPhy::GetHtMcs21 ();
361  break;
362  case 22:
363  mode = WifiPhy::GetHtMcs22 ();
364  break;
365  case 23:
366  mode = WifiPhy::GetHtMcs23 ();
367  break;
368  case 24:
369  mode = WifiPhy::GetHtMcs24 ();
370  break;
371  case 25:
372  mode = WifiPhy::GetHtMcs25 ();
373  break;
374  case 26:
375  mode = WifiPhy::GetHtMcs26 ();
376  break;
377  case 27:
378  mode = WifiPhy::GetHtMcs27 ();
379  break;
380  case 28:
381  mode = WifiPhy::GetHtMcs28 ();
382  break;
383  case 29:
384  mode = WifiPhy::GetHtMcs29 ();
385  break;
386  case 30:
387  mode = WifiPhy::GetHtMcs30 ();
388  break;
389  case 31:
390  mode = WifiPhy::GetHtMcs31 ();
391  break;
392  default:
393  NS_ASSERT_MSG (false, "Invalid MCS encoded in HT-SIG header");
394  break;
395  }
396  txVector.SetMode (mode);
398  txVector.SetNss (1 + (m_htSig.GetMcs () / 8));
399  txVector.SetGuardInterval(m_htSig.GetShortGuardInterval () ? 400 : 800);
400  txVector.SetAggregation (m_htSig.GetAggregation ());
401  break;
402  }
403  case WIFI_MOD_CLASS_VHT:
404  {
405  WifiMode mode;
406  switch (m_vhtSig.GetSuMcs ())
407  {
408  case 0:
409  mode = WifiPhy::GetVhtMcs0 ();
410  break;
411  case 1:
412  mode = WifiPhy::GetVhtMcs1 ();
413  break;
414  case 2:
415  mode = WifiPhy::GetVhtMcs2 ();
416  break;
417  case 3:
418  mode = WifiPhy::GetVhtMcs3 ();
419  break;
420  case 4:
421  mode = WifiPhy::GetVhtMcs4 ();
422  break;
423  case 5:
424  mode = WifiPhy::GetVhtMcs5 ();
425  break;
426  case 6:
427  mode = WifiPhy::GetVhtMcs6 ();
428  break;
429  case 7:
430  mode = WifiPhy::GetVhtMcs7 ();
431  break;
432  case 8:
433  mode = WifiPhy::GetVhtMcs8 ();
434  break;
435  case 9:
436  mode = WifiPhy::GetVhtMcs9 ();
437  break;
438  default:
439  NS_ASSERT_MSG (false, "Invalid MCS encoded in VHT-SIG header");
440  break;
441  }
442  txVector.SetMode (mode);
444  txVector.SetNss (m_vhtSig.GetNStreams ());
445  txVector.SetGuardInterval (m_vhtSig.GetShortGuardInterval () ? 400 : 800);
446  txVector.SetAggregation (m_psdu->IsAggregate ());
447  break;
448  }
449  case WIFI_MOD_CLASS_HE:
450  {
451  WifiMode mode;
452  switch (m_heSig.GetMcs ())
453  {
454  case 0:
455  mode = WifiPhy::GetHeMcs0 ();
456  break;
457  case 1:
458  mode = WifiPhy::GetHeMcs1 ();
459  break;
460  case 2:
461  mode = WifiPhy::GetHeMcs2 ();
462  break;
463  case 3:
464  mode = WifiPhy::GetHeMcs3 ();
465  break;
466  case 4:
467  mode = WifiPhy::GetHeMcs4 ();
468  break;
469  case 5:
470  mode = WifiPhy::GetHeMcs5 ();
471  break;
472  case 6:
473  mode = WifiPhy::GetHeMcs6 ();
474  break;
475  case 7:
476  mode = WifiPhy::GetHeMcs7 ();
477  break;
478  case 8:
479  mode = WifiPhy::GetHeMcs8 ();
480  break;
481  case 9:
482  mode = WifiPhy::GetHeMcs9 ();
483  break;
484  case 10:
485  mode = WifiPhy::GetHeMcs10 ();
486  break;
487  case 11:
488  mode = WifiPhy::GetHeMcs11 ();
489  break;
490  default:
491  NS_ASSERT_MSG (false, "Invalid MCS encoded in HE-SIG header");
492  break;
493  }
494  txVector.SetMode (mode);
496  txVector.SetNss (m_heSig.GetNStreams ());
498  txVector.SetBssColor (m_heSig.GetBssColor ());
499  txVector.SetAggregation (m_psdu->IsAggregate ());
500  break;
501  }
502  default:
503  NS_FATAL_ERROR ("unsupported modulation class");
504  break;
505  }
506  txVector.SetTxPowerLevel (m_txPowerLevel);
507  return txVector;
508 }
509 
511 WifiPpdu::GetPsdu (void) const
512 {
513  return m_psdu;
514 }
515 
516 bool
518 {
519  return m_truncatedTx;
520 }
521 
522 void
524 {
525  NS_LOG_FUNCTION (this);
526  m_truncatedTx = true;
527 }
528 
529 Time
531 {
532  Time ppduDuration = Seconds (0);
533  WifiTxVector txVector = GetTxVector ();
534  switch (m_modulation)
535  {
536  case WIFI_MOD_CLASS_DSSS:
539  break;
540  case WIFI_MOD_CLASS_OFDM:
542  ppduDuration = WifiPhy::CalculateTxDuration (m_lSig.GetLength (), txVector, m_frequency);
543  break;
544  case WIFI_MOD_CLASS_HT:
545  ppduDuration = WifiPhy::CalculateTxDuration (m_htSig.GetHtLength (), txVector, m_frequency);
546  break;
547  case WIFI_MOD_CLASS_VHT:
548  {
549  Time tSymbol = NanoSeconds (3200 + txVector.GetGuardInterval ());
550  Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector);
551  Time calculatedDuration = MicroSeconds (((ceil (static_cast<double> (m_lSig.GetLength () + 3) / 3)) * 4) + 20);
552  uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds ()) / tSymbol.GetNanoSeconds ());
554  {
555  nSymbols--;
556  }
557  ppduDuration = preambleDuration + (nSymbols * tSymbol);
558  break;
559  }
560  case WIFI_MOD_CLASS_HE:
561  {
562  Time tSymbol = NanoSeconds (12800 + txVector.GetGuardInterval ());
563  Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector);
564  uint8_t sigExtension = 0;
565  if (Is2_4Ghz (m_frequency))
566  {
567  sigExtension = 6;
568  }
569  uint8_t m = 0;
571  {
572  m = 2;
573  }
574  else if (m_preamble == WIFI_PREAMBLE_HE_MU)
575  {
576  m = 1;
577  }
578  //Equation 27-11 of IEEE P802.11ax/D4.0
579  Time calculatedDuration = MicroSeconds (((ceil (static_cast<double> (m_lSig.GetLength () + 3 + m) / 3)) * 4) + 20 + sigExtension);
580  uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds () - (sigExtension * 1000)) / tSymbol.GetNanoSeconds ());
581  ppduDuration = preambleDuration + (nSymbols * tSymbol) + MicroSeconds (sigExtension);
582  break;
583  }
584  default:
585  NS_FATAL_ERROR ("unsupported modulation class");
586  break;
587  }
588  return ppduDuration;
589 }
590 
591 void
592 WifiPpdu::Print (std::ostream& os) const
593 {
594  os << "preamble=" << m_preamble
595  << ", modulation=" << m_modulation
596  << ", truncatedTx=" << (m_truncatedTx ? "Y" : "N")
597  << ", PSDU=" << m_psdu;
598 }
599 
600 std::ostream & operator << (std::ostream &os, const WifiPpdu &ppdu)
601 {
602  ppdu.Print (os);
603  return os;
604 }
605 
606 } //namespace ns3
static WifiMode GetVhtMcs6()
Return MCS 6 from VHT MCS values.
Definition: wifi-phy.cc:3807
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3461
uint16_t GetChannelWidth(void) const
Return the channel width (in MHz).
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24Mbps.
Definition: wifi-phy.cc:3152
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
Definition: wifi-phy.cc:3089
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
static WifiMode GetHeMcs7()
Return MCS 7 from HE MCS values.
Definition: wifi-phy.cc:3897
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36Mbps.
Definition: wifi-phy.cc:3164
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static WifiMode GetVhtMcs8()
Return MCS 8 from VHT MCS values.
Definition: wifi-phy.cc:3823
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:54
void SetMcs(uint8_t mcs)
Fill the MCS field of HT-SIG.
static WifiMode GetOfdmRate9Mbps()
Return a WifiMode for OFDM at 9Mbps.
Definition: wifi-phy.cc:3215
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3362
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static WifiMode GetOfdmRate27MbpsBW10MHz()
Return a WifiMode for OFDM at 27Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3386
WifiPpdu(Ptr< const WifiPsdu > psdu, WifiTxVector txVector, Time ppduDuration, uint16_t frequency)
Create a single user PPDU storing a PSDU.
Definition: wifi-ppdu.cc:32
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of VHT-SIG-A1 (in MHz).
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3425
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
Definition: wifi-phy.cc:3759
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
Definition: wifi-phy.cc:3050
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Ptr< const WifiPsdu > GetPsdu(void) const
Get the payload of the PPDU.
Definition: wifi-ppdu.cc:511
uint16_t GetChannelWidth(void) const
Return the channel width (in MHz).
void SetBssColor(uint8_t color)
Set the BSS color.
static WifiMode GetHeMcs5()
Return MCS 5 from HE MCS values.
Definition: wifi-phy.cc:3881
void SetMuFlag(bool mu)
Set the Multi-User (MU) flag.
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-OFDM at 18Mbps.
Definition: wifi-phy.cc:3140
static WifiMode GetHtMcs7()
Return MCS 7 from HT MCS values.
Definition: wifi-phy.cc:3556
void SetNStreams(uint8_t nStreams)
Fill the number of streams field of HE-SIG-A1.
void SetTruncatedTx(void)
Indicate that the PPDU&#39;s transmission was aborted due to transmitter switch off.
Definition: wifi-ppdu.cc:523
bool Is2_4Ghz(double frequency)
Definition: wifi-utils.cc:59
static WifiMode GetVhtMcs5()
Return MCS 5 from VHT MCS values.
Definition: wifi-phy.cc:3799
static WifiMode GetHtMcs22()
Return MCS 22 from HT MCS values.
Definition: wifi-phy.cc:3676
static WifiMode GetHtMcs14()
Return MCS 14 from HT MCS values.
Definition: wifi-phy.cc:3612
static WifiMode GetOfdmRate12Mbps()
Return a WifiMode for OFDM at 12Mbps.
Definition: wifi-phy.cc:3227
static WifiMode GetHtMcs31()
Return MCS 31 from HT MCS values.
Definition: wifi-phy.cc:3748
static WifiMode GetHtMcs21()
Return MCS 21 from HT MCS values.
Definition: wifi-phy.cc:3668
WifiTxVector GetTxVector(void) const
Get the TXVECTOR used to send the PPDU.
Definition: wifi-ppdu.cc:132
static WifiMode GetHtMcs30()
Return MCS 30 from HT MCS values.
Definition: wifi-phy.cc:3740
HeSigHeader m_heSig
the HE-SIG PHY header
Definition: wifi-ppdu.h:90
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
static WifiMode GetHtMcs10()
Return MCS 10 from HT MCS values.
Definition: wifi-phy.cc:3580
static WifiMode GetHtMcs26()
Return MCS 26 from HT MCS values.
Definition: wifi-phy.cc:3708
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3401
static WifiMode GetHtMcs17()
Return MCS 17 from HT MCS values.
Definition: wifi-phy.cc:3636
static WifiMode GetHtMcs24()
Return MCS 24 from HT MCS values.
Definition: wifi-phy.cc:3692
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3314
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for OFDM at 54Mbps.
Definition: wifi-phy.cc:3287
uint16_t GetChannelWidth(void) const
Return the channel width (in MHz).
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
static WifiMode GetHeMcs4()
Return MCS 4 from HE MCS values.
Definition: wifi-phy.cc:3873
void SetShortGuardIntervalDisambiguation(bool disambiguation)
Fill the short GI NSYM disambiguation field of VHT-SIG-A2.
uint16_t GetGuardInterval(void) const
void SetRate(uint64_t rate, uint16_t channelWidth=20)
Fill the RATE field of L-SIG (in bit/s).
VHT PHY (Clause 22)
Definition: wifi-mode.h:60
void SetBssColor(uint8_t bssColor)
Fill the BSS Color field of HE-SIG-A1.
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:48
void SetRate(uint64_t rate)
Fill the RATE field of L-SIG (in bit/s).
static WifiMode GetHtMcs8()
Return MCS 8 from HT MCS values.
Definition: wifi-phy.cc:3564
static WifiMode GetHtMcs18()
Return MCS 18 from HT MCS values.
Definition: wifi-phy.cc:3644
static WifiMode GetVhtMcs4()
Return MCS 4 from VHT MCS values.
Definition: wifi-phy.cc:3791
static WifiMode GetHtMcs27()
Return MCS 27 from HT MCS values.
Definition: wifi-phy.cc:3716
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for OFDM at 36Mbps.
Definition: wifi-phy.cc:3263
static WifiMode GetVhtMcs7()
Return MCS 7 from VHT MCS values.
Definition: wifi-phy.cc:3815
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3449
static WifiMode GetVhtMcs3()
Return MCS 3 from VHT MCS values.
Definition: wifi-phy.cc:3783
uint8_t GetMcs(void) const
Return the MCS field of HE-SIG-A1.
uint16_t GetLength(void) const
Return the LENGTH field of L-SIG (in bytes).
Modulation class unknown or unspecified.
Definition: wifi-mode.h:40
static WifiMode GetHtMcs16()
Return MCS 16 from HT MCS values.
Definition: wifi-phy.cc:3628
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54Mbps.
Definition: wifi-phy.cc:3188
static WifiMode GetHtMcs29()
Return MCS 29 from HT MCS values.
Definition: wifi-phy.cc:3732
static WifiMode GetHtMcs11()
Return MCS 11 from HT MCS values.
Definition: wifi-phy.cc:3588
static Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, uint16_t frequency)
Definition: wifi-phy.cc:2417
static WifiMode GetHtMcs2()
Return MCS 2 from HT MCS values.
Definition: wifi-phy.cc:3516
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
void SetMcs(uint8_t mcs)
Fill the MCS field of HE-SIG-A1.
void SetNStreams(uint8_t nStreams)
Fill the number of streams field of VHT-SIG-A1.
void SetSuMcs(uint8_t mcs)
Fill the SU VHT MCS field of VHT-SIG-A2.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1094
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
static WifiMode GetHeMcs3()
Return MCS 3 from HE MCS values.
Definition: wifi-phy.cc:3865
bool GetShortGuardInterval(void) const
Return the short guard interval field of HT-SIG.
static WifiMode GetHtMcs12()
Return MCS 12 from HT MCS values.
Definition: wifi-phy.cc:3596
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-OFDM at 48Mbps.
Definition: wifi-phy.cc:3176
void Print(std::ostream &os) const
Print the PPDU contents.
Definition: wifi-ppdu.cc:592
WifiPreamble m_preamble
the PHY preamble
Definition: wifi-ppdu.h:91
HtSigHeader m_htSig
the HT-SIG PHY header
Definition: wifi-ppdu.h:88
uint16_t GetLength(void) const
Return the LENGTH field of L-SIG (in bytes).
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3350
WifiMode GetMode(void) const
static WifiMode GetHeMcs11()
Return MCS 11 from HE MCS values.
Definition: wifi-phy.cc:3929
HT PHY (Clause 20)
Definition: wifi-mode.h:58
void SetMuFlag(bool mu)
Set the Multi-User (MU) flag.
uint8_t GetNStreams(void) const
Return the number of streams.
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for OFDM at 18Mbps.
Definition: wifi-phy.cc:3239
void SetLength(uint16_t length)
Fill the LENGTH field of L-SIG (in bytes).
static WifiMode GetOfdmRate9MbpsBW10MHz()
Return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3338
uint8_t GetNStreams(void) const
Return the number of streams.
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3473
void SetAggregation(bool aggregation)
Fill the aggregation field of HT-SIG.
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
Definition: wifi-phy.cc:3767
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
static WifiMode GetOfdmRate48Mbps()
Return a WifiMode for OFDM at 48Mbps.
Definition: wifi-phy.cc:3275
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
Definition: wifi-ppdu.h:39
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of HE-SIG-A1 (in MHz).
static WifiMode GetHeMcs9()
Return MCS 9 from HE MCS values.
Definition: wifi-phy.cc:3913
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:369
static WifiMode GetHtMcs0()
Return MCS 0 from HT MCS values.
Definition: wifi-phy.cc:3500
bool IsTruncatedTx(void) const
Return true if the PPDU&#39;s transmission was aborted due to transmitter switch off. ...
Definition: wifi-ppdu.cc:517
Every class exported by the ns3 library is enclosed in the ns3 namespace.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:373
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
bool GetAggregation(void) const
Return the aggregation field of HT-SIG.
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for OFDM at 24Mbps.
Definition: wifi-phy.cc:3251
static WifiMode GetHeMcs1()
Return MCS 1 from HE MCS values.
Definition: wifi-phy.cc:3849
static WifiMode GetHtMcs13()
Return MCS 13 from HT MCS values.
Definition: wifi-phy.cc:3604
uint8_t GetMcs(void) const
Return the MCS field of HT-SIG.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
Definition: wifi-phy.cc:3841
virtual ~WifiPpdu()
Definition: wifi-ppdu.cc:127
static WifiMode GetHeMcs10()
Return MCS 10 from HE MCS values.
Definition: wifi-phy.cc:3921
static WifiMode GetHtMcs20()
Return MCS 20 from HT MCS values.
Definition: wifi-phy.cc:3660
static WifiMode GetHeMcs2()
Return MCS 2 from HE MCS values.
Definition: wifi-phy.cc:3857
uint8_t m_txPowerLevel
the transmission power level (used only for TX and initializing the returned WifiTxVector) ...
Definition: wifi-ppdu.h:97
static WifiMode GetHtMcs5()
Return MCS 5 from HT MCS values.
Definition: wifi-phy.cc:3540
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of HT-SIG (in MHz).
uint64_t GetRate(void) const
Return the RATE field of L-SIG (in bit/s).
static WifiMode GetVhtMcs2()
Return MCS 2 from VHT MCS values.
Definition: wifi-phy.cc:3775
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
Definition: wifi-phy.cc:3077
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3413
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9Mbps.
Definition: wifi-phy.cc:3116
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
bool m_truncatedTx
flag indicating whether the frame&#39;s transmission was aborted due to transmitter switch off ...
Definition: wifi-ppdu.h:94
void SetHtLength(uint16_t length)
Fill the HT length field of HT-SIG (in bytes).
uint8_t GetSuMcs(void) const
Return the SU VHT MCS field of VHT-SIG-A2.
Ptr< const WifiPsdu > m_psdu
the PSDU contained in this PPDU
Definition: wifi-ppdu.h:93
bool GetShortGuardInterval(void) const
Return the short GI field of VHT-SIG-A2.
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6Mbps.
Definition: wifi-phy.cc:3104
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12Mbps.
Definition: wifi-phy.cc:3128
DsssSigHeader m_dsssSig
the DSSS SIG PHY header
Definition: wifi-ppdu.h:86
uint16_t GetHtLength(void) const
Return the HT length field of HT-SIG (in bytes).
static WifiMode GetHtMcs19()
Return MCS 19 from HT MCS values.
Definition: wifi-phy.cc:3652
void SetGuardIntervalAndLtfSize(uint16_t gi, uint8_t ltf)
Fill the GI + LTF size field of HE-SIG-A1.
uint8_t GetBssColor(void) const
Get the BSS color.
static WifiMode GetHtMcs6()
Return MCS 6 from HT MCS values.
Definition: wifi-phy.cc:3548
LSigHeader m_lSig
the L-SIG PHY header
Definition: wifi-ppdu.h:87
void SetLength(uint16_t length)
Fill the LENGTH field of L-SIG (in bytes).
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1070
OFDM PHY (Clause 17)
Definition: wifi-mode.h:56
static WifiMode GetHtMcs28()
Return MCS 28 from HT MCS values.
Definition: wifi-phy.cc:3724
VhtSigHeader m_vhtSig
the VHT-SIG PHY header
Definition: wifi-ppdu.h:89
static WifiMode GetHtMcs9()
Return MCS 9 from HT MCS values.
Definition: wifi-phy.cc:3572
static WifiMode GetHtMcs4()
Return MCS 4 from HT MCS values.
Definition: wifi-phy.cc:3532
static WifiMode GetHtMcs25()
Return MCS 25 from HT MCS values.
Definition: wifi-phy.cc:3700
static WifiMode GetHeMcs8()
Return MCS 8 from HE MCS values.
Definition: wifi-phy.cc:3905
uint16_t m_channelWidth
the channel width used to transmit that PPDU in MHz
Definition: wifi-ppdu.h:96
void SetShortGuardInterval(bool sgi)
Fill the short guard interval field of VHT-SIG-A2.
uint16_t GetGuardInterval(void) const
Return the guard interval (in nanoseconds).
uint64_t GetRate(uint16_t channelWidth=20) const
Return the RATE field of L-SIG (in bit/s).
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1086
static WifiMode GetHtMcs1()
Return MCS 1 from HT MCS values.
Definition: wifi-phy.cc:3508
uint8_t GetBssColor(void) const
Return the BSS Color field in the HE-SIG-A1.
static WifiMode GetHtMcs23()
Return MCS 23 from HT MCS values.
Definition: wifi-phy.cc:3684
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2Mbps.
Definition: wifi-phy.cc:3062
static WifiMode GetVhtMcs9()
Return MCS 9 from VHT MCS values.
Definition: wifi-phy.cc:3831
static WifiMode GetOfdmRate6MbpsBW10MHz()
Return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3326
void SetShortGuardInterval(bool sgi)
Fill the short guard interval field of HT-SIG.
Time GetTxDuration() const
Get the total transmission duration of the PPDU.
Definition: wifi-ppdu.cc:530
static WifiMode GetOfdmRate24MbpsBW10MHz()
Return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3374
uint16_t m_frequency
the frequency used to transmit that PPDU in MHz
Definition: wifi-ppdu.h:95
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3485
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:441
static WifiMode GetHtMcs15()
Return MCS 15 from HT MCS values.
Definition: wifi-phy.cc:3620
static WifiMode GetHtMcs3()
Return MCS 3 from HT MCS values.
Definition: wifi-phy.cc:3524
WifiModulationClass m_modulation
the modulation used for the transmission of this PPDU
Definition: wifi-ppdu.h:92
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6Mbps.
Definition: wifi-phy.cc:3203
HE PHY (Clause 26)
Definition: wifi-mode.h:62
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:119
DSSS PHY (Clause 15)
Definition: wifi-mode.h:46
static WifiMode GetHeMcs6()
Return MCS 6 from HE MCS values.
Definition: wifi-phy.cc:3889
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:3437
bool GetShortGuardIntervalDisambiguation(void) const
Return the short GI NSYM disambiguation field of VHT-SIG-A2.
uint8_t GetNss(void) const
static WifiMode GetOfdmRate3MbpsBW10MHz()
Return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:3302
static Time CalculatePhyPreambleAndHeaderDuration(WifiTxVector txVector)
Definition: wifi-phy.cc:2403