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;
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;
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;
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;
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 "...
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#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
Container of BandInfo.
Ptr< SpectrumModel > g_LrWpanSpectrumModel
Global object used to initialize the LrWpan Spectrum Model.
double fc
center frequency
LrWpanSpectrumValueHelper(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double fl
lower limit of subband
Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t channel)
create spectrum value for noise
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint32_t channel)
create spectrum value
class ns3::LrWpanSpectrumModelInitializer g_LrWpanSpectrumModelInitializerInstance
Global object used to initialize the LrWpan Spectrum Model.
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 ...
LrWpanSpectrumModelInitializer(void)
double fh
upper limit of subband
The building block of a SpectrumModel.