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