59 if (item->
mcsValue == 9 && channelWidth == 20 && nss != 3)
63 if (item->
mcsValue == 6 && channelWidth == 80 && nss == 3)
76 uint64_t dataRate, phyRate;
77 dataRate =
GetDataRate (channelWidth, guardInterval, nss);
81 phyRate = dataRate * 6 / 5;
84 phyRate = dataRate * 4 / 3;
87 phyRate = dataRate * 3 / 2;
90 phyRate = dataRate * 2 / 1;
124 uint64_t dataRate = 0;
125 uint16_t usableSubCarriers = 0;
126 double symbolRate = 0;
127 double codingRate = 0;
131 dataRate = ((11000000 / 11) * numberOfBitsPerSubcarrier);
135 dataRate = ((11000000 / 8) * numberOfBitsPerSubcarrier);
139 usableSubCarriers = 48;
140 switch (channelWidth)
144 symbolRate = (1 / 4.0) * 1e6;
147 symbolRate = (1 / 8.0) * 1e6;
150 symbolRate = (1 / 16.0) * 1e6;
157 codingRate = (3.0 / 4.0);
160 codingRate = (2.0 / 3.0);
163 codingRate = (1.0 / 2.0);
167 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined");
171 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
180 NS_ASSERT (guardInterval == 800 || guardInterval == 400);
181 symbolRate = (1 / (3.2 + (
static_cast<double> (guardInterval) / 1000))) * 1e6;
185 switch (channelWidth)
189 usableSubCarriers = 52;
194 usableSubCarriers = 108;
200 switch (channelWidth)
204 usableSubCarriers = 52;
207 usableSubCarriers = 108;
210 usableSubCarriers = 234;
213 usableSubCarriers = 468;
221 codingRate = (5.0 / 6.0);
224 codingRate = (3.0 / 4.0);
227 codingRate = (2.0 / 3.0);
230 codingRate = (1.0 / 2.0);
234 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
238 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
242 NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
243 symbolRate = (1 / (12.8 + (
static_cast<double> (guardInterval) / 1000))) * 1e6;
245 switch (channelWidth)
249 usableSubCarriers = 234;
252 usableSubCarriers = 468;
255 usableSubCarriers = 980;
258 usableSubCarriers = 1960;
265 codingRate = (5.0 / 6.0);
268 codingRate = (3.0 / 4.0);
271 codingRate = (2.0 / 3.0);
274 codingRate = (1.0 / 2.0);
278 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
282 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
286 NS_ASSERT (
"undefined datarate for the modulation class!");
490 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
504 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
518 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
532 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
543 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
552 NS_FATAL_ERROR (
"Trying to get reference rate for a non-HT rate");
661 uint16_t constellationSize)
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");
719 WifiModeItemList::const_iterator i;
723 if (i->uniqueUid == name)
734 << name <<
"\". Valid options are:");
755 for (WifiModeItemList::const_iterator i =
m_itemList.begin ();
758 if (i->uniqueUid == uniqueUid)
764 uint32_t uid =
static_cast<uint32_t
> (
m_itemList.size ());
779 static bool isFirstTime =
true;
783 uint32_t uid = factory.
AllocateUid (
"Invalid-WifiMode");
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
WifiMode()
Create an invalid WifiMode.
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 ...
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
uint8_t mcsValue
MCS value.
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
WifiCodeRate codingRate
coding rate
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint16_t GetGuardInterval(void) const
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
uint32_t GetUid(void) const
Modulation class unknown or unspecified.
bool IsMandatory(void) const
bool operator<(const EventId &a, const EventId &b)
WifiMode Search(std::string name) const
Search and return WifiMode from a given name.
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
WifiModeItemList m_itemList
item list
WifiModulationClass GetModulationClass() const
std::string GetUniqueName(void) const
WifiModulationClass modClass
modulation class
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsHigherCodeRate(WifiMode mode) const
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
uint16_t constellationSize
constellation size
friend class WifiMode
allow WifiMode class access
uint16_t GetConstellationSize(void) const
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
uint64_t GetNonHtReferenceRate(void) const
No explicit coding (e.g., DSSS rates)
create WifiMode class instances and keep track of them.
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
bool operator==(const EventId &a, const EventId &b)
uint64_t GetPhyRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
uint16_t GetChannelWidth(void) const
WifiCodeRate GetCodeRate(void) const
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given UID index.
uint8_t GetMcsValue(void) const
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass)
bool isMandatory
flag to indicate whether this mode is mandatory
bool IsHigherDataRate(WifiMode mode) const
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
This is the data associated to a unique WifiMode.
uint8_t GetNss(void) const
std::string uniqueUid
unique UID