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