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