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) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 return; | 304 return; |
305 } | 305 } |
306 | 306 |
307 void | 307 void |
308 FdMtFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider
::SchedDlPagingBufferReqParameters& params) | 308 FdMtFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider
::SchedDlPagingBufferReqParameters& params) |
309 { | 309 { |
310 NS_LOG_FUNCTION (this); | 310 NS_LOG_FUNCTION (this); |
311 NS_FATAL_ERROR ("method not implemented"); | 311 NS_FATAL_ERROR ("method not implemented"); |
312 NS_UNUSED(params); | 312 NS_UNUSED (params); |
313 return; | 313 return; |
314 } | 314 } |
315 | 315 |
316 void | 316 void |
317 FdMtFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::S
chedDlMacBufferReqParameters& params) | 317 FdMtFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::S
chedDlMacBufferReqParameters& params) |
318 { | 318 { |
319 NS_LOG_FUNCTION (this); | 319 NS_LOG_FUNCTION (this); |
320 NS_FATAL_ERROR ("method not implemented"); | 320 NS_FATAL_ERROR ("method not implemented"); |
321 NS_UNUSED(params); | 321 NS_UNUSED (params); |
322 return; | 322 return; |
323 } | 323 } |
324 | 324 |
325 int | 325 int |
326 FdMtFfMacScheduler::GetRbgSize (int dlbandwidth) | 326 FdMtFfMacScheduler::GetRbgSize (int dlbandwidth) |
327 { | 327 { |
328 for (int i = 0; i < 4; i++) | 328 for (int i = 0; i < 4; i++) |
329 { | 329 { |
330 if (dlbandwidth < FdMtType0AllocationRbg[i]) | 330 if (dlbandwidth < FdMtType0AllocationRbg[i]) |
331 { | 331 { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); | 483 int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); |
484 int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; | 484 int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; |
485 std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNT
I | 485 std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNT
I |
486 std::vector <bool> rbgMap; // global RBGs map | 486 std::vector <bool> rbgMap; // global RBGs map |
487 uint16_t rbgAllocatedNum = 0; | 487 uint16_t rbgAllocatedNum = 0; |
488 std::set <uint16_t> rntiAllocated; | 488 std::set <uint16_t> rntiAllocated; |
489 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); | 489 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); |
490 FfMacSchedSapUser::SchedDlConfigIndParameters ret; | 490 FfMacSchedSapUser::SchedDlConfigIndParameters ret; |
491 | 491 |
492 // update UL HARQ proc id | 492 // update UL HARQ proc id |
493 std::map <uint16_t, uint8_t>::iterator itProcId; | 493 for (std::map <uint16_t, uint8_t>::iterator itProcId = m_ulHarqCurrentProcessI
d.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++) |
494 for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrent
ProcessId.end (); itProcId++) | |
495 { | 494 { |
496 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; | 495 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; |
497 } | 496 } |
498 | 497 |
499 // RACH Allocation | 498 // RACH Allocation |
500 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 499 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
501 uint16_t rbStart = 0; | 500 uint8_t rbStart = 0; |
502 std::vector <struct RachListElement_s>::iterator itRach; | 501 std::vector <struct RachListElement_s>::iterator itRach; |
503 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) | 502 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) |
504 { | 503 { |
505 NS_ASSERT_MSG (m_amc->GetTbSizeFromMcs (m_ulGrantMcs, m_cschedCellConfig.m
_ulBandwidth) > (*itRach).m_estimatedSize, " Default UL Grant MCS does not allow
to send RACH messages"); | 504 NS_ASSERT_MSG (m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, m_cschedCellConfig
.m_ulBandwidth) > (*itRach).m_estimatedSize, " Default UL Grant MCS does not all
ow to send RACH messages"); |
506 BuildRarListElement_s newRar; | 505 BuildRarListElement_s newRar; |
507 newRar.m_rnti = (*itRach).m_rnti; | 506 newRar.m_rnti = (*itRach).m_rnti; |
508 // DL-RACH Allocation | 507 // DL-RACH Allocation |
509 // Ideal: no needs of configuring m_dci | 508 // Ideal: no needs of configuring m_dci |
510 // UL-RACH Allocation | 509 // UL-RACH Allocation |
511 newRar.m_grant.m_rnti = newRar.m_rnti; | 510 newRar.m_grant.m_rnti = newRar.m_rnti; |
512 newRar.m_grant.m_mcs = m_ulGrantMcs; | 511 newRar.m_grant.m_mcs = m_ulGrantMcs; |
513 uint16_t rbLen = 1; | 512 uint8_t rbLen = 1; |
514 uint16_t tbSizeBits = 0; | 513 uint16_t tbSizeBits = 0; |
515 // find lowest TB size that fits UL grant estimated size | 514 // find lowest TB size that fits UL grant estimated size |
516 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cs
chedCellConfig.m_ulBandwidth)) | 515 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cs
chedCellConfig.m_ulBandwidth)) |
517 { | 516 { |
518 rbLen++; | 517 rbLen++; |
519 tbSizeBits = (uint16_t)m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen); | 518 tbSizeBits = m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, rbLen); |
520 } | 519 } |
521 if (tbSizeBits < (*itRach).m_estimatedSize) | 520 if (tbSizeBits < (*itRach).m_estimatedSize) |
522 { | 521 { |
523 // no more allocation space: finish allocation | 522 // no more allocation space: finish allocation |
524 break; | 523 break; |
525 } | 524 } |
526 newRar.m_grant.m_rbStart = (uint8_t)rbStart; | 525 newRar.m_grant.m_rbStart = rbStart; |
527 newRar.m_grant.m_rbLen = (uint8_t)rbLen; | 526 newRar.m_grant.m_rbLen = rbLen; |
528 newRar.m_grant.m_tbSize = tbSizeBits / 8; | 527 newRar.m_grant.m_tbSize = tbSizeBits / 8; |
529 newRar.m_grant.m_hopping = false; | 528 newRar.m_grant.m_hopping = false; |
530 newRar.m_grant.m_tpc = 0; | 529 newRar.m_grant.m_tpc = 0; |
531 newRar.m_grant.m_cqiRequest = false; | 530 newRar.m_grant.m_cqiRequest = false; |
532 newRar.m_grant.m_ulDelay = false; | 531 newRar.m_grant.m_ulDelay = false; |
533 NS_LOG_INFO (this << " UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart " << rbStart << " rbLen " << rbLen << " MCS " << m_ulGrantMcs << " tb
Size " << newRar.m_grant.m_tbSize); | 532 NS_LOG_INFO (this << " UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart " << rbStart << " rbLen " << rbLen << " MCS " << m_ulGrantMcs << " tb
Size " << newRar.m_grant.m_tbSize); |
534 for (uint16_t i = rbStart; i < rbStart + rbLen; i++) | 533 for (uint16_t i = rbStart; i < rbStart + rbLen; i++) |
535 { | 534 { |
536 m_rachAllocationMap.at (i) = (*itRach).m_rnti; | 535 m_rachAllocationMap.at (i) = (*itRach).m_rnti; |
537 } | 536 } |
538 | 537 |
539 if (m_harqOn == true) | 538 if (m_harqOn == true) |
540 { | 539 { |
541 // generate UL-DCI for HARQ retransmissions | 540 // generate UL-DCI for HARQ retransmissions |
542 UlDciListElement_s uldci; | 541 UlDciListElement_s uldci; |
543 uldci.m_rnti = newRar.m_rnti; | 542 uldci.m_rnti = newRar.m_rnti; |
544 uldci.m_rbLen = (uint8_t)rbLen; | 543 uldci.m_rbLen = rbLen; |
545 uldci.m_rbStart = (uint8_t)rbStart; | 544 uldci.m_rbStart = rbStart; |
546 uldci.m_mcs = m_ulGrantMcs; | 545 uldci.m_mcs = m_ulGrantMcs; |
547 uldci.m_tbSize = tbSizeBits / 8; | 546 uldci.m_tbSize = tbSizeBits / 8; |
548 uldci.m_ndi = 1; | 547 uldci.m_ndi = 1; |
549 uldci.m_cceIndex = 0; | 548 uldci.m_cceIndex = 0; |
550 uldci.m_aggrLevel = 1; | 549 uldci.m_aggrLevel = 1; |
551 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF | 550 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
552 uldci.m_hopping = false; | 551 uldci.m_hopping = false; |
553 uldci.m_n2Dmrs = 0; | 552 uldci.m_n2Dmrs = 0; |
554 uldci.m_tpc = 0; // no power control | 553 uldci.m_tpc = 0; // no power control |
555 uldci.m_cqiRequest = false; // only period CQI at this stage | 554 uldci.m_cqiRequest = false; // only period CQI at this stage |
556 uldci.m_ulIndex = 0; // TDD parameter | 555 uldci.m_ulIndex = 0; // TDD parameter |
557 uldci.m_dai = 1; // TDD parameter | 556 uldci.m_dai = 1; // TDD parameter |
558 uldci.m_freqHopping = 0; | 557 uldci.m_freqHopping = 0; |
559 uldci.m_pdcchPowerOffset = 0; // not used | 558 uldci.m_pdcchPowerOffset = 0; // not used |
560 | 559 |
561 uint8_t harqId = 0; | 560 uint8_t harqId = 0; |
| 561 std::map <uint16_t, uint8_t>::iterator itProcId; |
562 itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); | 562 itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); |
563 if (itProcId == m_ulHarqCurrentProcessId.end ()) | 563 if (itProcId == m_ulHarqCurrentProcessId.end ()) |
564 { | 564 { |
565 NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_r
nti); | 565 NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_r
nti); |
566 } | 566 } |
567 harqId = (*itProcId).second; | 567 harqId = (*itProcId).second; |
568 std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ul
HarqProcessesDciBuffer.find (uldci.m_rnti); | 568 std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ul
HarqProcessesDciBuffer.find (uldci.m_rnti); |
569 if (itDci == m_ulHarqProcessesDciBuffer.end ()) | 569 if (itDci == m_ulHarqProcessesDciBuffer.end ()) |
570 { | 570 { |
571 NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer f
or RNTI " << uldci.m_rnti); | 571 NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer f
or RNTI " << uldci.m_rnti); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; | 605 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; |
606 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) | 606 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) |
607 { | 607 { |
608 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); | 608 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); |
609 if (itRnti != rntiAllocated.end ()) | 609 if (itRnti != rntiAllocated.end ()) |
610 { | 610 { |
611 // RNTI already allocated for retx | 611 // RNTI already allocated for retx |
612 continue; | 612 continue; |
613 } | 613 } |
614 uint8_t nLayers = (uint8_t)m_dlInfoListBuffered.at (i).m_harqStatus.size (
); | 614 uint8_t nLayers = static_cast<uint8_t> (m_dlInfoListBuffered.at (i).m_harq
Status.size ()); |
615 std::vector <bool> retx; | 615 std::vector <bool> retx; |
616 NS_LOG_INFO (this << " Processing DLHARQ feedback"); | 616 NS_LOG_INFO (this << " Processing DLHARQ feedback"); |
617 if (nLayers == 1) | 617 if (nLayers == 1) |
618 { | 618 { |
619 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 619 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); |
620 retx.push_back (false); | 620 retx.push_back (false); |
621 } | 621 } |
622 else | 622 else |
623 { | 623 { |
624 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 624 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); | 701 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); |
702 rbgAllocatedNum++; | 702 rbgAllocatedNum++; |
703 } | 703 } |
704 | 704 |
705 NS_LOG_INFO (this << " Send retx in the same RBGs"); | 705 NS_LOG_INFO (this << " Send retx in the same RBGs"); |
706 } | 706 } |
707 else | 707 else |
708 { | 708 { |
709 // find RBGs for sending HARQ retx | 709 // find RBGs for sending HARQ retx |
710 uint8_t j = 0; | 710 uint8_t j = 0; |
711 uint8_t rbgId = (uint8_t)((dciRbg.at (dciRbg.size () - 1) + 1) % r
bgNum); | 711 uint8_t rbgId = static_cast<uint8_t> ((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); |
712 uint8_t startRbg = (uint8_t)dciRbg.at (dciRbg.size () - 1); | 712 uint8_t startRbg = static_cast<uint8_t> (dciRbg.at (dciRbg.size ()
- 1)); |
713 std::vector <bool> rbgMapCopy = rbgMap; | 713 std::vector <bool> rbgMapCopy = rbgMap; |
714 while ((j < dciRbg.size ())&&(startRbg != rbgId)) | 714 while ((j < dciRbg.size ())&&(startRbg != rbgId)) |
715 { | 715 { |
716 if (rbgMapCopy.at (rbgId) == false) | 716 if (rbgMapCopy.at (rbgId) == false) |
717 { | 717 { |
718 rbgMapCopy.at (rbgId) = true; | 718 rbgMapCopy.at (rbgId) = true; |
719 dciRbg.at (j) = rbgId; | 719 dciRbg.at (j) = rbgId; |
720 j++; | 720 j++; |
721 } | 721 } |
722 rbgId = (rbgId + 1) % rbgNum; | 722 rbgId = (rbgId + 1) % rbgNum; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 // all the RBGs are already allocated -> exit | 849 // all the RBGs are already allocated -> exit |
850 if ((ret.m_buildDataList.size () > 0) || (ret.m_buildRarList.size () > 0)) | 850 if ((ret.m_buildDataList.size () > 0) || (ret.m_buildRarList.size () > 0)) |
851 { | 851 { |
852 m_schedSapUser->SchedDlConfigInd (ret); | 852 m_schedSapUser->SchedDlConfigInd (ret); |
853 } | 853 } |
854 return; | 854 return; |
855 } | 855 } |
856 | 856 |
857 | 857 |
858 | 858 |
859 for (int i = 0; i < rbgNum; i++) | 859 for (uint16_t i = 0; i < rbgNum; i++) |
860 { | 860 { |
861 NS_LOG_INFO (this << " ALLOCATION for RBG " << i << " of " << rbgNum); | 861 NS_LOG_INFO (this << " ALLOCATION for RBG " << i << " of " << rbgNum); |
862 if (rbgMap.at (i) == false) | 862 if (rbgMap.at (i) == false) |
863 { | 863 { |
864 std::set <uint16_t>::iterator it; | 864 std::set <uint16_t>::iterator it; |
865 std::set <uint16_t>::iterator itMax = m_flowStatsDl.end (); | 865 std::set <uint16_t>::iterator itMax = m_flowStatsDl.end (); |
866 double rcqiMax = 0.0; | 866 double rcqiMax = 0.0; |
867 for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++) | 867 for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++) |
868 { | 868 { |
869 std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it)); | 869 std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 { | 912 { |
913 if (LcActivePerFlow ((*it)) > 0) | 913 if (LcActivePerFlow ((*it)) > 0) |
914 { | 914 { |
915 // this UE has data to transmit | 915 // this UE has data to transmit |
916 double achievableRate = 0.0; | 916 double achievableRate = 0.0; |
917 uint8_t mcs = 0; | 917 uint8_t mcs = 0; |
918 for (uint8_t k = 0; k < nLayer; k++) | 918 for (uint8_t k = 0; k < nLayer; k++) |
919 { | 919 { |
920 if (sbCqi.size () > k) | 920 if (sbCqi.size () > k) |
921 { | 921 { |
922 mcs = (uint8_t)m_amc->GetMcsFromCqi (sbCqi.at (k))
; | 922 mcs = m_amc->GetMcsFromCqi (sbCqi.at (k)); |
923 } | 923 } |
924 else | 924 else |
925 { | 925 { |
926 // no info on this subband -> worst MCS | 926 // no info on this subband -> worst MCS |
927 mcs = 0; | 927 mcs = 0; |
928 } | 928 } |
929 achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgS
ize) / 8) / 0.001); // = TB size / TTI | 929 achievableRate += ((m_amc->GetDlTbSizeFromMcs (mcs, rb
gSize) / 8) / 0.001); // = TB size / TTI |
930 } | 930 } |
931 | 931 |
932 double rcqi = achievableRate; | 932 double rcqi = achievableRate; |
933 NS_LOG_INFO (this << " RNTI " << (*it) << " MCS " << (uint
32_t)mcs << " achievableRate " << achievableRate << " RCQI " << rcqi); | 933 NS_LOG_INFO (this << " RNTI " << (*it) << " MCS " << (uint
32_t)mcs << " achievableRate " << achievableRate << " RCQI " << rcqi); |
934 | 934 |
935 if (rcqi > rcqiMax) | 935 if (rcqi > rcqiMax) |
936 { | 936 { |
937 rcqiMax = rcqi; | 937 rcqiMax = rcqi; |
938 itMax = it; | 938 itMax = it; |
939 } | 939 } |
940 } | 940 } |
941 } // end if cqi | 941 } // end if cqi |
942 ·············· | 942 ·············· |
943 } // end for m_rlcBufferReq | 943 } // end for m_rlcBufferReq |
944 | 944 |
945 if (itMax == m_flowStatsDl.end ()) | 945 if (itMax == m_flowStatsDl.end ()) |
946 { | 946 { |
947 // no UE available for this RB | 947 // no UE available for this RB |
948 NS_LOG_INFO (this << " any UE found"); | 948 NS_LOG_INFO (this << " any UE found"); |
949 } | 949 } |
950 else | 950 else |
951 { | 951 { |
952 rbgMap.at (i) = true; | 952 rbgMap.at (i) = true; |
953 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; | 953 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; |
954 itMap = allocationMap.find ((*itMax)); | 954 itMap = allocationMap.find ((*itMax)); |
955 if (itMap == allocationMap.end ()) | 955 if (itMap == allocationMap.end ()) |
956 { | 956 { |
957 // insert new element | 957 // insert new element |
958 std::vector <uint16_t> tempMap; | 958 std::vector <uint16_t> tempMap; |
959 tempMap.push_back ((uint16_t)i); | 959 tempMap.push_back (i); |
960 allocationMap.insert (std::pair <uint16_t, std::vector <uint16
_t> > ((*itMax), tempMap)); | 960 allocationMap.insert (std::pair <uint16_t, std::vector <uint16
_t> > ((*itMax), tempMap)); |
961 } | 961 } |
962 else | 962 else |
963 { | 963 { |
964 (*itMap).second.push_back ((uint16_t)i); | 964 (*itMap).second.push_back (i); |
965 } | 965 } |
966 NS_LOG_INFO (this << " UE assigned " << (*itMax)); | 966 NS_LOG_INFO (this << " UE assigned " << (*itMax)); |
967 } | 967 } |
968 } // end for RBG free | 968 } // end for RBG free |
969 } // end for RBGs | 969 } // end for RBGs |
970 | 970 |
971 // generate the transmission opportunities by grouping the RBGs of the same RN
TI and | 971 // generate the transmission opportunities by grouping the RBGs of the same RN
TI and |
972 // creating the correspondent DCIs | 972 // creating the correspondent DCIs |
973 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.b
egin (); | 973 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.b
egin (); |
974 while (itMap != allocationMap.end ()) | 974 while (itMap != allocationMap.end ()) |
975 { | 975 { |
976 // create new BuildDataListElement_s for this LC | 976 // create new BuildDataListElement_s for this LC |
977 BuildDataListElement_s newEl; | 977 BuildDataListElement_s newEl; |
978 newEl.m_rnti = (*itMap).first; | 978 newEl.m_rnti = (*itMap).first; |
979 // create the DlDciListElement_s | 979 // create the DlDciListElement_s |
980 DlDciListElement_s newDci; | 980 DlDciListElement_s newDci; |
981 newDci.m_rnti = (*itMap).first; | 981 newDci.m_rnti = (*itMap).first; |
982 newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); | 982 newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); |
983 | 983 |
984 uint16_t lcActives = (uint16_t)LcActivePerFlow ((*itMap).first); | 984 uint16_t lcActives = static_cast<uint16_t> (LcActivePerFlow ((*itMap).firs
t)); |
985 NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActi
ves); | 985 NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActi
ves); |
986 if (lcActives == 0) | 986 if (lcActives == 0) |
987 { | 987 { |
988 // Set to max value, to avoid divide by 0 below | 988 // Set to max value, to avoid divide by 0 below |
989 lcActives = (uint16_t)65535; // UINT16_MAX; | 989 lcActives = (uint16_t)65535; // UINT16_MAX; |
990 } | 990 } |
991 uint16_t RgbPerRnti = (uint16_t)(*itMap).second.size (); | 991 uint16_t RgbPerRnti = static_cast<uint16_t> ((*itMap).second.size ()); |
992 std::map <uint16_t,SbMeasResult_s>::iterator itCqi; | 992 std::map <uint16_t,SbMeasResult_s>::iterator itCqi; |
993 itCqi = m_a30CqiRxed.find ((*itMap).first); | 993 itCqi = m_a30CqiRxed.find ((*itMap).first); |
994 std::map <uint16_t,uint8_t>::iterator itTxMode; | 994 std::map <uint16_t,uint8_t>::iterator itTxMode; |
995 itTxMode = m_uesTxMode.find ((*itMap).first); | 995 itTxMode = m_uesTxMode.find ((*itMap).first); |
996 if (itTxMode == m_uesTxMode.end ()) | 996 if (itTxMode == m_uesTxMode.end ()) |
997 { | 997 { |
998 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first
); | 998 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first
); |
999 } | 999 } |
1000 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second)
; | 1000 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second)
; |
1001 std::vector <uint8_t> worstCqi (2, 15); | 1001 std::vector <uint8_t> worstCqi (2, 15); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on
channel | 1038 worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on
channel |
1039 } | 1039 } |
1040 } | 1040 } |
1041 for (uint8_t j = 0; j < nLayer; j++) | 1041 for (uint8_t j = 0; j < nLayer; j++) |
1042 { | 1042 { |
1043 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (
uint16_t)worstCqi.at (j)); | 1043 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (
uint16_t)worstCqi.at (j)); |
1044 } | 1044 } |
1045 uint32_t bytesTxed = 0; | 1045 uint32_t bytesTxed = 0; |
1046 for (uint8_t j = 0; j < nLayer; j++) | 1046 for (uint8_t j = 0; j < nLayer; j++) |
1047 { | 1047 { |
1048 newDci.m_mcs.push_back ((uint8_t)m_amc->GetMcsFromCqi (worstCqi.at (j)
)); | 1048 newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j))); |
1049 int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (j), RgbPerRnti
* rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.2
13) | 1049 int tbSize = (m_amc->GetDlTbSizeFromMcs (newDci.m_mcs.at (j), RgbPerRn
ti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36
.213) |
1050 newDci.m_tbsSize.push_back ((uint16_t)tbSize); | 1050 newDci.m_tbsSize.push_back (static_cast<uint16_t> (tbSize)); |
1051 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_
amc->GetMcsFromCqi (worstCqi.at (j))); | 1051 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_
amc->GetMcsFromCqi (worstCqi.at (j))); |
1052 bytesTxed += tbSize; | 1052 bytesTxed += tbSize; |
1053 } | 1053 } |
1054 | 1054 |
1055 newDci.m_resAlloc = 0; // only allocation type 0 at this stage | 1055 newDci.m_resAlloc = 0; // only allocation type 0 at this stage |
1056 newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) | 1056 newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) |
1057 uint32_t rbgMask = 0; | 1057 uint32_t rbgMask = 0; |
1058 for (uint16_t k = 0; k < (*itMap).second.size (); k++) | 1058 for (uint16_t k = 0; k < (*itMap).second.size (); k++) |
1059 { | 1059 { |
1060 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); | 1060 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 { | 1366 { |
1367 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); | 1367 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); |
1368 m_schedSapUser->SchedUlConfigInd (ret); | 1368 m_schedSapUser->SchedUlConfigInd (ret); |
1369 } | 1369 } |
1370 ········ | 1370 ········ |
1371 return; // no flows to be scheduled | 1371 return; // no flows to be scheduled |
1372 } | 1372 } |
1373 | 1373 |
1374 | 1374 |
1375 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger | 1375 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger |
1376 uint16_t rbPerFlow = (uint16_t)((m_cschedCellConfig.m_ulBandwidth) / (nflows +
rntiAllocated.size ())); | 1376 uint16_t rbPerFlow = static_cast<uint16_t> ((m_cschedCellConfig.m_ulBandwidth)
/ (nflows + rntiAllocated.size ())); |
1377 if (rbPerFlow < 3) | 1377 if (rbPerFlow < 3) |
1378 { | 1378 { |
1379 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes | 1379 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes |
1380 } | 1380 } |
1381 int rbAllocated = 0; | 1381 uint16_t rbAllocated = 0; |
1382 | 1382 |
1383 if (m_nextRntiUl != 0) | 1383 if (m_nextRntiUl != 0) |
1384 { | 1384 { |
1385 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) | 1385 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
1386 { | 1386 { |
1387 if ((*it).first == m_nextRntiUl) | 1387 if ((*it).first == m_nextRntiUl) |
1388 { | 1388 { |
1389 break; | 1389 break; |
1390 } | 1390 } |
1391 } | 1391 } |
(...skipping 18 matching lines...) Expand all Loading... |
1410 if (it == m_ceBsrRxed.end ()) | 1410 if (it == m_ceBsrRxed.end ()) |
1411 { | 1411 { |
1412 // restart from the first | 1412 // restart from the first |
1413 it = m_ceBsrRxed.begin (); | 1413 it = m_ceBsrRxed.begin (); |
1414 } | 1414 } |
1415 continue; | 1415 continue; |
1416 } | 1416 } |
1417 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 1417 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1418 { | 1418 { |
1419 // limit to physical resources last resource assignment | 1419 // limit to physical resources last resource assignment |
1420 rbPerFlow = (uint16_t)(m_cschedCellConfig.m_ulBandwidth - rbAllocated)
; | 1420 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1421 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1421 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1422 if (rbPerFlow < 3) | 1422 if (rbPerFlow < 3) |
1423 { | 1423 { |
1424 // terminate allocation | 1424 // terminate allocation |
1425 rbPerFlow = 0;······ | 1425 rbPerFlow = 0;······ |
1426 } | 1426 } |
1427 } | 1427 } |
1428 | 1428 |
1429 UlDciListElement_s uldci; | 1429 UlDciListElement_s uldci; |
1430 uldci.m_rnti = (*it).first; | 1430 uldci.m_rnti = (*it).first; |
1431 uldci.m_rbLen = (uint8_t)rbPerFlow; | 1431 uldci.m_rbLen = static_cast<uint8_t> (rbPerFlow); |
1432 uldci.m_rbStart = 0; | 1432 uldci.m_rbStart = 0; |
1433 bool allocated = false; | 1433 bool allocated = false; |
1434 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); | 1434 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); |
1435 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) | 1435 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) |
1436 { | 1436 { |
1437 // check availability | 1437 // check availability |
1438 bool free = true; | 1438 bool free = true; |
1439 for (uint16_t j = (uint16_t)rbAllocated; j < (uint16_t)(rbAllocated +
rbPerFlow); j++) | 1439 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1440 { | 1440 { |
1441 if (rbMap.at (j) == true) | 1441 if (rbMap.at (j) == true) |
1442 { | 1442 { |
1443 free = false; | 1443 free = false; |
1444 break; | 1444 break; |
1445 } | 1445 } |
1446 } | 1446 } |
1447 if (free) | 1447 if (free) |
1448 { | 1448 { |
1449 uldci.m_rbStart = (uint8_t)rbAllocated; | 1449 uldci.m_rbStart = static_cast<uint8_t> (rbAllocated); |
1450 | 1450 |
1451 for (uint16_t j = (uint16_t)rbAllocated; j < (uint16_t)(rbAllocate
d + rbPerFlow); j++) | 1451 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1452 { | 1452 { |
1453 rbMap.at (j) = true; | 1453 rbMap.at (j) = true; |
1454 // store info on allocation for managing ul-cqi interpretation | 1454 // store info on allocation for managing ul-cqi interpretation |
1455 rbgAllocationMap.at (j) = (*it).first; | 1455 rbgAllocationMap.at (j) = (*it).first; |
1456 } | 1456 } |
1457 rbAllocated += rbPerFlow; | 1457 rbAllocated += rbPerFlow; |
1458 allocated = true; | 1458 allocated = true; |
1459 break; | 1459 break; |
1460 } | 1460 } |
1461 rbAllocated++; | 1461 rbAllocated++; |
1462 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 1462 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1463 { | 1463 { |
1464 // limit to physical resources last resource assignment | 1464 // limit to physical resources last resource assignment |
1465 rbPerFlow = (uint16_t)(m_cschedCellConfig.m_ulBandwidth - rbAlloca
ted); | 1465 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1466 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1466 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1467 if (rbPerFlow < 3) | 1467 if (rbPerFlow < 3) |
1468 { | 1468 { |
1469 // terminate allocation | 1469 // terminate allocation |
1470 rbPerFlow = 0;················· | 1470 rbPerFlow = 0;················· |
1471 } | 1471 } |
1472 } | 1472 } |
1473 } | 1473 } |
1474 if (!allocated) | 1474 if (!allocated) |
1475 { | 1475 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 it = m_ceBsrRxed.begin (); | 1527 it = m_ceBsrRxed.begin (); |
1528 } | 1528 } |
1529 NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_r
nti); | 1529 NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_r
nti); |
1530 // remove UE from allocation map | 1530 // remove UE from allocation map |
1531 for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_r
bLen; i++) | 1531 for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_r
bLen; i++) |
1532 { | 1532 { |
1533 rbgAllocationMap.at (i) = 0; | 1533 rbgAllocationMap.at (i) = 0; |
1534 } | 1534 } |
1535 continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 3
6.213) | 1535 continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 3
6.213) |
1536 } | 1536 } |
1537 uldci.m_mcs = (uint8_t)m_amc->GetMcsFromCqi (cqi); | 1537 uldci.m_mcs = m_amc->GetMcsFromCqi (cqi); |
1538 } | 1538 } |
1539 | 1539 |
1540 uldci.m_tbSize = (uint16_t)(m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlo
w) / 8); | 1540 uldci.m_tbSize = (m_amc->GetUlTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); |
1541 UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); | 1541 UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); |
1542 uldci.m_ndi = 1; | 1542 uldci.m_ndi = 1; |
1543 uldci.m_cceIndex = 0; | 1543 uldci.m_cceIndex = 0; |
1544 uldci.m_aggrLevel = 1; | 1544 uldci.m_aggrLevel = 1; |
1545 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF | 1545 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
1546 uldci.m_hopping = false; | 1546 uldci.m_hopping = false; |
1547 uldci.m_n2Dmrs = 0; | 1547 uldci.m_n2Dmrs = 0; |
1548 uldci.m_tpc = 0; // no power control | 1548 uldci.m_tpc = 0; // no power control |
1549 uldci.m_cqiRequest = false; // only period CQI at this stage | 1549 uldci.m_cqiRequest = false; // only period CQI at this stage |
1550 uldci.m_ulIndex = 0; // TDD parameter | 1550 uldci.m_ulIndex = 0; // TDD parameter |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); | 1600 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); |
1601 m_schedSapUser->SchedUlConfigInd (ret); | 1601 m_schedSapUser->SchedUlConfigInd (ret); |
1602 | 1602 |
1603 return; | 1603 return; |
1604 } | 1604 } |
1605 | 1605 |
1606 void | 1606 void |
1607 FdMtFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapPro
vider::SchedUlNoiseInterferenceReqParameters& params) | 1607 FdMtFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapPro
vider::SchedUlNoiseInterferenceReqParameters& params) |
1608 { | 1608 { |
1609 NS_LOG_FUNCTION (this); | 1609 NS_LOG_FUNCTION (this); |
1610 NS_UNUSED(params); | 1610 NS_UNUSED (params); |
1611 return; | 1611 return; |
1612 } | 1612 } |
1613 | 1613 |
1614 void | 1614 void |
1615 FdMtFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::Sche
dUlSrInfoReqParameters& params) | 1615 FdMtFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::Sche
dUlSrInfoReqParameters& params) |
1616 { | 1616 { |
1617 NS_LOG_FUNCTION (this); | 1617 NS_LOG_FUNCTION (this); |
1618 NS_UNUSED(params); | 1618 NS_UNUSED (params); |
1619 return; | 1619 return; |
1620 } | 1620 } |
1621 | 1621 |
1622 void | 1622 void |
1623 FdMtFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider:
:SchedUlMacCtrlInfoReqParameters& params) | 1623 FdMtFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider:
:SchedUlMacCtrlInfoReqParameters& params) |
1624 { | 1624 { |
1625 NS_LOG_FUNCTION (this); | 1625 NS_LOG_FUNCTION (this); |
1626 | 1626 |
1627 std::map <uint16_t,uint32_t>::iterator it; | 1627 std::map <uint16_t,uint32_t>::iterator it; |
1628 | 1628 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1976 { | 1976 { |
1977 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); | 1977 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); |
1978 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; | 1978 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; |
1979 params.m_rnti = rnti; | 1979 params.m_rnti = rnti; |
1980 params.m_transmissionMode = txMode; | 1980 params.m_transmissionMode = txMode; |
1981 m_cschedSapUser->CschedUeConfigUpdateInd (params); | 1981 m_cschedSapUser->CschedUeConfigUpdateInd (params); |
1982 } | 1982 } |
1983 | 1983 |
1984 | 1984 |
1985 } | 1985 } |
LEFT | RIGHT |