A Discrete-Event Network Simulator
API
ns3::WifiSpectrumValueHelper Class Reference

This class defines all functions to create a spectrum model for Wi-Fi based on a a spectral model aligned with an OFDM subcarrier spacing of 312.5 KHz (model also reused for DSSS modulations) More...

#include "wifi-spectrum-value-helper.h"

Public Member Functions

virtual ~WifiSpectrumValueHelper ()=default
 Destructor. More...
 

Static Public Member Functions

static Ptr< SpectrumValueCreateDsssTxPowerSpectralDensity (uint32_t centerFrequency, double txPowerW, uint16_t guardBandwidth)
 Create a transmit power spectral density corresponding to DSSS. More...
 
static Ptr< SpectrumValueCreateDuplicated20MhzTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
 Create a transmit power spectral density corresponding to OFDM duplicated over multiple 20 MHz subchannels. More...
 
static Ptr< SpectrumValueCreateHeMuOfdmTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, const WifiSpectrumBandIndices &ru)
 Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given RU. More...
 
static Ptr< SpectrumValueCreateHeOfdmTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
 Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802.11ax). More...
 
static Ptr< SpectrumValueCreateHtOfdmTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
 Create a transmit power spectral density corresponding to OFDM High Throughput (HT) (802.11n/ac). More...
 
static Ptr< SpectrumValueCreateNoisePowerSpectralDensity (double noiseFigure, Ptr< SpectrumModel > spectrumModel)
 Create a thermal noise power spectral density. More...
 
static Ptr< SpectrumValueCreateNoisePowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, uint32_t carrierSpacing, double noiseFigure, uint16_t guardBandwidth)
 Create a power spectral density corresponding to the noise. More...
 
static Ptr< SpectrumValueCreateOfdmTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
 Create a transmit power spectral density corresponding to OFDM (802.11a/g). More...
 
static void CreateSpectrumMaskForOfdm (Ptr< SpectrumValue > c, const std::vector< WifiSpectrumBandIndices > &allocatedSubBands, const WifiSpectrumBandIndices &maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, double minInnerBandDbr, double minOuterbandDbr, double lowestPointDbr, const std::vector< WifiSpectrumBandIndices > &puncturedSubBands=std::vector< WifiSpectrumBandIndices >{}, uint32_t puncturedSlopeWidth=0)
 Create a transmit power spectral density corresponding to OFDM transmit spectrum mask requirements for 11a/11g/11n/11ac/11ax Channel width may vary between 5, 10, 20, 40, 80, and 160 MHz. More...
 
static double DbmToW (double dbm)
 Convert from dBm to Watts. More...
 
static double GetBandPowerW (Ptr< SpectrumValue > psd, const WifiSpectrumBandIndices &band)
 Calculate the power of the specified band composed of uniformly-sized sub-bands. More...
 
static Ptr< SpectrumModelGetSpectrumModel (uint32_t centerFrequency, uint16_t channelWidth, uint32_t carrierSpacing, uint16_t guardBandwidth)
 Return a SpectrumModel instance corresponding to the center frequency and channel width. More...
 
static void NormalizeSpectrumMask (Ptr< SpectrumValue > c, double txPowerW)
 Normalize the transmit spectrum mask generated by CreateSpectrumMaskForOfdm so that the total transmitted power corresponds to the input value. More...
 

Detailed Description

This class defines all functions to create a spectrum model for Wi-Fi based on a a spectral model aligned with an OFDM subcarrier spacing of 312.5 KHz (model also reused for DSSS modulations)

Definition at line 42 of file wifi-spectrum-value-helper.h.

Constructor & Destructor Documentation

◆ ~WifiSpectrumValueHelper()

virtual ns3::WifiSpectrumValueHelper::~WifiSpectrumValueHelper ( )
virtualdefault

Destructor.

Member Function Documentation

◆ CreateDsssTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity ( uint32_t  centerFrequency,
double  txPowerW,
uint16_t  guardBandwidth 
)
static

Create a transmit power spectral density corresponding to DSSS.

The center frequency typically corresponds to 802.11b channel center frequencies but is not restricted to those frequencies.

Note
There is no channel width parameter; this method assumes 22 MHz
Parameters
centerFrequencycenter frequency (MHz)
txPowerWtransmit power (W) to allocate
guardBandwidthwidth of the guard band (MHz)
Returns
a pointer to a newly allocated SpectrumValue representing the DSSS Transmit Power Spectral Density in W/Hz

Definition at line 127 of file wifi-spectrum-value-helper.cc.

References ns3::SpectrumValue::ConstBandsBegin(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), GetSpectrumModel(), NS_ASSERT, NS_LOG_FUNCTION, and ns3::SpectrumValue::ValuesBegin().

