23 #include <ns3/fatal-error.h>
44 operator<<(ostream& os,
const vector<int>& v)
84 {1, 2110, 0, 0, 599, 1920, 18000, 18000, 18599},
85 {2, 1930, 600, 600, 1199, 1850, 18600, 18600, 19199},
86 {3, 1805, 1200, 1200, 1949, 1710, 19200, 19200, 19949},
87 {4, 2110, 1950, 1950, 2399, 1710, 19950, 19950, 20399},
88 {5, 869, 2400, 2400, 2649, 824, 20400, 20400, 20649},
89 {6, 875, 2650, 2650, 2749, 830, 20650, 20650, 20749},
90 {7, 2620, 2750, 2750, 3449, 2500, 20750, 20750, 21449},
91 {8, 925, 3450, 3450, 3799, 880, 21450, 21450, 21799},
92 {9, 1844.9, 3800, 3800, 4149, 1749.9, 21800, 21800, 22149},
93 {10, 2110, 4150, 4150, 4749, 1710, 22150, 22150, 22749},
94 {11, 1475.9, 4750, 4750, 4949, 1427.9, 22750, 22750, 22949},
95 {12, 728, 5000, 5000, 5179, 698, 23000, 23000, 23179},
96 {13, 746, 5180, 5180, 5279, 777, 23180, 23180, 23279},
97 {14, 758, 5280, 5280, 5379, 788, 23280, 23280, 23379},
98 {17, 734, 5730, 5730, 5849, 704, 23730, 23730, 23849},
99 {18, 860, 5850, 5850, 5999, 815, 23850, 23850, 23999},
100 {19, 875, 6000, 6000, 6149, 830, 24000, 24000, 24149},
101 {20, 791, 6150, 6150, 6449, 832, 24150, 24150, 24449},
102 {21, 1495.9, 6450, 6450, 6599, 1447.9, 24450, 24450, 24599},
103 {33, 1900, 36000, 36000, 36199, 1900, 36000, 36000, 36199},
104 {34, 2010, 36200, 36200, 36349, 2010, 36200, 36200, 36349},
105 {35, 1850, 36350, 36350, 36949, 1850, 36350, 36350, 36949},
106 {36, 1930, 36950, 36950, 37549, 1930, 36950, 36950, 37549},
107 {37, 1910, 37550, 37550, 37749, 1910, 37550, 37550, 37749},
108 {38, 2570, 37750, 37750, 38249, 2570, 37750, 37750, 38249},
109 {39, 1880, 38250, 38250, 38649, 1880, 38250, 38250, 38649},
110 {40, 2300, 38650, 38650, 39649, 2300, 38650, 38650, 39649},
114 #define NUM_EUTRA_BANDS (sizeof(g_eutraChannelNumbers) / sizeof(EutraChannelNumbers))
194 switch (transmissionBandwidth)
209 NS_FATAL_ERROR(
"invalid bandwidth value " << transmissionBandwidth);
246 static std::map<LteSpectrumModelId, Ptr<SpectrumModel>>
265 double f = fc - (txBandwidthConfiguration * 180e3 / 2.0);
267 for (uint16_t numrb = 0; numrb < txBandwidthConfiguration; ++numrb)
277 ret = Create<SpectrumModel>(rbs);
286 uint16_t txBandwidthConfiguration,
288 std::vector<int> activeRbs)
290 NS_LOG_FUNCTION(earfcn << txBandwidthConfiguration << powerTx << activeRbs);
296 double powerTxW = std::pow(10., (powerTx - 30) / 10);
298 double txPowerDensity = (powerTxW / (txBandwidthConfiguration * 180000));
300 for (
auto it = activeRbs.begin(); it != activeRbs.end(); it++)
303 (*txPsd)[rbId] = txPowerDensity;
313 uint16_t txBandwidthConfiguration,
315 std::map<int, double> powerTxMap,
316 std::vector<int> activeRbs)
324 double basicPowerTxW = std::pow(10., (powerTx - 30) / 10);
326 for (
auto it = activeRbs.begin(); it != activeRbs.end(); it++)
330 auto powerIt = powerTxMap.find(rbId);
332 double txPowerDensity;
334 if (powerIt != powerTxMap.end())
336 double powerTxW = std::pow(10., (powerIt->second - 30) / 10);
337 txPowerDensity = (powerTxW / (txBandwidthConfiguration * 180000));
341 txPowerDensity = (basicPowerTxW / (txBandwidthConfiguration * 180000));
344 (*txPsd)[rbId] = txPowerDensity;
354 uint16_t txBandwidthConfiguration,
356 std::vector<int> activeRbs)
358 NS_LOG_FUNCTION(earfcn << txBandwidthConfiguration << powerTx << activeRbs);
364 double powerTxW = std::pow(10., (powerTx - 30) / 10);
366 double txPowerDensity = (powerTxW / (activeRbs.size() * 180000));
368 for (
auto it = activeRbs.begin(); it != activeRbs.end(); it++)
371 (*txPsd)[rbId] = txPowerDensity;
381 uint16_t txBandwidthConfiguration,
397 const double kT_dBm_Hz = -174.0;
398 double kT_W_Hz = std::pow(10.0, (kT_dBm_Hz - 30) / 10.0);
399 double noiseFigureLinear = std::pow(10.0, noiseFigureDb / 10.0);
400 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear;
403 (*noisePsd) = noisePowerSpectralDensity;
double f(double x, void *params)
static Ptr< SpectrumValue > CreateUlTxPowerSpectralDensity(uint16_t earfcn, uint16_t bandwidth, double powerTx, std::vector< int > activeRbs)
create a spectrum value representing the uplink power spectral density of a signal to be transmitted.
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t earfcn, uint16_t bandwidth, double noiseFigure)
create a SpectrumValue that models the power spectral density of AWGN
static Ptr< SpectrumValue > CreateTxPowerSpectralDensity(uint32_t earfcn, uint16_t bandwidth, double powerTx, std::vector< int > activeRbs)
create a spectrum value representing the power spectral density of a signal to be transmitted.
static uint16_t GetUplinkCarrierBand(uint32_t nUl)
Converts uplink EARFCN to corresponding LTE frequency band number.
static uint16_t GetDownlinkCarrierBand(uint32_t nDl)
Converts downlink EARFCN to corresponding LTE frequency band number.
static double GetChannelBandwidth(uint16_t txBandwidthConf)
static double GetUplinkCarrierFrequency(uint32_t earfcn)
Calculates the uplink carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARF...
static double GetCarrierFrequency(uint32_t earfcn)
Calculates the carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARFCN) acc...
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint16_t bandwidth)
static double GetDownlinkCarrierFrequency(uint32_t earfcn)
Calculates the downlink carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EA...
SpectrumModelUid_t GetUid() const
#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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NUM_EUTRA_BANDS
number of EUTRA bands
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static std::map< LteSpectrumModelId, Ptr< SpectrumModel > > g_lteSpectrumModelMap
LTE spectrum model map.
static const EutraChannelNumbers g_eutraChannelNumbers[]
Eutra channel numbers.
std::vector< BandInfo > Bands
Container of BandInfo.
bool operator<(const EventId &a, const EventId &b)
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
Table 5.7.3-1 "E-UTRA channel numbers" from 3GPP TS 36.101 The table was converted to C syntax doing ...
uint32_t nOffsDl
number offset DL
uint32_t rangeNdl2
range DL 2
uint32_t nOffsUl
number offset UL
uint32_t rangeNdl1
range DL 1
uint32_t rangeNul2
range UL 2
uint32_t rangeNul1
range UL 1
LteSpectrumModelId structure.
uint16_t bandwidth
bandwidth
LteSpectrumModelId(uint32_t f, uint8_t b)
Constructor.