A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Manuel Requena <manuel.requena@cttc.es>
18 * Author: Marco Miozzo <marco.miozzo@cttc.es>
19 */
20#ifndef LTE_COMMON_H
21#define LTE_COMMON_H
22
23#include "ns3/uinteger.h"
24
25#include <cmath>
26
27// see 36.213 section 8
28#define UL_PUSCH_TTIS_DELAY 4
29
30#define HARQ_PERIOD 7
31
32namespace ns3
33{
34
35/// Minimum number of carrier components allowed by 3GPP up to R13
36constexpr uint32_t MIN_NO_CC = 1;
37
38/// Maximum number of carrier components allowed by 3GPP up to R13
39constexpr uint32_t MAX_NO_CC = 5;
40
41/// LteFlowId structure
43{
44 uint16_t m_rnti; ///< RNTI
45 uint8_t m_lcId; ///< LCID
46
47 public:
49 /**
50 * Constructor
51 *
52 * \param a RNTI
53 * \param b LCID
54 */
55 LteFlowId_t(const uint16_t a, const uint8_t b);
56
57 friend bool operator==(const LteFlowId_t& a, const LteFlowId_t& b);
58 friend bool operator<(const LteFlowId_t& a, const LteFlowId_t& b);
59};
60
61/// ImsiLcidPair structure
63{
64 uint64_t m_imsi; ///< IMSI
65 uint8_t m_lcId; ///< LCID
66
67 public:
69 /**
70 * Constructor
71 *
72 * \param a first pair
73 * \param b second pair
74 */
75 ImsiLcidPair_t(const uint64_t a, const uint8_t b);
76
77 friend bool operator==(const ImsiLcidPair_t& a, const ImsiLcidPair_t& b);
78 friend bool operator<(const ImsiLcidPair_t& a, const ImsiLcidPair_t& b);
79};
80
81/**
82 * \brief Parameters for configuring the UE
83 */
85{
86 /**
87 * RNTI
88 */
89 uint16_t m_rnti;
90 /**
91 * When false means that the message is intended for configuring a new UE
92 */
94 /**
95 * Transmission mode [1..7] (i.e., SISO, MIMO, etc.)
96 */
98 /**
99 * Srs Configuration index for UE specific SRS, see section 8.2 of TS 36.213
100 */
102
103 public:
105
106 /**
107 * Equality operator
108 *
109 * \param a lhs
110 * \param b rhs
111 * \returns true if "equal"
112 */
113 friend bool operator==(const LteUeConfig_t& a, const LteUeConfig_t& b);
114 /**
115 * Less than operator
116 *
117 * \param a lhs
118 * \param b rhs
119 * \returns true if "less than"
120 */
121 friend bool operator<(const LteUeConfig_t& a, const LteUeConfig_t& b);
122};
123
124/// LteFfConverter class
126{
127 public:
128 /**
129 * Convert from double to fixed point S11.3 notation
130 *
131 * \param val double value
132 * \returns fixed point S11.3 value
133 */
134 static uint16_t double2fpS11dot3(double val);
135 /**
136 * Convert from fixed point S11.3 notation to double
137 *
138 * \param val fixed point S11.3 value
139 * \returns double value
140 */
141 static double fpS11dot3toDouble(uint16_t val);
142 /**
143 * Get minimum fixed point S11.3 value
144 *
145 * \returns double value for the minimum fixed point S11.3 value
146 */
147 static double getMinFpS11dot3Value();
148
149 // static const double MIN_FP_S11DOT3_VALUE = -4096;
150};
151
152/// BufferSizeLevelBsr class
154{
155 public:
156 /**
157 * Convert BSR ID to buffer size
158 *
159 * \param val BSR ID
160 * \returns buffer size
161 */
162 static uint32_t BsrId2BufferSize(uint8_t val);
163 /**
164 * Convert Buffer size to BSR ID
165 *
166 * \param val buffer size
167 * \returns BSR ID
168 */
169 static uint8_t BufferSize2BsrId(uint32_t val);
170
171 static int m_bufferSizeLevelBsr[64]; ///< buffer size level BSR
172};
173
174/// TransmissionModesLayers class
176{
177 public:
178 /**
179 * Transmit mode 2 layer number
180 * \param txMode the transmit mode
181 * \returns the layer 2 number
182 */
183 static uint8_t TxMode2LayerNum(uint8_t txMode);
184};
185
186/// PhyTransmissionStatParameters structure
188{
189 int64_t m_timestamp; ///< in millisecond
190 uint16_t m_cellId; ///< Cell ID of the attached Enb
191 uint64_t m_imsi; ///< IMSI of the scheduled UE
192 uint16_t m_rnti; ///< C-RNTI scheduled
193 uint8_t m_txMode; ///< the transmission Mode
194 uint8_t m_layer; ///< the layer (cw) of the transmission
195 uint8_t m_mcs; ///< MCS for transport block
196 uint16_t m_size; ///< Size of transport block
197 uint8_t m_rv; ///< the redundancy version (HARQ)
198 uint8_t m_ndi; ///< new data indicator flag
199 uint8_t m_ccId; ///< component carrier id
200
201 /**
202 * TracedCallback signature.
203 *
204 * \param [in] params Value of the PhyTransmissionionStatParameters.
205 * \todo The argument should be passed by const reference, since it's large.
206 */
207 typedef void (*TracedCallback)(const PhyTransmissionStatParameters params);
208};
209
210/// PhyReceptionStatParameters structure
212{
213 int64_t m_timestamp; ///< in millisecond
214 uint16_t m_cellId; ///< Cell ID of the attached Enb
215 uint64_t m_imsi; ///< IMSI of the scheduled UE
216 uint16_t m_rnti; ///< C-RNTI scheduled
217 uint8_t m_txMode; ///< the transmission Mode
218 uint8_t m_layer; ///< the layer (cw) of the transmission
219 uint8_t m_mcs; ///< MCS for transport block
220 uint16_t m_size; ///< Size of transport block
221 uint8_t m_rv; ///< the redundancy version (HARQ)
222 uint8_t m_ndi; ///< new data indicator flag
223 uint8_t m_correctness; ///< correctness of the TB received
224 uint8_t m_ccId; ///< component carrier id
225
226 /**
227 * TracedCallback signature.
228 *
229 * \param [in] params Value of the PhyReceptionStatParameters.
230 * \todo The argument should be passed by const reference, since it's large.
231 */
232 typedef void (*TracedCallback)(const PhyReceptionStatParameters params);
233};
234
235/// DlSchedulingCallbackInfo structure
237{
238 uint32_t frameNo; ///< frame number
239 uint32_t subframeNo; ///< subframe number
240 uint16_t rnti; ///< RNTI
241 uint8_t mcsTb1; ///< MCS TB1
242 uint16_t sizeTb1; ///< size TB1
243 uint8_t mcsTb2; ///< MCS TB2
244 uint16_t sizeTb2; ///< size TB2
245 uint8_t componentCarrierId; ///< component carrier ID
246};
247
248/**
249 * Implements the E-UTRA measurement mappings defined in 3GPP TS
250 * 36.133 section 9.1 E-UTRAN measurements
251 *
252 */
254{
255 public:
256 /**
257 * converts an RSRP range to dBm as per
258 * 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping
259 *
260 * \param range the RSRP range value
261 *
262 * \return the corresponding RSRP value in dBm
263 */
264 static double RsrpRange2Dbm(uint8_t range);
265
266 /**
267 * convert an RSRP value in dBm to the corresponding range as per
268 * 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping
269 *
270 * \param dbm the RSRP value in dBm
271 *
272 * \return the corresponding range
273 */
274 static uint8_t Dbm2RsrpRange(double dbm);
275
276 /**
277 * converts an RSRQ range to dB as per
278 * 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping
279 *
280 * \param range the RSRQ range value
281 *
282 * \return the corresponding RSRQ value in dB
283 */
284 static double RsrqRange2Db(uint8_t range);
285
286 /**
287 * convert an RSRQ value in dB to the corresponding range as per
288 * 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping
289 *
290 * \param db the RSRQ value in dB
291 *
292 * \return the corresponding range
293 */
294 static uint8_t Db2RsrqRange(double db);
295
296 /**
297 * Quantize an RSRP value according to the measurement mapping of TS 36.133
298 *
299 * \param v RSRP value in dBm
300 *
301 * \return the quantized RSRP value in dBm
302 */
303 static double QuantizeRsrp(double v);
304
305 /**
306 * Quantize an RSRQ value according to the measurement mapping of TS 36.133
307 *
308 * \param v RSRQ value in dB
309 *
310 * \return the quantized RSRQ value in dB
311 */
312 static double QuantizeRsrq(double v);
313
314 /**
315 * \brief Returns the actual value of a hysteresis parameter.
316 * \param hysteresisIeValue IE value of hysteresis
317 * \return actual value in dB, which is IE value * 0.5 dB
318 *
319 * As per section 6.3.5 of 3GPP TS 36.331.
320 *
321 * The allowed values for hysteresis IE value are between 0 and 30.
322 *
323 * \sa LteRrcSap::ReportConfigEutra
324 */
325 static double IeValue2ActualHysteresis(uint8_t hysteresisIeValue);
326
327 /**
328 * \brief Returns the IE value of hysteresis.
329 * \param hysteresisDb actual hysteresis value in dB
330 * \return IE value of hysteresis in dB, which is actual value * 2, rounded
331 * to the nearest integer
332 *
333 * The allowed values for hysteresis are between 0 and 15 dB.
334 *
335 * \sa LteRrcSap::ReportConfigEutra
336 */
337 static uint8_t ActualHysteresis2IeValue(double hysteresisDb);
338
339 /**
340 * \brief Returns the actual value of an a3-Offset parameter.
341 * \param a3OffsetIeValue IE value of a3-Offset
342 * \return actual value in dB, which is IE value * 0.5 dB
343 *
344 * As per section 6.3.5 of 3GPP TS 36.331.
345 *
346 * The allowed values for a3-Offset IE value are between -30 and 30.
347 *
348 * \sa LteRrcSap::ReportConfigEutra
349 */
350 static double IeValue2ActualA3Offset(int8_t a3OffsetIeValue);
351
352 /**
353 * \brief Returns the IE value of a3-Offset.
354 * \param a3OffsetDb actual A3 Offset value in dB
355 * \return IE value of a3-Offset in dB, which is actual value * 2, rounded
356 * to the nearest integer
357 *
358 * The allowed values for A3 Offset are between -15 and 15 dB.
359 *
360 * \sa LteRrcSap::ReportConfigEutra
361 */
362 static int8_t ActualA3Offset2IeValue(double a3OffsetDb);
363
364 /**
365 * \brief Returns the actual value of an Q-RxLevMin parameter.
366 * \param qRxLevMinIeValue IE value of Q-RxLevMin
367 * \return Q-RxLevMin actual value in dBm, which is IE value * 2 dBm
368 *
369 * As per section 6.3.4 of 3GPP TS 36.331.
370 *
371 * \sa LteRrcSap::CellSelectionInfo
372 */
373 static double IeValue2ActualQRxLevMin(int8_t qRxLevMinIeValue);
374
375 /**
376 * \brief Returns the actual value of an Q-QualMin parameter.
377 * \param qQualMinIeValue IE value of Q-QualMin
378 * \return Q-QualMin actual value in dB, which is IE value dB
379 *
380 * As per section 6.3.4 of 3GPP TS 36.331.
381 *
382 * \sa LteRrcSap::CellSelectionInfo
383 */
384 static double IeValue2ActualQQualMin(int8_t qQualMinIeValue);
385
386}; // end of class EutranMeasurementMapping
387
388}; // namespace ns3
389
390#endif /* LTE_COMMON_H_ */
BufferSizeLevelBsr class.
Definition: lte-common.h:154
static int m_bufferSizeLevelBsr[64]
buffer size level BSR
Definition: lte-common.h:171
static uint8_t BufferSize2BsrId(uint32_t val)
Convert Buffer size to BSR ID.
Definition: lte-common.cc:183
static uint32_t BsrId2BufferSize(uint8_t val)
Convert BSR ID to buffer size.
Definition: lte-common.cc:176
Implements the E-UTRA measurement mappings defined in 3GPP TS 36.133 section 9.1 E-UTRAN measurements...
Definition: lte-common.h:254
static double QuantizeRsrp(double v)
Quantize an RSRP value according to the measurement mapping of TS 36.133.
Definition: lte-common.cc:266
static int8_t ActualA3Offset2IeValue(double a3OffsetDb)
Returns the IE value of a3-Offset.
Definition: lte-common.cc:324
static uint8_t Dbm2RsrpRange(double dbm)
convert an RSRP value in dBm to the corresponding range as per 3GPP TS 36.133 section 9....
Definition: lte-common.cc:242
static uint8_t ActualHysteresis2IeValue(double hysteresisDb)
Returns the IE value of hysteresis.
Definition: lte-common.cc:294
static double RsrpRange2Dbm(uint8_t range)
converts an RSRP range to dBm as per 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping
Definition: lte-common.cc:234
static double RsrqRange2Db(uint8_t range)
converts an RSRQ range to dB as per 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping
Definition: lte-common.cc:250
static double QuantizeRsrq(double v)
Quantize an RSRQ value according to the measurement mapping of TS 36.133.
Definition: lte-common.cc:272
static double IeValue2ActualQQualMin(int8_t qQualMinIeValue)
Returns the actual value of an Q-QualMin parameter.
Definition: lte-common.cc:355
static double IeValue2ActualQRxLevMin(int8_t qRxLevMinIeValue)
Returns the actual value of an Q-RxLevMin parameter.
Definition: lte-common.cc:339
static double IeValue2ActualHysteresis(uint8_t hysteresisIeValue)
Returns the actual value of a hysteresis parameter.
Definition: lte-common.cc:278
static uint8_t Db2RsrqRange(double db)
convert an RSRQ value in dB to the corresponding range as per 3GPP TS 36.133 section 9....
Definition: lte-common.cc:258
static double IeValue2ActualA3Offset(int8_t a3OffsetIeValue)
Returns the actual value of an a3-Offset parameter.
Definition: lte-common.cc:308
LteFfConverter class.
Definition: lte-common.h:126
static double getMinFpS11dot3Value()
Get minimum fixed point S11.3 value.
Definition: lte-common.cc:159
static uint16_t double2fpS11dot3(double val)
Convert from double to fixed point S11.3 notation.
Definition: lte-common.cc:134
static double fpS11dot3toDouble(uint16_t val)
Convert from fixed point S11.3 notation to double.
Definition: lte-common.cc:151
Forward calls to a chain of Callback.
TransmissionModesLayers class.
Definition: lte-common.h:176
static uint8_t TxMode2LayerNum(uint8_t txMode)
Transmit mode 2 layer number.
Definition: lte-common.cc:203
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr uint32_t MIN_NO_CC
Minimum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:36
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:39
DlSchedulingCallbackInfo structure.
Definition: lte-common.h:237
uint32_t subframeNo
subframe number
Definition: lte-common.h:239
uint16_t sizeTb2
size TB2
Definition: lte-common.h:244
uint16_t sizeTb1
size TB1
Definition: lte-common.h:242
uint8_t componentCarrierId
component carrier ID
Definition: lte-common.h:245
uint32_t frameNo
frame number
Definition: lte-common.h:238
ImsiLcidPair structure.
Definition: lte-common.h:63
friend bool operator<(const ImsiLcidPair_t &a, const ImsiLcidPair_t &b)
Less than operator.
Definition: lte-common.cc:98
uint8_t m_lcId
LCID.
Definition: lte-common.h:65
friend bool operator==(const ImsiLcidPair_t &a, const ImsiLcidPair_t &b)
Equality operator.
Definition: lte-common.cc:85
uint64_t m_imsi
IMSI.
Definition: lte-common.h:64
LteFlowId structure.
Definition: lte-common.h:43
uint8_t m_lcId
LCID.
Definition: lte-common.h:45
friend bool operator<(const LteFlowId_t &a, const LteFlowId_t &b)
Less than operator.
Definition: lte-common.cc:62
uint16_t m_rnti
RNTI.
Definition: lte-common.h:44
friend bool operator==(const LteFlowId_t &a, const LteFlowId_t &b)
Equality operator.
Definition: lte-common.cc:49
Parameters for configuring the UE.
Definition: lte-common.h:85
friend bool operator==(const LteUeConfig_t &a, const LteUeConfig_t &b)
Equality operator.
Definition: lte-common.cc:115
bool m_reconfigureFlag
When false means that the message is intended for configuring a new UE.
Definition: lte-common.h:93
uint16_t m_srsConfigurationIndex
Srs Configuration index for UE specific SRS, see section 8.2 of TS 36.213.
Definition: lte-common.h:101
friend bool operator<(const LteUeConfig_t &a, const LteUeConfig_t &b)
Less than operator.
Definition: lte-common.cc:128
uint16_t m_rnti
RNTI.
Definition: lte-common.h:89
uint8_t m_transmissionMode
Transmission mode [1..7] (i.e., SISO, MIMO, etc.)
Definition: lte-common.h:97
PhyReceptionStatParameters structure.
Definition: lte-common.h:212
uint8_t m_txMode
the transmission Mode
Definition: lte-common.h:217
uint8_t m_rv
the redundancy version (HARQ)
Definition: lte-common.h:221
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:218
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:215
uint8_t m_correctness
correctness of the TB received
Definition: lte-common.h:223
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:216
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:214
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:222
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:219
int64_t m_timestamp
in millisecond
Definition: lte-common.h:213
uint16_t m_size
Size of transport block.
Definition: lte-common.h:220
uint8_t m_ccId
component carrier id
Definition: lte-common.h:224
PhyTransmissionStatParameters structure.
Definition: lte-common.h:188
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:198
int64_t m_timestamp
in millisecond
Definition: lte-common.h:189
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:194
uint16_t m_size
Size of transport block.
Definition: lte-common.h:196
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:191
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:192
uint8_t m_txMode
the transmission Mode
Definition: lte-common.h:193
uint8_t m_rv
the redundancy version (HARQ)
Definition: lte-common.h:197
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:190
uint8_t m_ccId
component carrier id
Definition: lte-common.h:199
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:195