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 uint16_t rbgSize = static_cast<uint16_t>(GetRbgSize (m_cschedCellConfig.m_dlBa
ndwidth)); | 541 uint16_t rbgSize = static_cast<uint16_t> (GetRbgSize (m_cschedCellConfig.m_dlB
andwidth)); |
542 uint16_t 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 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 maxContinuousUlBandwidth = tmpMinBandwidth; | 602 maxContinuousUlBandwidth = tmpMinBandwidth; |
603 ffrRbStartOffset = tmpFfrRbStartOffset; | 603 ffrRbStartOffset = tmpFfrRbStartOffset; |
604 } | 604 } |
605 | 605 |
606 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 606 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
607 uint8_t rbStart = 0; | 607 uint8_t rbStart = 0; |
608 rbStart = ffrRbStartOffset; | 608 rbStart = ffrRbStartOffset; |
609 std::vector <struct RachListElement_s>::iterator itRach; | 609 std::vector <struct RachListElement_s>::iterator itRach; |
610 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) | 610 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) |
611 { | 611 { |
612 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"); |
613 BuildRarListElement_s newRar; | 613 BuildRarListElement_s newRar; |
614 newRar.m_rnti = (*itRach).m_rnti; | 614 newRar.m_rnti = (*itRach).m_rnti; |
615 // DL-RACH Allocation | 615 // DL-RACH Allocation |
616 // Ideal: no needs of configuring m_dci | 616 // Ideal: no needs of configuring m_dci |
617 // UL-RACH Allocation | 617 // UL-RACH Allocation |
618 newRar.m_grant.m_rnti = newRar.m_rnti; | 618 newRar.m_grant.m_rnti = newRar.m_rnti; |
619 newRar.m_grant.m_mcs = m_ulGrantMcs; | 619 newRar.m_grant.m_mcs = m_ulGrantMcs; |
620 uint8_t rbLen = 1; | 620 uint8_t rbLen = 1; |
621 uint16_t tbSizeBits = 0; | 621 uint16_t tbSizeBits = 0; |
622 // find lowest TB size that fits UL grant estimated size | 622 // find lowest TB size that fits UL grant estimated size |
623 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < (ffr
RbStartOffset + maxContinuousUlBandwidth))) | 623 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < (ffr
RbStartOffset + maxContinuousUlBandwidth))) |
624 { | 624 { |
625 rbLen++; | 625 rbLen++; |
626 tbSizeBits = m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen); | 626 tbSizeBits = m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, rbLen); |
627 } | 627 } |
628 if (tbSizeBits < (*itRach).m_estimatedSize) | 628 if (tbSizeBits < (*itRach).m_estimatedSize) |
629 { | 629 { |
630 // no more allocation space: finish allocation | 630 // no more allocation space: finish allocation |
631 break; | 631 break; |
632 } | 632 } |
633 newRar.m_grant.m_rbStart = rbStart; | 633 newRar.m_grant.m_rbStart = rbStart; |
634 newRar.m_grant.m_rbLen = rbLen; | 634 newRar.m_grant.m_rbLen = rbLen; |
635 newRar.m_grant.m_tbSize = tbSizeBits / 8; | 635 newRar.m_grant.m_tbSize = tbSizeBits / 8; |
636 newRar.m_grant.m_hopping = false; | 636 newRar.m_grant.m_hopping = false; |
(...skipping 75 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 = static_cast<uint8_t>(m_dlInfoListBuffered.at (i).m_harqS
tatus.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 = static_cast<uint8_t>((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); | 819 uint8_t rbgId = static_cast<uint8_t> ((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); |
820 uint8_t startRbg = static_cast<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 += static_cast<int>((*itStats).second.tokenG
enerationRate / 1000 - ( (*itStats).second.maxTokenPoolSize - (*itStats).second
.tokenPoolSize )); | 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 += static_cast<uint32_t>((*itStats).se
cond.tokenGenerationRate / 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 = static_cast<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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 uint8_t mcs = 0;· | 1176 uint8_t mcs = 0;· |
1177 if (sbCqi.size () > j) | 1177 if (sbCqi.size () > j) |
1178 {······················· | 1178 {······················· |
1179 mcs = 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 (static_cast<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 (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 (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 = static_cast<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 (static_cast<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 = static_cast<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 = static_cast<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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 (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 (static_cast<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 = static_cast<uint8_t>(m_cschedCellConfig.m_ulBandwidth
- rbAllocatedNum); | 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 = static_cast<uint16_t>((ffrUlBandwidth) / (nflows + rn
tiAllocated.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 uint16_t 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) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = static_cast<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 = rbAllocated; j < 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 = static_cast<uint8_t>(rbAllocated); | 1813 uldci.m_rbStart = static_cast<uint8_t> (rbAllocated); |
1814 | 1814 |
1815 for (uint16_t j = rbAllocated; j < rbAllocated + 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; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = m_amc->GetMcsFromCqi (cqi); | 1902 uldci.m_mcs = m_amc->GetMcsFromCqi (cqi); |
1903 } | 1903 } |
1904 | 1904 |
1905 uldci.m_tbSize = m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 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 |