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 Types

typedef std::pair< uint32_t, uint32_t > StartStop
 typedef for a pair of start and stop sub-band indexes More...
 

Public Member Functions

virtual ~WifiSpectrumValueHelper ()
 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< SpectrumValueCreateHeOfdmTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth)
 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)
 Create a transmit power spectral density corresponding to OFDM High Throughput (HT) (802.11n/ac). More...
 
static Ptr< SpectrumValueCreateNoisePowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, double noiseFigure, uint16_t guardBandwidth)
 Create a power spectral density corresponding to the noise. More...
 
static Ptr< SpectrumValueCreateNoisePowerSpectralDensity (double noiseFigure, Ptr< SpectrumModel > spectrumModel)
 Create a thermal noise power spectral density. More...
 
static Ptr< SpectrumValueCreateOfdmTxPowerSpectralDensity (uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth)
 Create a transmit power spectral density corresponding to OFDM (802.11a/g). More...
 
static Ptr< SpectrumValueCreateRfFilter (uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth)
 Create a spectral density corresponding to the RF filter. More...
 
static void CreateSpectrumMaskForOfdm (Ptr< SpectrumValue > c, std::vector< StartStop > allocatedSubBands, StartStop maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, double lowestPointDbr)
 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 Ptr< SpectrumModelGetSpectrumModel (uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, 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 38 of file wifi-spectrum-value-helper.h.

Member Typedef Documentation

◆ StartStop

typedef std::pair<uint32_t, uint32_t> ns3::WifiSpectrumValueHelper::StartStop

typedef for a pair of start and stop sub-band indexes

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

Constructor & Destructor Documentation

◆ ~WifiSpectrumValueHelper()

ns3::WifiSpectrumValueHelper::~WifiSpectrumValueHelper ( )
virtual

Destructor.

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

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 136 of file wifi-spectrum-value-helper.cc.

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

Referenced by ns3::SpectrumWifiPhy::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 
)
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)
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 330 of file wifi-spectrum-value-helper.cc.

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

Referenced by ns3::SpectrumWifiPhy::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 
)
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)
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 213 of file wifi-spectrum-value-helper.cc.

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

Referenced by ns3::SpectrumWifiPhy::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 ( uint32_t  centerFrequency,
uint16_t  channelWidth,
uint32_t  bandBandwidth,
double  noiseFigure,
uint16_t  guardBandwidth 
)
static

Create a power spectral density corresponding to the noise.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
bandBandwidthwidth of each band (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 427 of file wifi-spectrum-value-helper.cc.

References GetSpectrumModel().

+ Here is the call graph for this function:

◆ CreateNoisePowerSpectralDensity() [2/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 434 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:

◆ CreateOfdmTxPowerSpectralDensity()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity ( uint32_t  centerFrequency,
uint16_t  channelWidth,
double  txPowerW,
uint16_t  guardBandwidth 
)
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)
Returns
a pointer to a newly allocated SpectrumValue representing the OFDM Transmit Power Spectral Density in W/Hz for each Band

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

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

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

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

◆ CreateRfFilter()

Ptr< SpectrumValue > ns3::WifiSpectrumValueHelper::CreateRfFilter ( uint32_t  centerFrequency,
uint16_t  channelWidth,
uint32_t  bandBandwidth,
uint16_t  guardBandwidth 
)
static

Create a spectral density corresponding to the RF filter.

Parameters
centerFrequencycenter frequency (MHz)
channelWidthchannel width (MHz)
bandBandwidthwidth of each band (Hz)
guardBandwidthwidth of the guard band (MHz)
Returns
a pointer to a SpectrumValue representing the RF filter applied to an received power spectral density

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

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

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

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

◆ CreateSpectrumMaskForOfdm()

void ns3::WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm ( Ptr< SpectrumValue c,
std::vector< StartStop allocatedSubBands,
StartStop  maskBand,
double  txPowerPerBandW,
uint32_t  nGuardBands,
uint32_t  innerSlopeWidth,
double  lowestPointDbr 
)
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.

[ 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)
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 479 of file wifi-spectrum-value-helper.cc.

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

Referenced by 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 620 of file wifi-spectrum-value-helper.cc.

Referenced by CreateNoisePowerSpectralDensity(), and CreateSpectrumMaskForOfdm().

+ Here is the caller graph for this function:

◆ GetSpectrumModel()

Ptr< SpectrumModel > ns3::WifiSpectrumValueHelper::GetSpectrumModel ( uint32_t  centerFrequency,
uint16_t  channelWidth,
uint32_t  bandBandwidth,
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)
bandBandwidthwidth of each band (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 86 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(), CreateHeOfdmTxPowerSpectralDensity(), CreateHtOfdmTxPowerSpectralDensity(), CreateNoisePowerSpectralDensity(), CreateOfdmTxPowerSpectralDensity(), CreateRfFilter(), ns3::SpectrumWifiPhy::GetRxSpectrumModel(), and ns3::SpectrumWifiPhy::ResetSpectrumModel().

+ 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 604 of file wifi-spectrum-value-helper.cc.

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

Referenced by 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: