22 #include <ns3/spectrum-value.h>
42 for (
int i = -1; i < 83; i++)
45 bi.
fl = 2400.5e6 + i * 1.0e6;
46 bi.
fh = 2400.5e6 + (i + 1) * 1.0e6;
47 bi.
fc = (bi.
fl + bi.
fh) / 2;
73 txPower = pow (10., (txPower - 30) / 10);
80 double txPowerDensity = txPower / 2.0e6;
82 NS_ASSERT_MSG ((channel >= 11 && channel <= 26),
"Invalid channel numbers");
86 (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 2] = txPowerDensity * 0.005;
87 (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 1] = txPowerDensity * 0.495;
88 (*txPsd)[2405 + 5 * (channel - 11) - 2400] = txPowerDensity;
89 (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 1 ] = txPowerDensity * 0.495;
90 (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 2 ] = txPowerDensity * 0.005;
105 static const double BOLTZMANN = 1.3803e-23;
107 double Nt = BOLTZMANN * 290.0;
111 NS_ASSERT_MSG ((channel >= 11 && channel <= 26),
"Invalid channel numbers");
113 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 - 2] = noisePowerDensity;
114 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 - 1] = noisePowerDensity;
115 (*noisePsd)[2405 + 5 * (channel - 11) - 2400] = noisePowerDensity;
116 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 + 1] = noisePowerDensity;
117 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 + 2] = noisePowerDensity;
126 double totalAvgPower = 0.0;
131 totalAvgPower =
Sum (*psd * 1.0e6);
132 return totalAvgPower;
virtual ~LrWpanSpectrumValueHelper(void)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
class ns3::LrWpanSpectrumModelInitializer g_LrWpanSpectrumModelInitializerInstance
#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
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)
LrWpanSpectrumModelInitializer(void)
double fh
upper limit of subband
The building block of a SpectrumModel.