wifi: Add helper function to convert HE RU indexes to Spectrum model indexes
This commit is contained in:
@@ -482,4 +482,33 @@ SpectrumWifiPhy::GetBand (uint16_t bandWidth, uint8_t bandIndex)
|
||||
return band;
|
||||
}
|
||||
|
||||
WifiSpectrumBand
|
||||
SpectrumWifiPhy::ConvertHeRuIndices (uint16_t channelWidth, HeRu::SubcarrierRange range) const
|
||||
{
|
||||
WifiSpectrumBand convertedIndices;
|
||||
uint32_t nGuardBands = static_cast<uint32_t> (((2 * GetGuardBandwidth (channelWidth) * 1e6) / GetBandBandwidth ()) + 0.5);
|
||||
uint32_t centerFrequencyIndex = 0;
|
||||
switch (channelWidth)
|
||||
{
|
||||
case 20:
|
||||
centerFrequencyIndex = (nGuardBands / 2) + 6 + 122;
|
||||
break;
|
||||
case 40:
|
||||
centerFrequencyIndex = (nGuardBands / 2) + 12 + 244;
|
||||
break;
|
||||
case 80:
|
||||
centerFrequencyIndex = (nGuardBands / 2) + 12 + 500;
|
||||
break;
|
||||
case 160:
|
||||
centerFrequencyIndex = (nGuardBands / 2) + 12 + 1012;
|
||||
break;
|
||||
default:
|
||||
NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported");
|
||||
break;
|
||||
}
|
||||
convertedIndices.first = centerFrequencyIndex + range.first;
|
||||
convertedIndices.second = centerFrequencyIndex + range.second;
|
||||
return convertedIndices;
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "ns3/antenna-model.h"
|
||||
#include "ns3/spectrum-channel.h"
|
||||
#include "ns3/spectrum-model.h"
|
||||
#include "ns3/wifi-spectrum-value-helper.h"
|
||||
#include "wifi-phy.h"
|
||||
|
||||
namespace ns3 {
|
||||
@@ -188,6 +189,15 @@ private:
|
||||
*/
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (uint16_t centerFrequency, uint16_t channelWidth, double txPowerW, WifiModulationClass modulationClass) const;
|
||||
|
||||
/**
|
||||
* \param channelWidth the total channel width (MHz) used for the OFDMA transmission
|
||||
* \param range the subcarrier range of the HE RU
|
||||
* \return the converted indices
|
||||
*
|
||||
* This is a helper function to convert HE RU indices, which are relative to the center frequency subcarrier, to the indices used by the Spectrum model.
|
||||
*/
|
||||
WifiSpectrumBand ConvertHeRuIndices (uint16_t channelWidth, HeRu::SubcarrierRange range) const;
|
||||
|
||||
/**
|
||||
* Perform run-time spectrum model change
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user