OLD | NEW |
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) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2012 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 CqaFfMacScheduler::CqaFfMacScheduler () | 264 CqaFfMacScheduler::CqaFfMacScheduler () |
265 : m_cschedSapUser (0), | 265 : m_cschedSapUser (0), |
266 m_schedSapUser (0), | 266 m_schedSapUser (0), |
267 m_timeWindow (99.0), | 267 m_timeWindow (99.0), |
268 m_nextRntiUl (0) | 268 m_nextRntiUl (0) |
269 { | 269 { |
270 m_amc = CreateObject <LteAmc> (); | 270 m_amc = CreateObject <LteAmc> (); |
271 m_cschedSapProvider = new CqaSchedulerMemberCschedSapProvider (this); | 271 m_cschedSapProvider = new CqaSchedulerMemberCschedSapProvider (this); |
272 m_schedSapProvider = new CqaSchedulerMemberSchedSapProvider (this); | 272 m_schedSapProvider = new CqaSchedulerMemberSchedSapProvider (this); |
| 273 m_ffrSapProvider = 0; |
| 274 m_ffrSapUser = new MemberLteFfrSapUser<CqaFfMacScheduler> (this); |
273 } | 275 } |
274 | 276 |
275 CqaFfMacScheduler::~CqaFfMacScheduler () | 277 CqaFfMacScheduler::~CqaFfMacScheduler () |
276 { | 278 { |
277 NS_LOG_FUNCTION (this); | 279 NS_LOG_FUNCTION (this); |
278 } | 280 } |
279 | 281 |
280 void | 282 void |
281 CqaFfMacScheduler::DoDispose () | 283 CqaFfMacScheduler::DoDispose () |
282 { | 284 { |
283 NS_LOG_FUNCTION (this); | 285 NS_LOG_FUNCTION (this); |
284 m_dlHarqProcessesDciBuffer.clear (); | 286 m_dlHarqProcessesDciBuffer.clear (); |
285 m_dlHarqProcessesTimer.clear (); | 287 m_dlHarqProcessesTimer.clear (); |
286 m_dlHarqProcessesRlcPduListBuffer.clear (); | 288 m_dlHarqProcessesRlcPduListBuffer.clear (); |
287 m_dlInfoListBuffered.clear (); | 289 m_dlInfoListBuffered.clear (); |
288 m_ulHarqCurrentProcessId.clear (); | 290 m_ulHarqCurrentProcessId.clear (); |
289 m_ulHarqProcessesStatus.clear (); | 291 m_ulHarqProcessesStatus.clear (); |
290 m_ulHarqProcessesDciBuffer.clear (); | 292 m_ulHarqProcessesDciBuffer.clear (); |
291 delete m_cschedSapProvider; | 293 delete m_cschedSapProvider; |
292 delete m_schedSapProvider; | 294 delete m_schedSapProvider; |
| 295 delete m_ffrSapUser; |
293 } | 296 } |
294 | 297 |
295 TypeId | 298 TypeId |
296 CqaFfMacScheduler::GetTypeId (void) | 299 CqaFfMacScheduler::GetTypeId (void) |
297 { | 300 { |
298 static TypeId tid = TypeId ("ns3::CqaFfMacScheduler") | 301 static TypeId tid = TypeId ("ns3::CqaFfMacScheduler") |
299 .SetParent<FfMacScheduler> () | 302 .SetParent<FfMacScheduler> () |
300 .AddConstructor<CqaFfMacScheduler>() | 303 .AddConstructor<CqaFfMacScheduler>() |
301 .AddAttribute ("CqiTimerThreshold", | 304 .AddAttribute ("CqiTimerThreshold", |
302 "The number of TTIs a CQI is valid (default 1000 - 1 sec.)", | 305 "The number of TTIs a CQI is valid (default 1000 - 1 sec.)", |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 return m_cschedSapProvider; | 345 return m_cschedSapProvider; |
343 } | 346 } |
344 | 347 |
345 FfMacSchedSapProvider* | 348 FfMacSchedSapProvider* |
346 CqaFfMacScheduler::GetFfMacSchedSapProvider () | 349 CqaFfMacScheduler::GetFfMacSchedSapProvider () |
347 { | 350 { |
348 return m_schedSapProvider; | 351 return m_schedSapProvider; |
349 } | 352 } |
350 | 353 |
351 void | 354 void |
| 355 CqaFfMacScheduler::SetLteFfrSapProvider (LteFfrSapProvider* s) |
| 356 { |
| 357 m_ffrSapProvider = s; |
| 358 } |
| 359 |
| 360 LteFfrSapUser* |
| 361 CqaFfMacScheduler::GetLteFfrSapUser () |
| 362 { |
| 363 return m_ffrSapUser; |
| 364 } |
| 365 |
| 366 void |
352 CqaFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::C
schedCellConfigReqParameters& params) | 367 CqaFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::C
schedCellConfigReqParameters& params) |
353 { | 368 { |
354 NS_LOG_FUNCTION (this); | 369 NS_LOG_FUNCTION (this); |
355 // Read the subset of parameters used | 370 // Read the subset of parameters used |
356 m_cschedCellConfig = params; | 371 m_cschedCellConfig = params; |
357 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 372 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
358 FfMacCschedSapUser::CschedUeConfigCnfParameters cnf; | 373 FfMacCschedSapUser::CschedUeConfigCnfParameters cnf; |
359 cnf.m_result = SUCCESS; | 374 cnf.m_result = SUCCESS; |
360 m_cschedSapUser->CschedUeConfigCnf (cnf); | 375 m_cschedSapUser->CschedUeConfigCnf (cnf); |
361 return; | 376 return; |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 bool(*key_function_pointer_groups)(int,int) = CqaGroupDescComparator; | 793 bool(*key_function_pointer_groups)(int,int) = CqaGroupDescComparator; |
779 t_map_HOLgroupToUEs map_GBRHOLgroupToUE (key_function_pointer_groups); | 794 t_map_HOLgroupToUEs map_GBRHOLgroupToUE (key_function_pointer_groups); |
780 t_map_HOLgroupToUEs map_nonGBRHOLgroupToUE (key_function_pointer_groups); | 795 t_map_HOLgroupToUEs map_nonGBRHOLgroupToUE (key_function_pointer_groups); |
781 int grouping_parameter = 1000; | 796 int grouping_parameter = 1000; |
782 double tolerance = 1.1; | 797 double tolerance = 1.1; |
783 std::map<LteFlowId_t,int> UEtoHOL; | 798 std::map<LteFlowId_t,int> UEtoHOL; |
784 std::vector <bool> rbgMap; // global RBGs map | 799 std::vector <bool> rbgMap; // global RBGs map |
785 uint16_t rbgAllocatedNum = 0; | 800 uint16_t rbgAllocatedNum = 0; |
786 std::set <uint16_t> rntiAllocated; | 801 std::set <uint16_t> rntiAllocated; |
787 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); | 802 rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); |
| 803 |
| 804 rbgMap = m_ffrSapProvider->GetAvailableDlRbg (); |
| 805 for(std::vector<bool>::iterator it = rbgMap.begin (); it != rbgMap.end (); it
++) |
| 806 { |
| 807 if((*it) == true ) |
| 808 { |
| 809 rbgAllocatedNum++; |
| 810 } |
| 811 } |
| 812 |
788 FfMacSchedSapUser::SchedDlConfigIndParameters ret; | 813 FfMacSchedSapUser::SchedDlConfigIndParameters ret; |
789 | 814 |
790 // update UL HARQ proc id | 815 // update UL HARQ proc id |
791 std::map <uint16_t, uint8_t>::iterator itProcId; | 816 std::map <uint16_t, uint8_t>::iterator itProcId; |
792 for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrent
ProcessId.end (); itProcId++) | 817 for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrent
ProcessId.end (); itProcId++) |
793 { | 818 { |
794 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; | 819 (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; |
795 } | 820 } |
796 | 821 |
797 | 822 |
798 // RACH Allocation | 823 // RACH Allocation |
| 824 uint16_t rbAllocatedNum = 0; |
| 825 std::vector <bool> ulRbMap; |
| 826 ulRbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); |
| 827 ulRbMap = m_ffrSapProvider->GetAvailableUlRbg (); |
| 828 uint8_t maxContinuousUlBandwidth = 0; |
| 829 uint8_t tmpMinBandwidth = 0; |
| 830 uint16_t ffrRbStartOffset = 0; |
| 831 uint16_t tmpFfrRbStartOffset = 0; |
| 832 uint16_t index = 0; |
| 833 |
| 834 for(std::vector<bool>::iterator it = ulRbMap.begin (); it != ulRbMap.end (); i
t++) |
| 835 { |
| 836 if((*it) == true ) |
| 837 { |
| 838 rbAllocatedNum++; |
| 839 if(tmpMinBandwidth > maxContinuousUlBandwidth) { |
| 840 maxContinuousUlBandwidth = tmpMinBandwidth; |
| 841 ffrRbStartOffset = tmpFfrRbStartOffset; |
| 842 } |
| 843 tmpMinBandwidth = 0; |
| 844 } else { |
| 845 if(tmpMinBandwidth == 0) { |
| 846 tmpFfrRbStartOffset = index; |
| 847 } |
| 848 tmpMinBandwidth++; |
| 849 } |
| 850 index++; |
| 851 } |
| 852 |
| 853 if(tmpMinBandwidth > maxContinuousUlBandwidth) { |
| 854 maxContinuousUlBandwidth = tmpMinBandwidth; |
| 855 ffrRbStartOffset = tmpFfrRbStartOffset; |
| 856 } |
| 857 |
799 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 858 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
800 uint16_t rbStart = 0; | 859 uint16_t rbStart = 0; |
| 860 rbStart = ffrRbStartOffset; |
801 std::vector <struct RachListElement_s>::iterator itRach; | 861 std::vector <struct RachListElement_s>::iterator itRach; |
802 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) | 862 for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++) |
803 { | 863 { |
804 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"); | 864 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"); |
805 BuildRarListElement_s newRar; | 865 BuildRarListElement_s newRar; |
806 newRar.m_rnti = (*itRach).m_rnti; | 866 newRar.m_rnti = (*itRach).m_rnti; |
807 // DL-RACH Allocation | 867 // DL-RACH Allocation |
808 // Ideal: no needs of configuring m_dci | 868 // Ideal: no needs of configuring m_dci |
809 // UL-RACH Allocation | 869 // UL-RACH Allocation |
810 newRar.m_grant.m_rnti = newRar.m_rnti; | 870 newRar.m_grant.m_rnti = newRar.m_rnti; |
811 newRar.m_grant.m_mcs = m_ulGrantMcs; | 871 newRar.m_grant.m_mcs = m_ulGrantMcs; |
812 uint16_t rbLen = 1; | 872 uint16_t rbLen = 1; |
813 uint16_t tbSizeBits = 0; | 873 uint16_t tbSizeBits = 0; |
814 // find lowest TB size that fits UL grant estimated size | 874 // find lowest TB size that fits UL grant estimated size |
815 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cs
chedCellConfig.m_ulBandwidth)) | 875 while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < (ffr
RbStartOffset+maxContinuousUlBandwidth))) |
816 { | 876 { |
817 rbLen++; | 877 rbLen++; |
818 tbSizeBits = m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen); | 878 tbSizeBits = m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen); |
819 } | 879 } |
820 if (tbSizeBits < (*itRach).m_estimatedSize) | 880 if (tbSizeBits < (*itRach).m_estimatedSize) |
821 { | 881 { |
822 // no more allocation space: finish allocation | 882 // no more allocation space: finish allocation |
823 break; | 883 break; |
824 } | 884 } |
825 newRar.m_grant.m_rbStart = rbStart; | 885 newRar.m_grant.m_rbStart = rbStart; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 uint8_t startRbg = dciRbg.at (dciRbg.size () - 1); | 1072 uint8_t startRbg = dciRbg.at (dciRbg.size () - 1); |
1013 std::vector <bool> rbgMapCopy = rbgMap; | 1073 std::vector <bool> rbgMapCopy = rbgMap; |
1014 while ((j < dciRbg.size ())&&(startRbg != rbgId)) | 1074 while ((j < dciRbg.size ())&&(startRbg != rbgId)) |
1015 { | 1075 { |
1016 if (rbgMapCopy.at (rbgId) == false) | 1076 if (rbgMapCopy.at (rbgId) == false) |
1017 { | 1077 { |
1018 rbgMapCopy.at (rbgId) = true; | 1078 rbgMapCopy.at (rbgId) = true; |
1019 dciRbg.at (j) = rbgId; | 1079 dciRbg.at (j) = rbgId; |
1020 j++; | 1080 j++; |
1021 } | 1081 } |
1022 rbgId++; | 1082 rbgId = (rbgId + 1) % numberOfRBGs; |
1023 } | 1083 } |
1024 if (j == dciRbg.size ()) | 1084 if (j == dciRbg.size ()) |
1025 { | 1085 { |
1026 // find new RBGs -> update DCI map | 1086 // find new RBGs -> update DCI map |
1027 uint32_t rbgMask = 0; | 1087 uint32_t rbgMask = 0; |
1028 for (uint16_t k = 0; k < dciRbg.size (); k++) | 1088 for (uint16_t k = 0; k < dciRbg.size (); k++) |
1029 { | 1089 { |
1030 rbgMask = rbgMask + (0x1 << dciRbg.at (k)); | 1090 rbgMask = rbgMask + (0x1 << dciRbg.at (k)); |
1031 rbgAllocatedNum++; | 1091 rbgAllocatedNum++; |
1032 } | 1092 } |
1033 dci.m_rbBitmap = rbgMask; | 1093 dci.m_rbBitmap = rbgMask; |
1034 rbgMap = rbgMapCopy; | 1094 rbgMap = rbgMapCopy; |
1035 NS_LOG_INFO (this << " Move retx in RBGs " << dciRbg.size ()); | 1095 NS_LOG_INFO (this << " Move retx in RBGs " << dciRbg.size ()); |
1036 } | 1096 } |
1037 else | 1097 else |
1038 { | 1098 { |
1039 // HARQ retx cannot be performed on this TTI -> store it | 1099 // HARQ retx cannot be performed on this TTI -> store it |
1040 dlInfoListUntxed.push_back (params.m_dlInfoList.at (i)); | 1100 dlInfoListUntxed.push_back (m_dlInfoListBuffered.at (i)); |
1041 NS_LOG_INFO (this << " No resource for this retx -> buffer it"
); | 1101 NS_LOG_INFO (this << " No resource for this retx -> buffer it"
); |
1042 } | 1102 } |
1043 } | 1103 } |
1044 // retrieve RLC PDU list for retx TBsize and update DCI | 1104 // retrieve RLC PDU list for retx TBsize and update DCI |
1045 BuildDataListElement_s newEl; | 1105 BuildDataListElement_s newEl; |
1046 std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu = m_
dlHarqProcessesRlcPduListBuffer.find (rnti); | 1106 std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu = m_
dlHarqProcessesRlcPduListBuffer.find (rnti); |
1047 if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) | 1107 if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) |
1048 { | 1108 { |
1049 NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI
" << rnti); | 1109 NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI
" << rnti); |
1050 } | 1110 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 itnonGBRgroups++; | 1372 itnonGBRgroups++; |
1313 } | 1373 } |
1314 else | 1374 else |
1315 { | 1375 { |
1316 NS_LOG_INFO ("Available RBGs:"<< availableRBGs.size ()<<"but no users"
); | 1376 NS_LOG_INFO ("Available RBGs:"<< availableRBGs.size ()<<"but no users"
); |
1317 break; | 1377 break; |
1318 } | 1378 } |
1319 | 1379 |
1320 while (availableRBGs.size ()>0 and itCurrentGroup->second.size ()>0) | 1380 while (availableRBGs.size ()>0 and itCurrentGroup->second.size ()>0) |
1321 { | 1381 { |
| 1382 bool currentRBchecked = false; |
1322 int currentRB = *(availableRBGs.begin ()); | 1383 int currentRB = *(availableRBGs.begin ()); |
1323 std::map<LteFlowId_t, CQI_value> UeToCQIValue; | 1384 std::map<LteFlowId_t, CQI_value> UeToCQIValue; |
1324 std::map<LteFlowId_t, double > UeToCoitaMetric; | 1385 std::map<LteFlowId_t, double > UeToCoitaMetric; |
1325 std::map<LteFlowId_t, bool> UeHasReachedGBR; | 1386 std::map<LteFlowId_t, bool> UeHasReachedGBR; |
1326 double maximumValueMetric = 0; | 1387 double maximumValueMetric = 0; |
1327 LteFlowId_t userWithMaximumMetric; | 1388 LteFlowId_t userWithMaximumMetric; |
1328 UeToCQIValue.clear (); | 1389 UeToCQIValue.clear (); |
1329 UeToCoitaMetric.clear (); | 1390 UeToCoitaMetric.clear (); |
1330 | 1391 |
1331 // Iterate through the users and calculate which user will use the bes
t of the current resource bloc.end()k and assign to that user. | 1392 // Iterate through the users and calculate which user will use the bes
t of the current resource bloc.end()k and assign to that user. |
1332 for (std::set<LteFlowId_t>::iterator it=itCurrentGroup->second.begin (
); it!=itCurrentGroup->second.end (); it++) | 1393 for (std::set<LteFlowId_t>::iterator it=itCurrentGroup->second.begin (
); it!=itCurrentGroup->second.end (); it++) |
1333 { | 1394 { |
1334 LteFlowId_t flowId = *it; | 1395 LteFlowId_t flowId = *it; |
1335 uint8_t cqi_value = 1; //higher better,
maximum is 15 | 1396 uint8_t cqi_value = 1; //higher better,
maximum is 15 |
1336 double coita_metric = 1; | 1397 double coita_metric = 1; |
1337 double coita_sum = 0; | 1398 double coita_sum = 0; |
1338 double metric = 0; | 1399 double metric = 0; |
1339 uint8_t worstCQIAmongRBGsAllocatedForThisUser = 15; | 1400 uint8_t worstCQIAmongRBGsAllocatedForThisUser = 15; |
1340 int numberOfRBGAllocatedForThisUser = 0; | 1401 int numberOfRBGAllocatedForThisUser = 0; |
1341 LogicalChannelConfigListElement_s lc = m_ueLogicalChannelsConfigLi
st.find (flowId)->second; | 1402 LogicalChannelConfigListElement_s lc = m_ueLogicalChannelsConfigLi
st.find (flowId)->second; |
1342 std::map <uint16_t,SbMeasResult_s>::iterator itRntiCQIsMap = m_a30
CqiRxed.find (flowId.m_rnti); | 1403 std::map <uint16_t,SbMeasResult_s>::iterator itRntiCQIsMap = m_a30
CqiRxed.find (flowId.m_rnti); |
1343 | 1404 |
1344 std::map <uint16_t, CqasFlowPerf_t>::iterator itStats; | 1405 std::map <uint16_t, CqasFlowPerf_t>::iterator itStats; |
1345 | 1406 |
| 1407 if((m_ffrSapProvider->IsDlRbgAvailableForUe (currentRB, flowId.m_r
nti)) == false) |
| 1408 continue; |
| 1409 |
1346 if (m_flowStatsDl.find (flowId.m_rnti) == m_flowStatsDl.end ()) | 1410 if (m_flowStatsDl.find (flowId.m_rnti) == m_flowStatsDl.end ()) |
1347 { | 1411 { |
1348 continue; // TO DO: check if th
is should be logged and how. | 1412 continue; // TO DO: check if th
is should be logged and how. |
1349 } | 1413 } |
| 1414 currentRBchecked = true; |
1350 | 1415 |
1351 itStats = m_flowStatsDl.find (flowId.m_rnti); | 1416 itStats = m_flowStatsDl.find (flowId.m_rnti); |
1352 double tbr_weight = (*itStats).second.targetThroughput / (*itStats
).second.lastAveragedThroughput; | 1417 double tbr_weight = (*itStats).second.targetThroughput / (*itStats
).second.lastAveragedThroughput; |
1353 if (tbr_weight < 1.0) | 1418 if (tbr_weight < 1.0) |
1354 tbr_weight = 1.0; | 1419 tbr_weight = 1.0; |
1355 | 1420 |
1356 if (itRntiCQIsMap != m_a30CqiRxed.end ()) | 1421 if (itRntiCQIsMap != m_a30CqiRxed.end ()) |
1357 { | 1422 { |
1358 for(std::set<int>::iterator it=availableRBGs.begin (); it!=ava
ilableRBGs.end (); it++) | 1423 for(std::set<int>::iterator it=availableRBGs.begin (); it!=ava
ilableRBGs.end (); it++) |
1359 { | 1424 { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 metric = 1; | 1519 metric = 1; |
1455 } | 1520 } |
1456 | 1521 |
1457 if (metric >= maximumValueMetric) | 1522 if (metric >= maximumValueMetric) |
1458 { | 1523 { |
1459 maximumValueMetric = metric; | 1524 maximumValueMetric = metric; |
1460 userWithMaximumMetric = flowId; | 1525 userWithMaximumMetric = flowId; |
1461 } | 1526 } |
1462 } | 1527 } |
1463 | 1528 |
| 1529 if(!currentRBchecked) { |
| 1530 // erase current RBG from the list of available RBG |
| 1531 availableRBGs.erase (currentRB); |
| 1532 continue; |
| 1533 } |
| 1534 |
1464 qos_rb_and_CQI_assigned_to_lc s; | 1535 qos_rb_and_CQI_assigned_to_lc s; |
1465 s.cqi_value_for_lc = UeToCQIValue.find (userWithMaximumMetric)->second
; | 1536 s.cqi_value_for_lc = UeToCQIValue.find (userWithMaximumMetric)->second
; |
1466 s.resource_block_index = currentRB; | 1537 s.resource_block_index = currentRB; |
1467 | 1538 |
1468 itMap = allocationMapPerRntiPerLCId.find (userWithMaximumMetric.m_rnti
); | 1539 itMap = allocationMapPerRntiPerLCId.find (userWithMaximumMetric.m_rnti
); |
1469 | 1540 |
1470 if (itMap == allocationMapPerRntiPerLCId.end ()) | 1541 if (itMap == allocationMapPerRntiPerLCId.end ()) |
1471 { | 1542 { |
1472 std::multimap <uint8_t, qos_rb_and_CQI_assigned_to_lc> tempMap; | 1543 std::multimap <uint8_t, qos_rb_and_CQI_assigned_to_lc> tempMap; |
1473 tempMap.insert (std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>
(userWithMaximumMetric.m_lcId,s)); | 1544 tempMap.insert (std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>
(userWithMaximumMetric.m_lcId,s)); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 { | 1659 { |
1589 break; | 1660 break; |
1590 } | 1661 } |
1591 } | 1662 } |
1592 // for (uint8_t j = 0; j < nLayer; j++) | 1663 // for (uint8_t j = 0; j < nLayer; j++) |
1593 // { | 1664 // { |
1594 newDci.m_ndi.push_back (1); | 1665 newDci.m_ndi.push_back (1); |
1595 newDci.m_rv.push_back (0); | 1666 newDci.m_rv.push_back (0); |
1596 //} | 1667 //} |
1597 | 1668 |
| 1669 newDci.m_tpc = m_ffrSapProvider->GetTpc((*itMap).first); |
| 1670 |
1598 newEl.m_dci = newDci; | 1671 newEl.m_dci = newDci; |
1599 | 1672 |
1600 if (m_harqOn == true) | 1673 if (m_harqOn == true) |
1601 { | 1674 { |
1602 // store DCI for HARQ | 1675 // store DCI for HARQ |
1603 std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itDci = m_dl
HarqProcessesDciBuffer.find (newEl.m_rnti); | 1676 std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itDci = m_dl
HarqProcessesDciBuffer.find (newEl.m_rnti); |
1604 if (itDci == m_dlHarqProcessesDciBuffer.end ()) | 1677 if (itDci == m_dlHarqProcessesDciBuffer.end ()) |
1605 { | 1678 { |
1606 NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for
RNTI " << newEl.m_rnti); | 1679 NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for
RNTI " << newEl.m_rnti); |
1607 } | 1680 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 | 1743 |
1671 m_rachList = params.m_rachList; | 1744 m_rachList = params.m_rachList; |
1672 | 1745 |
1673 return; | 1746 return; |
1674 } | 1747 } |
1675 | 1748 |
1676 void | 1749 void |
1677 CqaFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::Sche
dDlCqiInfoReqParameters& params) | 1750 CqaFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::Sche
dDlCqiInfoReqParameters& params) |
1678 { | 1751 { |
1679 NS_LOG_FUNCTION (this); | 1752 NS_LOG_FUNCTION (this); |
| 1753 m_ffrSapProvider->ReportDlCqiInfo(params); |
1680 | 1754 |
1681 for (unsigned int i = 0; i < params.m_cqiList.size (); i++) | 1755 for (unsigned int i = 0; i < params.m_cqiList.size (); i++) |
1682 { | 1756 { |
1683 if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 ) | 1757 if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 ) |
1684 { | 1758 { |
1685 // wideband CQI reporting | 1759 // wideband CQI reporting |
1686 std::map <uint16_t,uint8_t>::iterator it; | 1760 std::map <uint16_t,uint8_t>::iterator it; |
1687 uint16_t rnti = params.m_cqiList.at (i).m_rnti; | 1761 uint16_t rnti = params.m_cqiList.at (i).m_rnti; |
1688 it = m_p10CqiRxed.find (rnti); | 1762 it = m_p10CqiRxed.find (rnti); |
1689 if (it == m_p10CqiRxed.end ()) | 1763 if (it == m_p10CqiRxed.end ()) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 return (estimatedSinr); | 1838 return (estimatedSinr); |
1765 } | 1839 } |
1766 } | 1840 } |
1767 | 1841 |
1768 void | 1842 void |
1769 CqaFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sche
dUlTriggerReqParameters& params) | 1843 CqaFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sche
dUlTriggerReqParameters& params) |
1770 { | 1844 { |
1771 NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subf
rame no. " << (0xF & params.m_sfnSf) << " size " << params.m_ulInfoList.size ())
; | 1845 NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subf
rame no. " << (0xF & params.m_sfnSf) << " size " << params.m_ulInfoList.size ())
; |
1772 | 1846 |
1773 RefreshUlCqiMaps (); | 1847 RefreshUlCqiMaps (); |
| 1848 m_ffrSapProvider->ReportUlCqiInfo(m_ueCqi); |
1774 | 1849 |
1775 // Generate RBs map | 1850 // Generate RBs map |
1776 FfMacSchedSapUser::SchedUlConfigIndParameters ret; | 1851 FfMacSchedSapUser::SchedUlConfigIndParameters ret; |
1777 std::vector <bool> rbMap; | 1852 std::vector <bool> rbMap; |
1778 uint16_t rbAllocatedNum = 0; | 1853 uint16_t rbAllocatedNum = 0; |
1779 std::set <uint16_t> rntiAllocated; | 1854 std::set <uint16_t> rntiAllocated; |
1780 std::vector <uint16_t> rbgAllocationMap; | 1855 std::vector <uint16_t> rbgAllocationMap; |
1781 // update with RACH allocation map | 1856 // update with RACH allocation map |
1782 rbgAllocationMap = m_rachAllocationMap; | 1857 rbgAllocationMap = m_rachAllocationMap; |
1783 //rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 1858 //rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
1784 m_rachAllocationMap.clear (); | 1859 m_rachAllocationMap.clear (); |
1785 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); | 1860 m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); |
1786 | 1861 |
1787 rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); | 1862 rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); |
| 1863 |
| 1864 rbMap = m_ffrSapProvider->GetAvailableUlRbg (); |
| 1865 |
| 1866 for(std::vector<bool>::iterator it = rbMap.begin (); it != rbMap.end (); it++) |
| 1867 { |
| 1868 if((*it) == true ) |
| 1869 { |
| 1870 rbAllocatedNum++; |
| 1871 } |
| 1872 } |
| 1873 |
| 1874 uint8_t minContinuousUlBandwidth = m_ffrSapProvider->GetMinContinuousUlBandwid
th(); |
| 1875 uint8_t ffrUlBandwidth = m_cschedCellConfig.m_ulBandwidth - rbAllocatedNum; |
| 1876 |
1788 // remove RACH allocation | 1877 // remove RACH allocation |
1789 for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++) | 1878 for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++) |
1790 { | 1879 { |
1791 if (rbgAllocationMap.at (i) != 0) | 1880 if (rbgAllocationMap.at (i) != 0) |
1792 { | 1881 { |
1793 rbMap.at (i) = true; | 1882 rbMap.at (i) = true; |
1794 NS_LOG_DEBUG (this << " Allocated for RACH " << i); | 1883 NS_LOG_DEBUG (this << " Allocated for RACH " << i); |
1795 } | 1884 } |
1796 } | 1885 } |
1797 | 1886 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 { | 1979 { |
1891 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); | 1980 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); |
1892 m_schedSapUser->SchedUlConfigInd (ret); | 1981 m_schedSapUser->SchedUlConfigInd (ret); |
1893 } | 1982 } |
1894 | 1983 |
1895 return; // no flows to be scheduled | 1984 return; // no flows to be scheduled |
1896 } | 1985 } |
1897 | 1986 |
1898 | 1987 |
1899 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger | 1988 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger |
1900 uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAlloca
ted.size ()); | 1989 uint16_t tempRbPerFlow = (ffrUlBandwidth) / (nflows + rntiAllocated.size ()); |
| 1990 uint16_t rbPerFlow = (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuou
sUlBandwidth : tempRbPerFlow; |
| 1991 |
1901 if (rbPerFlow < 3) | 1992 if (rbPerFlow < 3) |
1902 { | 1993 { |
1903 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes | 1994 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes |
1904 } | 1995 } |
1905 int rbAllocated = 0; | 1996 int rbAllocated = 0; |
1906 | 1997 |
1907 std::map <uint16_t, CqasFlowPerf_t>::iterator itStats; | 1998 std::map <uint16_t, CqasFlowPerf_t>::iterator itStats; |
1908 if (m_nextRntiUl != 0) | 1999 if (m_nextRntiUl != 0) |
1909 { | 2000 { |
1910 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) | 2001 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 // limit to physical resources last resource assignment | 2035 // limit to physical resources last resource assignment |
1945 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; | 2036 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1946 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 2037 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1947 if (rbPerFlow < 3) | 2038 if (rbPerFlow < 3) |
1948 { | 2039 { |
1949 // terminate allocation | 2040 // terminate allocation |
1950 rbPerFlow = 0; | 2041 rbPerFlow = 0; |
1951 } | 2042 } |
1952 } | 2043 } |
1953 | 2044 |
| 2045 rbAllocated = 0; |
1954 UlDciListElement_s uldci; | 2046 UlDciListElement_s uldci; |
1955 uldci.m_rnti = (*it).first; | 2047 uldci.m_rnti = (*it).first; |
1956 uldci.m_rbLen = rbPerFlow; | 2048 uldci.m_rbLen = rbPerFlow; |
1957 bool allocated = false; | 2049 bool allocated = false; |
1958 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); | 2050 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); |
1959 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) | 2051 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) |
1960 { | 2052 { |
1961 // check availability | 2053 // check availability |
1962 bool free = true; | 2054 bool free = true; |
1963 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) | 2055 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1964 { | 2056 { |
1965 if (rbMap.at (j) == true) | 2057 if (rbMap.at (j) == true) |
1966 { | 2058 { |
1967 free = false; | 2059 free = false; |
1968 break; | 2060 break; |
1969 } | 2061 } |
| 2062 if((m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) ==
false) |
| 2063 { |
| 2064 free = false; |
| 2065 break; |
| 2066 } |
1970 } | 2067 } |
1971 if (free) | 2068 if (free) |
1972 { | 2069 { |
| 2070 NS_LOG_INFO (this << "RNTI: "<< (*it).first<< " RB Allocated "
<< rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows); |
1973 uldci.m_rbStart = rbAllocated; | 2071 uldci.m_rbStart = rbAllocated; |
1974 | 2072 |
1975 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) | 2073 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1976 { | 2074 { |
1977 rbMap.at (j) = true; | 2075 rbMap.at (j) = true; |
1978 // store info on allocation for managing ul-cqi interpretation | 2076 // store info on allocation for managing ul-cqi interpretation |
1979 rbgAllocationMap.at (j) = (*it).first; | 2077 rbgAllocationMap.at (j) = (*it).first; |
1980 } | 2078 } |
1981 rbAllocated += rbPerFlow; | 2079 rbAllocated += rbPerFlow; |
1982 allocated = true; | 2080 allocated = true; |
1983 break; | 2081 break; |
1984 } | 2082 } |
1985 rbAllocated++; | 2083 rbAllocated++; |
1986 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) | 2084 if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) |
1987 { | 2085 { |
1988 // limit to physical resources last resource assignment | 2086 // limit to physical resources last resource assignment |
1989 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; | 2087 rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
1990 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 2088 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1991 if (rbPerFlow < 3) | 2089 if (rbPerFlow < 3) |
1992 { | 2090 { |
1993 // terminate allocation | 2091 // terminate allocation |
1994 rbPerFlow = 0; | 2092 rbPerFlow = 0; |
1995 } | 2093 } |
1996 } | 2094 } |
1997 } | 2095 } |
1998 if (!allocated) | 2096 if (!allocated) |
1999 { | 2097 { |
2000 // unable to allocate new resource: finish scheduling | 2098 // unable to allocate new resource: finish scheduling |
2001 m_nextRntiUl = (*it).first; | 2099 // m_nextRntiUl = (*it).first; |
2002 if (ret.m_dciList.size () > 0) | 2100 // if (ret.m_dciList.size () > 0) |
2003 { | 2101 // { |
2004 m_schedSapUser->SchedUlConfigInd (ret); | 2102 // m_schedSapUser->SchedUlConfigInd (ret); |
2005 } | 2103 // } |
2006 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); | 2104 // m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t>
> (params.m_sfnSf, rbgAllocationMap)); |
2007 return; | 2105 // return; |
| 2106 break; |
2008 } | 2107 } |
2009 | 2108 |
2010 | 2109 |
2011 | 2110 |
2012 std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find
((*it).first); | 2111 std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find
((*it).first); |
2013 int cqi = 0; | 2112 int cqi = 0; |
2014 if (itCqi == m_ueCqi.end ()) | 2113 if (itCqi == m_ueCqi.end ()) |
2015 { | 2114 { |
2016 // no cqi info about this UE | 2115 // no cqi info about this UE |
2017 uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD | 2116 uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 { | 2620 { |
2522 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); | 2621 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); |
2523 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; | 2622 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; |
2524 params.m_rnti = rnti; | 2623 params.m_rnti = rnti; |
2525 params.m_transmissionMode = txMode; | 2624 params.m_transmissionMode = txMode; |
2526 m_cschedSapUser->CschedUeConfigUpdateInd (params); | 2625 m_cschedSapUser->CschedUeConfigUpdateInd (params); |
2527 } | 2626 } |
2528 | 2627 |
2529 | 2628 |
2530 } | 2629 } |
OLD | NEW |