11#include <ns3/spectrum-value.h>
39 for (
int i = -1; i < 83; i++)
42 bi.
fl = 2400.5e6 + i * 1.0e6;
43 bi.
fh = 2400.5e6 + (i + 1) * 1.0e6;
44 bi.
fc = (bi.
fl + bi.
fh) / 2;
71 txPower = pow(10., (txPower - 30) / 10);
78 double txPowerDensity = txPower / 2.0e6;
80 NS_ASSERT_MSG((channel >= 11 && channel <= 26),
"Invalid channel numbers");
84 (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 2] = txPowerDensity * 0.005;
85 (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 1] = txPowerDensity * 0.495;
86 (*txPsd)[2405 + 5 * (channel - 11) - 2400] = txPowerDensity;
87 (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 1] = txPowerDensity * 0.495;
88 (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 2] = txPowerDensity * 0.005;
103 static const double BOLTZMANN = 1.3803e-23;
105 double Nt = BOLTZMANN * 290.0;
109 NS_ASSERT_MSG((channel >= 11 && channel <= 26),
"Invalid channel numbers");
111 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 - 2] = noisePowerDensity;
112 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 - 1] = noisePowerDensity;
113 (*noisePsd)[2405 + 5 * (channel - 11) - 2400] = noisePowerDensity;
114 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 + 1] = noisePowerDensity;
115 (*noisePsd)[2405 + 5 * (channel - 11) - 2400 + 2] = noisePowerDensity;
130 double totalAvgPower = 0.0;
136 totalAvgPower += (*psd)[2405 + 5 * (channel - 11) - 2400 - 2];
137 totalAvgPower += (*psd)[2405 + 5 * (channel - 11) - 2400 - 1];
138 totalAvgPower += (*psd)[2405 + 5 * (channel - 11) - 2400];
139 totalAvgPower += (*psd)[2405 + 5 * (channel - 11) - 2400 + 1];
140 totalAvgPower += (*psd)[2405 + 5 * (channel - 11) - 2400 + 2];
141 totalAvgPower *= 1.0e6;
143 return totalAvgPower;
Smart pointer class similar to boost::intrusive_ptr.
Helper class used to automatically initialize the LrWpan Spectrum Model objects.
LrWpanSpectrumModelInitializer()
Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t channel)
create spectrum value for noise
virtual ~LrWpanSpectrumValueHelper()
static double TotalAvgPower(Ptr< const SpectrumValue > psd, uint32_t channel)
total average power of the signal is the integral of the PSD using the limits of the given channel
LrWpanSpectrumValueHelper()
double m_noiseFactor
A scaling factor for the noise power.
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint32_t channel)
create spectrum value
void SetNoiseFactor(double f)
Set the noise factor added to the thermal noise.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
class ns3::lrwpan::LrWpanSpectrumModelInitializer g_LrWpanSpectrumModelInitializerInstance
Global object used to initialize the LrWpan Spectrum Model.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Ptr< SpectrumModel > g_LrWpanSpectrumModel
Global object used to initialize the LrWpan Spectrum Model.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< BandInfo > Bands
Container of BandInfo.
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband