77 if (item->
mcsValue == 9 && channelWidth == 20 && nss != 3)
81 if (item->
mcsValue == 6 && channelWidth == 80 && nss == 3)
100 uint64_t dataRate, phyRate;
101 dataRate =
GetDataRate (channelWidth, guardInterval, nss);
105 phyRate = dataRate * 6 / 5;
108 phyRate = dataRate * 4 / 3;
111 phyRate = dataRate * 3 / 2;
114 phyRate = dataRate * 2 / 1;
148 uint64_t dataRate = 0;
149 uint16_t usableSubCarriers = 0;
150 double symbolRate = 0;
151 double codingRate = 0;
155 dataRate = ((11000000 / 11) * numberOfBitsPerSubcarrier);
159 dataRate = ((11000000 / 8) * numberOfBitsPerSubcarrier);
163 usableSubCarriers = 48;
164 switch (channelWidth)
168 symbolRate = (1 / 4.0) * 1e6;
171 symbolRate = (1 / 8.0) * 1e6;
174 symbolRate = (1 / 16.0) * 1e6;
181 codingRate = (3.0 / 4.0);
184 codingRate = (2.0 / 3.0);
187 codingRate = (1.0 / 2.0);
191 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined");
195 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
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);
204 NS_ASSERT (guardInterval == 800 || guardInterval == 400);
205 symbolRate = (1 / (3.2 + ((double)guardInterval / 1000))) * 1e6;
209 switch (channelWidth)
213 usableSubCarriers = 52;
218 usableSubCarriers = 108;
224 switch (channelWidth)
228 usableSubCarriers = 52;
231 usableSubCarriers = 108;
234 usableSubCarriers = 234;
237 usableSubCarriers = 468;
245 codingRate = (5.0 / 6.0);
248 codingRate = (3.0 / 4.0);
251 codingRate = (2.0 / 3.0);
254 codingRate = (1.0 / 2.0);
258 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << (uint16_t) nss);
262 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
266 NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
267 symbolRate = (1 / (12.8 + ((double)guardInterval / 1000))) * 1e6;
269 switch (channelWidth)
273 usableSubCarriers = 234;
276 usableSubCarriers = 468;
279 usableSubCarriers = 980;
282 usableSubCarriers = 1960;
289 codingRate = (5.0 / 6.0);
292 codingRate = (3.0 / 4.0);
295 codingRate = (2.0 / 3.0);
298 codingRate = (1.0 / 2.0);
302 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << (uint16_t) nss);
306 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
310 NS_ASSERT (
"undefined datarate for the modulation class!");
514 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
528 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
542 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
556 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
567 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
576 NS_FATAL_ERROR (
"Trying to get reference rate for a non-HT rate");
685 uint16_t constellationSize)
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");
744 WifiModeItemList::const_iterator i;
748 if (i->uniqueUid == name)
759 << name <<
"\". Valid options are:");
780 for (WifiModeItemList::const_iterator i =
m_itemList.begin ();
783 if (i->uniqueUid == uniqueUid)
804 static bool isFirstTime =
true;
808 uint32_t uid = factory.
AllocateUid (
"Invalid-WifiMode");
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
uint16_t GetGuardInterval(void) const
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.
#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.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
bool IsMandatory(void) const
Modulation class unknown or unspecified.
uint8_t GetChannelWidth(void) const
uint16_t GetConstellationSize(void) const
bool IsHigherDataRate(WifiMode mode) const
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
uint8_t GetMcsValue(void) const
std::string GetUniqueName(void) const
WifiModeItemList m_itemList
item list
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 IsAllowed(uint8_t channelWidth, uint8_t nss) const
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionaly.
uint16_t constellationSize
constellation size
friend class WifiMode
allow WifiMode class access
uint64_t GetNonHtReferenceRate(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...
No explicit coding (e.g., DSSS rates)
create WifiMode class instances and keep track of them.
uint8_t GetNss(void) const
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
uint64_t GetPhyRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
bool IsHigherCodeRate(WifiMode mode) const
bool operator==(const EventId &a, const EventId &b)
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
uint64_t GetPhyRate(WifiTxVector txVector) const
uint32_t GetUid(void) const
WifiModulationClass GetModulationClass() const
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given uid index.
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass)
bool isMandatory
flag to indicate whether this mode is mandatory
WifiCodeRate GetCodeRate(void) const
This is the data associated to a unique WifiMode.
WifiMode Search(std::string name) const
Search and return WifiMode from a given name.
std::string uniqueUid
unique UID