A Discrete-Event Network Simulator
API
wifi-mode.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * S├ębastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #include <cmath>
23 #include "ns3/log.h"
24 #include "wifi-mode.h"
25 #include "wifi-tx-vector.h"
26 #include "he-ru.h"
27 
28 namespace ns3 {
29 
30 bool operator == (const WifiMode &a, const WifiMode &b)
31 {
32  return a.GetUid () == b.GetUid ();
33 }
34 
35 bool operator < (const WifiMode &a, const WifiMode &b)
36 {
37  return a.GetUid () < b.GetUid ();
38 }
39 
40 std::ostream & operator << (std::ostream & os, const WifiMode &mode)
41 {
42  os << mode.GetUniqueName ();
43  return os;
44 }
45 
46 std::istream & operator >> (std::istream &is, WifiMode &mode)
47 {
48  std::string str;
49  is >> str;
50  mode = WifiModeFactory::GetFactory ()->Search (str);
51  return is;
52 }
53 
54 bool
55 WifiMode::IsAllowed (uint16_t channelWidth, uint8_t nss) const
56 {
58  if (item->modClass == WIFI_MOD_CLASS_VHT)
59  {
60  if (item->mcsValue == 9 && channelWidth == 20 && nss != 3)
61  {
62  return false;
63  }
64  if (item->mcsValue == 6 && channelWidth == 80 && nss == 3)
65  {
66  return false;
67  }
68  }
69  return true;
70 }
71 
72 uint64_t
73 WifiMode::GetPhyRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
74 {
75  //TODO: nss > 4 not supported yet
76  NS_ASSERT (nss <= 4);
77  uint64_t dataRate, phyRate;
78  dataRate = GetDataRate (channelWidth, guardInterval, nss);
79  switch (GetCodeRate ())
80  {
81  case WIFI_CODE_RATE_5_6:
82  phyRate = dataRate * 6 / 5;
83  break;
84  case WIFI_CODE_RATE_3_4:
85  phyRate = dataRate * 4 / 3;
86  break;
87  case WIFI_CODE_RATE_2_3:
88  phyRate = dataRate * 3 / 2;
89  break;
90  case WIFI_CODE_RATE_1_2:
91  phyRate = dataRate * 2 / 1;
92  break;
94  default:
95  phyRate = dataRate;
96  break;
97  }
98  return phyRate;
99 }
100 
101 uint64_t
103 {
104  return GetPhyRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), txVector.GetNss ());
105 }
106 
107 uint64_t
108 WifiMode::GetDataRate (uint16_t channelWidth) const
109 {
110  return GetDataRate (channelWidth, 800, 1);
111 }
112 
113 uint64_t
114 WifiMode::GetDataRate (WifiTxVector txVector, uint16_t staId) const
115 {
116  uint16_t bw = txVector.GetChannelWidth ();
117  uint8_t nss = txVector.GetNss (staId);
118  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU
119  || txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
120  {
121  bw = HeRu::GetBandwidth (txVector.GetRu (staId).ruType);
122  }
123  return GetDataRate (bw, txVector.GetGuardInterval (), nss);
124 }
125 
126 uint64_t
127 WifiMode::GetDataRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
128 {
129  //TODO: nss > 4 not supported yet
130  NS_ASSERT (nss <= 4);
132  uint64_t dataRate = 0;
133  uint16_t usableSubCarriers = 0;
134  double symbolRate = 0;
135  double codingRate = 0;
136  uint16_t numberOfBitsPerSubcarrier = static_cast<uint16_t> (log2 (GetConstellationSize ()));
137  if (item->modClass == WIFI_MOD_CLASS_DSSS)
138  {
139  dataRate = ((11000000 / 11) * numberOfBitsPerSubcarrier);
140  }
141  else if (item->modClass == WIFI_MOD_CLASS_HR_DSSS)
142  {
143  dataRate = ((11000000 / 8) * numberOfBitsPerSubcarrier);
144  }
145  else if (item->modClass == WIFI_MOD_CLASS_OFDM || item->modClass == WIFI_MOD_CLASS_ERP_OFDM)
146  {
147  usableSubCarriers = 48;
148  switch (channelWidth)
149  {
150  case 20:
151  default:
152  symbolRate = (1 / 4.0) * 1e6;
153  break;
154  case 10:
155  symbolRate = (1 / 8.0) * 1e6;
156  break;
157  case 5:
158  symbolRate = (1 / 16.0) * 1e6;
159  break;
160  }
161 
162  switch (GetCodeRate ())
163  {
164  case WIFI_CODE_RATE_3_4:
165  codingRate = (3.0 / 4.0);
166  break;
167  case WIFI_CODE_RATE_2_3:
168  codingRate = (2.0 / 3.0);
169  break;
170  case WIFI_CODE_RATE_1_2:
171  codingRate = (1.0 / 2.0);
172  break;
174  default:
175  NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined");
176  break;
177  }
178 
179  dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
180  }
181  else if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
182  {
183  if (item->modClass == WIFI_MOD_CLASS_VHT)
184  {
185  NS_ASSERT_MSG (IsAllowed (channelWidth, nss), "VHT MCS " << +item->mcsValue << " forbidden at " << channelWidth << " MHz when NSS is " << +nss);
186  }
187 
188  NS_ASSERT (guardInterval == 800 || guardInterval == 400);
189  symbolRate = (1 / (3.2 + (static_cast<double> (guardInterval) / 1000))) * 1e6;
190 
191  if (item->modClass == WIFI_MOD_CLASS_HT)
192  {
193  switch (channelWidth)
194  {
195  case 20:
196  default:
197  usableSubCarriers = 52;
198  break;
199  case 40:
200  case 80:
201  case 160:
202  usableSubCarriers = 108;
203  break;
204  }
205  }
206  else //WIFI_MOD_CLASS_VHT
207  {
208  switch (channelWidth)
209  {
210  case 20:
211  default:
212  usableSubCarriers = 52;
213  break;
214  case 40:
215  usableSubCarriers = 108;
216  break;
217  case 80:
218  usableSubCarriers = 234;
219  break;
220  case 160:
221  usableSubCarriers = 468;
222  break;
223  }
224  }
225 
226  switch (GetCodeRate ())
227  {
228  case WIFI_CODE_RATE_5_6:
229  codingRate = (5.0 / 6.0);
230  break;
231  case WIFI_CODE_RATE_3_4:
232  codingRate = (3.0 / 4.0);
233  break;
234  case WIFI_CODE_RATE_2_3:
235  codingRate = (2.0 / 3.0);
236  break;
237  case WIFI_CODE_RATE_1_2:
238  codingRate = (1.0 / 2.0);
239  break;
241  default:
242  NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
243  break;
244  }
245 
246  dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
247  }
248  else if (item->modClass == WIFI_MOD_CLASS_HE)
249  {
250  NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
251  symbolRate = (1 / (12.8 + (static_cast<double> (guardInterval) / 1000))) * 1e6;
252 
253  switch (channelWidth)
254  {
255  case 2: //26-tone RU
256  usableSubCarriers = 24;
257  break;
258  case 4: //52-tone RU
259  usableSubCarriers = 48;
260  break;
261  case 8: //106-tone RU
262  usableSubCarriers = 102;
263  break;
264  case 20:
265  default:
266  usableSubCarriers = 234;
267  break;
268  case 40:
269  usableSubCarriers = 468;
270  break;
271  case 80:
272  usableSubCarriers = 980;
273  break;
274  case 160:
275  usableSubCarriers = 1960;
276  break;
277  }
278 
279  switch (GetCodeRate ())
280  {
281  case WIFI_CODE_RATE_5_6:
282  codingRate = (5.0 / 6.0);
283  break;
284  case WIFI_CODE_RATE_3_4:
285  codingRate = (3.0 / 4.0);
286  break;
287  case WIFI_CODE_RATE_2_3:
288  codingRate = (2.0 / 3.0);
289  break;
290  case WIFI_CODE_RATE_1_2:
291  codingRate = (1.0 / 2.0);
292  break;
294  default:
295  NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
296  break;
297  }
298 
299  dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
300  }
301  else
302  {
303  NS_ASSERT ("undefined datarate for the modulation class!");
304  }
305  dataRate *= nss; // number of spatial streams
306  return dataRate;
307 }
308 
311 {
313  if (item->modClass == WIFI_MOD_CLASS_HT)
314  {
315  switch (item->mcsValue % 8)
316  {
317  case 0:
318  case 1:
319  case 3:
320  return WIFI_CODE_RATE_1_2;
321  case 2:
322  case 4:
323  case 6:
324  return WIFI_CODE_RATE_3_4;
325  case 5:
326  return WIFI_CODE_RATE_2_3;
327  case 7:
328  return WIFI_CODE_RATE_5_6;
329  default:
331  }
332  }
333  else if (item->modClass == WIFI_MOD_CLASS_VHT)
334  {
335  switch (item->mcsValue)
336  {
337  case 0:
338  case 1:
339  case 3:
340  return WIFI_CODE_RATE_1_2;
341  case 2:
342  case 4:
343  case 6:
344  case 8:
345  return WIFI_CODE_RATE_3_4;
346  case 5:
347  return WIFI_CODE_RATE_2_3;
348  case 7:
349  case 9:
350  return WIFI_CODE_RATE_5_6;
351  default:
353  }
354  }
355  else if (item->modClass == WIFI_MOD_CLASS_HE)
356  {
357  switch (item->mcsValue)
358  {
359  case 0:
360  case 1:
361  case 3:
362  return WIFI_CODE_RATE_1_2;
363  case 2:
364  case 4:
365  case 6:
366  case 8:
367  case 10:
368  return WIFI_CODE_RATE_3_4;
369  case 5:
370  return WIFI_CODE_RATE_2_3;
371  case 7:
372  case 9:
373  case 11:
374  return WIFI_CODE_RATE_5_6;
375  default:
377  }
378  }
379  else
380  {
381  return item->codingRate;
382  }
383 }
384 
385 uint16_t
387 {
389  if (item->modClass == WIFI_MOD_CLASS_HT)
390  {
391  switch (item->mcsValue % 8)
392  {
393  case 0:
394  return 2;
395  case 1:
396  case 2:
397  return 4;
398  case 3:
399  case 4:
400  return 16;
401  case 5:
402  case 6:
403  case 7:
404  return 64;
405  default:
406  return 0;
407  }
408  }
409  else if (item->modClass == WIFI_MOD_CLASS_VHT || item->modClass == WIFI_MOD_CLASS_HE)
410  {
411  switch (item->mcsValue)
412  {
413  case 0:
414  return 2;
415  case 1:
416  case 2:
417  return 4;
418  case 3:
419  case 4:
420  return 16;
421  case 5:
422  case 6:
423  case 7:
424  return 64;
425  case 8:
426  case 9:
427  return 256;
428  case 10:
429  case 11:
431  return 1024;
432  default:
433  return 0;
434  }
435  }
436  else
437  {
438  return item->constellationSize;
439  }
440 }
441 
442 std::string
444 {
445  //needed for ostream printing of the invalid mode
447  return item->uniqueUid;
448 }
449 
450 bool
452 {
454  return item->isMandatory;
455 }
456 
457 uint8_t
459 {
461  if (item->modClass >= WIFI_MOD_CLASS_HT)
462  {
463  return item->mcsValue;
464  }
465  else
466  {
467  //We should not go here!
468  NS_ASSERT (false);
469  return 0;
470  }
471 }
472 
473 uint32_t
474 WifiMode::GetUid (void) const
475 {
476  return m_uid;
477 }
478 
481 {
483  return item->modClass;
484 }
485 
486 uint64_t
488 {
489  uint64_t dataRate;
491  if (item->modClass >= WIFI_MOD_CLASS_HT)
492  {
493  WifiCodeRate codeRate = GetCodeRate ();
494  switch (GetConstellationSize ())
495  {
496  case 2:
497  if (codeRate == WIFI_CODE_RATE_1_2)
498  {
499  dataRate = 6000000;
500  }
501  else if (codeRate == WIFI_CODE_RATE_3_4)
502  {
503  dataRate = 9000000;
504  }
505  else
506  {
507  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
508  }
509  break;
510  case 4:
511  if (codeRate == WIFI_CODE_RATE_1_2)
512  {
513  dataRate = 12000000;
514  }
515  else if (codeRate == WIFI_CODE_RATE_3_4)
516  {
517  dataRate = 18000000;
518  }
519  else
520  {
521  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
522  }
523  break;
524  case 16:
525  if (codeRate == WIFI_CODE_RATE_1_2)
526  {
527  dataRate = 24000000;
528  }
529  else if (codeRate == WIFI_CODE_RATE_3_4)
530  {
531  dataRate = 36000000;
532  }
533  else
534  {
535  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
536  }
537  break;
538  case 64:
539  if (codeRate == WIFI_CODE_RATE_1_2 || codeRate == WIFI_CODE_RATE_2_3)
540  {
541  dataRate = 48000000;
542  }
543  else if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
544  {
545  dataRate = 54000000;
546  }
547  else
548  {
549  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
550  }
551  break;
552  case 256:
553  case 1024:
554  if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
555  {
556  dataRate = 54000000;
557  }
558  else
559  {
560  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
561  }
562  break;
563  default:
564  NS_FATAL_ERROR ("Wrong constellation size");
565  }
566  }
567  else
568  {
569  NS_FATAL_ERROR ("Trying to get reference rate for a non-HT rate");
570  }
571  return dataRate;
572 }
573 
574 bool
576 {
577  WifiCodeRate codeRate = mode.GetCodeRate ();
578  switch (GetCodeRate ())
579  {
580  case WIFI_CODE_RATE_1_2:
581  return false; //This is the smallest code rate.
582  case WIFI_CODE_RATE_2_3:
583  return (codeRate == WIFI_CODE_RATE_1_2);
584  case WIFI_CODE_RATE_3_4:
585  return (codeRate == WIFI_CODE_RATE_1_2 || codeRate == WIFI_CODE_RATE_2_3);
586  case WIFI_CODE_RATE_5_6:
587  return (codeRate == WIFI_CODE_RATE_1_2 || codeRate == WIFI_CODE_RATE_2_3 || codeRate == WIFI_CODE_RATE_3_4);
588  default:
589  NS_FATAL_ERROR ("Wifi Code Rate not defined");
590  return false;
591  }
592 }
593 
594 bool
596 {
598  switch (item->modClass)
599  {
600  case WIFI_MOD_CLASS_DSSS:
602  {
603  return (GetConstellationSize () > mode.GetConstellationSize ());
604  }
605  else
606  {
607  return false;
608  }
611  {
612  return true;
613  }
614  else
615  {
616  return (GetConstellationSize () > mode.GetConstellationSize ());
617  }
619  case WIFI_MOD_CLASS_OFDM:
620  case WIFI_MOD_CLASS_HT:
621  case WIFI_MOD_CLASS_VHT:
622  case WIFI_MOD_CLASS_HE:
624  {
625  return true;
626  }
627  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS)
628  {
629  return (mode.GetConstellationSize () > GetConstellationSize ());
630  }
631  else
632  {
634  {
635  return true;
636  }
637  else if (GetConstellationSize () == mode.GetConstellationSize ())
638  {
639  return IsHigherCodeRate (mode);
640  }
641  else
642  {
643  return false;
644  }
645  }
646  default:
647  NS_FATAL_ERROR ("Modulation class not defined");
648  return false;
649  }
650 }
651 
653  : m_uid (0)
654 {
655 }
656 
657 WifiMode::WifiMode (uint32_t uid)
658  : m_uid (uid)
659 {
660 }
661 
662 WifiMode::WifiMode (std::string name)
663 {
664  *this = WifiModeFactory::GetFactory ()->Search (name);
665 }
666 
668 
670 {
671 }
672 
673 WifiMode
674 WifiModeFactory::CreateWifiMode (std::string uniqueName,
675  WifiModulationClass modClass,
676  bool isMandatory,
677  WifiCodeRate codingRate,
678  uint16_t constellationSize)
679 {
680  WifiModeFactory *factory = GetFactory ();
681  uint32_t uid = factory->AllocateUid (uniqueName);
682  WifiModeItem *item = factory->Get (uid);
683  item->uniqueUid = uniqueName;
684  item->modClass = modClass;
685  //The modulation class for this WifiMode must be valid.
686  NS_ASSERT (modClass != WIFI_MOD_CLASS_UNKNOWN);
687  item->codingRate = codingRate;
688 
689  //Check for compatibility between modulation class and coding
690  //rate. If modulation class is DSSS then coding rate must be
691  //undefined, and vice versa. I could have done this with an
692  //assertion, but it seems better to always give the error (i.e.,
693  //not only in non-optimised builds) and the cycles that extra test
694  //here costs are only suffered at simulation setup.
695  if ((codingRate == WIFI_CODE_RATE_UNDEFINED) && modClass != WIFI_MOD_CLASS_DSSS && modClass != WIFI_MOD_CLASS_HR_DSSS)
696  {
697  NS_FATAL_ERROR ("Error in creation of WifiMode named " << uniqueName << std::endl
698  << "Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS or WIFI_MOD_CLASS_HR_DSSS");
699  }
700 
701  item->constellationSize = constellationSize;
702  item->isMandatory = isMandatory;
703 
704  NS_ASSERT (modClass < WIFI_MOD_CLASS_HT);
705  //fill unused MCS item with a dummy value
706  item->mcsValue = 0;
707 
708  return WifiMode (uid);
709 }
710 
711 WifiMode
712 WifiModeFactory::CreateWifiMcs (std::string uniqueName,
713  uint8_t mcsValue,
714  WifiModulationClass modClass)
715 {
716  WifiModeFactory *factory = GetFactory ();
717  uint32_t uid = factory->AllocateUid (uniqueName);
718  WifiModeItem *item = factory->Get (uid);
719  item->uniqueUid = uniqueName;
720  item->modClass = modClass;
721 
722  NS_ASSERT (modClass >= WIFI_MOD_CLASS_HT);
723 
724  item->mcsValue = mcsValue;
725  //fill unused items with dummy values
726  item->constellationSize = 0;
728  item->isMandatory = false;
729 
730  return WifiMode (uid);
731 }
732 
733 WifiMode
734 WifiModeFactory::Search (std::string name) const
735 {
736  WifiModeItemList::const_iterator i;
737  uint32_t j = 0;
738  for (i = m_itemList.begin (); i != m_itemList.end (); i++)
739  {
740  if (i->uniqueUid == name)
741  {
742  return WifiMode (j);
743  }
744  j++;
745  }
746 
747  //If we get here then a matching WifiMode was not found above. This
748  //is a fatal problem, but we try to be helpful by displaying the
749  //list of WifiModes that are supported.
750  NS_LOG_UNCOND ("Could not find match for WifiMode named \""
751  << name << "\". Valid options are:");
752  for (i = m_itemList.begin (); i != m_itemList.end (); i++)
753  {
754  NS_LOG_UNCOND (" " << i->uniqueUid);
755  }
756  //Empty fatal error to die. We've already unconditionally logged
757  //the helpful information.
758  NS_FATAL_ERROR ("");
759 
760  //This next line is unreachable because of the fatal error
761  //immediately above, and that is fortunate, because we have no idea
762  //what is in WifiMode (0), but we do know it is not what our caller
763  //has requested by name. It's here only because it's the safest
764  //thing that'll give valid code.
765  return WifiMode (0);
766 }
767 
768 uint32_t
769 WifiModeFactory::AllocateUid (std::string uniqueUid)
770 {
771  uint32_t j = 0;
772  for (WifiModeItemList::const_iterator i = m_itemList.begin ();
773  i != m_itemList.end (); i++)
774  {
775  if (i->uniqueUid == uniqueUid)
776  {
777  return j;
778  }
779  j++;
780  }
781  uint32_t uid = static_cast<uint32_t> (m_itemList.size ());
782  m_itemList.push_back (WifiModeItem ());
783  return uid;
784 }
785 
787 WifiModeFactory::Get (uint32_t uid)
788 {
789  NS_ASSERT (uid < m_itemList.size ());
790  return &m_itemList[uid];
791 }
792 
795 {
796  static bool isFirstTime = true;
797  static WifiModeFactory factory;
798  if (isFirstTime)
799  {
800  uint32_t uid = factory.AllocateUid ("Invalid-WifiMode");
801  WifiModeItem *item = factory.Get (uid);
802  item->uniqueUid = "Invalid-WifiMode";
804  item->constellationSize = 0;
806  item->isMandatory = false;
807  item->mcsValue = 0;
808  isFirstTime = false;
809  }
810  return &factory;
811 }
812 
813 } //namespace ns3
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:48
RuType ruType
RU type.
Definition: he-ru.h:67
WifiMode()
Create an invalid WifiMode.
Definition: wifi-mode.cc:652
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:56
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiCodeRate
This enumeration defines the various convolutional coding rates used for the OFDM transmission modes ...
Definition: wifi-mode.h:74
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:55
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
WifiCodeRate codingRate
coding rate
Definition: wifi-mode.h:361
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
uint16_t GetGuardInterval(void) const
VHT PHY (Clause 22)
Definition: wifi-mode.h:62
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:50
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
uint32_t GetUid(void) const
Definition: wifi-mode.cc:474
Modulation class unknown or unspecified.
Definition: wifi-mode.h:42
bool IsMandatory(void) const
Definition: wifi-mode.cc:451
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:160
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
WifiMode Search(std::string name) const
Search and return WifiMode from a given name.
Definition: wifi-mode.cc:734
WifiPreamble GetPreambleType(void) const
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:295
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
Definition: wifi-mode.cc:674
uint32_t m_uid
UID.
Definition: wifi-mode.h:236
HT PHY (Clause 20)
Definition: wifi-mode.h:60
WifiModeItemList m_itemList
item list
Definition: wifi-mode.h:395
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:480
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:443
WifiModulationClass modClass
modulation class
Definition: wifi-mode.h:359
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsHigherCodeRate(WifiMode mode) const
Definition: wifi-mode.cc:575
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
uint16_t constellationSize
constellation size
Definition: wifi-mode.h:360
friend class WifiMode
allow WifiMode class access
Definition: wifi-mode.h:340
uint16_t GetConstellationSize(void) const
Definition: wifi-mode.cc:386
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
uint64_t GetNonHtReferenceRate(void) const
Definition: wifi-mode.cc:487
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:77
create WifiMode class instances and keep track of them.
Definition: wifi-mode.h:298
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:38
OFDM PHY (Clause 17)
Definition: wifi-mode.h:58
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:142
uint64_t GetPhyRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:73
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:794
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:769
uint16_t GetChannelWidth(void) const
WifiCodeRate GetCodeRate(void) const
Definition: wifi-mode.cc:310
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given UID index.
Definition: wifi-mode.cc:787
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:458
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass)
Definition: wifi-mode.cc:712
bool isMandatory
flag to indicate whether this mode is mandatory
Definition: wifi-mode.h:362
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:595
HE PHY (Clause 26)
Definition: wifi-mode.h:64
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:127
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:356
DSSS PHY (Clause 15)
Definition: wifi-mode.h:48
std::string uniqueUid
unique UID
Definition: wifi-mode.h:358