LEFT | RIGHT |
(no file at all) | |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 int cqi = 0; | 269 int cqi = 0; |
270 while ((cqi < 15) && (SpectralEfficiencyForCqi[cqi + 1] < s)) | 270 while ((cqi < 15) && (SpectralEfficiencyForCqi[cqi + 1] < s)) |
271 { | 271 { |
272 ++cqi; | 272 ++cqi; |
273 } | 273 } |
274 NS_LOG_LOGIC ("cqi = " << cqi); | 274 NS_LOG_LOGIC ("cqi = " << cqi); |
275 return cqi; | 275 return cqi; |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 int | 279 uint8_t |
280 LteAmc::GetMcsFromCqi (int cqi) | 280 LteAmc::GetMcsFromCqi (int cqi) |
281 { | 281 { |
282 NS_LOG_FUNCTION (cqi); | 282 NS_LOG_FUNCTION (cqi); |
283 NS_ASSERT_MSG (cqi >= 0 && cqi <= 15, "CQI must be in [0..15] = " << cqi); | 283 NS_ASSERT_MSG (cqi >= 0 && cqi <= 15, "CQI must be in [0..15] = " << cqi); |
284 double spectralEfficiency = SpectralEfficiencyForCqi[cqi]; | 284 double spectralEfficiency = SpectralEfficiencyForCqi[cqi]; |
285 int mcs = 0; | 285 uint8_t mcs = 0; |
286 while ((mcs < 28) && (SpectralEfficiencyForMcs[mcs + 1] <= spectralEfficiency)
) | 286 while ((mcs < 28) && (SpectralEfficiencyForMcs[mcs + 1] <= spectralEfficiency)
) |
287 { | 287 { |
288 ++mcs; | 288 ++mcs; |
289 } | 289 } |
290 NS_LOG_LOGIC ("mcs = " << mcs); | 290 NS_LOG_LOGIC ("mcs = " << mcs); |
291 return mcs; | 291 return mcs; |
292 } | 292 } |
293 | 293 |
294 int | 294 uint16_t |
295 LteAmc::GetDlTbSizeFromMcs (int mcs, int nprb) | 295 LteAmc::GetDlTbSizeFromMcs (int mcs, int nprb) |
296 { | 296 { |
297 NS_LOG_FUNCTION (mcs); | 297 NS_LOG_FUNCTION (mcs); |
298 | 298 |
299 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); | 299 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); |
300 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); | 300 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); |
301 | 301 |
302 int itbs = McsToItbsDl[mcs]; | 302 int itbs = McsToItbsDl[mcs]; |
303 return (TransportBlockSizeTable[nprb - 1][itbs]); | 303 return static_cast<uint16_t>(TransportBlockSizeTable[nprb - 1][itbs]); |
304 } | 304 } |
305 | 305 |
306 int | 306 uint16_t |
307 LteAmc::GetUlTbSizeFromMcs (int mcs, int nprb) | 307 LteAmc::GetUlTbSizeFromMcs (int mcs, int nprb) |
308 { | 308 { |
309 NS_LOG_FUNCTION (mcs); | 309 NS_LOG_FUNCTION (mcs); |
310 | 310 |
311 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); | 311 NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs); |
312 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); | 312 NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb); |
313 | 313 |
314 int itbs = McsToItbsUl[mcs]; | 314 int itbs = McsToItbsUl[mcs]; |
315 return (TransportBlockSizeTable[nprb - 1][itbs]); | 315 return static_cast<uint16_t>(TransportBlockSizeTable[nprb - 1][itbs]); |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 double | 319 double |
320 LteAmc::GetSpectralEfficiencyFromCqi (int cqi) | 320 LteAmc::GetSpectralEfficiencyFromCqi (int cqi) |
321 { | 321 { |
322 NS_LOG_FUNCTION (cqi); | 322 NS_LOG_FUNCTION (cqi); |
323 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); |
324 NS_LOG_LOGIC ("Spectral efficiency = " << SpectralEfficiencyForCqi[cqi]); | 324 NS_LOG_LOGIC ("Spectral efficiency = " << SpectralEfficiencyForCqi[cqi]); |
325 return SpectralEfficiencyForCqi[cqi]; | 325 return SpectralEfficiencyForCqi[cqi]; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 NS_ASSERT_MSG (rbgSize > 0, " LteAmc-Vienna: RBG size must be greater than
0"); | 374 NS_ASSERT_MSG (rbgSize > 0, " LteAmc-Vienna: RBG size must be greater than
0"); |
375 std::vector <int> rbgMap; | 375 std::vector <int> rbgMap; |
376 int rbId = 0; | 376 int rbId = 0; |
377 for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++) | 377 for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++) |
378 { | 378 { |
379 rbgMap.push_back (rbId++); | 379 rbgMap.push_back (rbId++); |
380 if ((rbId % rbgSize == 0)||((it+1)==sinr.ConstValuesEnd ())) | 380 if ((rbId % rbgSize == 0)||((it+1)==sinr.ConstValuesEnd ())) |
381 { | 381 { |
382 uint8_t mcs = 0; | 382 uint8_t mcs = 0; |
383 TbStats_t tbStats; | 383 TbStats_t tbStats; |
| 384 tbStats.mi = 0.0; |
| 385 tbStats.tbler = 0.0; |
384 while (mcs <= 28) | 386 while (mcs <= 28) |
385 { | 387 { |
386 HarqProcessInfoList_t harqInfoList; | 388 HarqProcessInfoList_t harqInfoList; |
387 tbStats = LteMiErrorModel::GetTbDecodificationStats (sinr, rbgMa
p, (uint16_t)GetDlTbSizeFromMcs (mcs, rbgSize) / 8, mcs, harqInfoList); | 389 tbStats = LteMiErrorModel::GetTbDecodificationStats (sinr, rbgMa
p, (uint16_t)GetDlTbSizeFromMcs (mcs, rbgSize) / 8, mcs, harqInfoList); |
388 if (tbStats.tbler > 0.1) | 390 if (tbStats.tbler > 0.1) |
389 { | 391 { |
390 break; | 392 break; |
391 } | 393 } |
392 mcs++; | 394 mcs++; |
393 ················ | |
394 } | 395 } |
395 if (mcs > 0) | 396 if (mcs > 0) |
396 { | 397 { |
397 mcs--; | 398 mcs--; |
398 } | 399 } |
399 NS_LOG_DEBUG (this << "\t RBG " << rbId << " MCS " << (uint16_t)mcs
<< " TBLER " << tbStats.tbler); | 400 NS_LOG_DEBUG (this << "\t RBG " << rbId << " MCS " << (uint16_t)mcs
<< " TBLER " << tbStats.tbler); |
400 int rbgCqi = 0; | 401 int rbgCqi = 0; |
401 if ((tbStats.tbler > 0.1)&&(mcs==0)) | 402 if ((tbStats.tbler > 0.1)&&(mcs==0)) |
402 { | 403 { |
403 rbgCqi = 0; // any MCS can guarantee the 10 % of BER | 404 rbgCqi = 0; // any MCS can guarantee the 10 % of BER |
(...skipping 21 matching lines...) Expand all Loading... |
425 } | 426 } |
426 ········ | 427 ········ |
427 } | 428 } |
428 ······ | 429 ······ |
429 } | 430 } |
430 | 431 |
431 return cqi; | 432 return cqi; |
432 } | 433 } |
433 | 434 |
434 } // namespace ns3 | 435 } // namespace ns3 |
LEFT | RIGHT |