diff --git a/src/wifi/model/wifi-spectrum-value-helper.cc b/src/wifi/model/wifi-spectrum-value-helper.cc index 4f1e5c13a..90b0e60f7 100644 --- a/src/wifi/model/wifi-spectrum-value-helper.cc +++ b/src/wifi/model/wifi-spectrum-value-helper.cc @@ -23,6 +23,8 @@ #include "wifi-spectrum-value-helper.h" +#include "wifi-utils.h" + #include "ns3/assert.h" #include "ns3/fatal-error.h" #include "ns3/log.h" @@ -689,37 +691,6 @@ WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity( return c; } -Ptr -WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity(uint16_t centerFrequency, - ChannelWidthMhz channelWidth, - uint32_t carrierSpacing, - double noiseFigure, - ChannelWidthMhz guardBandwidth) -{ - Ptr model = - GetSpectrumModel({centerFrequency}, channelWidth, carrierSpacing, guardBandwidth); - return CreateNoisePowerSpectralDensity(noiseFigure, model); -} - -Ptr -WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity(double noiseFigureDb, - Ptr spectrumModel) -{ - NS_LOG_FUNCTION(noiseFigureDb << spectrumModel); - - // see "LTE - From theory to practice" - // Section 22.4.4.2 Thermal Noise and Receiver Noise Figure - const double kT_dBm_Hz = -174.0; // dBm/Hz - double kT_W_Hz = DbmToW(kT_dBm_Hz); - double noiseFigureLinear = std::pow(10.0, noiseFigureDb / 10.0); - double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear; - - Ptr noisePsd = Create(spectrumModel); - (*noisePsd) = noisePowerSpectralDensity; - NS_LOG_INFO("NoisePowerSpectralDensity has integrated power of " << Integral(*noisePsd)); - return noisePsd; -} - void WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm( Ptr c, @@ -1132,12 +1103,6 @@ WifiSpectrumValueHelper::NormalizeSpectrumMask(Ptr c, double txPo } } -double -WifiSpectrumValueHelper::DbmToW(double dBm) -{ - return std::pow(10.0, 0.1 * (dBm - 30.0)); -} - double WifiSpectrumValueHelper::GetBandPowerW(Ptr psd, const std::vector& segments) diff --git a/src/wifi/model/wifi-spectrum-value-helper.h b/src/wifi/model/wifi-spectrum-value-helper.h index dd02c7b1d..47fbd8c08 100644 --- a/src/wifi/model/wifi-spectrum-value-helper.h +++ b/src/wifi/model/wifi-spectrum-value-helper.h @@ -238,34 +238,6 @@ class WifiSpectrumValueHelper ChannelWidthMhz guardBandwidth, const std::vector& ru); - /** - * Create a power spectral density corresponding to the noise - * - * \param centerFrequency center frequency (MHz) - * \param channelWidth channel width (MHz) - * \param carrierSpacing carrier spacing (Hz) - * \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K - * \param guardBandwidth width of the guard band (MHz) - * \return a pointer to a newly allocated SpectrumValue representing the noise Power Spectral - * Density in W/Hz for each Band - */ - static Ptr CreateNoisePowerSpectralDensity(uint16_t centerFrequency, - ChannelWidthMhz channelWidth, - uint32_t carrierSpacing, - double noiseFigure, - ChannelWidthMhz guardBandwidth); - - /** - * Create a thermal noise power spectral density - * - * \param noiseFigure the noise figure - * \param spectrumModel the spectrum model - * \return a pointer to a newly allocated SpectrumValue representing the noise Power Spectral - * Density in W/Hz corresponding to thermal noise, for each Band - */ - static Ptr CreateNoisePowerSpectralDensity(double noiseFigure, - Ptr spectrumModel); - /** * Create a transmit power spectral density corresponding to OFDM * transmit spectrum mask requirements for 11a/11g/11n/11ac/11ax @@ -333,17 +305,6 @@ class WifiSpectrumValueHelper */ static void NormalizeSpectrumMask(Ptr c, double txPowerW); - /** - * 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. - * - * \param dbm the power in dBm - * - * \return the equivalent Watts for the given dBm - */ - static double DbmToW(double dbm); - /** * Calculate the power of the specified band composed of uniformly-sized sub-bands. *