1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  * Author: Giuseppe Piro  <g.piro@poliba.it>
19  */
20 
21 #ifndef LTE_SPECTRUM_VALUE_HELPER_H
22 #define LTE_SPECTRUM_VALUE_HELPER_H
23 
24 
25 #include <ns3/spectrum-value.h>
26 #include <vector>
27 
28 namespace ns3 {
29 
30 
31 /**
32  * \ingroup lte
33  *
34  * \brief This class defines all functions to create spectrum model for lte
35  */
36 class LteSpectrumValueHelper
37 {
38 public:
39   /**
40    * Calculates the carrier frequency from the E-UTRA Absolute
41    * Radio Frequency Channel Number (EARFCN) according to 3GPP TS
42    * 36.101 section 5.7.3 "Carrier frequency and EARFCN".
43    *
44    * \param earfcn the EARFCN
45    *
46    * \return the carrier frequency in Hz
47    */
48   static double GetCarrierFrequency (uint32_t earfcn);
49 
50   /**
51    * Converts downlink EARFCN to corresponding LTE frequency band number.
52    *
53    * \param nDl the EARFCN
54    *
55    * \return the downlink carrier band
56    */
57   static uint16_t GetDownlinkCarrierBand (uint32_t nDl);
58 
59   /**
60    * Converts uplink EARFCN to corresponding LTE frequency band number.
61    *
62    * \param nUl the EARFCN
63    *
64    * \return the uplink carrier band
65    */
66   static uint16_t GetUplinkCarrierBand (uint32_t nUl);
67 
68   /**
69    * Calculates the downlink carrier frequency from the E-UTRA Absolute
70    * Radio Frequency Channel Number (EARFCN) using the formula in 3GPP TS
71    * 36.101 section 5.7.3 "Carrier frequency and EARFCN".
72    *
73    * \param earfcn the EARFCN
74    *
75    * \return the downlink carrier frequency in Hz
76    */
77   static double GetDownlinkCarrierFrequency (uint32_t earfcn);
78 
79   /**
80    * Calculates the uplink carrier frequency from the E-UTRA Absolute
81    * Radio Frequency Channel Number (EARFCN) using the formula in 3GPP TS
82    * 36.101 section 5.7.3 "Carrier frequency and EARFCN".
83    *
84    * \param earfcn the EARFCN
85    *
86    * \return the uplink carrier frequency in Hz
87    */
88   static double GetUplinkCarrierFrequency (uint32_t earfcn);
89 
90   /**
91    *
92    *
93    * \param txBandwidthConf the tranmission bandwidth
94    * configuration in number of resource blocks
95    *
96    * \return the nominal channel bandwidth in Hz as per 3GPP TS 36.101
97    */
98   static double GetChannelBandwidth (uint16_t txBandwidthConf);
99 
100   /**
101    *
102    * \param earfcn the carrier frequency (EARFCN) at which reception
103    * is made
104    * \param bandwidth the Transmission Bandwidth Configuration in
105    * number of resource blocks
106    *
107    * \return the static SpectrumModel instance corresponding to the
108    * given carrier frequency and transmission bandwidth
109    * configuration. If such SpectrumModel does not exist, it is
110    * created.
111    */
112   static Ptr<SpectrumModel> GetSpectrumModel (uint32_t earfcn, uint16_t bandwidth);
113 
114 
115   /**
116    * create a spectrum value representing the power spectral
117    * density of a signal to be transmitted. See 3GPP TS 36.101 for
118    * a definition of most of the parameters described here.
119    *
120    * \param earfcn the carrier frequency (EARFCN) of the transmission
121    * \param bandwidth the Transmission Bandwidth Configuration in
122    * number of resource blocks
123    * \param powerTx the total power in dBm over the whole bandwidth
124    * \param activeRbs the list of Active Resource Blocks (PRBs)
125    *
126    * \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral Density in W/Hz for each Resource Block
127    */
128   static Ptr<SpectrumValue> CreateTxPowerSpectralDensity (uint32_t earfcn,
129                                                           uint16_t bandwidth,
130                                                           double powerTx,
131                                                           std::vector <int> activeRbs);
132 
133   /**
134    * create a spectrum value representing the power spectral
135    * density of a signal to be transmitted. See 3GPP TS 36.101 for
136    * a definition of most of the parameters described here.
137    *
138    * \param earfcn the carrier frequency (EARFCN) of the transmission
139    * \param bandwidth the Transmission Bandwidth Configuration in
140    * number of resource blocks
141    * \param powerTx the total power in dBm over the whole bandwidth
142    * \param powerTxMap the map of power in dBm for each RB,
143    * if map contain power for RB, powerTx is not used for this RB,
144    * otherwise powerTx is set for this RB
145    * \param activeRbs the list of Active Resource Blocks (PRBs)
146    *
147    * \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral Density in W/Hz for each Resource Block
148    */
149   static Ptr<SpectrumValue> CreateTxPowerSpectralDensity (uint32_t earfcn,
150                                                           uint16_t bandwidth,
151                                                           double powerTx,
152                                                           std::map<int, double> powerTxMap,
153                                                           std::vector <int> activeRbs);
154 
155   /**
156    * create a spectrum value representing the uplink power spectral
157    * density of a signal to be transmitted. See 3GPP TS 36.101 for
158    * a definition of most of the parameters described here.
159    * This function splits the power over the active RBs instead of
160    * the entire bandwidth
161    * \param earfcn the carrier frequency (EARFCN) of the transmission
162    * \param bandwidth the Transmission Bandwidth Configuration in
163    * number of resource blocks
164    * \param powerTx the total power in dBm over the whole bandwidth
165    * \param activeRbs the list of Active Resource Blocks (PRBs)
166    *
167    * \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral Density in W/Hz for each Resource Block
168    */
169   static Ptr<SpectrumValue> CreateUlTxPowerSpectralDensity (uint16_t earfcn,
170                                                             uint16_t bandwidth,
171                                                             double powerTx,
172                                                             std::vector <int> activeRbs);
173 
174   /**
175    * create a SpectrumValue that models the power spectral density of AWGN
176    *
177    * \param earfcn the carrier frequency (EARFCN) at which reception
178    * is made
179    * \param bandwidth the Transmission Bandwidth Configuration in
180    * number of resource blocks
181    * \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K
182    *
183    * \return a pointer to a newly allocated SpectrumValue representing the noise Power Spectral Density in W/Hz for each Resource Block
184    */
185   static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity (uint32_t earfcn, uint16_t bandwidth, double noiseFigure);
186 
187   /**
188    *  create a SpectrumValue that models the power spectral density of AWGN
189    *
190    * \param noiseFigure  the noise figure in dB  w.r.t. a reference temperature of 290K
191    * \param spectrumModel the SpectrumModel instance to be used
192    *
193    * \return a pointer to a newly allocated SpectrumValue representing the noise Power Spectral Density in W/Hz for each Resource Block
194    */
195   static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity (double noiseFigure, Ptr<SpectrumModel> spectrumModel);
196 
197 };
198 
199 
200 } // namespace ns3
201 
202 
203 
204 #endif /*  LTE_SPECTRUM_VALUE_HELPER_H */
205