31#include <ns3/boolean.h>
32#include <ns3/integer.h>
35#include <ns3/pointer.h>
36#include <ns3/simulator.h>
37#include <ns3/string.h>
132 : m_cschedSapUser(nullptr),
133 m_schedSapUser(nullptr),
137 m_amc = CreateObject<LteAmc>();
169 TypeId(
"ns3::CqaFfMacScheduler")
173 .AddAttribute(
"CqiTimerThreshold",
174 "The number of TTIs a CQI is valid (default 1000 - 1 sec.)",
177 MakeUintegerChecker<uint32_t>())
178 .AddAttribute(
"CqaMetric",
179 "CqaFfMacScheduler metric type that can be: CqaFf, CqaPf",
183 .AddAttribute(
"HarqEnabled",
184 "Activate/Deactivate the HARQ [by default is active].",
188 .AddAttribute(
"UlGrantMcs",
189 "The MCS of the UL grant, must be [0..15] (default 0)",
192 MakeUintegerChecker<uint8_t>());
250 << (uint16_t)params.m_transmissionMode);
254 m_uesTxMode.insert(std::pair<uint16_t, uint8_t>(params.m_rnti, params.m_transmissionMode));
258 dlHarqPrcStatus.resize(8, 0);
260 std::pair<uint16_t, DlHarqProcessesStatus_t>(params.m_rnti, dlHarqPrcStatus));
262 dlHarqProcessesTimer.resize(8, 0);
264 std::pair<uint16_t, DlHarqProcessesTimer_t>(params.m_rnti, dlHarqProcessesTimer));
268 std::pair<uint16_t, DlHarqProcessesDciBuffer_t>(params.m_rnti, dlHarqdci));
270 dlHarqRlcPdu.resize(2);
271 dlHarqRlcPdu.at(0).resize(8);
272 dlHarqRlcPdu.at(1).resize(8);
274 std::pair<uint16_t, DlHarqRlcPduListBuffer_t>(params.m_rnti, dlHarqRlcPdu));
277 ulHarqPrcStatus.resize(8, 0);
279 std::pair<uint16_t, UlHarqProcessesStatus_t>(params.m_rnti, ulHarqPrcStatus));
283 std::pair<uint16_t, UlHarqProcessesDciBuffer_t>(params.m_rnti, ulHarqdci));
287 (*it).second = params.m_transmissionMode;
297 NS_LOG_FUNCTION(
"LC configuration. Number of LCs:" << params.m_logicalChannelConfigList.size());
301 if (params.m_reconfigureFlag)
303 for (
auto 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 for (
auto lcit = params.m_logicalChannelConfigList.begin();
324 lcit != params.m_logicalChannelConfigList.end();
329 std::pair<LteFlowId_t, LogicalChannelConfigListElement_s>(flowId, *lcit));
333 for (std::size_t i = 0; i < params.m_logicalChannelConfigList.size(); i++)
339 double tbrDlInBytes =
340 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateDl / 8;
341 double tbrUlInBytes =
342 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateUl / 8;
351 m_flowStatsDl.insert(std::pair<uint16_t, CqasFlowPerf_t>(params.m_rnti, flowStatsDl));
359 m_flowStatsUl.insert(std::pair<uint16_t, CqasFlowPerf_t>(params.m_rnti, flowStatsUl));
364 double tbrDlInBytes =
365 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateDl / 8;
366 double tbrUlInBytes =
367 params.m_logicalChannelConfigList.at(i).m_eRabGuaranteedBitrateUl / 8;
380 for (
auto it = params.m_logicalChannelIdentity.begin();
381 it != params.m_logicalChannelIdentity.end();
394 NS_FATAL_ERROR(
"Logical channels cannot be released because it can not be found in the "
395 "list of active LCs");
399 for (std::size_t i = 0; i < params.m_logicalChannelIdentity.size(); i++)
404 if (((*it).first.m_rnti == params.m_rnti) &&
405 ((*it).first.m_lcId == params.m_logicalChannelIdentity.at(i)))
451 if ((*it).first.m_rnti == params.m_rnti)
475 LteFlowId_t flow(params.m_rnti, params.m_logicalChannelIdentity);
482 std::pair<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>(flow,
487 (*it).second = params;
510 for (
int i = 0; i < 4; i++)
524 unsigned int lcActive = 0;
527 if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0) ||
528 ((*it).second.m_rlcRetransmissionQueueSize > 0) ||
529 ((*it).second.m_rlcStatusPduSize > 0)))
533 if ((*it).first.m_rnti > rnti)
554 NS_FATAL_ERROR(
"No Process Id Statusfound for this RNTI " << rnti);
556 uint8_t i = (*it).second;
560 }
while (((*itStat).second.at(i) != 0) && (i != (*it).second));
562 return (*itStat).second.at(i) == 0;
583 NS_FATAL_ERROR(
"No Process Id Statusfound for this RNTI " << rnti);
585 uint8_t i = (*it).second;
589 }
while (((*itStat).second.at(i) != 0) && (i != (*it).second));
590 if ((*itStat).second.at(i) == 0)
593 (*itStat).second.at(i) = 1;
598 << rnti <<
" check before update with HarqProcessAvailability");
601 return ((*it).second);
618 NS_LOG_DEBUG(
this <<
" Reset HARQ proc " << i <<
" for RNTI " << (*itTimers).first);
623 << (*itTimers).first);
625 (*itStat).second.at(i) = 0;
626 (*itTimers).second.at(i) = 0;
630 (*itTimers).second.at(i)++;
640 NS_LOG_FUNCTION(
this <<
" Frame no. " << (params.m_sfnSf >> 4) <<
" subframe no. "
641 << (0xF & params.m_sfnSf));
651 std::map<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>
652 allocationMapPerRntiPerLCId;
653 allocationMapPerRntiPerLCId.clear();
657 int grouping_parameter = 1000;
658 double tolerance = 1.1;
659 std::map<LteFlowId_t, int> UEtoHOL;
660 std::vector<bool> rbgMap;
661 uint16_t rbgAllocatedNum = 0;
662 std::set<uint16_t> rntiAllocated;
666 for (
auto it = rbgMap.begin(); it != rbgMap.end(); it++)
681 (*itProcId).second = ((*itProcId).second + 1) %
HARQ_PROC_NUM;
685 std::vector<bool> ulRbMap;
688 uint8_t maxContinuousUlBandwidth = 0;
689 uint8_t tmpMinBandwidth = 0;
690 uint16_t ffrRbStartOffset = 0;
691 uint16_t tmpFfrRbStartOffset = 0;
694 for (
auto it = ulRbMap.begin(); it != ulRbMap.end(); it++)
698 if (tmpMinBandwidth > maxContinuousUlBandwidth)
700 maxContinuousUlBandwidth = tmpMinBandwidth;
701 ffrRbStartOffset = tmpFfrRbStartOffset;
707 if (tmpMinBandwidth == 0)
709 tmpFfrRbStartOffset = index;
716 if (tmpMinBandwidth > maxContinuousUlBandwidth)
718 maxContinuousUlBandwidth = tmpMinBandwidth;
719 ffrRbStartOffset = tmpFfrRbStartOffset;
723 uint16_t rbStart = 0;
724 rbStart = ffrRbStartOffset;
728 (*itRach).m_estimatedSize,
729 " Default UL Grant MCS does not allow to send RACH messages");
731 newRar.
m_rnti = (*itRach).m_rnti;
738 uint16_t tbSizeBits = 0;
740 while ((tbSizeBits < (*itRach).m_estimatedSize) &&
741 (rbStart + rbLen < (ffrRbStartOffset + maxContinuousUlBandwidth)))
746 if (tbSizeBits < (*itRach).m_estimatedSize)
758 NS_LOG_INFO(
this <<
" UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart "
759 << rbStart <<
" rbLen " << rbLen <<
" MCS " <<
m_ulGrantMcs <<
" tbSize "
761 for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
794 harqId = (*itProcId).second;
798 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
801 (*itDci).second.at(harqId) = uldci;
804 rbStart = rbStart + rbLen;
814 if (!params.m_dlInfoList.empty())
818 params.m_dlInfoList.begin(),
819 params.m_dlInfoList.end());
824 if (!params.m_dlInfoList.empty())
834 std::vector<DlInfoListElement_s> dlInfoListUntxed;
838 if (itRnti != rntiAllocated.end())
844 std::vector<bool> retx;
845 NS_LOG_INFO(
this <<
" Processing DLHARQ feedback");
850 retx.push_back(
false);
859 if (retx.at(0) || retx.at(1))
864 NS_LOG_INFO(
this <<
" HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId);
873 if (dci.
m_rv.size() == 1)
885 NS_LOG_INFO(
"Maximum number of retransmissions reached -> drop process");
889 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
892 (*it).second.at(harqId) = 0;
896 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
899 for (std::size_t k = 0; k < (*itRlcPdu).second.size(); k++)
901 (*itRlcPdu).second.at(k).at(harqId).clear();
907 std::vector<int> dciRbg;
910 for (
int j = 0; j < 32; j++)
920 for (std::size_t j = 0; j < dciRbg.size(); j++)
922 if (rbgMap.at(dciRbg.at(j)))
932 for (std::size_t j = 0; j < dciRbg.size(); j++)
934 rbgMap.at(dciRbg.at(j)) =
true;
935 NS_LOG_INFO(
"RBG " << dciRbg.at(j) <<
" assigned");
939 NS_LOG_INFO(
this <<
" Send retx in the same RBGs");
945 uint8_t rbgId = (dciRbg.at(dciRbg.size() - 1) + 1) % numberOfRBGs;
946 uint8_t startRbg = dciRbg.at(dciRbg.size() - 1);
947 std::vector<bool> rbgMapCopy = rbgMap;
948 while ((j < dciRbg.size()) && (startRbg != rbgId))
950 if (!rbgMapCopy.at(rbgId))
952 rbgMapCopy.at(rbgId) =
true;
953 dciRbg.at(j) = rbgId;
956 rbgId = (rbgId + 1) % numberOfRBGs;
958 if (j == dciRbg.size())
962 for (std::size_t k = 0; k < dciRbg.size(); k++)
964 rbgMask = rbgMask + (0x1 << dciRbg.at(k));
969 NS_LOG_INFO(
this <<
" Move retx in RBGs " << dciRbg.size());
975 NS_LOG_INFO(
this <<
" No resource for this retx -> buffer it");
983 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
985 for (std::size_t j = 0; j < nLayers; j++)
989 if (j >= dci.
m_ndi.size())
992 dci.
m_ndi.push_back(0);
993 dci.
m_rv.push_back(0);
994 dci.
m_mcs.push_back(0);
997 <<
" no txed (MIMO transition)");
1001 dci.
m_ndi.at(j) = 0;
1003 (*itHarq).second.at(harqId).m_rv.at(j)++;
1004 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" RV "
1005 << (uint16_t)dci.
m_rv.at(j));
1011 dci.
m_ndi.at(j) = 0;
1013 dci.
m_mcs.at(j) = 0;
1015 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" no retx");
1018 for (std::size_t k = 0; k < (*itRlcPdu).second.at(0).at(dci.
m_harqProcess).size(); k++)
1020 std::vector<RlcPduListElement_s> rlcPduListPerLc;
1021 for (std::size_t j = 0; j < nLayers; j++)
1025 if (j < dci.
m_ndi.size())
1027 NS_LOG_INFO(
" layer " << (uint16_t)j <<
" tb size "
1029 rlcPduListPerLc.push_back(
1042 .m_logicalChannelIdentity;
1044 rlcPduListPerLc.push_back(emptyElement);
1048 if (!rlcPduListPerLc.empty())
1055 (*itHarq).second.at(harqId).
m_rv = dci.
m_rv;
1060 NS_FATAL_ERROR(
"Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
1062 (*itHarqTimer).second.at(harqId) = 0;
1064 rntiAllocated.insert(rnti);
1081 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1084 for (std::size_t k = 0; k < (*itRlcPdu).second.size(); k++)
1093 if (rbgAllocatedNum == numberOfRBGs)
1105 itLogicalChannels++)
1107 auto itRnti = rntiAllocated.find(itLogicalChannels->first.m_rnti);
1108 if ((itRnti != rntiAllocated.end()) ||
1112 if (itRnti != rntiAllocated.end())
1115 << (uint16_t)(itLogicalChannels->first.m_rnti));
1120 << (uint16_t)(itLogicalChannels->first.m_rnti));
1125 auto itRlcBufferReq =
m_rlcBufferReq.find(itLogicalChannels->first);
1134 if (itRlcBufferReq->second.m_rlcRetransmissionQueueSize > 0)
1136 delay = itRlcBufferReq->second.m_rlcRetransmissionHolDelay;
1137 group = delay / grouping_parameter;
1139 else if (itRlcBufferReq->second.m_rlcTransmissionQueueSize > 0)
1141 delay = itRlcBufferReq->second.m_rlcTransmissionQueueHolDelay;
1142 group = delay / grouping_parameter;
1149 UEtoHOL.insert(std::pair<LteFlowId_t, int>(itLogicalChannels->first, delay));
1151 if (itLogicalChannels->second.m_qosBearerType ==
1154 if (map_nonGBRHOLgroupToUE.count(group) == 0)
1156 std::set<LteFlowId_t> v;
1157 v.insert(itRlcBufferReq->first);
1158 map_nonGBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group, v));
1162 map_nonGBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1165 else if (itLogicalChannels->second.m_qosBearerType ==
1167 itLogicalChannels->second.m_qosBearerType ==
1170 if (map_GBRHOLgroupToUE.count(group) == 0)
1172 std::set<LteFlowId_t> v;
1173 v.insert(itRlcBufferReq->first);
1174 map_GBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group, v));
1178 map_GBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1185 std::map<LteFlowId_t, int> UeToAmountOfDataToTransfer;
1187 std::map<LteFlowId_t, int> UeToAmountOfAssignedResources;
1190 std::map<uint16_t, uint8_t> sbCqiSum;
1197 auto itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1200 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1205 for (
int k = 0; k < numberOfRBGs; k++)
1207 for (uint8_t j = 0; j < nLayer; j++)
1215 cqiSum += (*itCqi).second.m_higherLayerSelected.at(k).m_sbCqi.at(j);
1222 NS_LOG_INFO(
"Skip this flow, CQI==0, rnti:" << (*itrbr).first.m_rnti);
1227 int amountOfDataToTransfer =
1228 8 * ((int)
m_rlcBufferReq.find(flowId)->second.m_rlcRetransmissionQueueSize +
1229 (int)
m_rlcBufferReq.find(flowId)->second.m_rlcTransmissionQueueSize);
1231 UeToAmountOfDataToTransfer.insert(
1232 std::pair<LteFlowId_t, int>(flowId, amountOfDataToTransfer));
1233 UeToAmountOfAssignedResources.insert(std::pair<LteFlowId_t, int>(flowId, 0));
1236 for (
int i = 0; i < numberOfRBGs; i++)
1239 auto itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1242 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1245 std::vector<uint8_t> sbCqis;
1248 sbCqis = std::vector<uint8_t>(nLayer, 1);
1252 sbCqis = (*itCqi).second.m_higherLayerSelected.at(i).m_sbCqi;
1255 uint8_t cqi1 = sbCqis.at(0);
1257 if (sbCqis.size() > 1)
1259 cqi2 = sbCqis.at(1);
1266 for (uint8_t k = 0; k < nLayer; k++)
1268 if (sbCqis.size() > k)
1270 sbCqi = sbCqis.at(k);
1282 sbCqiSum.insert(std::pair<uint16_t, uint8_t>((*itrbr).first.m_rnti, sum));
1286 std::set<int> availableRBGs;
1287 for (
int i = 0; i < numberOfRBGs; i++)
1291 availableRBGs.insert(i);
1295 auto itGBRgroups = map_GBRHOLgroupToUE.begin();
1296 auto itnonGBRgroups = map_nonGBRHOLgroupToUE.begin();
1300 while (!availableRBGs.empty())
1302 if (UeToAmountOfDataToTransfer.empty())
1304 NS_LOG_INFO(
"No UEs to be scheduled (no data or CQI==0),");
1307 std::set<LteFlowId_t> vUEs;
1310 if (itGBRgroups != map_GBRHOLgroupToUE.end())
1312 itCurrentGroup = itGBRgroups;
1315 else if (itnonGBRgroups !=
1316 map_nonGBRHOLgroupToUE
1320 itCurrentGroup = itnonGBRgroups;
1325 NS_LOG_INFO(
"Available RBGs:" << availableRBGs.size() <<
"but no users");
1329 while (!availableRBGs.empty() && !itCurrentGroup->second.empty())
1331 bool currentRBchecked =
false;
1332 int currentRB = *(availableRBGs.begin());
1333 std::map<LteFlowId_t, CQI_value> UeToCQIValue;
1334 std::map<LteFlowId_t, double> UeToCoitaMetric;
1335 std::map<LteFlowId_t, bool> UeHasReachedGBR;
1336 double maximumValueMetric = 0;
1338 UeToCQIValue.clear();
1339 UeToCoitaMetric.clear();
1343 for (
auto it = itCurrentGroup->second.begin(); it != itCurrentGroup->second.end(); it++)
1346 uint8_t cqi_value = 1;
1347 double coita_metric = 1;
1348 double coita_sum = 0;
1350 uint8_t worstCQIAmongRBGsAllocatedForThisUser = 15;
1351 int numberOfRBGAllocatedForThisUser = 0;
1365 currentRBchecked =
true;
1369 (*itStats).second.targetThroughput / (*itStats).second.lastAveragedThroughput;
1370 if (tbr_weight < 1.0)
1377 for (
auto it = availableRBGs.begin(); it != availableRBGs.end(); it++)
1382 (itRntiCQIsMap->second.m_higherLayerSelected.at(*it).m_sbCqi.at(0));
1387 if (*it == currentRB)
1393 catch (std::out_of_range&)
1397 <<
" rnti:" << flowId.
m_rnti
1398 <<
" at subband:" << currentRB);
1403 coita_metric = cqi_value / coita_sum;
1404 UeToCQIValue.insert(std::pair<LteFlowId_t, CQI_value>(flowId, cqi_value));
1405 UeToCoitaMetric.insert(std::pair<LteFlowId_t, double>(flowId, coita_metric));
1408 if (allocationMapPerRntiPerLCId.find(flowId.
m_rnti) ==
1409 allocationMapPerRntiPerLCId.end())
1411 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1415 numberOfRBGAllocatedForThisUser =
1416 (allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.size());
1419 allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.begin();
1420 itRBG != allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.end();
1430 if (cqi_value < worstCQIAmongRBGsAllocatedForThisUser)
1432 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1436 int mcsForThisUser =
m_amc->GetMcsFromCqi(worstCQIAmongRBGsAllocatedForThisUser);
1438 m_amc->GetDlTbSizeFromMcs(mcsForThisUser,
1439 (numberOfRBGAllocatedForThisUser + 1) * rbgSize) /
1443 double achievableRate =
1444 ((
m_amc->GetDlTbSizeFromMcs(mcsForThisUser, rbgSize) / 8) / 0.001);
1445 double pf_weight = achievableRate / (*itStats).second.secondLastAveragedThroughput;
1447 UeToAmountOfAssignedResources.find(flowId)->second = 8 * tbSize;
1451 if (UeToAmountOfDataToTransfer.find(flowId)->second -
1452 UeToAmountOfAssignedResources.find(flowId)->second <
1455 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1458 double bitRateWithNewRBG = 0;
1470 bitRateWithNewRBG = (1.0 /
m_timeWindow) * (
double)(tbSize * 1000);
1475 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
true));
1479 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1482 int hol = UEtoHOL.find(flowId)->second;
1491 metric = coita_metric * tbr_weight * hol;
1495 metric = tbr_weight * pf_weight * hol;
1502 if (metric >= maximumValueMetric)
1504 maximumValueMetric = metric;
1505 userWithMaximumMetric = flowId;
1509 if (!currentRBchecked)
1512 availableRBGs.erase(currentRB);
1520 auto itMap = allocationMapPerRntiPerLCId.find(userWithMaximumMetric.
m_rnti);
1522 if (itMap == allocationMapPerRntiPerLCId.end())
1524 std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc> tempMap;
1526 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1528 allocationMapPerRntiPerLCId.insert(
1529 std::pair<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>(
1530 userWithMaximumMetric.
m_rnti,
1535 itMap->second.insert(
1536 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1541 availableRBGs.erase(currentRB);
1543 if (UeToAmountOfDataToTransfer.find(userWithMaximumMetric)->second <=
1544 UeToAmountOfAssignedResources.find(userWithMaximumMetric)->second * tolerance)
1547 itCurrentGroup->second.erase(userWithMaximumMetric);
1556 (*itStats).second.lastTtiBytesTransmitted = 0;
1562 auto itMap = allocationMapPerRntiPerLCId.begin();
1563 std::map<uint16_t, double> m_rnti_per_ratio;
1565 while (itMap != allocationMapPerRntiPerLCId.end())
1569 newEl.
m_rnti = (*itMap).first;
1573 std::vector<RlcPduListElement_s> newRlcPduLe;
1574 newDci.
m_rnti = (*itMap).first;
1582 uint16_t RgbPerRnti = (*itMap).second.size();
1583 double doubleRBgPerRnti = RgbPerRnti;
1584 double doubleRbgNum = numberOfRBGs;
1585 double rrRatio = doubleRBgPerRnti / doubleRbgNum;
1586 m_rnti_per_ratio.insert(std::pair<uint16_t, double>((*itMap).first, rrRatio));
1587 uint8_t worstCqi = 15;
1590 for (
auto it = (*itMap).second.begin(); it != (*itMap).second.end(); it++)
1592 if (it->second.cqi_value_for_lc < worstCqi)
1594 worstCqi = it->second.cqi_value_for_lc;
1598 newDci.
m_mcs.push_back(
m_amc->GetMcsFromCqi(worstCqi));
1599 int tbSize = (
m_amc->GetDlTbSizeFromMcs(newDci.
m_mcs.at(0), RgbPerRnti * rbgSize) /
1605 for (
auto itRBGsPerRNTI = (*itMap).second.begin(); itRBGsPerRNTI != (*itMap).second.end();
1608 rbgMask = rbgMask + (0x1 << itRBGsPerRNTI->second.resource_block_index);
1615 if (((*itBufReq).first.m_rnti == (*itMap).first) &&
1616 (((*itBufReq).second.m_rlcTransmissionQueueSize > 0) ||
1617 ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0) ||
1618 ((*itBufReq).second.m_rlcStatusPduSize > 0)))
1620 std::vector<RlcPduListElement_s> newRlcPduLe;
1626 newRlcEl.
m_size = tbSize / lcActives;
1629 newRlcPduLe.push_back(newRlcEl);
1639 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1643 (*itRlcPdu).second.at(j).at(newDci.
m_harqProcess).push_back(newRlcEl);
1648 if ((*itBufReq).first.m_rnti > (*itMap).first)
1655 newDci.
m_ndi.push_back(1);
1656 newDci.
m_rv.push_back(0);
1661 newEl.
m_dci = newDci;
1669 NS_FATAL_ERROR(
"Unable to find RNTI entry in DCI HARQ buffer for RNTI "
1689 (*it).second.lastTtiBytesTransmitted = tbSize;
1704 if (allocationMapPerRntiPerLCId.find(itStats->first) != allocationMapPerRntiPerLCId.end())
1706 (*itStats).second.secondLastAveragedThroughput =
1707 ((1.0 - (1 /
m_timeWindow)) * (*itStats).second.secondLastAveragedThroughput) +
1711 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
1714 (*itStats).second.lastAveragedThroughput =
1715 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
1716 ((1.0 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1717 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
1718 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
1719 (*itStats).second.lastTtiBytesTransmitted = 0;
1724 int count_allocated_resource_blocks = 0;
1725 for (
auto itMap = allocationMapPerRntiPerLCId.begin();
1726 itMap != allocationMapPerRntiPerLCId.end();
1729 count_allocated_resource_blocks += itMap->second.size();
1731 NS_LOG_INFO(
this <<
" Allocated RBs:" << count_allocated_resource_blocks);
1750 for (
unsigned int i = 0; i < params.m_cqiList.size(); i++)
1756 uint16_t rnti = params.m_cqiList.at(i).m_rnti;
1763 params.m_cqiList.at(i).m_wbCqi.at(0)));
1770 (*it).second = params.m_cqiList.at(i).m_wbCqi.at(0);
1779 uint16_t rnti = params.m_cqiList.at(i).m_rnti;
1785 std::pair<uint16_t, SbMeasResult_s>(rnti,
1786 params.m_cqiList.at(i).m_sbMeasResult));
1792 (*it).second = params.m_cqiList.at(i).m_sbMeasResult;
1807 auto itCqi =
m_ueCqi.find(rnti);
1817 unsigned int sinrNum = 0;
1820 double sinr = (*itCqi).second.at(i);
1827 double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
1829 (*itCqi).second.at(rb) = estimatedSinr;
1830 return (estimatedSinr);
1838 NS_LOG_FUNCTION(
this <<
" UL - Frame no. " << (params.m_sfnSf >> 4) <<
" subframe no. "
1839 << (0xF & params.m_sfnSf) <<
" size " << params.m_ulInfoList.size());
1846 std::vector<bool> rbMap;
1847 uint16_t rbAllocatedNum = 0;
1848 std::set<uint16_t> rntiAllocated;
1849 std::vector<uint16_t> rbgAllocationMap;
1860 for (
auto it = rbMap.begin(); it != rbMap.end(); it++)
1874 if (rbgAllocationMap.at(i) != 0)
1884 for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++)
1889 uint16_t rnti = params.m_ulInfoList.at(i).m_rnti;
1893 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1896 NS_LOG_INFO(
this <<
" UL-HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId
1897 <<
" i " << i <<
" size " << params.m_ulInfoList.size());
1901 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1908 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1910 if ((*itStat).second.at(harqId) >= 3)
1912 NS_LOG_INFO(
"Max number of retransmissions reached (UL)-> drop process");
1931 rbgAllocationMap.at(j) = dci.
m_rnti;
1937 << (*itStat).second.at(harqId) + 1);
1941 NS_LOG_INFO(
"Cannot allocate retx due to RACH allocations for UE " << rnti);
1946 (*itStat).second.at((*itProcId).second) = (*itStat).second.at(harqId) + 1;
1947 (*itStat).second.at(harqId) = 0;
1948 (*itHarq).second.at((*itProcId).second) = dci;
1950 rntiAllocated.insert(dci.
m_rnti);
1954 NS_LOG_INFO(
this <<
" HARQ-ACK feedback from RNTI "
1955 << params.m_ulInfoList.at(i).m_rnti);
1960 std::map<uint16_t, uint32_t>::iterator it;
1965 auto itRnti = rntiAllocated.find((*it).first);
1967 if (((*it).second > 0) && (itRnti == rntiAllocated.end()))
1978 std::pair<uint16_t, std::vector<uint16_t>>(params.m_sfnSf, rbgAllocationMap));
1987 uint16_t tempRbPerFlow = (ffrUlBandwidth) / (nflows + rntiAllocated.size());
1988 uint16_t rbPerFlow =
1989 (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuousUlBandwidth : tempRbPerFlow;
1996 int rbAllocated = 0;
2019 auto itRnti = rntiAllocated.find((*it).first);
2020 if ((itRnti != rntiAllocated.end()) || ((*it).second == 0))
2023 NS_LOG_DEBUG(
this <<
" UE already allocated in HARQ -> discarded, RNTI "
2047 uldci.
m_rnti = (*it).first;
2049 bool allocated =
false;
2050 NS_LOG_INFO(
this <<
" RB Allocated " << rbAllocated <<
" rbPerFlow " << rbPerFlow
2051 <<
" flows " << nflows);
2057 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2072 NS_LOG_INFO(
this <<
"RNTI: " << (*it).first <<
" RB Allocated " << rbAllocated
2073 <<
" rbPerFlow " << rbPerFlow <<
" flows " << nflows);
2076 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2080 rbgAllocationMap.at(j) = (*it).first;
2082 rbAllocated += rbPerFlow;
2112 auto itCqi =
m_ueCqi.find((*it).first);
2123 "CQI of RNTI = " << (*it).first <<
" has expired");
2124 double minSinr = (*itCqi).second.at(uldci.
m_rbStart);
2131 double sinr = (*itCqi).second.at(i);
2143 double s = log2(1 + (std::pow(10, minSinr / 10) / ((-std::log(5.0 * 0.00005)) / 1.5)));
2144 cqi =
m_amc->GetCqiFromSpectralEfficiency(s);
2157 rbgAllocationMap.at(i) = 0;
2188 harqId = (*itProcId).second;
2192 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
2195 (*itDci).second.at(harqId) = uldci;
2200 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
2203 (*itStat).second.at(harqId) = 0;
2206 NS_LOG_INFO(
this <<
" UE Allocation RNTI " << (*it).first <<
" startPRB "
2208 <<
" CQI " << cqi <<
" MCS " << (
uint32_t)uldci.
m_mcs <<
" TBsize "
2209 << uldci.
m_tbSize <<
" RbAlloc " << rbAllocated <<
" harqId "
2210 << (uint16_t)harqId);
2216 (*itStats).second.lastTtiBytesTransmitted = uldci.
m_tbSize;
2220 NS_LOG_DEBUG(
this <<
" No Stats for this allocated UE");
2235 }
while (((*it).first !=
m_nextRntiUl) && (rbPerFlow != 0));
2241 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
2244 (*itStats).second.lastAveragedThroughput =
2245 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
2246 ((1.0 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
2247 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
2248 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
2249 (*itStats).second.lastTtiBytesTransmitted = 0;
2252 std::pair<uint16_t, std::vector<uint16_t>>(params.m_sfnSf, rbgAllocationMap));
2276 for (
unsigned int i = 0; i < params.m_macCeList.size(); i++)
2288 for (uint8_t lcg = 0; lcg < 4; ++lcg)
2290 uint8_t bsrId = params.m_macCeList.at(i).m_macCeValue.m_bufferStatus.at(lcg);
2294 uint16_t rnti = params.m_macCeList.at(i).m_rnti;
2295 NS_LOG_LOGIC(
this <<
"RNTI=" << rnti <<
" buffer=" << buffer);
2300 m_ceBsrRxed.insert(std::pair<uint16_t, uint32_t>(rnti, buffer));
2305 (*it).second = buffer;
2339 switch (params.m_ulCqi.m_type)
2342 NS_LOG_DEBUG(
this <<
" Collect PUSCH CQIs of Frame no. " << (params.m_sfnSf >> 4)
2343 <<
" subframe no. " << (0xF & params.m_sfnSf));
2349 for (
uint32_t i = 0; i < (*itMap).second.size(); i++)
2353 auto itCqi =
m_ueCqi.find((*itMap).second.at(i));
2357 std::vector<double> newCqi;
2362 newCqi.push_back(sinr);
2371 std::pair<uint16_t, std::vector<double>>((*itMap).second.at(i), newCqi));
2379 (*itCqi).second.at(i) = sinr;
2380 NS_LOG_DEBUG(
this <<
" RNTI " << (*itMap).second.at(i) <<
" RB " << i <<
" SINR "
2392 NS_LOG_DEBUG(
this <<
" Collect SRS CQIs of Frame no. " << (params.m_sfnSf >> 4)
2393 <<
" subframe no. " << (0xF & params.m_sfnSf));
2396 NS_ASSERT(!params.m_vendorSpecificList.empty());
2397 for (std::size_t i = 0; i < params.m_vendorSpecificList.size(); i++)
2402 DynamicCast<SrsCqiRntiVsp>(params.m_vendorSpecificList.at(i).m_value);
2403 rnti = vsp->GetRnti();
2406 auto itCqi =
m_ueCqi.find(rnti);
2410 std::vector<double> newCqi;
2414 newCqi.push_back(sinr);
2415 NS_LOG_INFO(
this <<
" RNTI " << rnti <<
" new SRS-CQI for RB " << j <<
" value "
2418 m_ueCqi.insert(std::pair<uint16_t, std::vector<double>>(rnti, newCqi));
2428 (*itCqi).second.at(j) = sinr;
2429 NS_LOG_INFO(
this <<
" RNTI " << rnti <<
" update SRS-CQI for RB " << j <<
" value "
2441 NS_FATAL_ERROR(
"PfFfMacScheduler supports only PUSCH and SRS UL-CQIs");
2456 NS_LOG_INFO(
this <<
" P10-CQI for user " << (*itP10).first <<
" is "
2458 if ((*itP10).second == 0)
2463 " Does not find CQI report for user " << (*itP10).first);
2464 NS_LOG_INFO(
this <<
" P10-CQI expired for user " << (*itP10).first);
2481 NS_LOG_INFO(
this <<
" A30-CQI for user " << (*itA30).first <<
" is "
2483 if ((*itA30).second == 0)
2488 " Does not find CQI report for user " << (*itA30).first);
2489 NS_LOG_INFO(
this <<
" A30-CQI expired for user " << (*itA30).first);
2510 NS_LOG_INFO(
this <<
" UL-CQI for user " << (*itUl).first <<
" is "
2512 if ((*itUl).second == 0)
2515 auto itMap =
m_ueCqi.find((*itUl).first);
2517 " Does not find CQI report for user " << (*itUl).first);
2518 NS_LOG_INFO(
this <<
" UL-CQI exired for user " << (*itUl).first);
2519 (*itMap).second.clear();
2540 NS_LOG_INFO(
this <<
" UE " << rnti <<
" LC " << (uint16_t)lcid <<
" txqueue "
2541 << (*it).second.m_rlcTransmissionQueueSize <<
" retxqueue "
2542 << (*it).second.m_rlcRetransmissionQueueSize <<
" status "
2543 << (*it).second.m_rlcStatusPduSize <<
" decrease " << size);
2546 if (((*it).second.m_rlcStatusPduSize > 0) && (size >= (*it).second.m_rlcStatusPduSize))
2548 (*it).second.m_rlcStatusPduSize = 0;
2550 else if (((*it).second.m_rlcRetransmissionQueueSize > 0) &&
2551 (size >= (*it).second.m_rlcRetransmissionQueueSize))
2553 (*it).second.m_rlcRetransmissionQueueSize = 0;
2555 else if ((*it).second.m_rlcTransmissionQueueSize > 0)
2572 if ((*it).second.m_rlcTransmissionQueueSize <= size - rlcOverhead)
2574 (*it).second.m_rlcTransmissionQueueSize = 0;
2578 (*it).second.m_rlcTransmissionQueueSize -= size - rlcOverhead;
2584 NS_LOG_ERROR(
this <<
" Does not find DL RLC Buffer Report of UE " << rnti);
2595 NS_LOG_INFO(
this <<
" UE " << rnti <<
" size " << size <<
" BSR " << (*it).second);
2596 if ((*it).second >= size)
2598 (*it).second -= size;
2607 NS_LOG_ERROR(
this <<
" Does not find BSR report info of UE " << rnti);
2614 NS_LOG_FUNCTION(
this <<
" RNTI " << rnti <<
" txMode " << (uint16_t)txMode);
2616 params.m_rnti = rnti;
2617 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.
int GetRbgSize(int dlbandwidth)
Get RGB Size.
void DoSchedUlTriggerReq(const FfMacSchedSapProvider::SchedUlTriggerReqParameters ¶ms)
Sched UL Trigger Request.
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.
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.
void DoSchedDlPagingBufferReq(const FfMacSchedSapProvider::SchedDlPagingBufferReqParameters ¶ms)
Sched DL Paging Buffer Request.
~CqaFfMacScheduler() override
Destructor.
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 DoSchedDlTriggerReq(const FfMacSchedSapProvider::SchedDlTriggerReqParameters ¶ms)
Sched DL RLC Buffer Request.
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.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
void DoSchedDlRlcBufferReq(const FfMacSchedSapProvider::SchedDlRlcBufferReqParameters ¶ms)
Sched DL RLC Buffer Request.
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.
std::vector< RachListElement_s > m_rachList
RACH list.
void DoSchedDlMacBufferReq(const FfMacSchedSapProvider::SchedDlMacBufferReqParameters ¶ms)
Sched DL MAC Buffer Request.
void DoCschedLcReleaseReq(const FfMacCschedSapProvider::CschedLcReleaseReqParameters ¶ms)
Csched LC Release Request.
void DoSchedUlMacCtrlInfoReq(const FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters ¶ms)
Sched UL MAC Control Info Request.
void DoCschedLcConfigReq(const FfMacCschedSapProvider::CschedLcConfigReqParameters ¶ms)
Csched LC Config 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 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 DoSchedUlNoiseInterferenceReq(const FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters ¶ms)
Sched UL Noise InterferenceRequest.
void DoSchedUlCqiInfoReq(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)
Sched UL CGI Info Request.
std::map< LteFlowId_t, LogicalChannelConfigListElement_s > m_ueLogicalChannelsConfigList
Map of UE logical channel config list.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
void DoDispose() override
Destructor implementation.
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 DoSchedDlRachInfoReq(const FfMacSchedSapProvider::SchedDlRachInfoReqParameters ¶ms)
Sched DL RACH 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 DoSchedDlCqiInfoReq(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)
Sched DL CGI Info Request.
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
DL HARQ retx buffered.
void DoCschedUeReleaseReq(const 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 DoCschedCellConfigReq(const FfMacCschedSapProvider::CschedCellConfigReqParameters ¶ms)
Csched Cell Config 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.
void DoCschedUeConfigReq(const FfMacCschedSapProvider::CschedUeConfigReqParameters ¶ms)
Csched UE Config Request.
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.
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.
bool m_harqOn
m_harqOn when false inhibit the HARQ mechanisms (by default active)
void DoSchedUlSrInfoReq(const FfMacSchedSapProvider::SchedUlSrInfoReqParameters ¶ms)
Sched UL Sr Info Request.
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Trans mode config update.
FfMacCschedSapUser class.
virtual void CschedUeConfigCnf(const CschedUeConfigCnfParameters ¶ms)=0
CSCHED_UE_CONFIG_CNF.
virtual void CschedUeConfigUpdateInd(const CschedUeConfigUpdateIndParameters ¶ms)=0
CSCHED_UE_UPDATE_IND.
virtual void SchedUlConfigInd(const SchedUlConfigIndParameters ¶ms)=0
SCHED_UL_CONFIG_IND.
virtual void SchedDlConfigInd(const 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 std::vector< bool > GetAvailableUlRbg()=0
Get vector of available RB in UL for this Cell.
virtual void ReportUlCqiInfo(const 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 void ReportDlCqiInfo(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)=0
ReportDlCqiInfo.
virtual std::vector< bool > GetAvailableDlRbg()=0
Get vector of available RBG in DL for this Cell.
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.
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)
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
#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.
bool CqaKeyDescComparator(uint16_t key1, uint16_t key2)
CQA key comparator.
constexpr double NO_SINR
Value for SINR outside the range defined by FF-API, used to indicate that there is no CQI for this el...
std::map< CQI_value, LteFlowId_t, bool(*)(uint8_t, uint8_t)>::iterator t_it_CQIToUE
CQI value map iterator typedef.
std::multimap< HOL_group, std::set< LteFlowId_t >, bool(*)(int, int)> t_map_HOLgroupToUEs
HOL group map typedef.
int HOL_group
HOL group typedef.
std::vector< UlDciListElement_s > UlHarqProcessesDciBuffer_t
UL HARQ process DCI buffer vector.
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::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.
constexpr uint32_t HARQ_DL_TIMEOUT
HARQ DL timeout.
std::map< RBG_index, t_map_CQIToUE >::iterator t_it_RBGToCQIsSorted
RBG index map iterator typedef.
std::map< HOL_group, t_map_RBGToCQIsSorted > t_map_HOLGroupToRBGs
HOL group map typedef.
constexpr uint32_t HARQ_PROC_NUM
Number of HARQ processes.
std::vector< DlDciListElement_s > DlHarqProcessesDciBuffer_t
DL HARQ process DCI buffer vector.
std::map< HOL_group, std::set< LteFlowId_t > >::iterator t_it_HOLgroupToUEs
HOL group multi map iterator typedef.
static const int CqaType0AllocationRbg[4]
CGA Type 0 Allocation.
std::vector< uint8_t > UlHarqProcessesStatus_t
UL HARQ process status vector.
std::vector< uint8_t > DlHarqProcessesTimer_t
DL HARQ process timer vector.
std::map< RBG_index, t_map_CQIToUE > t_map_RBGToCQIsSorted
RBG index map typedef.
uint8_t CQI_value
CQI value typedef.
std::vector< uint8_t > DlHarqProcessesStatus_t
DL HARQ process status vector.
bool CqaGroupDescComparator(int key1, int key2)
CGA group comparator function.
See section 4.3.8 buildDataListElement.
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.
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.
std::vector< BuildDataListElement_s > m_buildDataList
build data list
std::vector< BuildRarListElement_s > m_buildRarList
build rar list
uint8_t m_nrOfPdcchOfdmSymbols
number of PDCCH OFDM symbols
Parameters of the SCHED_UL_CONFIG_IND primitive.
std::vector< 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.