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