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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 | 314 |
315 return; | 315 return; |
316 } | 316 } |
317 | 317 |
318 void | 318 void |
319 TdBetFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvide
r::SchedDlPagingBufferReqParameters& params) | 319 TdBetFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvide
r::SchedDlPagingBufferReqParameters& params) |
320 { | 320 { |
321 NS_LOG_FUNCTION (this); | 321 NS_LOG_FUNCTION (this); |
322 NS_FATAL_ERROR ("method not implemented"); | 322 NS_FATAL_ERROR ("method not implemented"); |
323 NS_UNUSED(params); | 323 NS_UNUSED (params); |
324 return; | 324 return; |
325 } | 325 } |
326 | 326 |
327 void | 327 void |
328 TdBetFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::
SchedDlMacBufferReqParameters& params) | 328 TdBetFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::
SchedDlMacBufferReqParameters& params) |
329 { | 329 { |
330 NS_LOG_FUNCTION (this); | 330 NS_LOG_FUNCTION (this); |
331 NS_FATAL_ERROR ("method not implemented"); | 331 NS_FATAL_ERROR ("method not implemented"); |
332 NS_UNUSED(params); | 332 NS_UNUSED (params); |
333 return; | 333 return; |
334 } | 334 } |
335 | 335 |
336 int | 336 int |
337 TdBetFfMacScheduler::GetRbgSize (int dlbandwidth) | 337 TdBetFfMacScheduler::GetRbgSize (int dlbandwidth) |
338 { | 338 { |
339 for (int i = 0; i < 4; i++) | 339 for (int i = 0; i < 4; i++) |
340 { | 340 { |
341 if (dlbandwidth < TdBetType0AllocationRbg[i]) | 341 if (dlbandwidth < TdBetType0AllocationRbg[i]) |
342 { | 342 { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); | 494 int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); |
495 int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; | 495 int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; |
496 std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNT
I | 496 std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNT
I |
497 std::vector <bool> rbgMap; // global RBGs map | 497 std::vector <bool> rbgMap; // global RBGs map |
498 uint16_t rbgAllocatedNum = 0; | 498 uint16_t rbgAllocatedNum = 0; |
499 std::set <uint16_t> rntiAllocated; | 499 std::set <uint16_t> rntiAllocated; |
500 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); | 500 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); |
501 FfMacSchedSapUser::SchedDlConfigIndParameters ret; | 501 FfMacSchedSapUser::SchedDlConfigIndParameters ret; |
502 | 502 |
503 // update UL HARQ proc id | 503 // update UL HARQ proc id |
504 std::map <uint16_t, uint8_t>::iterator itProcId; | 504 for (std::map <uint16_t, uint8_t>::iterator itProcId = m_ulHarqCurrentProcessI
d.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++) |
505 for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrent
ProcessId.end (); itProcId++) | |
506 { | 505 { |
507 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; | 506 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; |
508 } | 507 } |
509 | 508 |
510 // RACH Allocation | 509 // RACH Allocation |
511 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 510 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
512 uint16_t rbStart = 0; | 511 uint8_t rbStart = 0; |
513 std::vector <struct RachListElement_s>::iterator itRach; | 512 std::vector <struct RachListElement_s>::iterator itRach; |
514 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) | 513 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) |
515 { | 514 { |
516 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"); | 515 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"); |
517 BuildRarListElement_s newRar; | 516 BuildRarListElement_s newRar; |
518 newRar.m_rnti = (*itRach).m_rnti; | 517 newRar.m_rnti = (*itRach).m_rnti; |
519 // DL-RACH Allocation | 518 // DL-RACH Allocation |
520 // Ideal: no needs of configuring m_dci | 519 // Ideal: no needs of configuring m_dci |
521 // UL-RACH Allocation | 520 // UL-RACH Allocation |
522 newRar.m_grant.m_rnti = newRar.m_rnti; | 521 newRar.m_grant.m_rnti = newRar.m_rnti; |
523 newRar.m_grant.m_mcs = m_ulGrantMcs; | 522 newRar.m_grant.m_mcs = m_ulGrantMcs; |
524 uint16_t rbLen = 1; | 523 uint8_t rbLen = 1; |
525 uint16_t tbSizeBits = 0; | 524 uint16_t tbSizeBits = 0; |
526 // find lowest TB size that fits UL grant estimated size | 525 // find lowest TB size that fits UL grant estimated size |
527 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cs
chedCellConfig.m_ulBandwidth)) | 526 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cs
chedCellConfig.m_ulBandwidth)) |
528 { | 527 { |
529 rbLen++; | 528 rbLen++; |
530 tbSizeBits = (uint16_t)m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen); | 529 tbSizeBits = m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, rbLen); |
531 } | 530 } |
532 if (tbSizeBits < (*itRach).m_estimatedSize) | 531 if (tbSizeBits < (*itRach).m_estimatedSize) |
533 { | 532 { |
534 // no more allocation space: finish allocation | 533 // no more allocation space: finish allocation |
535 break; | 534 break; |
536 } | 535 } |
537 newRar.m_grant.m_rbStart = (uint8_t)rbStart; | 536 newRar.m_grant.m_rbStart = rbStart; |
538 newRar.m_grant.m_rbLen = (uint8_t)rbLen; | 537 newRar.m_grant.m_rbLen = rbLen; |
539 newRar.m_grant.m_tbSize = tbSizeBits / 8; | 538 newRar.m_grant.m_tbSize = tbSizeBits / 8; |
540 newRar.m_grant.m_hopping = false; | 539 newRar.m_grant.m_hopping = false; |
541 newRar.m_grant.m_tpc = 0; | 540 newRar.m_grant.m_tpc = 0; |
542 newRar.m_grant.m_cqiRequest = false; | 541 newRar.m_grant.m_cqiRequest = false; |
543 newRar.m_grant.m_ulDelay = false; | 542 newRar.m_grant.m_ulDelay = false; |
544 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); | 543 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); |
545 for (uint16_t i = rbStart; i < rbStart + rbLen; i++) | 544 for (uint16_t i = rbStart; i < rbStart + rbLen; i++) |
546 { | 545 { |
547 m_rachAllocationMap.at (i) = (*itRach).m_rnti; | 546 m_rachAllocationMap.at (i) = (*itRach).m_rnti; |
548 } | 547 } |
549 | 548 |
550 if (m_harqOn == true) | 549 if (m_harqOn == true) |
551 { | 550 { |
552 // generate UL-DCI for HARQ retransmissions | 551 // generate UL-DCI for HARQ retransmissions |
553 UlDciListElement_s uldci; | 552 UlDciListElement_s uldci; |
554 uldci.m_rnti = newRar.m_rnti; | 553 uldci.m_rnti = newRar.m_rnti; |
555 uldci.m_rbLen = (uint8_t)rbLen; | 554 uldci.m_rbLen = rbLen; |
556 uldci.m_rbStart = (uint8_t)rbStart; | 555 uldci.m_rbStart = rbStart; |
557 uldci.m_mcs = m_ulGrantMcs; | 556 uldci.m_mcs = m_ulGrantMcs; |
558 uldci.m_tbSize = tbSizeBits / 8; | 557 uldci.m_tbSize = tbSizeBits / 8; |
559 uldci.m_ndi = 1; | 558 uldci.m_ndi = 1; |
560 uldci.m_cceIndex = 0; | 559 uldci.m_cceIndex = 0; |
561 uldci.m_aggrLevel = 1; | 560 uldci.m_aggrLevel = 1; |
562 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF | 561 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
563 uldci.m_hopping = false; | 562 uldci.m_hopping = false; |
564 uldci.m_n2Dmrs = 0; | 563 uldci.m_n2Dmrs = 0; |
565 uldci.m_tpc = 0; // no power control | 564 uldci.m_tpc = 0; // no power control |
566 uldci.m_cqiRequest = false; // only period CQI at this stage | 565 uldci.m_cqiRequest = false; // only period CQI at this stage |
567 uldci.m_ulIndex = 0; // TDD parameter | 566 uldci.m_ulIndex = 0; // TDD parameter |
568 uldci.m_dai = 1; // TDD parameter | 567 uldci.m_dai = 1; // TDD parameter |
569 uldci.m_freqHopping = 0; | 568 uldci.m_freqHopping = 0; |
570 uldci.m_pdcchPowerOffset = 0; // not used | 569 uldci.m_pdcchPowerOffset = 0; // not used |
571 | 570 |
572 uint8_t harqId = 0; | 571 uint8_t harqId = 0; |
| 572 std::map <uint16_t, uint8_t>::iterator itProcId; |
573 itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); | 573 itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); |
574 if (itProcId == m_ulHarqCurrentProcessId.end ()) | 574 if (itProcId == m_ulHarqCurrentProcessId.end ()) |
575 { | 575 { |
576 NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_r
nti); | 576 NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_r
nti); |
577 } | 577 } |
578 harqId = (*itProcId).second; | 578 harqId = (*itProcId).second; |
579 std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ul
HarqProcessesDciBuffer.find (uldci.m_rnti); | 579 std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ul
HarqProcessesDciBuffer.find (uldci.m_rnti); |
580 if (itDci == m_ulHarqProcessesDciBuffer.end ()) | 580 if (itDci == m_ulHarqProcessesDciBuffer.end ()) |
581 { | 581 { |
582 NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer f
or RNTI " << uldci.m_rnti); | 582 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... |
615 } | 615 } |
616 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; | 616 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; |
617 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) | 617 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) |
618 { | 618 { |
619 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); | 619 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); |
620 if (itRnti != rntiAllocated.end ()) | 620 if (itRnti != rntiAllocated.end ()) |
621 { | 621 { |
622 // RNTI already allocated for retx | 622 // RNTI already allocated for retx |
623 continue; | 623 continue; |
624 } | 624 } |
625 uint8_t nLayers = (uint8_t)m_dlInfoListBuffered.at (i).m_harqStatus.size (
); | 625 uint8_t nLayers = static_cast<uint8_t> (m_dlInfoListBuffered.at (i).m_harq
Status.size ()); |
626 std::vector <bool> retx; | 626 std::vector <bool> retx; |
627 NS_LOG_INFO (this << " Processing DLHARQ feedback"); | 627 NS_LOG_INFO (this << " Processing DLHARQ feedback"); |
628 if (nLayers == 1) | 628 if (nLayers == 1) |
629 { | 629 { |
630 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 630 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); |
631 retx.push_back (false); | 631 retx.push_back (false); |
632 } | 632 } |
633 else | 633 else |
634 { | 634 { |
635 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 635 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... |
712 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); | 712 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); |
713 rbgAllocatedNum++; | 713 rbgAllocatedNum++; |
714 } | 714 } |
715 | 715 |
716 NS_LOG_INFO (this << " Send retx in the same RBGs"); | 716 NS_LOG_INFO (this << " Send retx in the same RBGs"); |
717 } | 717 } |
718 else | 718 else |
719 { | 719 { |
720 // find RBGs for sending HARQ retx | 720 // find RBGs for sending HARQ retx |
721 uint8_t j = 0; | 721 uint8_t j = 0; |
722 uint8_t rbgId = (uint8_t)((dciRbg.at (dciRbg.size () - 1) + 1) % r
bgNum); | 722 uint8_t rbgId = static_cast<uint8_t> ((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); |
723 uint8_t startRbg = (uint8_t)dciRbg.at (dciRbg.size () - 1); | 723 uint8_t startRbg = static_cast<uint8_t> (dciRbg.at (dciRbg.size ()
- 1)); |
724 std::vector <bool> rbgMapCopy = rbgMap; | 724 std::vector <bool> rbgMapCopy = rbgMap; |
725 while ((j < dciRbg.size ())&&(startRbg != rbgId)) | 725 while ((j < dciRbg.size ())&&(startRbg != rbgId)) |
726 { | 726 { |
727 if (rbgMapCopy.at (rbgId) == false) | 727 if (rbgMapCopy.at (rbgId) == false) |
728 { | 728 { |
729 rbgMapCopy.at (rbgId) = true; | 729 rbgMapCopy.at (rbgId) = true; |
730 dciRbg.at (j) = rbgId; | 730 dciRbg.at (j) = rbgId; |
731 j++; | 731 j++; |
732 } | 732 } |
733 rbgId = (rbgId + 1) % rbgNum; | 733 rbgId = (rbgId + 1) % rbgNum; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 { | 859 { |
860 // all the RBGs are already allocated -> exit | 860 // all the RBGs are already allocated -> exit |
861 if ((ret.m_buildDataList.size () > 0) || (ret.m_buildRarList.size () > 0)) | 861 if ((ret.m_buildDataList.size () > 0) || (ret.m_buildRarList.size () > 0)) |
862 { | 862 { |
863 m_schedSapUser->SchedDlConfigInd (ret); | 863 m_schedSapUser->SchedDlConfigInd (ret); |
864 } | 864 } |
865 return; | 865 return; |
866 } | 866 } |
867 | 867 |
868 | 868 |
869 std::map <uint16_t, tdbetsFlowPerf_t>::iterator it; | |
870 std::map <uint16_t, tdbetsFlowPerf_t>::iterator itMax = m_flowStatsDl.end (); | 869 std::map <uint16_t, tdbetsFlowPerf_t>::iterator itMax = m_flowStatsDl.end (); |
871 double metricMax = 0.0; | 870 double metricMax = 0.0; |
872 for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++) | 871 for (std::map <uint16_t, tdbetsFlowPerf_t>::iterator it = m_flowStatsDl.begin
(); it != m_flowStatsDl.end (); it++) |
873 { | 872 { |
874 | 873 |
875 // check first what are channel conditions for this UE, if CQI!=0 | 874 // check first what are channel conditions for this UE, if CQI!=0 |
876 std::map <uint16_t,uint8_t>::iterator itCqi; | 875 std::map <uint16_t,uint8_t>::iterator itCqi; |
877 itCqi = m_p10CqiRxed.find ((*it).first); | 876 itCqi = m_p10CqiRxed.find ((*it).first); |
878 std::map <uint16_t,uint8_t>::iterator itTxMode; | 877 std::map <uint16_t,uint8_t>::iterator itTxMode; |
879 itTxMode = m_uesTxMode.find ((*it).first); | 878 itTxMode = m_uesTxMode.find ((*it).first); |
880 if (itTxMode == m_uesTxMode.end ()) | 879 if (itTxMode == m_uesTxMode.end ()) |
881 { | 880 { |
882 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first); | 881 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 { | 929 { |
931 // no UE available for downlink· | 930 // no UE available for downlink· |
932 return; | 931 return; |
933 } | 932 } |
934 else | 933 else |
935 { | 934 { |
936 // assign all RBGs to this UE | 935 // assign all RBGs to this UE |
937 std::vector <uint16_t> tempMap; | 936 std::vector <uint16_t> tempMap; |
938 for (int i = 0; i < rbgNum; i++) | 937 for (int i = 0; i < rbgNum; i++) |
939 { | 938 { |
940 tempMap.push_back ((uint16_t)i); | 939 tempMap.push_back (static_cast<uint16_t> (i)); |
941 } | 940 } |
942 allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itM
ax).first, tempMap)); | 941 allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itM
ax).first, tempMap)); |
943 } | 942 } |
944 | 943 |
945 | 944 |
946 // reset TTI stats of users | 945 // reset TTI stats of users |
947 std::map <uint16_t, tdbetsFlowPerf_t>::iterator itStats; | 946 std::map <uint16_t, tdbetsFlowPerf_t>::iterator itStats; |
948 for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStat
s++) | 947 for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStat
s++) |
949 { | 948 { |
950 (*itStats).second.lastTtiBytesTrasmitted = 0; | 949 (*itStats).second.lastTtiBytesTrasmitted = 0; |
951 } | 950 } |
952 | 951 |
953 // generate the transmission opportunities by grouping the RBGs of the same RN
TI and | 952 // generate the transmission opportunities by grouping the RBGs of the same RN
TI and |
954 // creating the correspondent DCIs | 953 // creating the correspondent DCIs |
955 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.b
egin (); | 954 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.b
egin (); |
956 while (itMap != allocationMap.end ()) | 955 while (itMap != allocationMap.end ()) |
957 { | 956 { |
958 // create new BuildDataListElement_s for this LC | 957 // create new BuildDataListElement_s for this LC |
959 BuildDataListElement_s newEl; | 958 BuildDataListElement_s newEl; |
960 newEl.m_rnti = (*itMap).first; | 959 newEl.m_rnti = (*itMap).first; |
961 // create the DlDciListElement_s | 960 // create the DlDciListElement_s |
962 DlDciListElement_s newDci; | 961 DlDciListElement_s newDci; |
963 newDci.m_rnti = (*itMap).first; | 962 newDci.m_rnti = (*itMap).first; |
964 newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); | 963 newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); |
965 | 964 |
966 uint16_t lcActives = (uint16_t)LcActivePerFlow ((*itMap).first); | 965 uint16_t lcActives = static_cast<uint16_t> (LcActivePerFlow ((*itMap).firs
t)); |
967 NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActi
ves); | 966 NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActi
ves); |
968 if (lcActives == 0) | 967 if (lcActives == 0) |
969 { | 968 { |
970 // Set to max value, to avoid divide by 0 below | 969 // Set to max value, to avoid divide by 0 below |
971 lcActives = (uint16_t)65535; // UINT16_MAX; | 970 lcActives = (uint16_t)65535; // UINT16_MAX; |
972 } | 971 } |
973 uint16_t RgbPerRnti = (uint16_t)(*itMap).second.size (); | 972 uint16_t RgbPerRnti = static_cast<uint16_t> ((*itMap).second.size ()); |
974 std::map <uint16_t,uint8_t>::iterator itCqi; | 973 std::map <uint16_t,uint8_t>::iterator itCqi; |
975 itCqi = m_p10CqiRxed.find ((*itMap).first); | 974 itCqi = m_p10CqiRxed.find ((*itMap).first); |
976 std::map <uint16_t,uint8_t>::iterator itTxMode; | 975 std::map <uint16_t,uint8_t>::iterator itTxMode; |
977 itTxMode = m_uesTxMode.find ((*itMap).first); | 976 itTxMode = m_uesTxMode.find ((*itMap).first); |
978 if (itTxMode == m_uesTxMode.end ()) | 977 if (itTxMode == m_uesTxMode.end ()) |
979 { | 978 { |
980 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first
); | 979 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first
); |
981 } | 980 } |
982 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second)
; | 981 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second)
; |
983 | 982 |
984 uint32_t bytesTxed = 0; | 983 uint32_t bytesTxed = 0; |
985 for (uint8_t j = 0; j < nLayer; j++) | 984 for (uint8_t j = 0; j < nLayer; j++) |
986 { | 985 { |
987 if (itCqi == m_p10CqiRxed.end ()) | 986 if (itCqi == m_p10CqiRxed.end ()) |
988 { | 987 { |
989 newDci.m_mcs.push_back (0); // no info on this user -> lowest MCS | 988 newDci.m_mcs.push_back (0); // no info on this user -> lowest MCS |
990 } | 989 } |
991 else | 990 else |
992 { | 991 { |
993 newDci.m_mcs.push_back ( (uint8_t)m_amc->GetMcsFromCqi ((*itCqi).s
econd) ); | 992 newDci.m_mcs.push_back ( m_amc->GetMcsFromCqi ((*itCqi).second) ); |
994 } | 993 } |
995 | 994 |
996 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) | 995 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) |
997 newDci.m_tbsSize.push_back ((uint16_t)tbSize); | 996 newDci.m_tbsSize.push_back (static_cast<uint16_t> (tbSize)); |
998 bytesTxed += tbSize; | 997 bytesTxed += tbSize; |
999 } | 998 } |
1000 | 999 |
1001 newDci.m_resAlloc = 0; // only allocation type 0 at this stage | 1000 newDci.m_resAlloc = 0; // only allocation type 0 at this stage |
1002 newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) | 1001 newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) |
1003 uint32_t rbgMask = 0; | 1002 uint32_t rbgMask = 0; |
1004 for (uint16_t k = 0; k < (*itMap).second.size (); k++) | 1003 for (uint16_t k = 0; k < (*itMap).second.size (); k++) |
1005 { | 1004 { |
1006 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); | 1005 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); |
1007 NS_LOG_INFO (this << " Allocated RBG " << (*itMap).second.at (k)); | 1006 NS_LOG_INFO (this << " Allocated RBG " << (*itMap).second.at (k)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 { | 1068 { |
1070 NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t
)newEl.m_rnti); | 1069 NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t
)newEl.m_rnti); |
1071 } | 1070 } |
1072 (*itHarqTimer).second.at (newDci.m_harqProcess) = 0; | 1071 (*itHarqTimer).second.at (newDci.m_harqProcess) = 0; |
1073 } | 1072 } |
1074 | 1073 |
1075 // ...more parameters -> ingored in this version | 1074 // ...more parameters -> ingored in this version |
1076 | 1075 |
1077 ret.m_buildDataList.push_back (newEl); | 1076 ret.m_buildDataList.push_back (newEl); |
1078 // update UE stats | 1077 // update UE stats |
| 1078 std::map <uint16_t, tdbetsFlowPerf_t>::iterator it; |
1079 it = m_flowStatsDl.find ((*itMap).first); | 1079 it = m_flowStatsDl.find ((*itMap).first); |
1080 if (it != m_flowStatsDl.end ()) | 1080 if (it != m_flowStatsDl.end ()) |
1081 { | 1081 { |
1082 (*it).second.lastTtiBytesTrasmitted = bytesTxed; | 1082 (*it).second.lastTtiBytesTrasmitted = bytesTxed; |
1083 NS_LOG_INFO (this << " UE total bytes txed " << (*it).second.lastTtiBy
tesTrasmitted); | 1083 NS_LOG_INFO (this << " UE total bytes txed " << (*it).second.lastTtiBy
tesTrasmitted); |
1084 | 1084 |
1085 | 1085 |
1086 } | 1086 } |
1087 else | 1087 else |
1088 { | 1088 { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 { | 1338 { |
1339 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); | 1339 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); |
1340 m_schedSapUser->SchedUlConfigInd (ret); | 1340 m_schedSapUser->SchedUlConfigInd (ret); |
1341 } | 1341 } |
1342 ········ | 1342 ········ |
1343 return; // no flows to be scheduled | 1343 return; // no flows to be scheduled |
1344 } | 1344 } |
1345 | 1345 |
1346 | 1346 |
1347 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger | 1347 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger |
1348 uint16_t rbPerFlow = (uint16_t)((m_cschedCellConfig.m_ulBandwidth / (nflows +
rntiAllocated.size ()))); | 1348 uint16_t rbPerFlow = static_cast<uint16_t> ((m_cschedCellConfig.m_ulBandwidth
/ (nflows + rntiAllocated.size ()))); |
1349 if (rbPerFlow < 3) | 1349 if (rbPerFlow < 3) |
1350 { | 1350 { |
1351 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes | 1351 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes |
1352 } | 1352 } |
1353 int rbAllocated = 0; | 1353 uint16_t rbAllocated = 0; |
1354 | 1354 |
1355 std::map <uint16_t, tdbetsFlowPerf_t>::iterator itStats; | 1355 std::map <uint16_t, tdbetsFlowPerf_t>::iterator itStats; |
1356 if (m_nextRntiUl != 0) | 1356 if (m_nextRntiUl != 0) |
1357 { | 1357 { |
1358 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) | 1358 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
1359 { | 1359 { |
1360 if ((*it).first == m_nextRntiUl) | 1360 if ((*it).first == m_nextRntiUl) |
1361 { | 1361 { |
1362 break; | 1362 break; |
1363 } | 1363 } |
(...skipping 19 matching lines...) Expand all Loading... |
1383 if (it == m_ceBsrRxed.end ()) | 1383 if (it == m_ceBsrRxed.end ()) |
1384 { | 1384 { |
1385 // restart from the first | 1385 // restart from the first |
1386 it = m_ceBsrRxed.begin (); | 1386 it = m_ceBsrRxed.begin (); |
1387 } | 1387 } |
1388 continue; | 1388 continue; |
1389 } | 1389 } |
1390 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 1390 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1391 { | 1391 { |
1392 // limit to physical resources last resource assignment | 1392 // limit to physical resources last resource assignment |
1393 rbPerFlow = (uint16_t)(m_cschedCellConfig.m_ulBandwidth - rbAllocated)
; | 1393 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1394 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1394 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1395 if (rbPerFlow < 3) | 1395 if (rbPerFlow < 3) |
1396 { | 1396 { |
1397 // terminate allocation | 1397 // terminate allocation |
1398 rbPerFlow = 0;······ | 1398 rbPerFlow = 0;······ |
1399 } | 1399 } |
1400 } | 1400 } |
1401 | 1401 |
1402 UlDciListElement_s uldci; | 1402 UlDciListElement_s uldci; |
1403 uldci.m_rnti = (*it).first; | 1403 uldci.m_rnti = (*it).first; |
1404 uldci.m_rbLen = (uint8_t)rbPerFlow; | 1404 uldci.m_rbLen = static_cast<uint8_t> (rbPerFlow); |
1405 uldci.m_rbStart = 0; | 1405 uldci.m_rbStart = 0; |
1406 bool allocated = false; | 1406 bool allocated = false; |
1407 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); | 1407 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); |
1408 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) | 1408 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) |
1409 { | 1409 { |
1410 // check availability | 1410 // check availability |
1411 bool free = true; | 1411 bool free = true; |
1412 for (uint16_t j = (uint16_t)rbAllocated; j < (uint16_t)(rbAllocated +
rbPerFlow); j++) | 1412 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1413 { | 1413 { |
1414 if (rbMap.at (j) == true) | 1414 if (rbMap.at (j) == true) |
1415 { | 1415 { |
1416 free = false; | 1416 free = false; |
1417 break; | 1417 break; |
1418 } | 1418 } |
1419 } | 1419 } |
1420 if (free) | 1420 if (free) |
1421 { | 1421 { |
1422 uldci.m_rbStart = (uint8_t)rbAllocated; | 1422 uldci.m_rbStart = static_cast<uint8_t> (rbAllocated); |
1423 | 1423 |
1424 for (uint16_t j = (uint16_t)rbAllocated; j < (uint16_t)(rbAllocate
d + rbPerFlow); j++) | 1424 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1425 { | 1425 { |
1426 rbMap.at (j) = true; | 1426 rbMap.at (j) = true; |
1427 // store info on allocation for managing ul-cqi interpretation | 1427 // store info on allocation for managing ul-cqi interpretation |
1428 rbgAllocationMap.at (j) = (*it).first; | 1428 rbgAllocationMap.at (j) = (*it).first; |
1429 } | 1429 } |
1430 rbAllocated += rbPerFlow; | 1430 rbAllocated += rbPerFlow; |
1431 allocated = true; | 1431 allocated = true; |
1432 break; | 1432 break; |
1433 } | 1433 } |
1434 rbAllocated++; | 1434 rbAllocated++; |
1435 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 1435 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1436 { | 1436 { |
1437 // limit to physical resources last resource assignment | 1437 // limit to physical resources last resource assignment |
1438 rbPerFlow = (uint16_t)(m_cschedCellConfig.m_ulBandwidth - rbAlloca
ted); | 1438 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1439 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1439 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1440 if (rbPerFlow < 3) | 1440 if (rbPerFlow < 3) |
1441 { | 1441 { |
1442 // terminate allocation | 1442 // terminate allocation |
1443 rbPerFlow = 0;················· | 1443 rbPerFlow = 0;················· |
1444 } | 1444 } |
1445 } | 1445 } |
1446 } | 1446 } |
1447 if (!allocated) | 1447 if (!allocated) |
1448 { | 1448 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 it = m_ceBsrRxed.begin (); | 1500 it = m_ceBsrRxed.begin (); |
1501 } | 1501 } |
1502 NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_r
nti); | 1502 NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_r
nti); |
1503 // remove UE from allocation map | 1503 // remove UE from allocation map |
1504 for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_r
bLen; i++) | 1504 for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_r
bLen; i++) |
1505 { | 1505 { |
1506 rbgAllocationMap.at (i) = 0; | 1506 rbgAllocationMap.at (i) = 0; |
1507 } | 1507 } |
1508 continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 3
6.213) | 1508 continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 3
6.213) |
1509 } | 1509 } |
1510 uldci.m_mcs = (uint8_t)m_amc->GetMcsFromCqi (cqi); | 1510 uldci.m_mcs = m_amc->GetMcsFromCqi (cqi); |
1511 } | 1511 } |
1512 | 1512 |
1513 uldci.m_tbSize = (uint16_t)(m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlo
w) / 8); | 1513 uldci.m_tbSize = (m_amc->GetUlTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); |
1514 UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); | 1514 UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); |
1515 uldci.m_ndi = 1; | 1515 uldci.m_ndi = 1; |
1516 uldci.m_cceIndex = 0; | 1516 uldci.m_cceIndex = 0; |
1517 uldci.m_aggrLevel = 1; | 1517 uldci.m_aggrLevel = 1; |
1518 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF | 1518 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
1519 uldci.m_hopping = false; | 1519 uldci.m_hopping = false; |
1520 uldci.m_n2Dmrs = 0; | 1520 uldci.m_n2Dmrs = 0; |
1521 uldci.m_tpc = 0; // no power control | 1521 uldci.m_tpc = 0; // no power control |
1522 uldci.m_cqiRequest = false; // only period CQI at this stage | 1522 uldci.m_cqiRequest = false; // only period CQI at this stage |
1523 uldci.m_ulIndex = 0; // TDD parameter | 1523 uldci.m_ulIndex = 0; // TDD parameter |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); | 1595 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); |
1596 m_schedSapUser->SchedUlConfigInd (ret); | 1596 m_schedSapUser->SchedUlConfigInd (ret); |
1597 | 1597 |
1598 return; | 1598 return; |
1599 } | 1599 } |
1600 | 1600 |
1601 void | 1601 void |
1602 TdBetFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapPr
ovider::SchedUlNoiseInterferenceReqParameters& params) | 1602 TdBetFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapPr
ovider::SchedUlNoiseInterferenceReqParameters& params) |
1603 { | 1603 { |
1604 NS_LOG_FUNCTION (this); | 1604 NS_LOG_FUNCTION (this); |
1605 NS_UNUSED(params); | 1605 NS_UNUSED (params); |
1606 return; | 1606 return; |
1607 } | 1607 } |
1608 | 1608 |
1609 void | 1609 void |
1610 TdBetFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::Sch
edUlSrInfoReqParameters& params) | 1610 TdBetFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::Sch
edUlSrInfoReqParameters& params) |
1611 { | 1611 { |
1612 NS_LOG_FUNCTION (this); | 1612 NS_LOG_FUNCTION (this); |
1613 NS_UNUSED(params); | 1613 NS_UNUSED (params); |
1614 return; | 1614 return; |
1615 } | 1615 } |
1616 | 1616 |
1617 void | 1617 void |
1618 TdBetFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider
::SchedUlMacCtrlInfoReqParameters& params) | 1618 TdBetFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider
::SchedUlMacCtrlInfoReqParameters& params) |
1619 { | 1619 { |
1620 NS_LOG_FUNCTION (this); | 1620 NS_LOG_FUNCTION (this); |
1621 | 1621 |
1622 std::map <uint16_t,uint32_t>::iterator it; | 1622 std::map <uint16_t,uint32_t>::iterator it; |
1623 | 1623 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 { | 1971 { |
1972 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); | 1972 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); |
1973 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; | 1973 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; |
1974 params.m_rnti = rnti; | 1974 params.m_rnti = rnti; |
1975 params.m_transmissionMode = txMode; | 1975 params.m_transmissionMode = txMode; |
1976 m_cschedSapUser->CschedUeConfigUpdateInd (params); | 1976 m_cschedSapUser->CschedUeConfigUpdateInd (params); |
1977 } | 1977 } |
1978 | 1978 |
1979 | 1979 |
1980 } | 1980 } |
LEFT | RIGHT |