60 if (item->
mcsValue == 9 && channelWidth == 20 && nss != 3)
64 if (item->
mcsValue == 6 && channelWidth == 80 && nss == 3)
77 uint64_t dataRate, phyRate;
78 dataRate =
GetDataRate (channelWidth, guardInterval, nss);
82 phyRate = dataRate * 6 / 5;
85 phyRate = dataRate * 4 / 3;
88 phyRate = dataRate * 3 / 2;
91 phyRate = dataRate * 2 / 1;
117 uint8_t nss = txVector.
GetNss (staId);
132 uint64_t dataRate = 0;
133 uint16_t usableSubCarriers = 0;
134 double symbolRate = 0;
135 double codingRate = 0;
139 dataRate = ((11000000 / 11) * numberOfBitsPerSubcarrier);
143 dataRate = ((11000000 / 8) * numberOfBitsPerSubcarrier);
147 usableSubCarriers = 48;
148 switch (channelWidth)
152 symbolRate = (1 / 4.0) * 1e6;
155 symbolRate = (1 / 8.0) * 1e6;
158 symbolRate = (1 / 16.0) * 1e6;
165 codingRate = (3.0 / 4.0);
168 codingRate = (2.0 / 3.0);
171 codingRate = (1.0 / 2.0);
175 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined");
179 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
188 NS_ASSERT (guardInterval == 800 || guardInterval == 400);
189 symbolRate = (1 / (3.2 + (
static_cast<double> (guardInterval) / 1000))) * 1e6;
193 switch (channelWidth)
197 usableSubCarriers = 52;
202 usableSubCarriers = 108;
208 switch (channelWidth)
212 usableSubCarriers = 52;
215 usableSubCarriers = 108;
218 usableSubCarriers = 234;
221 usableSubCarriers = 468;
229 codingRate = (5.0 / 6.0);
232 codingRate = (3.0 / 4.0);
235 codingRate = (2.0 / 3.0);
238 codingRate = (1.0 / 2.0);
242 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
246 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
250 NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
251 symbolRate = (1 / (12.8 + (
static_cast<double> (guardInterval) / 1000))) * 1e6;
253 switch (channelWidth)
256 usableSubCarriers = 24;
259 usableSubCarriers = 48;
262 usableSubCarriers = 102;
266 usableSubCarriers = 234;
269 usableSubCarriers = 468;
272 usableSubCarriers = 980;
275 usableSubCarriers = 1960;
282 codingRate = (5.0 / 6.0);
285 codingRate = (3.0 / 4.0);
288 codingRate = (2.0 / 3.0);
291 codingRate = (1.0 / 2.0);
295 NS_FATAL_ERROR (
"trying to get datarate for a mcs without any coding rate defined with nss: " << +nss);
299 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
303 NS_ASSERT (
"undefined datarate for the modulation class!");
507 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
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");
560 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
569 NS_FATAL_ERROR (
"Trying to get reference rate for a non-HT rate");
678 uint16_t constellationSize)
697 NS_FATAL_ERROR (
"Error in creation of WifiMode named " << uniqueName << std::endl
698 <<
"Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS or WIFI_MOD_CLASS_HR_DSSS");
736 WifiModeItemList::const_iterator i;
740 if (i->uniqueUid == name)
751 << name <<
"\". Valid options are:");
772 for (WifiModeItemList::const_iterator i =
m_itemList.begin ();
775 if (i->uniqueUid == uniqueUid)
781 uint32_t uid =
static_cast<uint32_t
> (
m_itemList.size ());
796 static bool isFirstTime =
true;
800 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
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
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)
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
WifiMode Search(std::string name) const
Search and return WifiMode from a given name.
WifiPreamble GetPreambleType(void) const
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
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.
std::string uniqueUid
unique UID