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