LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 1.33, 1.48, 1.7, 1.91, 2.16, 2.41, 2.57, | 85 1.33, 1.48, 1.7, 1.91, 2.16, 2.41, 2.57, |
86 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55, | 86 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55, |
87 0, 0, 0 | 87 0, 0, 0 |
88 }; | 88 }; |
89 | 89 |
90 /** | 90 /** |
91 * Table of MCS index (IMCS) and its TBS index (ITBS). Taken from 3GPP TS | 91 * Table of MCS index (IMCS) and its TBS index (ITBS). Taken from 3GPP TS |
92 * 36.213 v8.8.0 Table 7.1.7.1-1: _Modulation and TBS index table for PDSCH_. | 92 * 36.213 v8.8.0 Table 7.1.7.1-1: _Modulation and TBS index table for PDSCH_. |
93 * The index of the vector (range 0-28) identifies the MCS index. | 93 * The index of the vector (range 0-28) identifies the MCS index. |
94 */ | 94 */ |
95 static const int McsToItbs[29] = { | 95 static const int McsToItbsDl[29] = { |
96 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, | 96 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, |
97 19, 20, 21, 22, 23, 24, 25, 26 | 97 19, 20, 21, 22, 23, 24, 25, 26 |
| 98 }; |
| 99 |
| 100 /** |
| 101 * Table of MCS index (IMCS) and its TBS index (ITBS). Taken from 3GPP TS |
| 102 * 36.213 v8.8.0 Table 8.6.1-1: _Modulation, TBS index and redundancy version ta
ble for PUSCH_. |
| 103 * The index of the vector (range 0-28) identifies the MCS index. |
| 104 */ |
| 105 static const int McsToItbsUl[29] = { |
| 106 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 107 19, 19, 20, 21, 22, 23, 24, 25, 26 |
98 }; | 108 }; |
99 | 109 |
100 /** | 110 /** |
101 * Table of number of physical resource blocks (NPRB), TBS index (ITBS), and | 111 * Table of number of physical resource blocks (NPRB), TBS index (ITBS), and |
102 * their associated transport block size. Taken from 3GPP TS 36.213 v8.8.0 | 112 * their associated transport block size. Taken from 3GPP TS 36.213 v8.8.0 |
103 * Table 7.1.7.2.1-1: _Transport block size table (dimension 27×110)_. | 113 * Table 7.1.7.2.1-1: _Transport block size table (dimension 27×110)_. |
104 * \note For NPRB = 1 and ITBS = 6 the standard returns 328, but it is not | 114 * \note For NPRB = 1 and ITBS = 6 the standard returns 328, but it is not |
105 * consistent with the other values, therefore we use 88 obtained by | 115 * consistent with the other values, therefore we use 88 obtained by |
106 * following the sequence of NPRB = 1 values. | 116 * following the sequence of NPRB = 1 values. |
107 */ | 117 */ |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 double spectralEfficiency = SpectralEfficiencyForCqi[cqi]; | 284 double spectralEfficiency = SpectralEfficiencyForCqi[cqi]; |
275 uint8_t mcs = 0; | 285 uint8_t mcs = 0; |
276 while ((mcs < 28) && (SpectralEfficiencyForMcs[mcs + 1] <= spectralEfficiency)
) | 286 while ((mcs < 28) && (SpectralEfficiencyForMcs[mcs + 1] <= spectralEfficiency)
) |
277 { | 287 { |
278 ++mcs; | 288 ++mcs; |
279 } | 289 } |
280 NS_LOG_LOGIC ("mcs = " << mcs); | 290 NS_LOG_LOGIC ("mcs = " << mcs); |
281 return mcs; | 291 return mcs; |
282 } | 292 } |
283 | 293 |
284 uint16_t | 294 uint16_t |
285 LteAmc::GetTbSizeFromMcs (int mcs, int nprb) | 295 LteAmc::GetDlTbSizeFromMcs (int mcs, int nprb) |
286 { | 296 { |
287 NS_LOG_FUNCTION (mcs); | 297 NS_LOG_FUNCTION (mcs); |
288 | 298 |
289 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); | 299 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); |
290 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); | 300 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); |
291 | 301 |
292 int itbs = McsToItbs[mcs]; | 302 int itbs = McsToItbsDl[mcs]; |
293 return static_cast<uint16_t>(TransportBlockSizeTable[nprb - 1][itbs]); | 303 return static_cast<uint16_t> (TransportBlockSizeTable[nprb - 1][itbs]); |
| 304 } |
| 305 |
| 306 uint16_t |
| 307 LteAmc::GetUlTbSizeFromMcs (int mcs, int nprb) |
| 308 { |
| 309 NS_LOG_FUNCTION (mcs); |
| 310 |
| 311 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); |
| 312 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); |
| 313 |
| 314 int itbs = McsToItbsUl[mcs]; |
| 315 return static_cast<uint16_t> (TransportBlockSizeTable[nprb - 1][itbs]); |
294 } | 316 } |
295 | 317 |
296 | 318 |
297 double | 319 double |
298 LteAmc::GetSpectralEfficiencyFromCqi (int cqi) | 320 LteAmc::GetSpectralEfficiencyFromCqi (int cqi) |
299 { | 321 { |
300 NS_LOG_FUNCTION (cqi); | 322 NS_LOG_FUNCTION (cqi); |
301 NS_ASSERT_MSG (cqi >= 0 && cqi <= 15, "CQI must be in [0..15] = " << cqi); | 323 NS_ASSERT_MSG (cqi >= 0 && cqi <= 15, "CQI must be in [0..15] = " << cqi); |
302 NS_LOG_LOGIC ("Spectral efficiency = " << SpectralEfficiencyForCqi[cqi]); | 324 NS_LOG_LOGIC ("Spectral efficiency = " << SpectralEfficiencyForCqi[cqi]); |
303 return SpectralEfficiencyForCqi[cqi]; | 325 return SpectralEfficiencyForCqi[cqi]; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 rbgMap.push_back (rbId++); | 379 rbgMap.push_back (rbId++); |
358 if ((rbId % rbgSize == 0)||((it+1)==sinr.ConstValuesEnd ())) | 380 if ((rbId % rbgSize == 0)||((it+1)==sinr.ConstValuesEnd ())) |
359 { | 381 { |
360 uint8_t mcs = 0; | 382 uint8_t mcs = 0; |
361 TbStats_t tbStats; | 383 TbStats_t tbStats; |
362 tbStats.mi = 0.0; | 384 tbStats.mi = 0.0; |
363 tbStats.tbler = 0.0; | 385 tbStats.tbler = 0.0; |
364 while (mcs <= 28) | 386 while (mcs <= 28) |
365 { | 387 { |
366 HarqProcessInfoList_t harqInfoList; | 388 HarqProcessInfoList_t harqInfoList; |
367 tbStats = LteMiErrorModel::GetTbDecodificationStats (sinr, rbgMa
p, (uint16_t)GetTbSizeFromMcs (mcs, rbgSize) / 8, mcs, harqInfoList); | 389 tbStats = LteMiErrorModel::GetTbDecodificationStats (sinr, rbgMa
p, (uint16_t)GetDlTbSizeFromMcs (mcs, rbgSize) / 8, mcs, harqInfoList); |
368 if (tbStats.tbler > 0.1) | 390 if (tbStats.tbler > 0.1) |
369 { | 391 { |
370 break; | 392 break; |
371 } | 393 } |
372 mcs++; | 394 mcs++; |
| 395 ················ |
373 } | 396 } |
374 if (mcs > 0) | 397 if (mcs > 0) |
375 { | 398 { |
376 mcs--; | 399 mcs--; |
377 } | 400 } |
378 NS_LOG_DEBUG (this << "\t RBG " << rbId << " MCS " << (uint16_t)mcs
<< " TBLER " << tbStats.tbler); | 401 NS_LOG_DEBUG (this << "\t RBG " << rbId << " MCS " << (uint16_t)mcs
<< " TBLER " << tbStats.tbler); |
379 int rbgCqi = 0; | 402 int rbgCqi = 0; |
380 if ((tbStats.tbler > 0.1)&&(mcs==0)) | 403 if ((tbStats.tbler > 0.1)&&(mcs==0)) |
381 { | 404 { |
382 rbgCqi = 0; // any MCS can guarantee the 10 % of BER | 405 rbgCqi = 0; // any MCS can guarantee the 10 % of BER |
(...skipping 21 matching lines...) Expand all Loading... |
404 } | 427 } |
405 ········ | 428 ········ |
406 } | 429 } |
407 ······ | 430 ······ |
408 } | 431 } |
409 | 432 |
410 return cqi; | 433 return cqi; |
411 } | 434 } |
412 | 435 |
413 } // namespace ns3 | 436 } // namespace ns3 |
LEFT | RIGHT |