OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
| 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: Manuel Requena <manuel.requena@cttc.es> |
| 19 * Author: Marco Miozzo <marco.miozzo@cttc.es> |
| 20 * Modified by: NIST |
| 21 */ |
| 22 #ifndef NIST_LTE_COMMON_H |
| 23 #define NIST_LTE_COMMON_H |
| 24 |
| 25 #include "ns3/uinteger.h" |
| 26 #include <cmath> |
| 27 |
| 28 // see 36.213 section 8 |
| 29 #define UL_PUSCH_TTIS_DELAY 4 |
| 30 |
| 31 #define HARQ_PERIOD 7 |
| 32 |
| 33 namespace ns3 { |
| 34 |
| 35 |
| 36 struct NistLteFlowId_t |
| 37 { |
| 38 uint16_t m_rnti; |
| 39 uint8_t m_lcId; |
| 40 |
| 41 public: |
| 42 NistLteFlowId_t (); |
| 43 NistLteFlowId_t (const uint16_t a, const uint8_t b); |
| 44 |
| 45 friend bool operator == (const NistLteFlowId_t &a, const NistLteFlowId_t &b); |
| 46 friend bool operator < (const NistLteFlowId_t &a, const NistLteFlowId_t &b); |
| 47 }; |
| 48 |
| 49 struct NistImsiLcidPair_t |
| 50 { |
| 51 uint64_t m_imsi; |
| 52 uint8_t m_lcId; |
| 53 |
| 54 public: |
| 55 NistImsiLcidPair_t (); |
| 56 NistImsiLcidPair_t (const uint64_t a, const uint8_t b); |
| 57 |
| 58 friend bool operator == (const NistImsiLcidPair_t &a, const NistImsiLcidPair_t
&b); |
| 59 friend bool operator < (const NistImsiLcidPair_t &a, const NistImsiLcidPair_t
&b); |
| 60 }; |
| 61 |
| 62 /** |
| 63 * \brief Parameters for configuring the UE· |
| 64 */ |
| 65 struct NistLteNistUeConfig_t |
| 66 { |
| 67 uint16_t m_rnti; |
| 68 /** |
| 69 * When false means that the message is inteded foro configuring a new UE |
| 70 */ |
| 71 bool m_reconfigureFlag; |
| 72 /** |
| 73 * Transmission mode [1..7] (i.e., SISO, MIMO, etc.) |
| 74 */ |
| 75 uint8_t m_transmissionMode; |
| 76 /** |
| 77 * Srs Configuration index for UE specific SRS, see section 8.2 of TS 36.213 |
| 78 */ |
| 79 uint16_t m_srsConfigurationIndex; |
| 80 |
| 81 public: |
| 82 NistLteNistUeConfig_t (); |
| 83 |
| 84 friend bool operator == (const NistLteNistUeConfig_t &a, const NistLteNistUeCo
nfig_t &b); |
| 85 friend bool operator < (const NistLteNistUeConfig_t &a, const NistLteNistUeCon
fig_t &b); |
| 86 }; |
| 87 |
| 88 |
| 89 class NistLteFfConverter |
| 90 { |
| 91 |
| 92 public: |
| 93 static uint16_t double2fpS11dot3 (double val); |
| 94 static double fpS11dot3toDouble (uint16_t val); |
| 95 static double getMinFpS11dot3Value (); |
| 96 |
| 97 //static const double MIN_FP_S11DOT3_VALUE = -4096; |
| 98 |
| 99 }; |
| 100 |
| 101 class NistBufferSizeLevelBsr |
| 102 { |
| 103 |
| 104 public: |
| 105 static uint32_t BsrId2BufferSize (uint8_t val); |
| 106 static uint8_t BufferSize2BsrId (uint32_t val); |
| 107 |
| 108 static int m_bufferSizeLevelBsr[64]; |
| 109 |
| 110 }; |
| 111 |
| 112 class NistTransmissionModesLayers |
| 113 { |
| 114 public: |
| 115 static uint8_t TxMode2LayerNum (uint8_t txMode); |
| 116 }; |
| 117 |
| 118 |
| 119 struct NistPhyTransmissionStatParameters |
| 120 { |
| 121 int64_t m_timestamp; // in millisecond |
| 122 uint16_t m_cellId; ///< Cell ID of the attached Enb |
| 123 uint64_t m_imsi; ///< IMSI of the scheduled UE |
| 124 uint16_t m_rnti; ///< C-RNTI scheduled |
| 125 uint8_t m_txMode; ///< the transmission Mode |
| 126 uint8_t m_layer; ///< the layer (cw) of the transmission |
| 127 uint8_t m_mcs; ///< MCS for transport block |
| 128 uint16_t m_size; ///< Size of transport block |
| 129 uint8_t m_rv; ///< the redundancy version (HARQ) |
| 130 uint8_t m_ndi; ///< new data indicator flag |
| 131 ·· |
| 132 /** |
| 133 * TracedCallback signature. |
| 134 * |
| 135 * \param [in] params Value of the PhyTransmissionionStatParameters. |
| 136 */ |
| 137 typedef void (* TracedCallback)(const NistPhyTransmissionStatParameters params
); |
| 138 ·· |
| 139 }; |
| 140 |
| 141 |
| 142 struct NistPhyReceptionStatParameters |
| 143 { |
| 144 int64_t m_timestamp; // in millisecond |
| 145 uint16_t m_cellId; ///< Cell ID of the attached Enb |
| 146 uint64_t m_imsi; ///< IMSI of the scheduled UE |
| 147 uint16_t m_rnti; ///< C-RNTI scheduled |
| 148 uint8_t m_txMode; ///< the transmission Mode |
| 149 uint8_t m_layer; ///< the layer (cw) of the transmission |
| 150 uint8_t m_mcs; ///< MCS for transport block |
| 151 uint16_t m_size; ///< Size of transport block |
| 152 uint8_t m_rv; ///< the redundancy version (HARQ) |
| 153 uint8_t m_ndi; ///< new data indicator flag |
| 154 uint8_t m_correctness; ///< correctness of the TB received |
| 155 //Aziza |
| 156 double m_sinrPerRb; ///< linear average SINR per RB |
| 157 |
| 158 /** |
| 159 * TracedCallback signature. |
| 160 * |
| 161 * \param [in] params Value of the NistPhyReceptionStatParameters. |
| 162 */ |
| 163 typedef void (* TracedCallback)(const NistPhyReceptionStatParameters params); |
| 164 ·· |
| 165 }; |
| 166 |
| 167 struct NistSlUeMacStatParameters |
| 168 { |
| 169 int64_t m_timestamp; ///< in millisecond |
| 170 uint16_t m_cellId; ///< Cell ID of the attached Enb |
| 171 uint64_t m_imsi; ///< IMSI of the scheduled UE |
| 172 uint16_t m_rnti; ///< C-RNTI scheduled |
| 173 uint32_t m_frameNo; ///< the frame number |
| 174 uint32_t m_subframeNo; ///< the subframe number |
| 175 uint8_t m_mcs; ///< MCS for transport block |
| 176 uint16_t m_tbSize; ///< Size of transport block in bytes |
| 177 uint16_t m_pscchRi; ///< PSCCH resource index |
| 178 //uint16_t m_pscchTx1; ///< PSCCH 1st transmission sf |
| 179 //uint16_t m_pscchTx2; ///< PSCCH 2nd transmission sf |
| 180 uint32_t m_pscchFrame1; ///< PSCCH 1st transmission frame number |
| 181 uint32_t m_pscchSubframe1; ///< PSCCH 1st transmission subframe number |
| 182 uint32_t m_pscchFrame2; ///< PSCCH 2st transmission frame number |
| 183 uint32_t m_pscchSubframe2; ///< PSCCH 2st transmission subframe number |
| 184 uint16_t m_psschTxStartRB; ///< PSSCH transmission start RB |
| 185 uint16_t m_psschTxLengthRB; ///< PSSCH transmission length RB |
| 186 uint16_t m_psschItrp; ///< PSSCH I_TRP |
| 187 uint32_t m_psschFrame; ///< PSSCH frame used to transmitt |
| 188 uint32_t m_psschSubframe; ///< PSSCH subframe used to transmitt |
| 189 uint32_t m_psschFrameStart; ///< PSSCH frame start |
| 190 uint32_t m_psschSubframeStart; ///< PSSCH frame start |
| 191 |
| 192 /** |
| 193 * TracedCallback signature. |
| 194 * |
| 195 * \param [in] params Value of the NistSlUeMacStatParameters. |
| 196 */ |
| 197 typedef void (* TracedCallback)(const NistSlUeMacStatParameters params); |
| 198 ·· |
| 199 }; |
| 200 |
| 201 |
| 202 /** |
| 203 * Implements the E-UTRA measurement mappings defined in 3GPP TS |
| 204 * 36.133 section 9.1 E-UTRAN measurements· |
| 205 *· |
| 206 */ |
| 207 class NistEutranMeasurementMapping |
| 208 { |
| 209 public: |
| 210 /**· |
| 211 * converts an RSRP range to dBm as per· |
| 212 * 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping |
| 213 * |
| 214 * \param range the RSRP range value |
| 215 *· |
| 216 * \return the corresponding RSRP value in dBm |
| 217 */ |
| 218 static double RsrpRange2Dbm (uint8_t range); |
| 219 |
| 220 /**· |
| 221 * convert an RSRP value in dBm to the corresponding range as per· |
| 222 * 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping |
| 223 *· |
| 224 * \param dbm the RSRP value in dBm |
| 225 *· |
| 226 * \return the corresponding range |
| 227 */ |
| 228 static uint8_t Dbm2RsrpRange (double dbm); |
| 229 |
| 230 /**· |
| 231 * converts an RSRQ range to dB as per· |
| 232 * 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping |
| 233 * |
| 234 * \param range the RSRQ range value |
| 235 *· |
| 236 * \return the corresponding RSRQ value in dB |
| 237 */ |
| 238 static double RsrqRange2Db (uint8_t range); |
| 239 |
| 240 /**· |
| 241 * convert an RSRQ value in dB to the corresponding range as per· |
| 242 * 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping |
| 243 *· |
| 244 * \param db the RSRQ value in dB |
| 245 *· |
| 246 * \return the corresponding range |
| 247 */ |
| 248 static uint8_t Db2RsrqRange (double db); |
| 249 |
| 250 /**· |
| 251 * Quantize an RSRP value according to the measurement mapping of TS 36.133 |
| 252 *· |
| 253 * \param v RSRP value in dBm |
| 254 *· |
| 255 * \return the quantized RSRP value in dBm |
| 256 */ |
| 257 static double QuantizeRsrp (double v); |
| 258 |
| 259 /**· |
| 260 * Quantize an RSRQ value according to the measurement mapping of TS 36.133 |
| 261 *· |
| 262 * \param v RSRQ value in dB |
| 263 *· |
| 264 * \return the quantized RSRQ value in dB |
| 265 */ |
| 266 static double QuantizeRsrq (double v); |
| 267 |
| 268 /** |
| 269 * \brief Returns the actual value of a hysteresis parameter. |
| 270 * \param hysteresisIeValue IE value of hysteresis |
| 271 * \return actual value in dB, which is IE value * 0.5 dB |
| 272 * |
| 273 * As per section 6.3.5 of 3GPP TS 36.331. |
| 274 * |
| 275 * The allowed values for hysteresis IE value are between 0 and 30. |
| 276 * |
| 277 * \sa NistLteRrcSap::NistReportConfigEutra |
| 278 */ |
| 279 static double IeValue2ActualHysteresis (uint8_t hysteresisIeValue); |
| 280 |
| 281 /** |
| 282 * \brief Returns the IE value of hysteresis. |
| 283 * \param hysteresisDb actual hysteresis value in dB |
| 284 * \return IE value of hysteresis in dB, which is actual value * 2, rounded |
| 285 * to the nearest integer |
| 286 * |
| 287 * The allowed values for hysteresis are between 0 and 15 dB. |
| 288 * |
| 289 * \sa NistLteRrcSap::NistReportConfigEutra |
| 290 */ |
| 291 static uint8_t ActualHysteresis2IeValue (double hysteresisDb); |
| 292 |
| 293 /** |
| 294 * \brief Returns the actual value of an a3-Offset parameter. |
| 295 * \param a3OffsetIeValue IE value of a3-Offset |
| 296 * \return actual value in dB, which is IE value * 0.5 dB |
| 297 * |
| 298 * As per section 6.3.5 of 3GPP TS 36.331. |
| 299 * |
| 300 * The allowed values for a3-Offset IE value are between -30 and 30. |
| 301 * |
| 302 * \sa NistLteRrcSap::NistReportConfigEutra |
| 303 */ |
| 304 static double IeValue2ActualA3Offset (int8_t a3OffsetIeValue); |
| 305 |
| 306 /** |
| 307 * \brief Returns the IE value of a3-Offset. |
| 308 * \param a3OffsetDb actual A3 Offset value in dB |
| 309 * \return IE value of a3-Offset in dB, which is actual value * 2, rounded |
| 310 * to the nearest integer |
| 311 * |
| 312 * The allowed values for A3 Offset are between -15 and 15 dB. |
| 313 * |
| 314 * \sa NistLteRrcSap::NistReportConfigEutra |
| 315 */ |
| 316 static int8_t ActualA3Offset2IeValue (double a3OffsetDb); |
| 317 |
| 318 /** |
| 319 * \brief Returns the actual value of an Q-RxLevMin parameter. |
| 320 * \param qRxLevMinIeValue IE value of Q-RxLevMin |
| 321 * \return Q-RxLevMin actual value in dBm, which is IE value * 2 dBm |
| 322 * |
| 323 * As per section 6.3.4 of 3GPP TS 36.331. |
| 324 * |
| 325 * \sa NistLteRrcSap::NistCellSelectionInfo |
| 326 */ |
| 327 static double IeValue2ActualQRxLevMin (int8_t qRxLevMinIeValue); |
| 328 |
| 329 /** |
| 330 * \brief Returns the actual value of an Q-QualMin parameter. |
| 331 * \param qQualMinIeValue IE value of Q-QualMin |
| 332 * \return Q-QualMin actual value in dB, which is IE value dB |
| 333 * |
| 334 * As per section 6.3.4 of 3GPP TS 36.331. |
| 335 * |
| 336 * \sa NistLteRrcSap::NistCellSelectionInfo |
| 337 */ |
| 338 static double IeValue2ActualQQualMin (int8_t qQualMinIeValue); |
| 339 |
| 340 }; // end of class NistEutranMeasurementMapping |
| 341 |
| 342 }; // namespace ns3 |
| 343 |
| 344 |
| 345 #endif /* NIST_LTE_COMMON_H_ */ |
OLD | NEW |