Referenced by ns3::DsssPhy::GetTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateDuplicated20MhzTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
double  txPowerW,
uint16_t  guardBandwidth,
double  minInnerBandDbr = -20,
double  minOuterbandDbr = -28,
double  lowestPointDbr = -40,
const std::vector< bool > &  puncturedSubchannels = std::vector<bool>{} 
)
static

Create a transmit power spectral density corresponding to OFDM duplicated over multiple 20 MHz subchannels.

Channel width may vary between 20, 40, 80, and 160 MHz.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
txPowerWtransmit power (W) to allocate
guardBandwidthwidth of the guard band (MHz)
minInnerBandDbrthe minimum relative power in the inner band (in dBr)
minOuterbandDbrthe minimum relative power in the outer band (in dBr)
lowestPointDbrmaximum relative power of the outermost subcarriers of the guard band (in dBr)
puncturedSubchannelsbitmap indicating whether a 20 MHz subchannel is punctured or not
Returns
a pointer to a newly allocated SpectrumValue representing the duplicated 20 MHz OFDM Transmit Power Spectral Density in W/Hz for each Band

Definition at line 225 of file wifi-spectrum-value-helper.cc.

References CreateSpectrumMaskForOfdm(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), GetSpectrumModel(), ns3::Integral(), NormalizeSpectrumMask(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, two-ray-to-three-gpp-ch-calibration::start, and two-ray-to-three-gpp-ch-calibration::stop.

Referenced by ns3::OfdmPhy::GetTxPowerSpectralDensity(), and ns3::HePhy::GetTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateHeMuOfdmTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
double  txPowerW,
uint16_t  guardBandwidth,
const WifiSpectrumBandIndices ru 
)
static

Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given RU.

An ideal (i.e. rectangular) spectral mask is considered for the time being.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
txPowerWtransmit power (W) to allocate
guardBandwidthwidth of the guard band (MHz)
ruthe RU band used by the STA
Returns
a pointer to a newly allocated SpectrumValue representing the HE OFDM Transmit Power Spectral Density on the RU used by the STA in W/Hz for each Band

Definition at line 500 of file wifi-spectrum-value-helper.cc.

References ns3::SpectrumValue::ConstBandsBegin(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), GetSpectrumModel(), NS_LOG_FUNCTION, and ns3::SpectrumValue::ValuesBegin().

Referenced by ns3::HePhy::GetTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateHeOfdmTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
double  txPowerW,
uint16_t  guardBandwidth,
double  minInnerBandDbr = -20,
double  minOuterbandDbr = -28,
double  lowestPointDbr = -40,
const std::vector< bool > &  puncturedSubchannels = std::vector<bool>{} 
)
static

Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802.11ax).

Channel width may vary between 20, 40, 80, and 160 MHz.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
txPowerWtransmit power (W) to allocate
guardBandwidthwidth of the guard band (MHz)
minInnerBandDbrthe minimum relative power in the inner band (in dBr)
minOuterbandDbrthe minimum relative power in the outer band (in dBr)
lowestPointDbrmaximum relative power of the outermost subcarriers of the guard band (in dBr)
puncturedSubchannelsbitmap indicating whether a 20 MHz subchannel is punctured or not
Returns
a pointer to a newly allocated SpectrumValue representing the HE OFDM Transmit Power Spectral Density in W/Hz for each Band

Definition at line 366 of file wifi-spectrum-value-helper.cc.

References CreateSpectrumMaskForOfdm(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), GetSpectrumModel(), ns3::Integral(), NormalizeSpectrumMask(), NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_FUNCTION, two-ray-to-three-gpp-ch-calibration::start, and two-ray-to-three-gpp-ch-calibration::stop.

Referenced by ns3::HePhy::GetTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateHtOfdmTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
double  txPowerW,
uint16_t  guardBandwidth,
double  minInnerBandDbr = -20,
double  minOuterbandDbr = -28,
double  lowestPointDbr = -40 
)
static

Create a transmit power spectral density corresponding to OFDM High Throughput (HT) (802.11n/ac).

Channel width may vary between 20, 40, 80, and 160 MHz.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
txPowerWtransmit power (W) to allocate
guardBandwidthwidth of the guard band (MHz)
minInnerBandDbrthe minimum relative power in the inner band (in dBr)
minOuterbandDbrthe minimum relative power in the outer band (in dBr)
lowestPointDbrmaximum relative power of the outermost subcarriers of the guard band (in dBr)
Returns
a pointer to a newly allocated SpectrumValue representing the HT OFDM Transmit Power Spectral Density in W/Hz for each Band

Definition at line 301 of file wifi-spectrum-value-helper.cc.

