wifi: (fixes #2317) Add method to convert a HT MCS to a non-HT rate
This commit is contained in:
@@ -120,6 +120,7 @@ Bugs fixed
|
||||
- Bug 2313 - Assert failed when using aggregation and RTS/CTS
|
||||
- Bug 2315 - Problem when BACK Request is part of an A-MPDU
|
||||
- Bug 2316 - MacLow shall use a single TXVECTOR for all MPDUs belonging to a same A-MPDU
|
||||
- Bug 2317 - Get the non-HT reference rate of a HT MCS
|
||||
- Bug 2318 - MPDU Aggregation fails with TCP
|
||||
- Bug 2319 - BlockAckTimeout value is too low for 802.11n operating at 2.4 GHz
|
||||
- Bug 2320 - Add method to check whether a WifiTxVector contains a valid combination of WifiMode, number of spatial streams and channel width
|
||||
|
||||
@@ -390,6 +390,100 @@ WifiMode::GetModulationClass () const
|
||||
return item->modClass;
|
||||
}
|
||||
|
||||
WifiMode
|
||||
WifiMode::GetNonHtReferenceRate (uint8_t nss) const
|
||||
{
|
||||
WifiMode mode;
|
||||
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
|
||||
if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
|
||||
{
|
||||
WifiCodeRate codeRate = GetCodeRate(nss);
|
||||
switch(GetConstellationSize(nss))
|
||||
{
|
||||
case 2:
|
||||
if (codeRate == WIFI_CODE_RATE_1_2)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate6Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
true,
|
||||
WIFI_CODE_RATE_1_2,
|
||||
2);
|
||||
else if (codeRate == WIFI_CODE_RATE_3_4)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate9Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
false,
|
||||
WIFI_CODE_RATE_3_4,
|
||||
2);
|
||||
else
|
||||
NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
|
||||
break;
|
||||
case 4:
|
||||
if (codeRate == WIFI_CODE_RATE_1_2)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate12Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
true,
|
||||
WIFI_CODE_RATE_1_2,
|
||||
4);
|
||||
else if (codeRate == WIFI_CODE_RATE_3_4)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate18Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
false,
|
||||
WIFI_CODE_RATE_3_4,
|
||||
4);
|
||||
else
|
||||
NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
|
||||
break;
|
||||
case 16:
|
||||
if (codeRate == WIFI_CODE_RATE_1_2)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate24Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
true,
|
||||
WIFI_CODE_RATE_1_2,
|
||||
16);
|
||||
else if (codeRate == WIFI_CODE_RATE_3_4)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate36Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
false,
|
||||
WIFI_CODE_RATE_3_4,
|
||||
16);
|
||||
else
|
||||
NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
|
||||
break;
|
||||
case 64:
|
||||
if (codeRate == WIFI_CODE_RATE_1_2 || codeRate == WIFI_CODE_RATE_2_3)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate48Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
false,
|
||||
WIFI_CODE_RATE_2_3,
|
||||
64);
|
||||
else if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
false,
|
||||
WIFI_CODE_RATE_3_4,
|
||||
64);
|
||||
else
|
||||
NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
|
||||
break;
|
||||
case 256:
|
||||
if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
|
||||
mode = WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
|
||||
WIFI_MOD_CLASS_OFDM,
|
||||
false,
|
||||
WIFI_CODE_RATE_3_4,
|
||||
64);
|
||||
else
|
||||
NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
|
||||
break;
|
||||
default:
|
||||
NS_FATAL_ERROR ("Wrong constellation size");
|
||||
}
|
||||
}
|
||||
else
|
||||
mode = *this;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
WifiMode::WifiMode ()
|
||||
: m_uid (0)
|
||||
{
|
||||
|
||||
@@ -176,7 +176,16 @@ public:
|
||||
* \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012)
|
||||
* to which this WifiMode belongs.
|
||||
*/
|
||||
enum WifiModulationClass GetModulationClass () const;
|
||||
enum WifiModulationClass GetModulationClass () const;
|
||||
/**
|
||||
* \returns the WifiMode which represents the non-HT Reference Rate
|
||||
* which corresponds to the HT MCS of this WifiMode.
|
||||
*
|
||||
* To convert an HT MCS to is corresponding non-HT Reference Rate
|
||||
* use the modulation and coding rate determined by the HT MCS
|
||||
* and get the non-HT reference rate by lookup into Table 9-5 of IEEE 802.11-2012.
|
||||
*/
|
||||
WifiMode GetNonHtReferenceRate (uint8_t nss) const;
|
||||
|
||||
/**
|
||||
* Create an invalid WifiMode. Calling any method on the
|
||||
|
||||
Reference in New Issue
Block a user