90 if (item->
mcsValue == 9 && channelWidth == 20 && nss != 3)
94 if (item->
mcsValue == 6 && channelWidth == 80 && nss == 3)
107 uint64_t dataRate, phyRate;
108 dataRate =
GetDataRate (channelWidth, guardInterval, nss);
112 phyRate = dataRate * 6 / 5;
115 phyRate = dataRate * 4 / 3;
118 phyRate = dataRate * 3 / 2;
121 phyRate = dataRate * 2 / 1;
155 uint64_t dataRate = 0;
156 uint16_t usableSubCarriers = 0;
157 double symbolRate = 0;
158 double codingRate = 0;
162 dataRate = ((11000000 / 11) * numberOfBitsPerSubcarrier);
166 dataRate = ((11000000 / 8) * numberOfBitsPerSubcarrier);
170 usableSubCarriers = 48;
171 switch (channelWidth)
175 symbolRate = (1 / 4.0) * 1e6;
178 symbolRate = (1 / 8.0) * 1e6;
181 symbolRate = (1 / 16.0) * 1e6;
188 codingRate = (3.0 / 4.0);
191 codingRate = (2.0 / 3.0);
194 codingRate = (1.0 / 2.0);
198 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined");
202 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
211 NS_ASSERT (guardInterval == 800 || guardInterval == 400);
212 symbolRate = (1 / (3.2 + (
static_cast<double> (guardInterval) / 1000))) * 1e6;
216 switch (channelWidth)
220 usableSubCarriers = 52;
225 usableSubCarriers = 108;
231 switch (channelWidth)
235 usableSubCarriers = 52;
238 usableSubCarriers = 108;
241 usableSubCarriers = 234;
244 usableSubCarriers = 468;
252 codingRate = (5.0 / 6.0);
255 codingRate = (3.0 / 4.0);
258 codingRate = (2.0 / 3.0);
261 codingRate = (1.0 / 2.0);
265 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
269 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
273 NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
274 symbolRate = (1 / (12.8 + (
static_cast<double> (guardInterval) / 1000))) * 1e6;
276 switch (channelWidth)
280 usableSubCarriers = 234;
283 usableSubCarriers = 468;
286 usableSubCarriers = 980;
289 usableSubCarriers = 1960;
296 codingRate = (5.0 / 6.0);
299 codingRate = (3.0 / 4.0);
302 codingRate = (2.0 / 3.0);
305 codingRate = (1.0 / 2.0);
309 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
313 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
317 NS_ASSERT (
"undefined datarate for the modulation class!");
521 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
535 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
549 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
563 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
574 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
583 NS_FATAL_ERROR (
"Trying to get reference rate for a non-HT rate");
692 uint16_t constellationSize)
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");
751 WifiModeItemList::const_iterator i;
755 if (i->uniqueUid == name)
766 << name <<
"\". Valid options are:");
787 for (WifiModeItemList::const_iterator i =
m_itemList.begin ();
790 if (i->uniqueUid == uniqueUid)
796 uint32_t uid =
static_cast<uint32_t
> (
m_itemList.size ());
811 static bool isFirstTime =
true;
815 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 ...
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
#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
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