22 #include <ns3/spectrum-value.h>
46 for (
int i = -1; i < 83; i++)
49 bi.
fl = 2400.5e6 + i * 1.0e6;
50 bi.
fh = 2400.5e6 + (i + 1) * 1.0e6;
51 bi.
fc = (bi.
fl + bi.
fh) / 2;
77 txPower = pow (10., (txPower - 30) / 10);
84 double txPowerDensity = txPower / 2.0e6;
86 NS_ASSERT_MSG ((channel >= 11 && channel <= 26),
"Invalid channel numbers");
90 (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 2] = txPowerDensity * 0.005;
91 (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 1] = txPowerDensity * 0.495;
92 (*txPsd)[2405 + 5 * (channel - 11) - 2400] = txPowerDensity;
93 (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 1 ] = txPowerDensity * 0.495;
94 (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 2 ] = txPowerDensity * 0.005;
109 static const double BOLTZMANN = 1.3803e-23;
111 double Nt = BOLTZMANN * 290.0;
115 NS_ASSERT_MSG ((channel >= 11 && channel <= 26),
"Invalid channel numbers");
117 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 - 2] = noisePowerDensity;
118 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 - 1] = noisePowerDensity;
119 (*noisePsd)[2405 + 5 * (channel - 11) - 2400] = noisePowerDensity;
120 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 + 1] = noisePowerDensity;
121 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 + 2] = noisePowerDensity;
130 double totalAvgPower = 0.0;
135 totalAvgPower =
Sum (*psd * 1.0e6);
136 return totalAvgPower;
Helper class used to automatically initialize the LrWpan Spectrum Model objects.
virtual ~LrWpanSpectrumValueHelper(void)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
double m_noiseFactor
A scaling factor for the noise power.
std::vector< BandInfo > Bands
Ptr< SpectrumModel > g_LrWpanSpectrumModel
Global object used to initialize the LrWpan Spectrum Model.
double fc
center frequency
LrWpanSpectrumValueHelper(void)
double fl
lower limit of subband
static double TotalAvgPower(Ptr< const SpectrumValue > psd)
total average power of the signal is the integral of the PSD
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t channel)
create spectrum value for noise
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint32_t channel)
create spectrum value
double Sum(const SpectrumValue &x)
class ns3::LrWpanSpectrumModelInitializer g_LrWpanSpectrumModelInitializerInstance
Global object used to initialize the LrWpan Spectrum Model.
LrWpanSpectrumModelInitializer(void)
double fh
upper limit of subband
The building block of a SpectrumModel.