22 #include <ns3/spectrum-value.h>
48 for (
int i = -1; i < 83; i++)
51 bi.
fl = 2400.5e6 + i * 1.0e6;
52 bi.
fh = 2400.5e6 + (i + 1) * 1.0e6;
53 bi.
fc = (bi.
fl + bi.
fh) / 2;
80 txPower = pow(10., (txPower - 30) / 10);
87 double txPowerDensity = txPower / 2.0e6;
93 (*txPsd)[2405 + 5 * (
channel - 11) - 2400 - 2] = txPowerDensity * 0.005;
94 (*txPsd)[2405 + 5 * (
channel - 11) - 2400 - 1] = txPowerDensity * 0.495;
95 (*txPsd)[2405 + 5 * (
channel - 11) - 2400] = txPowerDensity;
96 (*txPsd)[2405 + 5 * (
channel - 11) - 2400 + 1] = txPowerDensity * 0.495;
97 (*txPsd)[2405 + 5 * (
channel - 11) - 2400 + 2] = txPowerDensity * 0.005;
112 static const double BOLTZMANN = 1.3803e-23;
114 double Nt = BOLTZMANN * 290.0;
120 (*noisePsd)[2405 + 5 * (
channel - 11) - 2400 - 2] = noisePowerDensity;
121 (*noisePsd)[2405 + 5 * (
channel - 11) - 2400 - 1] = noisePowerDensity;
122 (*noisePsd)[2405 + 5 * (
channel - 11) - 2400] = noisePowerDensity;
123 (*noisePsd)[2405 + 5 * (
channel - 11) - 2400 + 1] = noisePowerDensity;
124 (*noisePsd)[2405 + 5 * (
channel - 11) - 2400 + 2] = noisePowerDensity;
139 double totalAvgPower = 0.0;
145 totalAvgPower += (*psd)[2405 + 5 * (
channel - 11) - 2400 - 2];
146 totalAvgPower += (*psd)[2405 + 5 * (
channel - 11) - 2400 - 1];
147 totalAvgPower += (*psd)[2405 + 5 * (
channel - 11) - 2400];
148 totalAvgPower += (*psd)[2405 + 5 * (
channel - 11) - 2400 + 1];
149 totalAvgPower += (*psd)[2405 + 5 * (
channel - 11) - 2400 + 2];
150 totalAvgPower *= 1.0e6;
152 return totalAvgPower;
double f(double x, void *params)
Helper class used to automatically initialize the LrWpan Spectrum Model objects.
LrWpanSpectrumModelInitializer()
virtual ~LrWpanSpectrumValueHelper()
Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t channel)
create spectrum value for noise
double m_noiseFactor
A scaling factor for the noise power.
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()
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::LrWpanSpectrumModelInitializer g_LrWpanSpectrumModelInitializerInstance
Global object used to initialize the LrWpan Spectrum Model.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< SpectrumModel > g_LrWpanSpectrumModel
Global object used to initialize the LrWpan Spectrum Model.
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