References CreateSpectrumMaskForOfdm(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), GetSpectrumModel(), ns3::Integral(), NormalizeSpectrumMask(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, two-ray-to-three-gpp-ch-calibration::start, and two-ray-to-three-gpp-ch-calibration::stop.

Referenced by ns3::HtPhy::GetTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateNoisePowerSpectralDensity() [1/2]

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity ( double  noiseFigure,
Ptr< SpectrumModel spectrumModel 
)
static

Create a thermal noise power spectral density.

Parameters
noiseFigurethe noise figure
spectrumModelthe spectrum model
Returns
a pointer to a newly allocated SpectrumValue representing the noise Power Spectral Density in W/Hz corresponding to thermal noise, for each Band

Definition at line 545 of file wifi-spectrum-value-helper.cc.

References DbmToW(), ns3::Integral(), NS_LOG_FUNCTION, and NS_LOG_INFO.

+ Here is the call graph for this function:

◆ CreateNoisePowerSpectralDensity() [2/2]

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
uint32_t  carrierSpacing,
double  noiseFigure,
uint16_t  guardBandwidth 
)
static

Create a power spectral density corresponding to the noise.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
carrierSpacingcarrier spacing (Hz)
noiseFigurethe noise figure in dB w.r.t. a reference temperature of 290K
guardBandwidthwidth of the guard band (MHz)
Returns
a pointer to a newly allocated SpectrumValue representing the noise Power Spectral Density in W/Hz for each Band

Definition at line 533 of file wifi-spectrum-value-helper.cc.

References GetSpectrumModel().

+ Here is the call graph for this function:

◆ CreateOfdmTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
double  txPowerW,
uint16_t  guardBandwidth,
double  minInnerBandDbr = -20,
double  minOuterbandDbr = -28,
double  lowestPointDbr = -40 
)
static

Create a transmit power spectral density corresponding to OFDM (802.11a/g).

Channel width may vary between 20, 10, and 5 MHz. Guard bandwidth also typically varies with channel width.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
txPowerWtransmit power (W) to allocate
guardBandwidthwidth of the guard band (MHz)
minInnerBandDbrthe minimum relative power in the inner band (in dBr)
minOuterbandDbrthe minimum relative power in the outer band (in dBr)
lowestPointDbrmaximum relative power of the outermost subcarriers of the guard band (in dBr)
Returns
a pointer to a newly allocated SpectrumValue representing the OFDM Transmit Power Spectral Density in W/Hz for each Band

Definition at line 154 of file wifi-spectrum-value-helper.cc.

References CreateSpectrumMaskForOfdm(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), GetSpectrumModel(), ns3::Integral(), NormalizeSpectrumMask(), NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::OfdmPhy::GetTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateSpectrumMaskForOfdm()

void ns3::WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm ( Ptr< SpectrumValue c,
const std::vector< WifiSpectrumBandIndices > &  allocatedSubBands,
const WifiSpectrumBandIndices maskBand,
double  txPowerPerBandW,
uint32_t  nGuardBands,
uint32_t  innerSlopeWidth,
double  minInnerBandDbr,
double  minOuterbandDbr,
double  lowestPointDbr,
const std::vector< WifiSpectrumBandIndices > &  puncturedSubBands = std::vector<WifiSpectrumBandIndices>{},
uint32_t  puncturedSlopeWidth = 0 
)
static

Create a transmit power spectral density corresponding to OFDM transmit spectrum mask requirements for 11a/11g/11n/11ac/11ax Channel width may vary between 5, 10, 20, 40, 80, and 160 MHz.

The default (standard) values are illustrated below.

[ guard band ][ channel width ][ guard band ] __________ __________ _ 0 dBr / | | \ / |_| \ _ -20 dBr . ' ' . . ' ' . _ -28 dBr .' '. .' '. .' '. _ lowest point

|--—| |--—| outerBand left/right |---—| |– —| middle band left/right |-| |-| inner band left/right |--------------------—| allocated sub-bands |--------------------------------------------------—| mask band

Please take note that, since guard tones are within the allocated band while not being ideally allocated any power, the inner band had to be shifted inwards and a flat junction band (at -20 dBr) had to be added between the inner and the middle bands.

Parameters
cspectrumValue to allocate according to transmit power spectral density mask (in W/Hz for each band)
allocatedSubBandsvector of start and stop subcarrier indexes of the allocated sub bands
maskBandstart and stop subcarrier indexes of transmit mask (in case signal doesn't cover whole SpectrumModel)
txPowerPerBandWpower allocated to each subcarrier in the allocated sub bands
nGuardBandssize (in number of subcarriers) of the guard band (left and right)
innerSlopeWidthsize (in number of subcarriers) of the inner band (i.e. slope going from 0 dBr to -20 dBr in the figure above)
minInnerBandDbrthe minimum relative power in the inner band (i.e., -20 dBr in the figure above)
minOuterbandDbrthe minimum relative power in the outer band (i.e., -28 dBr in the figure above)
lowestPointDbrmaximum relative power of the outermost subcarriers of the guard band (in dBr)
puncturedSubBandsvector of start and stop subcarrier indexes of the punctured sub bands
puncturedSlopeWidthsize (in number of subcarriers) of the punctured band slope

Definition at line 564 of file wifi-spectrum-value-helper.cc.

References ns3::SpectrumValue::ConstBandsBegin(), DbmToW(), ns3::SpectrumModel::GetNumBands(), ns3::SpectrumValue::GetSpectrumModel(), max, min, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, and ns3::SpectrumValue::ValuesBegin().

Referenced by CreateDuplicated20MhzTxPowerSpectralDensity(), CreateHeOfdmTxPowerSpectralDensity(), CreateHtOfdmTxPowerSpectralDensity(), and CreateOfdmTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DbmToW()

double ns3::WifiSpectrumValueHelper::DbmToW ( double  dbm)
static

Convert from dBm to Watts.

Taken from wifi-utils since the original method couldn't be called from here due to resulting circular dependencies of spectrum and wifi modules.

Parameters
dbmthe power in dBm
Returns
the equivalent Watts for the given dBm

Definition at line 785 of file wifi-spectrum-value-helper.cc.

Referenced by CreateNoisePowerSpectralDensity(), and CreateSpectrumMaskForOfdm().

+ Here is the caller graph for this function:

◆ GetBandPowerW()

double ns3::WifiSpectrumValueHelper::GetBandPowerW ( Ptr< SpectrumValue psd,
const WifiSpectrumBandIndices band 
)
static

Calculate the power of the specified band composed of uniformly-sized sub-bands.

Parameters
psdreceived Power Spectral Density in W/Hz
banda pair of start and stop indexes that defines the band
Returns
band power in W

Definition at line 791 of file wifi-spectrum-value-helper.cc.

References ns3::SpectrumValue::ConstBandsBegin(), and ns3::SpectrumValue::ConstValuesBegin().

Referenced by ns3::SpectrumWifiPhy::StartRx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpectrumModel()

Ptr< SpectrumModel > ns3::WifiSpectrumValueHelper::GetSpectrumModel ( uint32_t  centerFrequency,
uint16_t  channelWidth,
uint32_t  carrierSpacing,
uint16_t  guardBandwidth 
)
static

Return a SpectrumModel instance corresponding to the center frequency and channel width.

The spectrum model spans the channel width +/- the guard bands (i.e. the model will span (channelWidth + 2 * guardBandwidth) MHz of bandwidth).

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
carrierSpacingcarrier spacing (Hz)
guardBandwidthwidth of the guard band (MHz)
Returns
the static SpectrumModel instance corresponding to the given carrier frequency and channel width configuration.

Definition at line 72 of file wifi-spectrum-value-helper.cc.

References f(), ns3::BandInfo::fc, ns3::BandInfo::fh, ns3::BandInfo::fl, ns3::g_wifiSpectrumModelMap, ns3::SpectrumModel::GetUid(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by CreateDsssTxPowerSpectralDensity(), CreateDuplicated20MhzTxPowerSpectralDensity(), CreateHeMuOfdmTxPowerSpectralDensity(), CreateHeOfdmTxPowerSpectralDensity(), CreateHtOfdmTxPowerSpectralDensity(), CreateNoisePowerSpectralDensity(), CreateOfdmTxPowerSpectralDensity(), and ns3::WifiSpectrumPhyInterface::SetRxSpectrumModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NormalizeSpectrumMask()

void ns3::WifiSpectrumValueHelper::NormalizeSpectrumMask ( Ptr< SpectrumValue c,
double  txPowerW 
)
static

Normalize the transmit spectrum mask generated by CreateSpectrumMaskForOfdm so that the total transmitted power corresponds to the input value.

Parameters
cspectrumValue to normalize (in W/Hz for each band)
txPowerWtotal transmit power (W) to allocate

Definition at line 769 of file wifi-spectrum-value-helper.cc.

References ns3::SpectrumValue::GetSpectrumModel(), ns3::Integral(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::SpectrumValue::ValuesBegin().

Referenced by CreateDuplicated20MhzTxPowerSpectralDensity(), CreateHeOfdmTxPowerSpectralDensity(), CreateHtOfdmTxPowerSpectralDensity(), and CreateOfdmTxPowerSpectralDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: