25 #include <ns3/boolean.h>
26 #include <ns3/cqa-ff-mac-scheduler.h>
27 #include <ns3/ff-mac-common.h>
28 #include <ns3/integer.h>
30 #include <ns3/lte-amc.h>
31 #include <ns3/lte-vendor-specific-parameters.h>
33 #include <ns3/pointer.h>
34 #include <ns3/simulator.h>
35 #include <ns3/string.h>
130 : m_cschedSapUser(nullptr),
131 m_schedSapUser(nullptr),
135 m_amc = CreateObject<LteAmc>();
167 TypeId(
"ns3::CqaFfMacScheduler")
171 .AddAttribute(
"CqiTimerThreshold",
172 "The number of TTIs a CQI is valid (default 1000 - 1 sec.)",
175 MakeUintegerChecker<uint32_t>())
176 .AddAttribute(
"CqaMetric",
177 "CqaFfMacScheduler metric type that can be: CqaFf, CqaPf",
181 .AddAttribute(
"HarqEnabled",
182 "Activate/Deactivate the HARQ [by default is active].",
186 .AddAttribute(
"UlGrantMcs",
187 "The MCS of the UL grant, must be [0..15] (default 0)",
190 MakeUintegerChecker<uint8_t>());
248 << (uint16_t)
params.m_transmissionMode);
256 dlHarqPrcStatus.resize(8, 0);
258 std::pair<uint16_t, DlHarqProcessesStatus_t>(
params.m_rnti, dlHarqPrcStatus));
260 dlHarqProcessesTimer.resize(8, 0);
262 std::pair<uint16_t, DlHarqProcessesTimer_t>(
params.m_rnti, dlHarqProcessesTimer));
266 std::pair<uint16_t, DlHarqProcessesDciBuffer_t>(
params.m_rnti, dlHarqdci));
268 dlHarqRlcPdu.resize(2);
269 dlHarqRlcPdu.at(0).resize(8);
270 dlHarqRlcPdu.at(1).resize(8);
272 std::pair<uint16_t, DlHarqRlcPduListBuffer_t>(
params.m_rnti, dlHarqRlcPdu));
275 ulHarqPrcStatus.resize(8, 0);
277 std::pair<uint16_t, UlHarqProcessesStatus_t>(
params.m_rnti, ulHarqPrcStatus));
281 std::pair<uint16_t, UlHarqProcessesDciBuffer_t>(
params.m_rnti, ulHarqdci));
285 (*it).second =
params.m_transmissionMode;
299 if (
params.m_reconfigureFlag)
301 std::vector<struct LogicalChannelConfigListElement_s>::const_iterator lcit;
303 for (lcit =
params.m_logicalChannelConfigList.begin();
304 lcit !=
params.m_logicalChannelConfigList.end();
311 NS_LOG_ERROR(
"UE logical channels can not be reconfigured because it was not "
312 "configured before.");
323 std::vector<struct LogicalChannelConfigListElement_s>::const_iterator lcit;
325 for (lcit =
params.m_logicalChannelConfigList.begin();
326 lcit !=
params.m_logicalChannelConfigList.end();
331 std::pair<LteFlowId_t, LogicalChannelConfigListElement_s>(flowId, *lcit));
335 std::map<uint16_t, CqasFlowPerf_t>::iterator it;
337 for (std::size_t i = 0; i <
params.m_logicalChannelConfigList.size(); i++)
343 double tbrDlInBytes =
344 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateDl / 8;
345 double tbrUlInBytes =
346 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateUl / 8;
368 double tbrDlInBytes =
369 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateDl / 8;
370 double tbrUlInBytes =
371 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateUl / 8;
383 std::vector<uint8_t>::const_iterator it;
385 for (it =
params.m_logicalChannelIdentity.begin(); it !=
params.m_logicalChannelIdentity.end();
398 NS_FATAL_ERROR(
"Logical channels cannot be released because it can not be found in the "
399 "list of active LCs");
403 for (std::size_t i = 0; i <
params.m_logicalChannelIdentity.size(); i++)
405 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it =
407 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
410 if (((*it).first.m_rnti ==
params.m_rnti) &&
411 ((*it).first.m_lcId ==
params.m_logicalChannelIdentity.at(i)))
454 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it =
456 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
459 if ((*it).first.m_rnti ==
params.m_rnti)
483 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
492 std::pair<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>(flow,
520 for (
int i = 0; i < 4; i++)
534 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
535 unsigned int lcActive = 0;
538 if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0) ||
539 ((*it).second.m_rlcRetransmissionQueueSize > 0) ||
540 ((*it).second.m_rlcStatusPduSize > 0)))
544 if ((*it).first.m_rnti > rnti)
562 std::map<uint16_t, DlHarqProcessesStatus_t>::iterator itStat =
566 NS_FATAL_ERROR(
"No Process Id Statusfound for this RNTI " << rnti);
568 uint8_t i = (*it).second;
572 }
while (((*itStat).second.at(i) != 0) && (i != (*it).second));
573 if ((*itStat).second.at(i) == 0)
598 std::map<uint16_t, DlHarqProcessesStatus_t>::iterator itStat =
602 NS_FATAL_ERROR(
"No Process Id Statusfound for this RNTI " << rnti);
604 uint8_t i = (*it).second;
608 }
while (((*itStat).second.at(i) != 0) && (i != (*it).second));
609 if ((*itStat).second.at(i) == 0)
612 (*itStat).second.at(i) = 1;
617 << rnti <<
" check before update with HarqProcessAvailability");
620 return ((*it).second);
628 std::map<uint16_t, DlHarqProcessesTimer_t>::iterator itTimers;
638 NS_LOG_DEBUG(
this <<
" Reset HARQ proc " << i <<
" for RNTI " << (*itTimers).first);
639 std::map<uint16_t, DlHarqProcessesStatus_t>::iterator itStat =
644 << (*itTimers).first);
646 (*itStat).second.at(i) = 0;
647 (*itTimers).second.at(i) = 0;
651 (*itTimers).second.at(i)++;
662 << (0xF &
params.m_sfnSf));
672 std::map<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>
673 allocationMapPerRntiPerLCId;
674 std::map<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>::iterator itMap;
675 allocationMapPerRntiPerLCId.clear();
679 int grouping_parameter = 1000;
680 double tolerance = 1.1;
681 std::map<LteFlowId_t, int> UEtoHOL;
682 std::vector<bool> rbgMap;
683 uint16_t rbgAllocatedNum = 0;
684 std::set<uint16_t> rntiAllocated;
688 for (std::vector<bool>::iterator it = rbgMap.begin(); it != rbgMap.end(); it++)
699 std::map<uint16_t, uint8_t>::iterator itProcId;
703 (*itProcId).second = ((*itProcId).second + 1) %
HARQ_PROC_NUM;
707 std::vector<bool> ulRbMap;
710 uint8_t maxContinuousUlBandwidth = 0;
711 uint8_t tmpMinBandwidth = 0;
712 uint16_t ffrRbStartOffset = 0;
713 uint16_t tmpFfrRbStartOffset = 0;
716 for (std::vector<bool>::iterator it = ulRbMap.begin(); it != ulRbMap.end(); it++)
720 if (tmpMinBandwidth > maxContinuousUlBandwidth)
722 maxContinuousUlBandwidth = tmpMinBandwidth;
723 ffrRbStartOffset = tmpFfrRbStartOffset;
729 if (tmpMinBandwidth == 0)
731 tmpFfrRbStartOffset = index;
738 if (tmpMinBandwidth > maxContinuousUlBandwidth)
740 maxContinuousUlBandwidth = tmpMinBandwidth;
741 ffrRbStartOffset = tmpFfrRbStartOffset;
745 uint16_t rbStart = 0;
746 rbStart = ffrRbStartOffset;
747 std::vector<struct RachListElement_s>::iterator itRach;
751 (*itRach).m_estimatedSize,
752 " Default UL Grant MCS does not allow to send RACH messages");
754 newRar.
m_rnti = (*itRach).m_rnti;
761 uint16_t tbSizeBits = 0;
763 while ((tbSizeBits < (*itRach).m_estimatedSize) &&
764 (rbStart + rbLen < (ffrRbStartOffset + maxContinuousUlBandwidth)))
769 if (tbSizeBits < (*itRach).m_estimatedSize)
781 NS_LOG_INFO(
this <<
" UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart "
782 << rbStart <<
" rbLen " << rbLen <<
" MCS " <<
m_ulGrantMcs <<
" tbSize "
784 for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
812 std::map<uint16_t, uint8_t>::iterator itProcId;
818 harqId = (*itProcId).second;
819 std::map<uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci =
823 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
826 (*itDci).second.at(harqId) = uldci;
829 rbStart = rbStart + rbLen;
839 if (!
params.m_dlInfoList.empty())
843 params.m_dlInfoList.begin(),
844 params.m_dlInfoList.end());
849 if (!
params.m_dlInfoList.empty())
859 std::vector<struct DlInfoListElement_s> dlInfoListUntxed;
863 if (itRnti != rntiAllocated.end())
869 std::vector<bool> retx;
870 NS_LOG_INFO(
this <<
" Processing DLHARQ feedback");
875 retx.push_back(
false);
884 if (retx.at(0) || retx.at(1))
889 NS_LOG_INFO(
this <<
" HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId);
890 std::map<uint16_t, DlHarqProcessesDciBuffer_t>::iterator itHarq =
899 if (dci.
m_rv.size() == 1)
911 NS_LOG_INFO(
"Maximum number of retransmissions reached -> drop process");
912 std::map<uint16_t, DlHarqProcessesStatus_t>::iterator it =
916 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
919 (*it).second.at(harqId) = 0;
920 std::map<uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =
924 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
927 for (std::size_t
k = 0;
k < (*itRlcPdu).second.size();
k++)
929 (*itRlcPdu).second.at(
k).at(harqId).clear();
935 std::vector<int> dciRbg;
938 for (
int j = 0; j < 32; j++)
948 for (std::size_t j = 0; j < dciRbg.size(); j++)
950 if (rbgMap.at(dciRbg.at(j)) ==
true)
960 for (std::size_t j = 0; j < dciRbg.size(); j++)
962 rbgMap.at(dciRbg.at(j)) =
true;
963 NS_LOG_INFO(
"RBG " << dciRbg.at(j) <<
" assigned");
967 NS_LOG_INFO(
this <<
" Send retx in the same RBGs");
973 uint8_t rbgId = (dciRbg.at(dciRbg.size() - 1) + 1) % numberOfRBGs;
974 uint8_t startRbg = dciRbg.at(dciRbg.size() - 1);
975 std::vector<bool> rbgMapCopy = rbgMap;
976 while ((j < dciRbg.size()) && (startRbg != rbgId))
978 if (rbgMapCopy.at(rbgId) ==
false)
980 rbgMapCopy.at(rbgId) =
true;
981 dciRbg.at(j) = rbgId;
984 rbgId = (rbgId + 1) % numberOfRBGs;
986 if (j == dciRbg.size())
989 uint32_t rbgMask = 0;
990 for (std::size_t
k = 0;
k < dciRbg.size();
k++)
992 rbgMask = rbgMask + (0x1 << dciRbg.at(
k));
997 NS_LOG_INFO(
this <<
" Move retx in RBGs " << dciRbg.size());
1003 NS_LOG_INFO(
this <<
" No resource for this retx -> buffer it");
1008 std::map<uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =
1012 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
1014 for (std::size_t j = 0; j < nLayers; j++)
1018 if (j >= dci.
m_ndi.size())
1021 dci.
m_ndi.push_back(0);
1022 dci.
m_rv.push_back(0);
1023 dci.
m_mcs.push_back(0);
1026 <<
" no txed (MIMO transition)");
1030 dci.
m_ndi.at(j) = 0;
1032 (*itHarq).second.at(harqId).m_rv.at(j)++;
1033 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" RV "
1034 << (uint16_t)dci.
m_rv.at(j));
1040 dci.
m_ndi.at(j) = 0;
1042 dci.
m_mcs.at(j) = 0;
1044 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" no retx");
1047 for (std::size_t
k = 0;
k < (*itRlcPdu).second.at(0).at(dci.
m_harqProcess).size();
k++)
1049 std::vector<struct RlcPduListElement_s> rlcPduListPerLc;
1050 for (std::size_t j = 0; j < nLayers; j++)
1054 if (j < dci.
m_ndi.size())
1056 NS_LOG_INFO(
" layer " << (uint16_t)j <<
" tb size "
1058 rlcPduListPerLc.push_back(
1071 .m_logicalChannelIdentity;
1073 rlcPduListPerLc.push_back(emptyElement);
1077 if (!rlcPduListPerLc.empty())
1084 (*itHarq).second.at(harqId).
m_rv = dci.
m_rv;
1086 std::map<uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer =
1090 NS_FATAL_ERROR(
"Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
1092 (*itHarqTimer).second.at(harqId) = 0;
1094 rntiAllocated.insert(rnti);
1100 std::map<uint16_t, DlHarqProcessesStatus_t>::iterator it =
1108 std::map<uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =
1112 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1115 for (std::size_t
k = 0;
k < (*itRlcPdu).second.size();
k++)
1124 if (rbgAllocatedNum == numberOfRBGs)
1134 std::map<LteFlowId_t, struct LogicalChannelConfigListElement_s>::iterator itLogicalChannels;
1138 itLogicalChannels++)
1140 std::set<uint16_t>::iterator itRnti = rntiAllocated.find(itLogicalChannels->first.m_rnti);
1141 if ((itRnti != rntiAllocated.end()) ||
1145 if (itRnti != rntiAllocated.end())
1148 << (uint16_t)(itLogicalChannels->first.m_rnti));
1153 << (uint16_t)(itLogicalChannels->first.m_rnti));
1158 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator
1168 if (itRlcBufferReq->second.m_rlcRetransmissionQueueSize > 0)
1170 delay = itRlcBufferReq->second.m_rlcRetransmissionHolDelay;
1171 group = delay / grouping_parameter;
1173 else if (itRlcBufferReq->second.m_rlcTransmissionQueueSize > 0)
1175 delay = itRlcBufferReq->second.m_rlcTransmissionQueueHolDelay;
1176 group = delay / grouping_parameter;
1183 UEtoHOL.insert(std::pair<LteFlowId_t, int>(itLogicalChannels->first, delay));
1185 if (itLogicalChannels->second.m_qosBearerType == itLogicalChannels->second.QBT_NON_GBR)
1187 if (map_nonGBRHOLgroupToUE.count(group) == 0)
1189 std::set<LteFlowId_t> v;
1190 v.insert(itRlcBufferReq->first);
1191 map_nonGBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group, v));
1195 map_nonGBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1198 else if (itLogicalChannels->second.m_qosBearerType == itLogicalChannels->second.QBT_GBR)
1200 if (map_GBRHOLgroupToUE.count(group) == 0)
1202 std::set<LteFlowId_t> v;
1203 v.insert(itRlcBufferReq->first);
1204 map_GBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group, v));
1208 map_GBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1215 std::map<LteFlowId_t, int> UeToAmountOfDataToTransfer;
1217 std::map<LteFlowId_t, int> UeToAmountOfAssignedResources;
1220 std::map<uint16_t, uint8_t> sbCqiSum;
1222 for (std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator
1229 std::map<uint16_t, SbMeasResult_s>::iterator itCqi;
1231 std::map<uint16_t, uint8_t>::iterator itTxMode;
1232 itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1235 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1240 for (
int k = 0;
k < numberOfRBGs;
k++)
1242 for (uint8_t j = 0; j < nLayer; j++)
1250 cqiSum += (*itCqi).second.m_higherLayerSelected.at(
k).m_sbCqi.at(j);
1257 NS_LOG_INFO(
"Skip this flow, CQI==0, rnti:" << (*itrbr).first.m_rnti);
1262 int amountOfDataToTransfer =
1266 UeToAmountOfDataToTransfer.insert(
1267 std::pair<LteFlowId_t, int>(flowId, amountOfDataToTransfer));
1268 UeToAmountOfAssignedResources.insert(std::pair<LteFlowId_t, int>(flowId, 0));
1271 for (
int i = 0; i < numberOfRBGs; i++)
1273 std::map<uint16_t, SbMeasResult_s>::iterator itCqi;
1275 std::map<uint16_t, uint8_t>::iterator itTxMode;
1276 itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1279 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1282 std::vector<uint8_t> sbCqis;
1285 for (uint8_t
k = 0;
k < nLayer;
k++)
1287 sbCqis.push_back(1);
1292 sbCqis = (*itCqi).second.m_higherLayerSelected.at(i).m_sbCqi;
1295 uint8_t cqi1 = sbCqis.at(0);
1297 if (sbCqis.size() > 1)
1299 cqi2 = sbCqis.at(1);
1306 for (uint8_t
k = 0;
k < nLayer;
k++)
1308 if (sbCqis.size() >
k)
1310 sbCqi = sbCqis.at(
k);
1322 sbCqiSum.insert(std::pair<uint16_t, uint8_t>((*itrbr).first.m_rnti, sum));
1326 std::set<int> availableRBGs;
1327 for (
int i = 0; i < numberOfRBGs; i++)
1329 if (rbgMap.at(i) ==
false)
1331 availableRBGs.insert(i);
1340 while (!availableRBGs.empty())
1342 if (UeToAmountOfDataToTransfer.empty())
1344 NS_LOG_INFO(
"No UEs to be scheduled (no data or CQI==0),");
1347 std::set<LteFlowId_t> vUEs;
1350 if (itGBRgroups != map_GBRHOLgroupToUE.end())
1352 itCurrentGroup = itGBRgroups;
1355 else if (itnonGBRgroups !=
1356 map_nonGBRHOLgroupToUE
1360 itCurrentGroup = itnonGBRgroups;
1365 NS_LOG_INFO(
"Available RBGs:" << availableRBGs.size() <<
"but no users");
1369 while (!availableRBGs.empty() && !itCurrentGroup->second.empty())
1371 bool currentRBchecked =
false;
1372 int currentRB = *(availableRBGs.begin());
1373 std::map<LteFlowId_t, CQI_value> UeToCQIValue;
1374 std::map<LteFlowId_t, double> UeToCoitaMetric;
1375 std::map<LteFlowId_t, bool> UeHasReachedGBR;
1376 double maximumValueMetric = 0;
1378 UeToCQIValue.clear();
1379 UeToCoitaMetric.clear();
1383 for (std::set<LteFlowId_t>::iterator it = itCurrentGroup->second.begin();
1384 it != itCurrentGroup->second.end();
1388 uint8_t cqi_value = 1;
1389 double coita_metric = 1;
1390 double coita_sum = 0;
1392 uint8_t worstCQIAmongRBGsAllocatedForThisUser = 15;
1393 int numberOfRBGAllocatedForThisUser = 0;
1396 std::map<uint16_t, SbMeasResult_s>::iterator itRntiCQIsMap =
1399 std::map<uint16_t, CqasFlowPerf_t>::iterator itStats;
1410 currentRBchecked =
true;
1414 (*itStats).second.targetThroughput / (*itStats).second.lastAveragedThroughput;
1415 if (tbr_weight < 1.0)
1422 for (std::set<int>::iterator it = availableRBGs.begin();
1423 it != availableRBGs.end();
1429 (itRntiCQIsMap->second.m_higherLayerSelected.at(*it).m_sbCqi.at(0));
1434 if (*it == currentRB)
1440 catch (std::out_of_range&)
1444 <<
" rnti:" << flowId.
m_rnti
1445 <<
" at subband:" << currentRB);
1450 coita_metric = cqi_value / coita_sum;
1451 UeToCQIValue.insert(std::pair<LteFlowId_t, CQI_value>(flowId, cqi_value));
1452 UeToCoitaMetric.insert(std::pair<LteFlowId_t, double>(flowId, coita_metric));
1455 if (allocationMapPerRntiPerLCId.find(flowId.
m_rnti) ==
1456 allocationMapPerRntiPerLCId.end())
1458 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1462 numberOfRBGAllocatedForThisUser =
1463 (allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.size());
1465 for (std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>::iterator itRBG =
1466 allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.begin();
1467 itRBG != allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.end();
1477 if (cqi_value < worstCQIAmongRBGsAllocatedForThisUser)
1479 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1483 int mcsForThisUser =
m_amc->GetMcsFromCqi(worstCQIAmongRBGsAllocatedForThisUser);
1485 m_amc->GetDlTbSizeFromMcs(mcsForThisUser,
1486 (numberOfRBGAllocatedForThisUser + 1) * rbgSize) /
1490 double achievableRate =
1491 ((
m_amc->GetDlTbSizeFromMcs(mcsForThisUser, rbgSize) / 8) / 0.001);
1492 double pf_weight = achievableRate / (*itStats).second.secondLastAveragedThroughput;
1494 UeToAmountOfAssignedResources.find(flowId)->second = 8 * tbSize;
1498 if (UeToAmountOfDataToTransfer.find(flowId)->second -
1499 UeToAmountOfAssignedResources.find(flowId)->second <
1502 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1505 double bitRateWithNewRBG = 0;
1517 bitRateWithNewRBG = (1.0 /
m_timeWindow) * (
double)(tbSize * 1000);
1522 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
true));
1526 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1529 int hol = UEtoHOL.find(flowId)->second;
1538 metric = coita_metric * tbr_weight * hol;
1542 metric = tbr_weight * pf_weight * hol;
1549 if (metric >= maximumValueMetric)
1551 maximumValueMetric = metric;
1552 userWithMaximumMetric = flowId;
1556 if (!currentRBchecked)
1559 availableRBGs.erase(currentRB);
1567 itMap = allocationMapPerRntiPerLCId.find(userWithMaximumMetric.
m_rnti);
1569 if (itMap == allocationMapPerRntiPerLCId.end())
1571 std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc> tempMap;
1573 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1575 allocationMapPerRntiPerLCId.insert(
1576 std::pair<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>(
1577 userWithMaximumMetric.
m_rnti,
1582 itMap->second.insert(
1583 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1588 availableRBGs.erase(currentRB);
1590 if (UeToAmountOfDataToTransfer.find(userWithMaximumMetric)->second <=
1591 UeToAmountOfAssignedResources.find(userWithMaximumMetric)->second * tolerance)
1594 itCurrentGroup->second.erase(userWithMaximumMetric);
1601 std::map<uint16_t, CqasFlowPerf_t>::iterator itStats;
1604 (*itStats).second.lastTtiBytesTransmitted = 0;
1610 itMap = allocationMapPerRntiPerLCId.begin();
1611 std::map<uint16_t, double> m_rnti_per_ratio;
1613 while (itMap != allocationMapPerRntiPerLCId.end())
1617 newEl.
m_rnti = (*itMap).first;
1621 std::vector<struct RlcPduListElement_s> newRlcPduLe;
1622 newDci.
m_rnti = (*itMap).first;
1630 uint16_t RgbPerRnti = (*itMap).second.size();
1631 double doubleRBgPerRnti = RgbPerRnti;
1632 double doubleRbgNum = numberOfRBGs;
1633 double rrRatio = doubleRBgPerRnti / doubleRbgNum;
1634 m_rnti_per_ratio.insert(std::pair<uint16_t, double>((*itMap).first, rrRatio));
1635 std::map<uint16_t, SbMeasResult_s>::iterator itCqi;
1637 uint8_t worstCqi = 15;
1640 for (std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>::iterator it =
1641 (*itMap).second.begin();
1642 it != (*itMap).second.end();
1645 if (it->second.cqi_value_for_lc < worstCqi)
1647 worstCqi = it->second.cqi_value_for_lc;
1651 newDci.
m_mcs.push_back(
m_amc->GetMcsFromCqi(worstCqi));
1652 int tbSize = (
m_amc->GetDlTbSizeFromMcs(newDci.
m_mcs.at(0), RgbPerRnti * rbgSize) /
1657 uint32_t rbgMask = 0;
1658 std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>::iterator itRBGsPerRNTI;
1659 for (itRBGsPerRNTI = (*itMap).second.begin(); itRBGsPerRNTI != (*itMap).second.end();
1662 rbgMask = rbgMask + (0x1 << itRBGsPerRNTI->second.resource_block_index);
1667 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator
1671 if (((*itBufReq).first.m_rnti == (*itMap).first) &&
1672 (((*itBufReq).second.m_rlcTransmissionQueueSize > 0) ||
1673 ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0) ||
1674 ((*itBufReq).second.m_rlcStatusPduSize > 0)))
1676 std::vector<struct RlcPduListElement_s> newRlcPduLe;
1682 newRlcEl.
m_size = tbSize / lcActives;
1685 newRlcPduLe.push_back(newRlcEl);
1692 std::map<uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =
1696 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1700 (*itRlcPdu).second.at(j).at(newDci.
m_harqProcess).push_back(newRlcEl);
1705 if ((*itBufReq).first.m_rnti > (*itMap).first)
1712 newDci.
m_ndi.push_back(1);
1713 newDci.
m_rv.push_back(0);
1718 newEl.
m_dci = newDci;
1723 std::map<uint16_t, DlHarqProcessesDciBuffer_t>::iterator itDci =
1727 NS_FATAL_ERROR(
"Unable to find RNTI entry in DCI HARQ buffer for RNTI "
1732 std::map<uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer =
1745 std::map<uint16_t, CqasFlowPerf_t>::iterator it;
1749 (*it).second.lastTtiBytesTransmitted = tbSize;
1764 if (allocationMapPerRntiPerLCId.find(itStats->first) != allocationMapPerRntiPerLCId.end())
1766 (*itStats).second.secondLastAveragedThroughput =
1767 ((1.0 - (1 /
m_timeWindow)) * (*itStats).second.secondLastAveragedThroughput) +
1768 ((1 /
m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1771 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
1774 (*itStats).second.lastAveragedThroughput =
1775 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
1776 ((1.0 /
m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1777 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
1778 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
1779 (*itStats).second.lastTtiBytesTransmitted = 0;
1784 int count_allocated_resource_blocks = 0;
1785 for (std::map<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>::iterator itMap =
1786 allocationMapPerRntiPerLCId.begin();
1787 itMap != allocationMapPerRntiPerLCId.end();
1790 count_allocated_resource_blocks += itMap->second.size();
1792 NS_LOG_INFO(
this <<
" Allocated RBs:" << count_allocated_resource_blocks);
1811 for (
unsigned int i = 0; i <
params.m_cqiList.size(); i++)
1817 std::map<uint16_t, uint8_t>::iterator it;
1818 uint16_t rnti =
params.m_cqiList.at(i).m_rnti;
1825 params.m_cqiList.at(i).m_wbCqi.at(0)));
1832 (*it).second =
params.m_cqiList.at(i).m_wbCqi.at(0);
1834 std::map<uint16_t, uint32_t>::iterator itTimers;
1842 std::map<uint16_t, SbMeasResult_s>::iterator it;
1843 uint16_t rnti =
params.m_cqiList.at(i).m_rnti;
1849 std::pair<uint16_t, SbMeasResult_s>(rnti,
1850 params.m_cqiList.at(i).m_sbMeasResult));
1856 (*it).second =
params.m_cqiList.at(i).m_sbMeasResult;
1857 std::map<uint16_t, uint32_t>::iterator itTimers;
1872 std::map<uint16_t, std::vector<double>>::iterator itCqi =
m_ueCqi.find(rnti);
1882 unsigned int sinrNum = 0;
1885 double sinr = (*itCqi).second.at(i);
1892 double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
1894 (*itCqi).second.at(rb) = estimatedSinr;
1895 return (estimatedSinr);
1904 << (0xF &
params.m_sfnSf) <<
" size " <<
params.m_ulInfoList.size());
1911 std::vector<bool> rbMap;
1912 uint16_t rbAllocatedNum = 0;
1913 std::set<uint16_t> rntiAllocated;
1914 std::vector<uint16_t> rbgAllocationMap;
1925 for (std::vector<bool>::iterator it = rbMap.begin(); it != rbMap.end(); it++)
1939 if (rbgAllocationMap.at(i) != 0)
1949 for (std::size_t i = 0; i <
params.m_ulInfoList.size(); i++)
1954 uint16_t rnti =
params.m_ulInfoList.at(i).m_rnti;
1955 std::map<uint16_t, uint8_t>::iterator itProcId =
1959 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1962 NS_LOG_INFO(
this <<
" UL-HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId
1963 <<
" i " << i <<
" size " <<
params.m_ulInfoList.size());
1964 std::map<uint16_t, UlHarqProcessesDciBuffer_t>::iterator itHarq =
1968 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1972 std::map<uint16_t, UlHarqProcessesStatus_t>::iterator itStat =
1976 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1978 if ((*itStat).second.at(harqId) >= 3)
1980 NS_LOG_INFO(
"Max number of retransmissions reached (UL)-> drop process");
1987 if (rbMap.at(j) ==
true)
1999 rbgAllocationMap.at(j) = dci.
m_rnti;
2005 << (*itStat).second.at(harqId) + 1);
2009 NS_LOG_INFO(
"Cannot allocate retx due to RACH allocations for UE " << rnti);
2014 (*itStat).second.at((*itProcId).second) = (*itStat).second.at(harqId) + 1;
2015 (*itStat).second.at(harqId) = 0;
2016 (*itHarq).second.at((*itProcId).second) = dci;
2018 rntiAllocated.insert(dci.
m_rnti);
2022 NS_LOG_INFO(
this <<
" HARQ-ACK feedback from RNTI "
2023 <<
params.m_ulInfoList.at(i).m_rnti);
2028 std::map<uint16_t, uint32_t>::iterator it;
2033 std::set<uint16_t>::iterator itRnti = rntiAllocated.find((*it).first);
2035 if (((*it).second > 0) && (itRnti == rntiAllocated.end()))
2046 std::pair<uint16_t, std::vector<uint16_t>>(
params.m_sfnSf, rbgAllocationMap));
2055 uint16_t tempRbPerFlow = (ffrUlBandwidth) / (nflows + rntiAllocated.size());
2056 uint16_t rbPerFlow =
2057 (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuousUlBandwidth : tempRbPerFlow;
2064 int rbAllocated = 0;
2066 std::map<uint16_t, CqasFlowPerf_t>::iterator itStats;
2088 std::set<uint16_t>::iterator itRnti = rntiAllocated.find((*it).first);
2089 if ((itRnti != rntiAllocated.end()) || ((*it).second == 0))
2092 NS_LOG_DEBUG(
this <<
" UE already allocated in HARQ -> discarded, RNTI "
2116 uldci.
m_rnti = (*it).first;
2118 bool allocated =
false;
2119 NS_LOG_INFO(
this <<
" RB Allocated " << rbAllocated <<
" rbPerFlow " << rbPerFlow
2120 <<
" flows " << nflows);
2126 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2128 if (rbMap.at(j) ==
true)
2141 NS_LOG_INFO(
this <<
"RNTI: " << (*it).first <<
" RB Allocated " << rbAllocated
2142 <<
" rbPerFlow " << rbPerFlow <<
" flows " << nflows);
2145 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2149 rbgAllocationMap.at(j) = (*it).first;
2151 rbAllocated += rbPerFlow;
2181 std::map<uint16_t, std::vector<double>>::iterator itCqi =
m_ueCqi.find((*it).first);
2192 "CQI of RNTI = " << (*it).first <<
" has expired");
2193 double minSinr = (*itCqi).second.at(uldci.
m_rbStart);
2200 double sinr = (*itCqi).second.at(i);
2212 double s = log2(1 + (std::pow(10, minSinr / 10) / ((-std::log(5.0 * 0.00005)) / 1.5)));
2213 cqi =
m_amc->GetCqiFromSpectralEfficiency(s);
2226 rbgAllocationMap.at(i) = 0;
2252 std::map<uint16_t, uint8_t>::iterator itProcId;
2258 harqId = (*itProcId).second;
2259 std::map<uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci =
2263 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
2266 (*itDci).second.at(harqId) = uldci;
2268 std::map<uint16_t, UlHarqProcessesStatus_t>::iterator itStat =
2272 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
2275 (*itStat).second.at(harqId) = 0;
2278 NS_LOG_INFO(
this <<
" UE Allocation RNTI " << (*it).first <<
" startPRB "
2280 <<
" CQI " << cqi <<
" MCS " << (uint32_t)uldci.
m_mcs <<
" TBsize "
2281 << uldci.
m_tbSize <<
" RbAlloc " << rbAllocated <<
" harqId "
2282 << (uint16_t)harqId);
2288 (*itStats).second.lastTtiBytesTransmitted = uldci.
m_tbSize;
2292 NS_LOG_DEBUG(
this <<
" No Stats for this allocated UE");
2307 }
while (((*it).first !=
m_nextRntiUl) && (rbPerFlow != 0));
2313 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
2316 (*itStats).second.lastAveragedThroughput =
2317 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
2318 ((1.0 /
m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
2319 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
2320 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
2321 (*itStats).second.lastTtiBytesTransmitted = 0;
2324 std::pair<uint16_t, std::vector<uint16_t>>(
params.m_sfnSf, rbgAllocationMap));
2348 std::map<uint16_t, uint32_t>::iterator it;
2350 for (
unsigned int i = 0; i <
params.m_macCeList.size(); i++)
2361 uint32_t buffer = 0;
2362 for (uint8_t lcg = 0; lcg < 4; ++lcg)
2364 uint8_t bsrId =
params.m_macCeList.at(i).m_macCeValue.m_bufferStatus.at(lcg);
2368 uint16_t rnti =
params.m_macCeList.at(i).m_rnti;
2369 NS_LOG_LOGIC(
this <<
"RNTI=" << rnti <<
" buffer=" << buffer);
2374 m_ceBsrRxed.insert(std::pair<uint16_t, uint32_t>(rnti, buffer));
2379 (*it).second = buffer;
2413 switch (
params.m_ulCqi.m_type)
2416 std::map<uint16_t, std::vector<uint16_t>>::iterator itMap;
2417 std::map<uint16_t, std::vector<double>>::iterator itCqi;
2419 <<
" subframe no. " << (0xF &
params.m_sfnSf));
2425 for (uint32_t i = 0; i < (*itMap).second.size(); i++)
2429 itCqi =
m_ueCqi.find((*itMap).second.at(i));
2433 std::vector<double> newCqi;
2438 newCqi.push_back(sinr);
2447 std::pair<uint16_t, std::vector<double>>((*itMap).second.at(i), newCqi));
2455 (*itCqi).second.at(i) = sinr;
2456 NS_LOG_DEBUG(
this <<
" RNTI " << (*itMap).second.at(i) <<
" RB " << i <<
" SINR "
2459 std::map<uint16_t, uint32_t>::iterator itTimers;
2470 <<
" subframe no. " << (0xF &
params.m_sfnSf));
2474 for (std::size_t i = 0; i <
params.m_vendorSpecificList.size(); i++)
2479 DynamicCast<SrsCqiRntiVsp>(
params.m_vendorSpecificList.at(i).m_value);
2480 rnti = vsp->GetRnti();
2483 std::map<uint16_t, std::vector<double>>::iterator itCqi;
2488 std::vector<double> newCqi;
2492 newCqi.push_back(sinr);
2493 NS_LOG_INFO(
this <<
" RNTI " << rnti <<
" new SRS-CQI for RB " << j <<
" value "
2496 m_ueCqi.insert(std::pair<uint16_t, std::vector<double>>(rnti, newCqi));
2506 (*itCqi).second.at(j) = sinr;
2507 NS_LOG_INFO(
this <<
" RNTI " << rnti <<
" update SRS-CQI for RB " << j <<
" value "
2511 std::map<uint16_t, uint32_t>::iterator itTimers;
2520 NS_FATAL_ERROR(
"PfFfMacScheduler supports only PUSCH and SRS UL-CQIs");
2532 std::map<uint16_t, uint32_t>::iterator itP10 =
m_p10CqiTimers.begin();
2535 NS_LOG_INFO(
this <<
" P10-CQI for user " << (*itP10).first <<
" is "
2537 if ((*itP10).second == 0)
2540 std::map<uint16_t, uint8_t>::iterator itMap =
m_p10CqiRxed.find((*itP10).first);
2542 " Does not find CQI report for user " << (*itP10).first);
2543 NS_LOG_INFO(
this <<
" P10-CQI expired for user " << (*itP10).first);
2545 std::map<uint16_t, uint32_t>::iterator temp = itP10;
2557 std::map<uint16_t, uint32_t>::iterator itA30 =
m_a30CqiTimers.begin();
2560 NS_LOG_INFO(
this <<
" A30-CQI for user " << (*itA30).first <<
" is "
2562 if ((*itA30).second == 0)
2565 std::map<uint16_t, SbMeasResult_s>::iterator itMap =
m_a30CqiRxed.find((*itA30).first);
2567 " Does not find CQI report for user " << (*itA30).first);
2568 NS_LOG_INFO(
this <<
" A30-CQI expired for user " << (*itA30).first);
2570 std::map<uint16_t, uint32_t>::iterator temp = itA30;
2586 std::map<uint16_t, uint32_t>::iterator itUl =
m_ueCqiTimers.begin();
2589 NS_LOG_INFO(
this <<
" UL-CQI for user " << (*itUl).first <<
" is "
2591 if ((*itUl).second == 0)
2594 std::map<uint16_t, std::vector<double>>::iterator itMap =
m_ueCqi.find((*itUl).first);
2596 " Does not find CQI report for user " << (*itUl).first);
2597 NS_LOG_INFO(
this <<
" UL-CQI exired for user " << (*itUl).first);
2598 (*itMap).second.clear();
2600 std::map<uint16_t, uint32_t>::iterator temp = itUl;
2615 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
2620 NS_LOG_INFO(
this <<
" UE " << rnti <<
" LC " << (uint16_t)lcid <<
" txqueue "
2621 << (*it).second.m_rlcTransmissionQueueSize <<
" retxqueue "
2622 << (*it).second.m_rlcRetransmissionQueueSize <<
" status "
2623 << (*it).second.m_rlcStatusPduSize <<
" decrease " << size);
2626 if (((*it).second.m_rlcStatusPduSize > 0) && (size >= (*it).second.m_rlcStatusPduSize))
2628 (*it).second.m_rlcStatusPduSize = 0;
2630 else if (((*it).second.m_rlcRetransmissionQueueSize > 0) &&
2631 (size >= (*it).second.m_rlcRetransmissionQueueSize))
2633 (*it).second.m_rlcRetransmissionQueueSize = 0;
2635 else if ((*it).second.m_rlcTransmissionQueueSize > 0)
2637 uint32_t rlcOverhead;
2652 if ((*it).second.m_rlcTransmissionQueueSize <= size - rlcOverhead)
2654 (*it).second.m_rlcTransmissionQueueSize = 0;
2658 (*it).second.m_rlcTransmissionQueueSize -= size - rlcOverhead;
2664 NS_LOG_ERROR(
this <<
" Does not find DL RLC Buffer Report of UE " << rnti);
2672 std::map<uint16_t, uint32_t>::iterator it =
m_ceBsrRxed.find(rnti);
2675 NS_LOG_INFO(
this <<
" UE " << rnti <<
" size " << size <<
" BSR " << (*it).second);
2676 if ((*it).second >= size)
2678 (*it).second -= size;
2687 NS_LOG_ERROR(
this <<
" Does not find BSR report info of UE " << rnti);
2694 NS_LOG_FUNCTION(
this <<
" RNTI " << rnti <<
" txMode " << (uint16_t)txMode);
2697 params.m_transmissionMode = txMode;
AttributeValue implementation for Boolean.
static uint32_t BsrId2BufferSize(uint8_t val)
Convert BSR ID to buffer size.
Implements the SCHED SAP and CSCHED SAP for the Channel and QoS Aware Scheduler.
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU list buffer.
FfMacCschedSapProvider * m_cschedSapProvider
Csched SAP provider.
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
void DoSchedUlSrInfoReq(const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters ¶ms)
Sched UL Sr Info Request.
int GetRbgSize(int dlbandwidth)
Get RGB Size.
std::map< uint16_t, CqasFlowPerf_t > m_flowStatsDl
Map of UE statistics (per RNTI basis) in downlink.
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL HARQ process ID.
void DoCschedCellConfigReq(const struct FfMacCschedSapProvider::CschedCellConfigReqParameters ¶ms)
Csched Cell Config Request.
static TypeId GetTypeId()
Get the type ID.
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARQ process timers.
double m_timeWindow
time window
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
~CqaFfMacScheduler() override
Destructor.
void DoSchedDlTriggerReq(const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters ¶ms)
Sched DL RLC Buffer Request.
unsigned int LcActivePerFlow(uint16_t rnti)
LC Active per flow.
void SetLteFfrSapProvider(LteFfrSapProvider *s) override
Set the Provider part of the LteFfrSap that this Scheduler will interact with.
FfMacSchedSapUser * m_schedSapUser
MAC Sched SAP user.
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RLC buffer info.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
void DoSchedUlNoiseInterferenceReq(const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters ¶ms)
Sched UL Noise InterferenceRequest.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
friend class MemberSchedSapProvider< CqaFfMacScheduler >
allow MemberSchedSapProvider<CqaFfMacScheduler> class friend access
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
void DoSchedDlCqiInfoReq(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)
Sched DL CGI Info Request.
FfMacCschedSapUser * m_cschedSapUser
MAC Csched SAP user.
bool HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
void DoCschedLcConfigReq(const struct FfMacCschedSapProvider::CschedLcConfigReqParameters ¶ms)
Csched LC Config Request.
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RLC buffer info.
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
void DoSchedDlRachInfoReq(const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters ¶ms)
Sched DL RACH Info Request.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
std::map< LteFlowId_t, struct LogicalChannelConfigListElement_s > m_ueLogicalChannelsConfigList
Map of UE logical channel config list.
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
void DoCschedUeConfigReq(const struct FfMacCschedSapProvider::CschedUeConfigReqParameters ¶ms)
Csched UE Config Request.
std::vector< struct RachListElement_s > m_rachList
RACH list.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
void DoSchedUlTriggerReq(const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters ¶ms)
Sched UL Trigger Request.
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
void DoDispose() override
Destructor implementation.
void DoSchedDlPagingBufferReq(const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters ¶ms)
Sched DL Paging Buffer Request.
std::map< uint16_t, std::vector< uint16_t > > m_allocationMaps
Map of previous allocated UE per RBG (used to retrieve info from UL-CQI)
void DoSchedUlCqiInfoReq(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)
Sched UL CGI Info Request.
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
UL HARQ process DCI buffer.
void RefreshUlCqiMaps()
Refresh UL CGI maps.
Ptr< LteAmc > m_amc
LTE AMC object.
void DoSchedDlMacBufferReq(const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters ¶ms)
Sched DL MAC Buffer Request.
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
DL HARQ retx buffered.
void DoCschedUeReleaseReq(const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters ¶ms)
Csched UE Release Request.
FfMacSchedSapProvider * GetFfMacSchedSapProvider() override
void SetFfMacCschedSapUser(FfMacCschedSapUser *s) override
set the user part of the FfMacCschedSap that this Scheduler will interact with.
uint32_t m_cqiTimersThreshold
std::map< uint16_t, CqasFlowPerf_t > m_flowStatsUl
Map of UE statistics (per RNTI basis)
FfMacSchedSapProvider * m_schedSapProvider
Sched SAP provider.
FfMacCschedSapProvider * GetFfMacCschedSapProvider() override
void DoSchedUlMacCtrlInfoReq(const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters ¶ms)
Sched UL MAC Control Info Request.
friend class MemberCschedSapProvider< CqaFfMacScheduler >
allow MemberCschedSapProvider<CqaFfMacScheduler> class friend access
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL Sinr.
void RefreshDlCqiMaps()
Refresh DL CGI maps.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
Internal parameters.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process statuses.
CqaFfMacScheduler()
Constructor.
LteFfrSapUser * GetLteFfrSapUser() override
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
void DoSchedDlRlcBufferReq(const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters ¶ms)
Sched DL RLC Buffer Request.
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
std::string m_CqaMetric
CQA metric name.
std::map< uint16_t, uint32_t > m_ceBsrRxed
Map of UE's buffer status reports received.
void DoCschedLcReleaseReq(const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters ¶ms)
Csched LC Release Request.
bool m_harqOn
m_harqOn when false inhibit the HARQ mechanisms (by default active)
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Trans mode config update.
FfMacCschedSapUser class.
virtual void CschedUeConfigUpdateInd(const struct CschedUeConfigUpdateIndParameters ¶ms)=0
CSCHED_UE_UPDATE_IND.
virtual void CschedUeConfigCnf(const struct CschedUeConfigCnfParameters ¶ms)=0
CSCHED_UE_CONFIG_CNF.
virtual void SchedUlConfigInd(const struct SchedUlConfigIndParameters ¶ms)=0
SCHED_UL_CONFIG_IND.
virtual void SchedDlConfigInd(const struct SchedDlConfigIndParameters ¶ms)=0
SCHED_DL_CONFIG_IND.
This abstract base class identifies the interface by means of which the helper object can plug on the...
UlCqiFilter_t m_ulCqiFilter
UL CQI filter.
static double fpS11dot3toDouble(uint16_t val)
Convert from fixed point S11.3 notation to double.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
virtual uint8_t GetTpc(uint16_t rnti)=0
GetTpc.
virtual void ReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)=0
ReportUlCqiInfo.
virtual bool IsUlRbgAvailableForUe(int i, uint16_t rnti)=0
Check if UE can be served on i-th RB in UL.
virtual uint16_t GetMinContinuousUlBandwidth()=0
Get the minimum continuous Ul bandwidth.
virtual bool IsDlRbgAvailableForUe(int i, uint16_t rnti)=0
Check if UE can be served on i-th RB in DL.
virtual void ReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)=0
ReportDlCqiInfo.
virtual std::vector< bool > GetAvailableUlRbg()=0
Get vector of available RB in UL for this Cell.
virtual std::vector< bool > GetAvailableDlRbg()=0
Get vector of available RBG in DL for this Cell.
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Template for the implementation of the LteFfrSapUser as a member of an owner class of type C to which...
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Hold variables of type string.
static uint8_t TxMode2LayerNum(uint8_t txMode)
Transmit mode 2 layer number.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
int RBG_index
RBG index typedef.
std::vector< UlDciListElement_s > UlHarqProcessesDciBuffer_t
UL HARQ process DCI buffer vector.
bool CqaKeyDescComparator(uint16_t key1, uint16_t key2)
CQA key comparator.
std::multimap< HOL_group, std::set< LteFlowId_t >, bool(*)(int, int)> t_map_HOLgroupToUEs
HOL group map typedef.
std::vector< uint8_t > DlHarqProcessesTimer_t
DL HARQ process timer vector typedef.
int HOL_group
HOL group typedef.
std::vector< uint8_t > DlHarqProcessesStatus_t
DL HARQ process status vector typedef.
std::vector< RlcPduList_t > DlHarqRlcPduListBuffer_t
vector of the 8 HARQ processes per UE
std::map< HOL_group, t_map_RBGToCQIsSorted >::iterator t_it_HOLGroupToRBGs
HOL group map iterator typedef.
std::map< CQI_value, LteFlowId_t, bool(*)(uint8_t, uint8_t)> t_map_CQIToUE
CQI value map typedef.
bool CQIValueDescComparator(uint8_t key1, uint8_t key2)
CQI value comparator function.
std::map< HOL_group, t_map_RBGToCQIsSorted > t_map_HOLGroupToRBGs
HOL group map typedef.
std::map< RBG_index, t_map_CQIToUE >::iterator t_it_RBGToCQIsSorted
RBG index map iterator typedef.
static const int CqaType0AllocationRbg[4]
CGA Type 0 Allocation.
std::map< RBG_index, t_map_CQIToUE > t_map_RBGToCQIsSorted
RBG index map typedef.
std::map< HOL_group, std::set< LteFlowId_t > >::iterator t_it_HOLgroupToUEs
HOL group multi map iterator typedef.
std::map< CQI_value, LteFlowId_t, bool(*)(uint8_t, uint8_t)>::iterator t_it_CQIToUE
CQI value map iterator typedef.
uint8_t CQI_value
CQI value typedef.
std::vector< DlDciListElement_s > DlHarqProcessesDciBuffer_t
DL HARQ process DCI buffer vector typedef.
std::vector< uint8_t > UlHarqProcessesStatus_t
UL HARQ process status vector.
bool CqaGroupDescComparator(int key1, int key2)
CGA group comparator function.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
See section 4.3.8 builDataListElement.
std::vector< std::vector< struct RlcPduListElement_s > > m_rlcPduList
RLC PDU list.
struct DlDciListElement_s m_dci
DCI.
See section 4.3.10 buildRARListElement.
CGA Flow Performance structure.
double lastAveragedThroughput
Past average throughput.
double secondLastAveragedThroughput
Second last average throughput.
double targetThroughput
Target throughput.
Time flowStart
flow start time
unsigned int lastTtiBytesTransmitted
Total bytes send by eNB in last tti for this UE.
unsigned long totalBytesTransmitted
Total bytes send by eNb for this UE.
See section 4.3.1 dlDciListElement.
std::vector< uint8_t > m_ndi
New data indicator.
uint8_t m_harqProcess
HARQ process.
uint32_t m_rbBitmap
RB bitmap.
std::vector< uint8_t > m_mcs
MCS.
uint8_t m_resAlloc
The type of resource allocation.
std::vector< uint16_t > m_tbsSize
The TBs size.
std::vector< uint8_t > m_rv
Redundancy version.
uint8_t m_tpc
Tx power control command.
Parameters of the API primitives.
uint16_t m_dlBandwidth
DL bandwidth.
uint16_t m_ulBandwidth
UL bandwidth.
Parameters of the CSCHED_LC_CONFIG_REQ primitive.
Parameters of the CSCHED_LC_RELEASE_REQ primitive.
Parameters of the CSCHED_UE_CONFIG_REQ primitive.
Parameters of the CSCHED_UE_RELEASE_REQ primitive.
Parameters of the CSCHED_UE_CONFIG_CNF primitive.
enum Result_e m_result
result
Parameters of the CSCHED_UE_CONFIG_UPDATE_IND primitive.
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Parameters of the SCHED_DL_MAC_BUFFER_REQ primitive.
Parameters of the SCHED_DL_PAGING_BUFFER_REQ primitive.
Parameters of the SCHED_DL_RACH_INFO_REQ primitive.
Parameters of the API primitives.
Parameters of the SCHED_DL_TRIGGER_REQ primitive.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
Parameters of the SCHED_UL_MAC_CTRL_INFO_REQ primitive.
Parameters of the SCHED_UL_NOISE_INTERFERENCE_REQ primitive.
Parameters of the SCHED_UL_SR_INFO_REQ primitive.
Parameters of the SCHED_UL_TRIGGER_REQ primitive.
Parameters of the API primitives.
uint8_t m_nrOfPdcchOfdmSymbols
number of PDCCH OFDM symbols
std::vector< struct BuildDataListElement_s > m_buildDataList
build data list
std::vector< struct BuildRarListElement_s > m_buildRarList
build rar list
Parameters of the SCHED_UL_CONFIG_IND primitive.
std::vector< struct UlDciListElement_s > m_dciList
DCI list.
See section 4.3.4 logicalChannelConfigListElement.
uint64_t m_eRabGuaranteedBitrateDl
ERAB guaranteed bit rate DL.
See section 4.3.9 rlcPDU_ListElement.
uint8_t m_logicalChannelIdentity
logical channel identity
See section 4.3.2 ulDciListElement.
int8_t m_pdcchPowerOffset
CCH power offset.
int8_t m_tpc
Tx power control command.
uint8_t m_dai
DL assignment index.
uint8_t m_cceIndex
Control Channel Element index.
uint8_t m_ulIndex
UL index.
uint8_t m_ueTxAntennaSelection
UE antenna selection.
bool m_cqiRequest
CQI request.
uint8_t m_freqHopping
freq hopping
uint8_t m_aggrLevel
The aggregation level.
int8_t m_tpc
Tx power control command.
bool m_cqiRequest
CQI request?
qos_rb_and_CQI_assigned_to_lc
uint8_t cqi_value_for_lc
CQI indicator value.
uint16_t resource_block_index
Resource block indexHOL_GROUP_index.