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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 360 } |
361 | 361 |
362 return; | 362 return; |
363 } | 363 } |
364 | 364 |
365 void | 365 void |
366 FdTbfqFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvid
er::SchedDlPagingBufferReqParameters& params) | 366 FdTbfqFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvid
er::SchedDlPagingBufferReqParameters& params) |
367 { | 367 { |
368 NS_LOG_FUNCTION (this); | 368 NS_LOG_FUNCTION (this); |
369 NS_FATAL_ERROR ("method not implemented"); | 369 NS_FATAL_ERROR ("method not implemented"); |
370 NS_UNUSED(params); | 370 NS_UNUSED (params); |
371 return; | 371 return; |
372 } | 372 } |
373 | 373 |
374 void | 374 void |
375 FdTbfqFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider:
:SchedDlMacBufferReqParameters& params) | 375 FdTbfqFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider:
:SchedDlMacBufferReqParameters& params) |
376 { | 376 { |
377 NS_LOG_FUNCTION (this); | 377 NS_LOG_FUNCTION (this); |
378 NS_FATAL_ERROR ("method not implemented"); | 378 NS_FATAL_ERROR ("method not implemented"); |
379 NS_UNUSED(params); | 379 NS_UNUSED (params); |
380 return; | 380 return; |
381 } | 381 } |
382 | 382 |
383 int | 383 int |
384 FdTbfqFfMacScheduler::GetRbgSize (int dlbandwidth) | 384 FdTbfqFfMacScheduler::GetRbgSize (int dlbandwidth) |
385 { | 385 { |
386 for (int i = 0; i < 4; i++) | 386 for (int i = 0; i < 4; i++) |
387 { | 387 { |
388 if (dlbandwidth < FdTbfqType0AllocationRbg[i]) | 388 if (dlbandwidth < FdTbfqType0AllocationRbg[i]) |
389 { | 389 { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe
no. " << (0xF & params.m_sfnSf)); | 531 NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe
no. " << (0xF & params.m_sfnSf)); |
532 // API generated by RLC for triggering the scheduling of a DL subframe | 532 // API generated by RLC for triggering the scheduling of a DL subframe |
533 | 533 |
534 | 534 |
535 // evaluate the relative channel quality indicator for each UE per each RBG | 535 // evaluate the relative channel quality indicator for each UE per each RBG |
536 // (since we are using allocation type 0 the small unit of allocation is RBG) | 536 // (since we are using allocation type 0 the small unit of allocation is RBG) |
537 // Resource allocation type 0 (see sec 7.1.6.1 of 36.213) | 537 // Resource allocation type 0 (see sec 7.1.6.1 of 36.213) |
538 | 538 |
539 RefreshDlCqiMaps (); | 539 RefreshDlCqiMaps (); |
540 | 540 |
541 int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); | 541 uint16_t rbgSize = static_cast<uint16_t> (GetRbgSize (m_cschedCellConfig.m_dlB
andwidth)); |
542 int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; | 542 uint16_t rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; |
543 std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNT
I | 543 std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNT
I |
544 std::vector <bool> rbgMap; // global RBGs map | 544 std::vector <bool> rbgMap; // global RBGs map |
545 uint16_t rbgAllocatedNum = 0; | 545 uint16_t rbgAllocatedNum = 0; |
546 std::set <uint16_t> rntiAllocated; | 546 std::set <uint16_t> rntiAllocated; |
547 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); | 547 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); |
548 | 548 |
549 rbgMap = m_ffrSapProvider->GetAvailableDlRbg (); | 549 rbgMap = m_ffrSapProvider->GetAvailableDlRbg (); |
550 for (std::vector<bool>::iterator it = rbgMap.begin (); it != rbgMap.end (); it
++) | 550 for (std::vector<bool>::iterator it = rbgMap.begin (); it != rbgMap.end (); it
++) |
551 { | 551 { |
552 if ((*it) == true ) | 552 if ((*it) == true ) |
553 { | 553 { |
554 rbgAllocatedNum++; | 554 rbgAllocatedNum++; |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 FfMacSchedSapUser::SchedDlConfigIndParameters ret; | 558 FfMacSchedSapUser::SchedDlConfigIndParameters ret; |
559 | 559 |
560 // update UL HARQ proc id | 560 // update UL HARQ proc id |
561 std::map <uint16_t, uint8_t>::iterator itProcId; | 561 for (std::map <uint16_t, uint8_t>::iterator itProcId = m_ulHarqCurrentProcessI
d.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++) |
562 for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrent
ProcessId.end (); itProcId++) | |
563 { | 562 { |
564 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; | 563 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; |
565 } | 564 } |
566 | 565 |
567 // RACH Allocation | 566 // RACH Allocation |
568 uint16_t rbAllocatedNum = 0; | 567 uint16_t rbAllocatedNum = 0; |
569 std::vector <bool> ulRbMap; | 568 std::vector <bool> ulRbMap; |
570 ulRbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); | 569 ulRbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); |
571 ulRbMap = m_ffrSapProvider->GetAvailableUlRbg (); | 570 ulRbMap = m_ffrSapProvider->GetAvailableUlRbg (); |
572 uint8_t maxContinuousUlBandwidth = 0; | 571 uint8_t maxContinuousUlBandwidth = 0; |
573 uint8_t tmpMinBandwidth = 0; | 572 uint8_t tmpMinBandwidth = 0; |
574 uint16_t ffrRbStartOffset = 0; | 573 uint8_t ffrRbStartOffset = 0; |
575 uint16_t tmpFfrRbStartOffset = 0; | 574 uint8_t tmpFfrRbStartOffset = 0; |
576 uint16_t index = 0; | 575 uint8_t index = 0; |
577 | 576 |
578 for (std::vector<bool>::iterator it = ulRbMap.begin (); it != ulRbMap.end ();
it++) | 577 for (std::vector<bool>::iterator it = ulRbMap.begin (); it != ulRbMap.end ();
it++) |
579 { | 578 { |
580 if ((*it) == true ) | 579 if ((*it) == true ) |
581 { | 580 { |
582 rbAllocatedNum++; | 581 rbAllocatedNum++; |
583 if (tmpMinBandwidth > maxContinuousUlBandwidth) | 582 if (tmpMinBandwidth > maxContinuousUlBandwidth) |
584 { | 583 { |
585 maxContinuousUlBandwidth = tmpMinBandwidth; | 584 maxContinuousUlBandwidth = tmpMinBandwidth; |
586 ffrRbStartOffset = tmpFfrRbStartOffset; | 585 ffrRbStartOffset = tmpFfrRbStartOffset; |
(...skipping 11 matching lines...) Expand all Loading... |
598 index++; | 597 index++; |
599 } | 598 } |
600 | 599 |
601 if (tmpMinBandwidth > maxContinuousUlBandwidth) | 600 if (tmpMinBandwidth > maxContinuousUlBandwidth) |
602 { | 601 { |
603 maxContinuousUlBandwidth = tmpMinBandwidth; | 602 maxContinuousUlBandwidth = tmpMinBandwidth; |
604 ffrRbStartOffset = tmpFfrRbStartOffset; | 603 ffrRbStartOffset = tmpFfrRbStartOffset; |
605 } | 604 } |
606 | 605 |
607 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 606 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
608 uint16_t rbStart = 0; | 607 uint8_t rbStart = 0; |
609 rbStart = ffrRbStartOffset; | 608 rbStart = ffrRbStartOffset; |
610 std::vector <struct RachListElement_s>::iterator itRach; | 609 std::vector <struct RachListElement_s>::iterator itRach; |
611 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) | 610 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) |
612 { | 611 { |
613 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"); | 612 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"); |
614 BuildRarListElement_s newRar; | 613 BuildRarListElement_s newRar; |
615 newRar.m_rnti = (*itRach).m_rnti; | 614 newRar.m_rnti = (*itRach).m_rnti; |
616 // DL-RACH Allocation | 615 // DL-RACH Allocation |
617 // Ideal: no needs of configuring m_dci | 616 // Ideal: no needs of configuring m_dci |
618 // UL-RACH Allocation | 617 // UL-RACH Allocation |
619 newRar.m_grant.m_rnti = newRar.m_rnti; | 618 newRar.m_grant.m_rnti = newRar.m_rnti; |
620 newRar.m_grant.m_mcs = m_ulGrantMcs; | 619 newRar.m_grant.m_mcs = m_ulGrantMcs; |
621 uint16_t rbLen = 1; | 620 uint8_t rbLen = 1; |
622 uint16_t tbSizeBits = 0; | 621 uint16_t tbSizeBits = 0; |
623 // find lowest TB size that fits UL grant estimated size | 622 // find lowest TB size that fits UL grant estimated size |
624 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < (ffr
RbStartOffset + maxContinuousUlBandwidth))) | 623 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < (ffr
RbStartOffset + maxContinuousUlBandwidth))) |
625 { | 624 { |
626 rbLen++; | 625 rbLen++; |
627 tbSizeBits = (uint16_t)m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen); | 626 tbSizeBits = m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, rbLen); |
628 } | 627 } |
629 if (tbSizeBits < (*itRach).m_estimatedSize) | 628 if (tbSizeBits < (*itRach).m_estimatedSize) |
630 { | 629 { |
631 // no more allocation space: finish allocation | 630 // no more allocation space: finish allocation |
632 break; | 631 break; |
633 } | 632 } |
634 newRar.m_grant.m_rbStart = (uint8_t)rbStart; | 633 newRar.m_grant.m_rbStart = rbStart; |
635 newRar.m_grant.m_rbLen = (uint8_t)rbLen; | 634 newRar.m_grant.m_rbLen = rbLen; |
636 newRar.m_grant.m_tbSize = tbSizeBits / 8; | 635 newRar.m_grant.m_tbSize = tbSizeBits / 8; |
637 newRar.m_grant.m_hopping = false; | 636 newRar.m_grant.m_hopping = false; |
638 newRar.m_grant.m_tpc = 0; | 637 newRar.m_grant.m_tpc = 0; |
639 newRar.m_grant.m_cqiRequest = false; | 638 newRar.m_grant.m_cqiRequest = false; |
640 newRar.m_grant.m_ulDelay = false; | 639 newRar.m_grant.m_ulDelay = false; |
641 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); | 640 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); |
642 for (uint16_t i = rbStart; i < rbStart + rbLen; i++) | 641 for (uint16_t i = rbStart; i < rbStart + rbLen; i++) |
643 { | 642 { |
644 m_rachAllocationMap.at (i) = (*itRach).m_rnti; | 643 m_rachAllocationMap.at (i) = (*itRach).m_rnti; |
645 } | 644 } |
646 | 645 |
647 if (m_harqOn == true) | 646 if (m_harqOn == true) |
648 { | 647 { |
649 // generate UL-DCI for HARQ retransmissions | 648 // generate UL-DCI for HARQ retransmissions |
650 UlDciListElement_s uldci; | 649 UlDciListElement_s uldci; |
651 uldci.m_rnti = newRar.m_rnti; | 650 uldci.m_rnti = newRar.m_rnti; |
652 uldci.m_rbLen = (uint8_t)rbLen; | 651 uldci.m_rbLen = rbLen; |
653 uldci.m_rbStart = (uint8_t)rbStart; | 652 uldci.m_rbStart = rbStart; |
654 uldci.m_mcs = m_ulGrantMcs; | 653 uldci.m_mcs = m_ulGrantMcs; |
655 uldci.m_tbSize = tbSizeBits / 8; | 654 uldci.m_tbSize = tbSizeBits / 8; |
656 uldci.m_ndi = 1; | 655 uldci.m_ndi = 1; |
657 uldci.m_cceIndex = 0; | 656 uldci.m_cceIndex = 0; |
658 uldci.m_aggrLevel = 1; | 657 uldci.m_aggrLevel = 1; |
659 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF | 658 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
660 uldci.m_hopping = false; | 659 uldci.m_hopping = false; |
661 uldci.m_n2Dmrs = 0; | 660 uldci.m_n2Dmrs = 0; |
662 uldci.m_tpc = 0; // no power control | 661 uldci.m_tpc = 0; // no power control |
663 uldci.m_cqiRequest = false; // only period CQI at this stage | 662 uldci.m_cqiRequest = false; // only period CQI at this stage |
664 uldci.m_ulIndex = 0; // TDD parameter | 663 uldci.m_ulIndex = 0; // TDD parameter |
665 uldci.m_dai = 1; // TDD parameter | 664 uldci.m_dai = 1; // TDD parameter |
666 uldci.m_freqHopping = 0; | 665 uldci.m_freqHopping = 0; |
667 uldci.m_pdcchPowerOffset = 0; // not used | 666 uldci.m_pdcchPowerOffset = 0; // not used |
668 | 667 |
669 uint8_t harqId = 0; | 668 uint8_t harqId = 0; |
| 669 std::map <uint16_t, uint8_t>::iterator itProcId; |
670 itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); | 670 itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); |
671 if (itProcId == m_ulHarqCurrentProcessId.end ()) | 671 if (itProcId == m_ulHarqCurrentProcessId.end ()) |
672 { | 672 { |
673 NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_r
nti); | 673 NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_r
nti); |
674 } | 674 } |
675 harqId = (*itProcId).second; | 675 harqId = (*itProcId).second; |
676 std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ul
HarqProcessesDciBuffer.find (uldci.m_rnti); | 676 std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ul
HarqProcessesDciBuffer.find (uldci.m_rnti); |
677 if (itDci == m_ulHarqProcessesDciBuffer.end ()) | 677 if (itDci == m_ulHarqProcessesDciBuffer.end ()) |
678 { | 678 { |
679 NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer f
or RNTI " << uldci.m_rnti); | 679 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... |
712 } | 712 } |
713 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; | 713 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; |
714 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) | 714 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) |
715 { | 715 { |
716 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); | 716 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); |
717 if (itRnti != rntiAllocated.end ()) | 717 if (itRnti != rntiAllocated.end ()) |
718 { | 718 { |
719 // RNTI already allocated for retx | 719 // RNTI already allocated for retx |
720 continue; | 720 continue; |
721 } | 721 } |
722 uint8_t nLayers = (uint8_t)m_dlInfoListBuffered.at (i).m_harqStatus.size (
); | 722 uint8_t nLayers = static_cast<uint8_t> (m_dlInfoListBuffered.at (i).m_harq
Status.size ()); |
723 std::vector <bool> retx; | 723 std::vector <bool> retx; |
724 NS_LOG_INFO (this << " Processing DLHARQ feedback"); | 724 NS_LOG_INFO (this << " Processing DLHARQ feedback"); |
725 if (nLayers == 1) | 725 if (nLayers == 1) |
726 { | 726 { |
727 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 727 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); |
728 retx.push_back (false); | 728 retx.push_back (false); |
729 } | 729 } |
730 else | 730 else |
731 { | 731 { |
732 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 732 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... |
809 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); | 809 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); |
810 rbgAllocatedNum++; | 810 rbgAllocatedNum++; |
811 } | 811 } |
812 | 812 |
813 NS_LOG_INFO (this << " Send retx in the same RBGs"); | 813 NS_LOG_INFO (this << " Send retx in the same RBGs"); |
814 } | 814 } |
815 else | 815 else |
816 { | 816 { |
817 // find RBGs for sending HARQ retx | 817 // find RBGs for sending HARQ retx |
818 uint8_t j = 0; | 818 uint8_t j = 0; |
819 uint8_t rbgId = (uint8_t)((dciRbg.at (dciRbg.size () - 1) + 1) % r
bgNum); | 819 uint8_t rbgId = static_cast<uint8_t> ((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); |
820 uint8_t startRbg = (uint8_t)dciRbg.at (dciRbg.size () - 1); | 820 uint8_t startRbg = static_cast<uint8_t> (dciRbg.at (dciRbg.size ()
- 1)); |
821 std::vector <bool> rbgMapCopy = rbgMap; | 821 std::vector <bool> rbgMapCopy = rbgMap; |
822 while ((j < dciRbg.size ())&&(startRbg != rbgId)) | 822 while ((j < dciRbg.size ())&&(startRbg != rbgId)) |
823 { | 823 { |
824 if (rbgMapCopy.at (rbgId) == false) | 824 if (rbgMapCopy.at (rbgId) == false) |
825 { | 825 { |
826 rbgMapCopy.at (rbgId) = true; | 826 rbgMapCopy.at (rbgId) = true; |
827 dciRbg.at (j) = rbgId; | 827 dciRbg.at (j) = rbgId; |
828 j++; | 828 j++; |
829 } | 829 } |
830 rbgId = (rbgId + 1) % rbgNum; | 830 rbgId = (rbgId + 1) % rbgNum; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 } | 961 } |
962 return; | 962 return; |
963 } | 963 } |
964 | 964 |
965 // update token pool, counter and bank size | 965 // update token pool, counter and bank size |
966 std::map <uint16_t, fdtbfqsFlowPerf_t>::iterator itStats; | 966 std::map <uint16_t, fdtbfqsFlowPerf_t>::iterator itStats; |
967 for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStat
s++) | 967 for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStat
s++) |
968 { | 968 { |
969 if ( (*itStats).second.tokenGenerationRate / 1000 + (*itStats).second.tok
enPoolSize > (*itStats).second.maxTokenPoolSize )····· | 969 if ( (*itStats).second.tokenGenerationRate / 1000 + (*itStats).second.tok
enPoolSize > (*itStats).second.maxTokenPoolSize )····· |
970 { | 970 { |
971 (*itStats).second.counter += (int)((*itStats).second.tokenGenerationR
ate / 1000 - ( (*itStats).second.maxTokenPoolSize - (*itStats).second.tokenPool
Size )); | 971 (*itStats).second.counter += static_cast<int> ((*itStats).second.token
GenerationRate / 1000 - ( (*itStats).second.maxTokenPoolSize - (*itStats).secon
d.tokenPoolSize )); |
972 (*itStats).second.tokenPoolSize = (*itStats).second.maxTokenPoolSize; | 972 (*itStats).second.tokenPoolSize = (*itStats).second.maxTokenPoolSize; |
973 bankSize += (*itStats).second.tokenGenerationRate / 1000 - ( (*itStats
).second.maxTokenPoolSize - (*itStats).second.tokenPoolSize ); | 973 bankSize += (*itStats).second.tokenGenerationRate / 1000 - ( (*itStats
).second.maxTokenPoolSize - (*itStats).second.tokenPoolSize ); |
974 } | 974 } |
975 else | 975 else |
976 { | 976 { |
977 (*itStats).second.tokenPoolSize += (uint32_t)((*itStats).second.tokenG
enerationRate / 1000); | 977 (*itStats).second.tokenPoolSize += static_cast<uint32_t> ((*itStats).s
econd.tokenGenerationRate / 1000); |
978 } | 978 } |
979 } | 979 } |
980 | 980 |
981 std::set <uint16_t> allocatedRnti; // store UEs which are already assigned R
BGs | 981 std::set <uint16_t> allocatedRnti; // store UEs which are already assigned R
BGs |
982 std::set <uint8_t> allocatedRbg; // store RBGs which are already allocated to
UE | 982 std::set <uint8_t> allocatedRbg; // store RBGs which are already allocated to
UE |
983 | 983 |
984 int totalRbg = 0; | 984 int totalRbg = 0; |
985 while (totalRbg < rbgNum) | 985 while (totalRbg < rbgNum) |
986 { | 986 { |
987 // select UE with largest metric | 987 // select UE with largest metric |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 allocatedRnti.insert((*itMax).first); | 1076 allocatedRnti.insert((*itMax).first); |
1077 | 1077 |
1078 // calculate the maximum number of byte that the scheduler can assigned to
this UE | 1078 // calculate the maximum number of byte that the scheduler can assigned to
this UE |
1079 uint32_t budget = 0; | 1079 uint32_t budget = 0; |
1080 if ( bankSize > 0 ) | 1080 if ( bankSize > 0 ) |
1081 { | 1081 { |
1082 budget = (*itMax).second.counter - (*itMax).second.debtLimit; | 1082 budget = (*itMax).second.counter - (*itMax).second.debtLimit; |
1083 if ( budget > (*itMax).second.burstCredit ) | 1083 if ( budget > (*itMax).second.burstCredit ) |
1084 budget = (*itMax).second.burstCredit; | 1084 budget = (*itMax).second.burstCredit; |
1085 if ( budget > bankSize ) | 1085 if ( budget > bankSize ) |
1086 budget = (uint32_t)bankSize; | 1086 budget = static_cast<uint32_t> (bankSize); |
1087 } | 1087 } |
1088 budget = budget + (*itMax).second.tokenPoolSize; | 1088 budget = budget + (*itMax).second.tokenPoolSize; |
1089 | 1089 |
1090 // calcualte how much bytes this UE actally need | 1090 // calcualte how much bytes this UE actally need |
1091 if (budget == 0) | 1091 if (budget == 0) |
1092 { | 1092 { |
1093 // there are no tokens for this UE | 1093 // there are no tokens for this UE |
1094 continue; | 1094 continue; |
1095 } | 1095 } |
1096 else· | 1096 else· |
(...skipping 11 matching lines...) Expand all Loading... |
1108 itRlcBuf = m_rlcBufferReq.find (flow); | 1108 itRlcBuf = m_rlcBufferReq.find (flow); |
1109 if (itRlcBuf!=m_rlcBufferReq.end ()) | 1109 if (itRlcBuf!=m_rlcBufferReq.end ()) |
1110 rlcBufSize = (*itRlcBuf).second.m_rlcTransmissionQueueSize + (*itRlc
Buf).second.m_rlcRetransmissionQueueSize + (*itRlcBuf).second.m_rlcStatusPduSize
; | 1110 rlcBufSize = (*itRlcBuf).second.m_rlcTransmissionQueueSize + (*itRlc
Buf).second.m_rlcRetransmissionQueueSize + (*itRlcBuf).second.m_rlcStatusPduSize
; |
1111 if ( budget > rlcBufSize ) | 1111 if ( budget > rlcBufSize ) |
1112 budget = rlcBufSize; | 1112 budget = rlcBufSize; |
1113 } | 1113 } |
1114 | 1114 |
1115 // assign RBGs to this UE· | 1115 // assign RBGs to this UE· |
1116 uint32_t bytesTxed = 0; | 1116 uint32_t bytesTxed = 0; |
1117 uint32_t bytesTxedTmp = 0; | 1117 uint32_t bytesTxedTmp = 0; |
1118 int rbgIndex = 0; | 1118 uint16_t rbgIndex = 0; |
1119 while ( bytesTxed <= budget ) | 1119 while ( bytesTxed <= budget ) |
1120 { | 1120 { |
1121 totalRbg++; | 1121 totalRbg++; |
1122 | 1122 |
1123 std::map <uint16_t,SbMeasResult_s>::iterator itCqi; | 1123 std::map <uint16_t,SbMeasResult_s>::iterator itCqi; |
1124 itCqi = m_a30CqiRxed.find ((*itMax).first); | 1124 itCqi = m_a30CqiRxed.find ((*itMax).first); |
1125 std::map <uint16_t,uint8_t>::iterator itTxMode; | 1125 std::map <uint16_t,uint8_t>::iterator itTxMode; |
1126 itTxMode = m_uesTxMode.find ((*itMax).first); | 1126 itTxMode = m_uesTxMode.find ((*itMax).first); |
1127 if (itTxMode == m_uesTxMode.end ()) | 1127 if (itTxMode == m_uesTxMode.end ()) |
1128 { | 1128 { |
1129 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).firs
t); | 1129 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).firs
t); |
1130 } | 1130 } |
1131 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).sec
ond); | 1131 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).sec
ond); |
1132 | 1132 |
1133 // find RBG with largest achievableRate | 1133 // find RBG with largest achievableRate |
1134 double achievableRateMax = 0.0; | 1134 double achievableRateMax = 0.0; |
1135 rbgIndex = rbgNum; | 1135 rbgIndex = rbgNum; |
1136 for (int k = 0; k < rbgNum; k++) | 1136 for (uint8_t k = 0; k < rbgNum; k++) |
1137 { | 1137 { |
1138 std::set <uint8_t>::iterator rbg; | 1138 std::set <uint8_t>::iterator rbg; |
1139 rbg = allocatedRbg.find ((uint8_t)k); | 1139 rbg = allocatedRbg.find (k); |
1140 if (rbg != allocatedRbg.end ()) // RBGs are already allocated to
this UE | 1140 if (rbg != allocatedRbg.end ()) // RBGs are already allocated to
this UE |
1141 continue; | 1141 continue; |
1142 | 1142 |
1143 if ( rbgMap.at (k) == true) // this RBG is allocated in RACH proce
dure | 1143 if ( rbgMap.at (k) == true) // this RBG is allocated in RACH proce
dure |
1144 continue; | 1144 continue; |
1145 | 1145 |
1146 if ((m_ffrSapProvider->IsDlRbgAvailableForUe (k, (*itMax).first))
== false) | 1146 if ((m_ffrSapProvider->IsDlRbgAvailableForUe (k, (*itMax).first))
== false) |
1147 continue; | 1147 continue; |
1148 | 1148 |
1149 std::vector <uint8_t> sbCqi; | 1149 std::vector <uint8_t> sbCqi; |
(...skipping 19 matching lines...) Expand all Loading... |
1169 { | 1169 { |
1170 if (LcActivePerFlow ((*itMax).first) > 0) | 1170 if (LcActivePerFlow ((*itMax).first) > 0) |
1171 { | 1171 { |
1172 // this UE has data to transmit | 1172 // this UE has data to transmit |
1173 double achievableRate = 0.0; | 1173 double achievableRate = 0.0; |
1174 for (uint8_t j = 0; j < nLayer; j++)· | 1174 for (uint8_t j = 0; j < nLayer; j++)· |
1175 { | 1175 { |
1176 uint8_t mcs = 0;· | 1176 uint8_t mcs = 0;· |
1177 if (sbCqi.size () > j) | 1177 if (sbCqi.size () > j) |
1178 {······················· | 1178 {······················· |
1179 mcs = (uint8_t)m_amc->GetMcsFromCqi (sbCqi.at (j))
; | 1179 mcs = m_amc->GetMcsFromCqi (sbCqi.at (j)); |
1180 } | 1180 } |
1181 else | 1181 else |
1182 { | 1182 { |
1183 // no info on this subband -> worst MCS | 1183 // no info on this subband -> worst MCS |
1184 mcs = 0; | 1184 mcs = 0; |
1185 } | 1185 } |
1186 achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgS
ize) / 8) / 0.001); // = TB size / TTI | 1186 achievableRate += ((m_amc->GetDlTbSizeFromMcs (mcs, rb
gSize) / 8) / 0.001); // = TB size / TTI |
1187 } | 1187 } |
1188 | 1188 |
1189 if ( achievableRate > achievableRateMax ) | 1189 if ( achievableRate > achievableRateMax ) |
1190 { | 1190 { |
1191 achievableRateMax = achievableRate; | 1191 achievableRateMax = achievableRate; |
1192 rbgIndex = k; | 1192 rbgIndex = k; |
1193 } | 1193 } |
1194 } // end of LcActivePerFlow | 1194 } // end of LcActivePerFlow |
1195 } // end of cqi | 1195 } // end of cqi |
1196 } // end of for rbgNum | 1196 } // end of for rbgNum |
1197 | 1197 |
1198 if ( rbgIndex == rbgNum) // impossible | 1198 if ( rbgIndex == rbgNum) // impossible |
1199 { | 1199 { |
1200 // all RBGs are already assigned | 1200 // all RBGs are already assigned |
1201 totalRbg = rbgNum; | 1201 totalRbg = rbgNum; |
1202 break; | 1202 break; |
1203 } | 1203 } |
1204 else | 1204 else |
1205 { | 1205 { |
1206 // mark this UE as "allocated" | 1206 // mark this UE as "allocated" |
1207 allocatedRbg.insert ((uint8_t)rbgIndex); | 1207 allocatedRbg.insert (static_cast<uint8_t> (rbgIndex)); |
1208 } | 1208 } |
1209 | 1209 |
1210 // assign this RBG to UE | 1210 // assign this RBG to UE |
1211 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; | 1211 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; |
1212 itMap = allocationMap.find ((*itMax).first); | 1212 itMap = allocationMap.find ((*itMax).first); |
1213 uint16_t RbgPerRnti; | 1213 uint16_t RbgPerRnti; |
1214 if (itMap == allocationMap.end ()) | 1214 if (itMap == allocationMap.end ()) |
1215 { | 1215 { |
1216 // insert new element | 1216 // insert new element |
1217 std::vector <uint16_t> tempMap; | 1217 std::vector <uint16_t> tempMap; |
1218 tempMap.push_back ((uint16_t)rbgIndex); | 1218 tempMap.push_back (rbgIndex); |
1219 allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t>
> ((*itMax).first, tempMap)); | 1219 allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t>
> ((*itMax).first, tempMap)); |
1220 itMap = allocationMap.find ((*itMax).first); // point itMap to th
e first RBGs assigned to this UE | 1220 itMap = allocationMap.find ((*itMax).first); // point itMap to th
e first RBGs assigned to this UE |
1221 } | 1221 } |
1222 else | 1222 else |
1223 { | 1223 { |
1224 (*itMap).second.push_back ((uint16_t)rbgIndex); | 1224 (*itMap).second.push_back (rbgIndex); |
1225 } | 1225 } |
1226 rbgMap.at (rbgIndex) = true; // Mark this RBG as allocated | 1226 rbgMap.at (rbgIndex) = true; // Mark this RBG as allocated |
1227 · | 1227 · |
1228 RbgPerRnti = (uint16_t)(*itMap).second.size(); | 1228 RbgPerRnti = static_cast<uint16_t> ((*itMap).second.size()); |
1229 | 1229 |
1230 // calculate tb size | 1230 // calculate tb size |
1231 std::vector <uint8_t> worstCqi (2, 15); | 1231 std::vector <uint8_t> worstCqi (2, 15); |
1232 if (itCqi != m_a30CqiRxed.end ()) | 1232 if (itCqi != m_a30CqiRxed.end ()) |
1233 { | 1233 { |
1234 for (uint16_t k = 0; k < (*itMap).second.size (); k++) | 1234 for (uint16_t k = 0; k < (*itMap).second.size (); k++) |
1235 { | 1235 { |
1236 if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).s
econd.at (k)) | 1236 if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).s
econd.at (k)) |
1237 { | 1237 { |
1238 for (uint8_t j = 0; j < nLayer; j++)· | 1238 for (uint8_t j = 0; j < nLayer; j++)· |
(...skipping 26 matching lines...) Expand all Loading... |
1265 for (uint8_t j = 0; j < nLayer; j++) | 1265 for (uint8_t j = 0; j < nLayer; j++) |
1266 { | 1266 { |
1267 worstCqi.at (j) = 1; // try with lowest MCS in RBG with no inf
o on channel | 1267 worstCqi.at (j) = 1; // try with lowest MCS in RBG with no inf
o on channel |
1268 } | 1268 } |
1269 } | 1269 } |
1270 · | 1270 · |
1271 bytesTxedTmp = bytesTxed; | 1271 bytesTxedTmp = bytesTxed; |
1272 bytesTxed = 0; | 1272 bytesTxed = 0; |
1273 for (uint8_t j = 0; j < nLayer; j++) | 1273 for (uint8_t j = 0; j < nLayer; j++) |
1274 { | 1274 { |
1275 int tbSize = (m_amc->GetTbSizeFromMcs (m_amc->GetMcsFromCqi (worst
Cqi.at (j)), RbgPerRnti * rbgSize) / 8); // (size of TB in bytes according to ta
ble 7.1.7.2.1-1 of 36.213)· | 1275 int tbSize = (m_amc->GetDlTbSizeFromMcs (m_amc->GetMcsFromCqi (wor
stCqi.at (j)), RbgPerRnti * rbgSize) / 8); // (size of TB in bytes according to
table 7.1.7.2.1-1 of 36.213)· |
1276 bytesTxed += tbSize; | 1276 bytesTxed += tbSize; |
1277 } | 1277 } |
1278 | 1278 |
1279 } // end of while() | 1279 } // end of while() |
1280 | 1280 |
1281 // remove and unmark last RBG assigned to UE | 1281 // remove and unmark last RBG assigned to UE |
1282 if ( bytesTxed > budget ) | 1282 if ( bytesTxed > budget ) |
1283 { | 1283 { |
1284 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; | 1284 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; |
1285 itMap = allocationMap.find ((*itMax).first); | 1285 itMap = allocationMap.find ((*itMax).first); |
1286 (*itMap).second.pop_back (); | 1286 (*itMap).second.pop_back (); |
1287 allocatedRbg.erase ((uint8_t)rbgIndex); | 1287 allocatedRbg.erase (static_cast<uint8_t> (rbgIndex)); |
1288 bytesTxed = bytesTxedTmp; // recovery bytesTxed | 1288 bytesTxed = bytesTxedTmp; // recovery bytesTxed |
1289 totalRbg--; | 1289 totalRbg--; |
1290 rbgMap.at (rbgIndex) = false; // unmark this RBG | 1290 rbgMap.at (rbgIndex) = false; // unmark this RBG |
1291 } | 1291 } |
1292 | 1292 |
1293 // update UE stats | 1293 // update UE stats |
1294 if ( bytesTxed <= (*itMax).second.tokenPoolSize ) | 1294 if ( bytesTxed <= (*itMax).second.tokenPoolSize ) |
1295 { | 1295 { |
1296 (*itMax).second.tokenPoolSize -= bytesTxed; | 1296 (*itMax).second.tokenPoolSize -= bytesTxed; |
1297 } | 1297 } |
(...skipping 14 matching lines...) Expand all Loading... |
1312 while (itMap != allocationMap.end ()) | 1312 while (itMap != allocationMap.end ()) |
1313 { | 1313 { |
1314 // create new BuildDataListElement_s for this LC | 1314 // create new BuildDataListElement_s for this LC |
1315 BuildDataListElement_s newEl; | 1315 BuildDataListElement_s newEl; |
1316 newEl.m_rnti = (*itMap).first; | 1316 newEl.m_rnti = (*itMap).first; |
1317 // create the DlDciListElement_s | 1317 // create the DlDciListElement_s |
1318 DlDciListElement_s newDci; | 1318 DlDciListElement_s newDci; |
1319 newDci.m_rnti = (*itMap).first; | 1319 newDci.m_rnti = (*itMap).first; |
1320 newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); | 1320 newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); |
1321 | 1321 |
1322 uint16_t lcActives = (uint16_t)LcActivePerFlow ((*itMap).first); | 1322 uint16_t lcActives = static_cast<uint16_t> (LcActivePerFlow ((*itMap).firs
t)); |
1323 NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActi
ves); | 1323 NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActi
ves); |
1324 if (lcActives == 0) | 1324 if (lcActives == 0) |
1325 { | 1325 { |
1326 // Set to max value, to avoid divide by 0 below | 1326 // Set to max value, to avoid divide by 0 below |
1327 lcActives = (uint16_t)65535; // UINT16_MAX; | 1327 lcActives = (uint16_t)65535; // UINT16_MAX; |
1328 } | 1328 } |
1329 uint16_t RgbPerRnti = (uint16_t)(*itMap).second.size (); | 1329 uint16_t RgbPerRnti = static_cast<uint16_t> ((*itMap).second.size ()); |
1330 std::map <uint16_t,SbMeasResult_s>::iterator itCqi; | 1330 std::map <uint16_t,SbMeasResult_s>::iterator itCqi; |
1331 itCqi = m_a30CqiRxed.find ((*itMap).first); | 1331 itCqi = m_a30CqiRxed.find ((*itMap).first); |
1332 std::map <uint16_t,uint8_t>::iterator itTxMode; | 1332 std::map <uint16_t,uint8_t>::iterator itTxMode; |
1333 itTxMode = m_uesTxMode.find ((*itMap).first); | 1333 itTxMode = m_uesTxMode.find ((*itMap).first); |
1334 if (itTxMode == m_uesTxMode.end ()) | 1334 if (itTxMode == m_uesTxMode.end ()) |
1335 { | 1335 { |
1336 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first
); | 1336 NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first
); |
1337 } | 1337 } |
1338 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second)
; | 1338 int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second)
; |
1339 std::vector <uint8_t> worstCqi (2, 15); | 1339 std::vector <uint8_t> worstCqi (2, 15); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on
channel | 1376 worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on
channel |
1377 } | 1377 } |
1378 } | 1378 } |
1379 for (uint8_t j = 0; j < nLayer; j++) | 1379 for (uint8_t j = 0; j < nLayer; j++) |
1380 { | 1380 { |
1381 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (
uint16_t)worstCqi.at (j)); | 1381 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (
uint16_t)worstCqi.at (j)); |
1382 } | 1382 } |
1383 uint32_t bytesTxed = 0; | 1383 uint32_t bytesTxed = 0; |
1384 for (uint8_t j = 0; j < nLayer; j++) | 1384 for (uint8_t j = 0; j < nLayer; j++) |
1385 { | 1385 { |
1386 newDci.m_mcs.push_back ((uint8_t)m_amc->GetMcsFromCqi (worstCqi.at (j)
)); | 1386 newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j))); |
1387 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) | 1387 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) |
1388 newDci.m_tbsSize.push_back ((uint16_t)tbSize); | 1388 newDci.m_tbsSize.push_back (static_cast<uint16_t> (tbSize)); |
1389 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_
amc->GetMcsFromCqi (worstCqi.at (j))); | 1389 NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_
amc->GetMcsFromCqi (worstCqi.at (j))); |
1390 bytesTxed += tbSize; | 1390 bytesTxed += tbSize; |
1391 } | 1391 } |
1392 | 1392 |
1393 newDci.m_resAlloc = 0; // only allocation type 0 at this stage | 1393 newDci.m_resAlloc = 0; // only allocation type 0 at this stage |
1394 newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) | 1394 newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) |
1395 uint32_t rbgMask = 0; | 1395 uint32_t rbgMask = 0; |
1396 for (uint16_t k = 0; k < (*itMap).second.size (); k++) | 1396 for (uint16_t k = 0; k < (*itMap).second.size (); k++) |
1397 { | 1397 { |
1398 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); | 1398 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 | 1607 |
1608 for (std::vector<bool>::iterator it = rbMap.begin (); it != rbMap.end (); it++
) | 1608 for (std::vector<bool>::iterator it = rbMap.begin (); it != rbMap.end (); it++
) |
1609 { | 1609 { |
1610 if ((*it) == true ) | 1610 if ((*it) == true ) |
1611 { | 1611 { |
1612 rbAllocatedNum++; | 1612 rbAllocatedNum++; |
1613 } | 1613 } |
1614 } | 1614 } |
1615 | 1615 |
1616 uint8_t minContinuousUlBandwidth = m_ffrSapProvider->GetMinContinuousUlBandwid
th (); | 1616 uint8_t minContinuousUlBandwidth = m_ffrSapProvider->GetMinContinuousUlBandwid
th (); |
1617 uint8_t ffrUlBandwidth = (uint8_t)(m_cschedCellConfig.m_ulBandwidth - rbAlloca
tedNum); | 1617 uint8_t ffrUlBandwidth = static_cast<uint8_t> (m_cschedCellConfig.m_ulBandwidt
h - rbAllocatedNum); |
1618 | 1618 |
1619 // remove RACH allocation | 1619 // remove RACH allocation |
1620 for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++) | 1620 for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++) |
1621 { | 1621 { |
1622 if (rbgAllocationMap.at (i) != 0) | 1622 if (rbgAllocationMap.at (i) != 0) |
1623 { | 1623 { |
1624 rbMap.at (i) = true; | 1624 rbMap.at (i) = true; |
1625 NS_LOG_DEBUG (this << " Allocated for RACH " << i); | 1625 NS_LOG_DEBUG (this << " Allocated for RACH " << i); |
1626 } | 1626 } |
1627 } | 1627 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 { | 1720 { |
1721 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); | 1721 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); |
1722 m_schedSapUser->SchedUlConfigInd (ret); | 1722 m_schedSapUser->SchedUlConfigInd (ret); |
1723 } | 1723 } |
1724 ········ | 1724 ········ |
1725 return; // no flows to be scheduled | 1725 return; // no flows to be scheduled |
1726 } | 1726 } |
1727 | 1727 |
1728 | 1728 |
1729 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger | 1729 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger |
1730 uint16_t tempRbPerFlow = (uint16_t)((ffrUlBandwidth) / (nflows + rntiAllocated
.size ())); | 1730 uint16_t tempRbPerFlow = static_cast<uint16_t> ((ffrUlBandwidth) / (nflows + r
ntiAllocated.size ())); |
1731 uint16_t rbPerFlow = (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuou
sUlBandwidth : tempRbPerFlow; | 1731 uint16_t rbPerFlow = (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuou
sUlBandwidth : tempRbPerFlow; |
1732 | 1732 |
1733 if (rbPerFlow < 3) | 1733 if (rbPerFlow < 3) |
1734 { | 1734 { |
1735 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes | 1735 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes |
1736 } | 1736 } |
1737 int rbAllocated = 0; | 1737 uint16_t rbAllocated = 0; |
1738 | 1738 |
1739 std::map <uint16_t, fdtbfqsFlowPerf_t>::iterator itStats; | 1739 std::map <uint16_t, fdtbfqsFlowPerf_t>::iterator itStats; |
1740 if (m_nextRntiUl != 0) | 1740 if (m_nextRntiUl != 0) |
1741 { | 1741 { |
1742 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) | 1742 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
1743 { | 1743 { |
1744 if ((*it).first == m_nextRntiUl) | 1744 if ((*it).first == m_nextRntiUl) |
1745 { | 1745 { |
1746 break; | 1746 break; |
1747 } | 1747 } |
(...skipping 19 matching lines...) Expand all Loading... |
1767 if (it == m_ceBsrRxed.end ()) | 1767 if (it == m_ceBsrRxed.end ()) |
1768 { | 1768 { |
1769 // restart from the first | 1769 // restart from the first |
1770 it = m_ceBsrRxed.begin (); | 1770 it = m_ceBsrRxed.begin (); |
1771 } | 1771 } |
1772 continue; | 1772 continue; |
1773 } | 1773 } |
1774 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 1774 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1775 { | 1775 { |
1776 // limit to physical resources last resource assignment | 1776 // limit to physical resources last resource assignment |
1777 rbPerFlow = (uint16_t)(m_cschedCellConfig.m_ulBandwidth - rbAllocated)
; | 1777 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1778 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1778 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1779 if (rbPerFlow < 3) | 1779 if (rbPerFlow < 3) |
1780 { | 1780 { |
1781 // terminate allocation | 1781 // terminate allocation |
1782 rbPerFlow = 0;······ | 1782 rbPerFlow = 0;······ |
1783 } | 1783 } |
1784 } | 1784 } |
1785 | 1785 |
1786 rbAllocated = 0; | 1786 rbAllocated = 0; |
1787 UlDciListElement_s uldci; | 1787 UlDciListElement_s uldci; |
1788 uldci.m_rnti = (*it).first; | 1788 uldci.m_rnti = (*it).first; |
1789 uldci.m_rbLen = (uint8_t)rbPerFlow; | 1789 uldci.m_rbLen = static_cast<uint8_t> (rbPerFlow); |
1790 uldci.m_rbStart = 0; | 1790 uldci.m_rbStart = 0; |
1791 bool allocated = false; | 1791 bool allocated = false; |
1792 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); | 1792 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); |
1793 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) | 1793 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) |
1794 { | 1794 { |
1795 // check availability | 1795 // check availability |
1796 bool free = true; | 1796 bool free = true; |
1797 for (uint16_t j = (uint16_t)rbAllocated; j < (uint16_t)(rbAllocated +
rbPerFlow); j++) | 1797 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1798 { | 1798 { |
1799 if (rbMap.at (j) == true) | 1799 if (rbMap.at (j) == true) |
1800 { | 1800 { |
1801 free = false; | 1801 free = false; |
1802 break; | 1802 break; |
1803 } | 1803 } |
1804 if ((m_ffrSapProvider->IsUlRbgAvailableForUe (j, (*it).first)) ==
false) | 1804 if ((m_ffrSapProvider->IsUlRbgAvailableForUe (j, (*it).first)) ==
false) |
1805 { | 1805 { |
1806 free = false; | 1806 free = false; |
1807 break; | 1807 break; |
1808 } | 1808 } |
1809 } | 1809 } |
1810 if (free) | 1810 if (free) |
1811 { | 1811 { |
1812 NS_LOG_INFO (this << "RNTI: "<< (*it).first<< " RB Allocated " <<
rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows); | 1812 NS_LOG_INFO (this << "RNTI: "<< (*it).first<< " RB Allocated " <<
rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows); |
1813 uldci.m_rbStart = (uint8_t)rbAllocated; | 1813 uldci.m_rbStart = static_cast<uint8_t> (rbAllocated); |
1814 | 1814 |
1815 for (uint16_t j = (uint16_t)rbAllocated; j < (uint16_t)(rbAllocate
d + rbPerFlow); j++) | 1815 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1816 { | 1816 { |
1817 rbMap.at (j) = true; | 1817 rbMap.at (j) = true; |
1818 // store info on allocation for managing ul-cqi interpretation | 1818 // store info on allocation for managing ul-cqi interpretation |
1819 rbgAllocationMap.at (j) = (*it).first; | 1819 rbgAllocationMap.at (j) = (*it).first; |
1820 } | 1820 } |
1821 rbAllocated += rbPerFlow; | 1821 rbAllocated += rbPerFlow; |
1822 allocated = true; | 1822 allocated = true; |
1823 break; | 1823 break; |
1824 } | 1824 } |
1825 rbAllocated++; | 1825 rbAllocated++; |
1826 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 1826 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1827 { | 1827 { |
1828 // limit to physical resources last resource assignment | 1828 // limit to physical resources last resource assignment |
1829 rbPerFlow = (uint16_t)(m_cschedCellConfig.m_ulBandwidth - rbAlloca
ted); | 1829 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1830 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1830 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1831 if (rbPerFlow < 3) | 1831 if (rbPerFlow < 3) |
1832 { | 1832 { |
1833 // terminate allocation | 1833 // terminate allocation |
1834 rbPerFlow = 0;················· | 1834 rbPerFlow = 0;················· |
1835 } | 1835 } |
1836 } | 1836 } |
1837 } | 1837 } |
1838 if (!allocated) | 1838 if (!allocated) |
1839 { | 1839 { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 it = m_ceBsrRxed.begin (); | 1892 it = m_ceBsrRxed.begin (); |
1893 } | 1893 } |
1894 NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_r
nti); | 1894 NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_r
nti); |
1895 // remove UE from allocation map | 1895 // remove UE from allocation map |
1896 for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_r
bLen; i++) | 1896 for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_r
bLen; i++) |
1897 { | 1897 { |
1898 rbgAllocationMap.at (i) = 0; | 1898 rbgAllocationMap.at (i) = 0; |
1899 } | 1899 } |
1900 continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 3
6.213) | 1900 continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 3
6.213) |
1901 } | 1901 } |
1902 uldci.m_mcs = (uint8_t)m_amc->GetMcsFromCqi (cqi); | 1902 uldci.m_mcs = m_amc->GetMcsFromCqi (cqi); |
1903 } | 1903 } |
1904 | 1904 |
1905 uldci.m_tbSize = (uint16_t)(m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlo
w) / 8); | 1905 uldci.m_tbSize = (m_amc->GetUlTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); |
1906 UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); | 1906 UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); |
1907 uldci.m_ndi = 1; | 1907 uldci.m_ndi = 1; |
1908 uldci.m_cceIndex = 0; | 1908 uldci.m_cceIndex = 0; |
1909 uldci.m_aggrLevel = 1; | 1909 uldci.m_aggrLevel = 1; |
1910 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF | 1910 uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
1911 uldci.m_hopping = false; | 1911 uldci.m_hopping = false; |
1912 uldci.m_n2Dmrs = 0; | 1912 uldci.m_n2Dmrs = 0; |
1913 uldci.m_tpc = 0; // no power control | 1913 uldci.m_tpc = 0; // no power control |
1914 uldci.m_cqiRequest = false; // only period CQI at this stage | 1914 uldci.m_cqiRequest = false; // only period CQI at this stage |
1915 uldci.m_ulIndex = 0; // TDD parameter | 1915 uldci.m_ulIndex = 0; // TDD parameter |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); | 1964 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); |
1965 m_schedSapUser->SchedUlConfigInd (ret); | 1965 m_schedSapUser->SchedUlConfigInd (ret); |
1966 | 1966 |
1967 return; | 1967 return; |
1968 } | 1968 } |
1969 | 1969 |
1970 void | 1970 void |
1971 FdTbfqFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapP
rovider::SchedUlNoiseInterferenceReqParameters& params) | 1971 FdTbfqFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapP
rovider::SchedUlNoiseInterferenceReqParameters& params) |
1972 { | 1972 { |
1973 NS_LOG_FUNCTION (this); | 1973 NS_LOG_FUNCTION (this); |
1974 NS_UNUSED(params); | 1974 NS_UNUSED (params); |
1975 return; | 1975 return; |
1976 } | 1976 } |
1977 | 1977 |
1978 void | 1978 void |
1979 FdTbfqFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::Sc
hedUlSrInfoReqParameters& params) | 1979 FdTbfqFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::Sc
hedUlSrInfoReqParameters& params) |
1980 { | 1980 { |
1981 NS_LOG_FUNCTION (this); | 1981 NS_LOG_FUNCTION (this); |
1982 NS_UNUSED(params); | 1982 NS_UNUSED (params); |
1983 return; | 1983 return; |
1984 } | 1984 } |
1985 | 1985 |
1986 void | 1986 void |
1987 FdTbfqFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvide
r::SchedUlMacCtrlInfoReqParameters& params) | 1987 FdTbfqFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvide
r::SchedUlMacCtrlInfoReqParameters& params) |
1988 { | 1988 { |
1989 NS_LOG_FUNCTION (this); | 1989 NS_LOG_FUNCTION (this); |
1990 | 1990 |
1991 std::map <uint16_t,uint32_t>::iterator it; | 1991 std::map <uint16_t,uint32_t>::iterator it; |
1992 | 1992 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2340 { | 2340 { |
2341 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); | 2341 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); |
2342 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; | 2342 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; |
2343 params.m_rnti = rnti; | 2343 params.m_rnti = rnti; |
2344 params.m_transmissionMode = txMode; | 2344 params.m_transmissionMode = txMode; |
2345 m_cschedSapUser->CschedUeConfigUpdateInd (params); | 2345 m_cschedSapUser->CschedUeConfigUpdateInd (params); |
2346 } | 2346 } |
2347 | 2347 |
2348 | 2348 |
2349 } | 2349 } |
LEFT | RIGHT |