599 NS_LOG_FUNCTION(
this <<
" Frame no. " << (params.m_sfnSf >> 4) <<
" subframe no. "
600 << (0xF & params.m_sfnSf));
610 std::map<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>
611 allocationMapPerRntiPerLCId;
612 allocationMapPerRntiPerLCId.clear();
616 int grouping_parameter = 1000;
617 double tolerance = 1.1;
618 std::map<LteFlowId_t, int> UEtoHOL;
619 std::vector<bool> rbgMap;
620 uint16_t rbgAllocatedNum = 0;
621 std::set<uint16_t> rntiAllocated;
625 for (
auto it = rbgMap.begin(); it != rbgMap.end(); it++)
640 (*itProcId).second = ((*itProcId).second + 1) %
HARQ_PROC_NUM;
644 std::vector<bool> ulRbMap;
647 uint8_t maxContinuousUlBandwidth = 0;
648 uint8_t tmpMinBandwidth = 0;
649 uint16_t ffrRbStartOffset = 0;
650 uint16_t tmpFfrRbStartOffset = 0;
653 for (
auto it = ulRbMap.begin(); it != ulRbMap.end(); it++)
657 if (tmpMinBandwidth > maxContinuousUlBandwidth)
659 maxContinuousUlBandwidth = tmpMinBandwidth;
660 ffrRbStartOffset = tmpFfrRbStartOffset;
666 if (tmpMinBandwidth == 0)
668 tmpFfrRbStartOffset = index;
675 if (tmpMinBandwidth > maxContinuousUlBandwidth)
677 maxContinuousUlBandwidth = tmpMinBandwidth;
678 ffrRbStartOffset = tmpFfrRbStartOffset;
682 uint16_t rbStart = 0;
683 rbStart = ffrRbStartOffset;
687 (*itRach).m_estimatedSize,
688 " Default UL Grant MCS does not allow to send RACH messages");
690 newRar.
m_rnti = (*itRach).m_rnti;
697 uint16_t tbSizeBits = 0;
699 while ((tbSizeBits < (*itRach).m_estimatedSize) &&
700 (rbStart + rbLen < (ffrRbStartOffset + maxContinuousUlBandwidth)))
705 if (tbSizeBits < (*itRach).m_estimatedSize)
717 NS_LOG_INFO(
this <<
" UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart "
718 << rbStart <<
" rbLen " << rbLen <<
" MCS " <<
m_ulGrantMcs <<
" tbSize "
720 for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
753 harqId = (*itProcId).second;
757 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
760 (*itDci).second.at(harqId) = uldci;
763 rbStart = rbStart + rbLen;
773 if (!params.m_dlInfoList.empty())
777 params.m_dlInfoList.begin(),
778 params.m_dlInfoList.end());
783 if (!params.m_dlInfoList.empty())
793 std::vector<DlInfoListElement_s> dlInfoListUntxed;
797 if (itRnti != rntiAllocated.end())
803 std::vector<bool> retx;
805 NS_LOG_INFO(
this <<
" Processing DLHARQ feedback");
810 retx.push_back(
false);
819 if (retx.at(0) || retx.at(1))
824 NS_LOG_INFO(
this <<
" HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId);
833 if (dci.
m_rv.size() == 1)
845 NS_LOG_INFO(
"Maximum number of retransmissions reached -> drop process");
849 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
852 (*it).second.at(harqId) = 0;
856 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
859 for (std::size_t k = 0; k < (*itRlcPdu).second.size(); k++)
861 (*itRlcPdu).second.at(k).at(harqId).clear();
867 std::vector<int> dciRbg;
870 for (
int j = 0; j < 32; j++)
880 for (std::size_t j = 0; j < dciRbg.size(); j++)
882 if (rbgMap.at(dciRbg.at(j)))
892 for (std::size_t j = 0; j < dciRbg.size(); j++)
894 rbgMap.at(dciRbg.at(j)) =
true;
895 NS_LOG_INFO(
"RBG " << dciRbg.at(j) <<
" assigned");
899 NS_LOG_INFO(
this <<
" Send retx in the same RBGs");
905 uint8_t rbgId = (dciRbg.at(dciRbg.size() - 1) + 1) % numberOfRBGs;
906 uint8_t startRbg = dciRbg.at(dciRbg.size() - 1);
907 std::vector<bool> rbgMapCopy = rbgMap;
908 while ((j < dciRbg.size()) && (startRbg != rbgId))
910 if (!rbgMapCopy.at(rbgId))
912 rbgMapCopy.at(rbgId) =
true;
913 dciRbg.at(j) = rbgId;
916 rbgId = (rbgId + 1) % numberOfRBGs;
918 if (j == dciRbg.size())
922 for (std::size_t k = 0; k < dciRbg.size(); k++)
924 rbgMask = rbgMask + (0x1 << dciRbg.at(k));
929 NS_LOG_INFO(
this <<
" Move retx in RBGs " << dciRbg.size());
935 NS_LOG_INFO(
this <<
" No resource for this retx -> buffer it");
943 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
945 for (std::size_t j = 0; j < nLayers; j++)
949 if (j >= dci.
m_ndi.size())
952 dci.
m_ndi.push_back(0);
953 dci.
m_rv.push_back(0);
954 dci.
m_mcs.push_back(0);
957 <<
" no txed (MIMO transition)");
963 (*itHarq).second.at(harqId).m_rv.at(j)++;
964 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" RV "
965 << (uint16_t)dci.
m_rv.at(j));
975 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" no retx");
978 for (std::size_t k = 0; k < (*itRlcPdu).second.at(0).at(dci.
m_harqProcess).size(); k++)
980 std::vector<RlcPduListElement_s> rlcPduListPerLc;
981 for (std::size_t j = 0; j < nLayers; j++)
985 if (j < dci.
m_ndi.size())
987 NS_LOG_INFO(
" layer " << (uint16_t)j <<
" tb size "
989 rlcPduListPerLc.push_back(
1002 .m_logicalChannelIdentity;
1004 rlcPduListPerLc.push_back(emptyElement);
1008 if (!rlcPduListPerLc.empty())
1015 (*itHarq).second.at(harqId).
m_rv = dci.
m_rv;
1020 NS_FATAL_ERROR(
"Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
1022 (*itHarqTimer).second.at(harqId) = 0;
1024 rntiAllocated.insert(rnti);
1041 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1044 for (std::size_t k = 0; k < (*itRlcPdu).second.size(); k++)
1053 if (rbgAllocatedNum == numberOfRBGs)
1065 itLogicalChannels++)
1067 auto itRnti = rntiAllocated.find(itLogicalChannels->first.m_rnti);
1068 if ((itRnti != rntiAllocated.end()) ||
1072 if (itRnti != rntiAllocated.end())
1075 << (uint16_t)(itLogicalChannels->first.m_rnti));
1080 << (uint16_t)(itLogicalChannels->first.m_rnti));
1085 auto itRlcBufferReq =
m_rlcBufferReq.find(itLogicalChannels->first);
1094 if (itRlcBufferReq->second.m_rlcRetransmissionQueueSize > 0)
1096 delay = itRlcBufferReq->second.m_rlcRetransmissionHolDelay;
1097 group = delay / grouping_parameter;
1099 else if (itRlcBufferReq->second.m_rlcTransmissionQueueSize > 0)
1101 delay = itRlcBufferReq->second.m_rlcTransmissionQueueHolDelay;
1102 group = delay / grouping_parameter;
1109 UEtoHOL.insert(std::pair<LteFlowId_t, int>(itLogicalChannels->first, delay));
1111 if (itLogicalChannels->second.m_qosBearerType ==
1114 if (map_nonGBRHOLgroupToUE.count(group) == 0)
1116 std::set<LteFlowId_t>
v;
1117 v.insert(itRlcBufferReq->first);
1118 map_nonGBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group,
v));
1122 map_nonGBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1125 else if (itLogicalChannels->second.m_qosBearerType ==
1127 itLogicalChannels->second.m_qosBearerType ==
1130 if (map_GBRHOLgroupToUE.count(group) == 0)
1132 std::set<LteFlowId_t>
v;
1133 v.insert(itRlcBufferReq->first);
1134 map_GBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group,
v));
1138 map_GBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1145 std::map<LteFlowId_t, int> UeToAmountOfDataToTransfer;
1147 std::map<LteFlowId_t, int> UeToAmountOfAssignedResources;
1150 std::map<uint16_t, uint8_t> sbCqiSum;
1157 auto itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1160 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1165 for (
int k = 0; k < numberOfRBGs; k++)
1167 for (uint8_t j = 0; j < nLayer; j++)
1175 cqiSum += (*itCqi).second.m_higherLayerSelected.at(k).m_sbCqi.at(j);
1182 NS_LOG_INFO(
"Skip this flow, CQI==0, rnti:" << (*itrbr).first.m_rnti);
1187 int amountOfDataToTransfer =
1189 (
int)
m_rlcBufferReq.find(flowId)->second.m_rlcTransmissionQueueSize);
1191 UeToAmountOfDataToTransfer.insert(
1192 std::pair<LteFlowId_t, int>(flowId, amountOfDataToTransfer));
1193 UeToAmountOfAssignedResources.insert(std::pair<LteFlowId_t, int>(flowId, 0));
1196 for (
int i = 0; i < numberOfRBGs; i++)
1199 auto itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1202 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1205 std::vector<uint8_t> sbCqis;
1208 sbCqis = std::vector<uint8_t>(nLayer, 1);
1212 sbCqis = (*itCqi).second.m_higherLayerSelected.at(i).m_sbCqi;
1215 uint8_t cqi1 = sbCqis.at(0);
1217 if (sbCqis.size() > 1)
1219 cqi2 = sbCqis.at(1);
1226 for (uint8_t k = 0; k < nLayer; k++)
1228 if (sbCqis.size() > k)
1230 sbCqi = sbCqis.at(k);
1242 sbCqiSum.insert(std::pair<uint16_t, uint8_t>((*itrbr).first.m_rnti, sum));
1246 std::set<int> availableRBGs;
1247 for (
int i = 0; i < numberOfRBGs; i++)
1251 availableRBGs.insert(i);
1255 auto itGBRgroups = map_GBRHOLgroupToUE.begin();
1256 auto itnonGBRgroups = map_nonGBRHOLgroupToUE.begin();
1260 while (!availableRBGs.empty())
1262 if (UeToAmountOfDataToTransfer.empty())
1264 NS_LOG_INFO(
"No UEs to be scheduled (no data or CQI==0),");
1267 std::set<LteFlowId_t> vUEs;
1270 if (itGBRgroups != map_GBRHOLgroupToUE.end())
1272 itCurrentGroup = itGBRgroups;
1275 else if (itnonGBRgroups !=
1276 map_nonGBRHOLgroupToUE
1280 itCurrentGroup = itnonGBRgroups;
1285 NS_LOG_INFO(
"Available RBGs:" << availableRBGs.size() <<
"but no users");
1290 while (!availableRBGs.empty() && !itCurrentGroup->second.empty())
1292 bool currentRBchecked =
false;
1293 int currentRB = *(availableRBGs.begin());
1294 std::map<LteFlowId_t, CQI_value> UeToCQIValue;
1295 std::map<LteFlowId_t, double> UeToCoitaMetric;
1296 std::map<LteFlowId_t, bool> UeHasReachedGBR;
1297 double maximumValueMetric = 0;
1299 UeToCQIValue.clear();
1300 UeToCoitaMetric.clear();
1304 for (
auto it = itCurrentGroup->second.begin(); it != itCurrentGroup->second.end(); it++)
1307 uint8_t cqi_value = 1;
1308 double coita_metric = 1;
1309 double coita_sum = 0;
1311 uint8_t worstCQIAmongRBGsAllocatedForThisUser = 15;
1312 int numberOfRBGAllocatedForThisUser = 0;
1326 currentRBchecked =
true;
1330 (*itStats).second.targetThroughput / (*itStats).second.lastAveragedThroughput;
1331 if (tbr_weight < 1.0)
1338 for (
auto it = availableRBGs.begin(); it != availableRBGs.end(); it++)
1343 (itRntiCQIsMap->second.m_higherLayerSelected.at(*it).m_sbCqi.at(0));
1348 if (*it == currentRB)
1354 catch (std::out_of_range&)
1358 <<
" rnti:" << flowId.
m_rnti
1359 <<
" at subband:" << currentRB);
1364 coita_metric = cqi_value / coita_sum;
1365 UeToCQIValue.insert(std::pair<LteFlowId_t, CQI_value>(flowId, cqi_value));
1366 UeToCoitaMetric.insert(std::pair<LteFlowId_t, double>(flowId, coita_metric));
1369 if (allocationMapPerRntiPerLCId.find(flowId.
m_rnti) ==
1370 allocationMapPerRntiPerLCId.end())
1372 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1376 numberOfRBGAllocatedForThisUser =
1377 (allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.size());
1380 allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.begin();
1381 itRBG != allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.end();
1391 if (cqi_value < worstCQIAmongRBGsAllocatedForThisUser)
1393 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1397 int mcsForThisUser =
m_amc->GetMcsFromCqi(worstCQIAmongRBGsAllocatedForThisUser);
1399 m_amc->GetDlTbSizeFromMcs(mcsForThisUser,
1400 (numberOfRBGAllocatedForThisUser + 1) * rbgSize) /
1404 double achievableRate =
1405 ((
m_amc->GetDlTbSizeFromMcs(mcsForThisUser, rbgSize) / 8) / 0.001);
1406 double pf_weight = achievableRate / (*itStats).second.secondLastAveragedThroughput;
1408 UeToAmountOfAssignedResources.find(flowId)->second = 8 * tbSize;
1412 if (UeToAmountOfDataToTransfer.find(flowId)->second -
1413 UeToAmountOfAssignedResources.find(flowId)->second <
1416 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1419 double bitRateWithNewRBG = 0;
1431 bitRateWithNewRBG = (1.0 /
m_timeWindow) * (
double)(tbSize * 1000);
1436 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
true));
1440 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1443 int hol = UEtoHOL.find(flowId)->second;
1452 metric = coita_metric * tbr_weight * hol;
1456 metric = tbr_weight * pf_weight * hol;
1463 if (metric >= maximumValueMetric)
1465 maximumValueMetric = metric;
1466 userWithMaximumMetric = flowId;
1470 if (!currentRBchecked)
1473 availableRBGs.erase(currentRB);
1478 const auto ueToCqiIt = UeToCQIValue.find(userWithMaximumMetric);
1479 s.
cqi_value_for_lc = ueToCqiIt != UeToCQIValue.end() ? ueToCqiIt->second : 1;
1482 auto itMap = allocationMapPerRntiPerLCId.find(userWithMaximumMetric.
m_rnti);
1484 if (itMap == allocationMapPerRntiPerLCId.end())
1486 std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc> tempMap;
1488 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1490 allocationMapPerRntiPerLCId.insert(
1491 std::pair<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>(
1492 userWithMaximumMetric.
m_rnti,
1497 itMap->second.insert(
1498 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1503 availableRBGs.erase(currentRB);
1505 if (UeToAmountOfDataToTransfer.find(userWithMaximumMetric)->second <=
1506 UeToAmountOfAssignedResources.find(userWithMaximumMetric)->second * tolerance)
1509 itCurrentGroup->second.erase(userWithMaximumMetric);
1517 (*itStats).second.lastTtiBytesTransmitted = 0;
1523 auto itMap = allocationMapPerRntiPerLCId.begin();
1524 std::map<uint16_t, double> m_rnti_per_ratio;
1526 while (itMap != allocationMapPerRntiPerLCId.end())
1530 newEl.
m_rnti = (*itMap).first;
1534 std::vector<RlcPduListElement_s> newRlcPduLe;
1535 newDci.
m_rnti = (*itMap).first;
1543 uint16_t RbgPerRnti = (*itMap).second.size();
1544 double doubleRBgPerRnti = RbgPerRnti;
1545 double doubleRbgNum = numberOfRBGs;
1546 double rrRatio = doubleRBgPerRnti / doubleRbgNum;
1547 m_rnti_per_ratio.insert(std::pair<uint16_t, double>((*itMap).first, rrRatio));
1548 uint8_t worstCqi = 15;
1551 for (
auto it = (*itMap).second.begin(); it != (*itMap).second.end(); it++)
1553 if (it->second.cqi_value_for_lc < worstCqi)
1555 worstCqi = it->second.cqi_value_for_lc;
1559 newDci.
m_mcs.push_back(
m_amc->GetMcsFromCqi(worstCqi));
1560 int tbSize = (
m_amc->GetDlTbSizeFromMcs(newDci.
m_mcs.at(0), RbgPerRnti * rbgSize) /
1566 for (
auto itRBGsPerRNTI = (*itMap).second.begin(); itRBGsPerRNTI != (*itMap).second.end();
1569 rbgMask = rbgMask + (0x1 << itRBGsPerRNTI->second.resource_block_index);
1576 if (((*itBufReq).first.m_rnti == (*itMap).first) &&
1577 (((*itBufReq).second.m_rlcTransmissionQueueSize > 0) ||
1578 ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0) ||
1579 ((*itBufReq).second.m_rlcStatusPduSize > 0)))
1581 std::vector<RlcPduListElement_s> newRlcPduLe;
1587 newRlcEl.
m_size = tbSize / lcActives;
1590 newRlcPduLe.push_back(newRlcEl);
1600 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1604 (*itRlcPdu).second.at(j).at(newDci.
m_harqProcess).push_back(newRlcEl);
1609 if ((*itBufReq).first.m_rnti > (*itMap).first)
1616 newDci.
m_ndi.push_back(1);
1617 newDci.
m_rv.push_back(0);
1622 newEl.
m_dci = newDci;
1630 NS_FATAL_ERROR(
"Unable to find RNTI entry in DCI HARQ buffer for RNTI "
1650 (*it).second.lastTtiBytesTransmitted = tbSize;
1665 if (allocationMapPerRntiPerLCId.find(itStats->first) != allocationMapPerRntiPerLCId.end())
1667 (*itStats).second.secondLastAveragedThroughput =
1668 ((1.0 - (1 /
m_timeWindow)) * (*itStats).second.secondLastAveragedThroughput) +
1669 ((1 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1672 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
1675 (*itStats).second.lastAveragedThroughput =
1676 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
1677 ((1.0 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1678 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
1679 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
1680 (*itStats).second.lastTtiBytesTransmitted = 0;
1685 int count_allocated_resource_blocks = 0;
1686 for (
auto itMap = allocationMapPerRntiPerLCId.begin();
1687 itMap != allocationMapPerRntiPerLCId.end();
1690 count_allocated_resource_blocks += itMap->second.size();
1692 NS_LOG_INFO(
this <<
" Allocated RBs:" << count_allocated_resource_blocks);
1796 NS_LOG_FUNCTION(
this <<
" UL - Frame no. " << (params.m_sfnSf >> 4) <<
" subframe no. "
1797 << (0xF & params.m_sfnSf) <<
" size " << params.m_ulInfoList.size());
1804 std::vector<bool> rbMap;
1805 uint16_t rbAllocatedNum = 0;
1806 std::set<uint16_t> rntiAllocated;
1807 std::vector<uint16_t> rbgAllocationMap;
1818 for (
auto it = rbMap.begin(); it != rbMap.end(); it++)
1826 uint8_t minContinuousUlBandwidth =
m_ffrSapProvider->GetMinContinuousUlBandwidth();
1832 if (rbgAllocationMap.at(i) != 0)
1842 for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++)
1847 uint16_t rnti = params.m_ulInfoList.at(i).m_rnti;
1851 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1854 NS_LOG_INFO(
this <<
" UL-HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId
1855 <<
" i " << i <<
" size " << params.m_ulInfoList.size());
1859 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1866 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1868 if ((*itStat).second.at(harqId) >= 3)
1870 NS_LOG_INFO(
"Max number of retransmissions reached (UL)-> drop process");
1889 rbgAllocationMap.at(j) = dci.
m_rnti;
1895 << (*itStat).second.at(harqId) + 1);
1899 NS_LOG_INFO(
"Cannot allocate retx due to RACH allocations for UE " << rnti);
1904 (*itStat).second.at((*itProcId).second) = (*itStat).second.at(harqId) + 1;
1905 (*itStat).second.at(harqId) = 0;
1906 (*itHarq).second.at((*itProcId).second) = dci;
1908 rntiAllocated.insert(dci.
m_rnti);
1912 NS_LOG_INFO(
this <<
" HARQ-ACK feedback from RNTI "
1913 << params.m_ulInfoList.at(i).m_rnti);
1918 std::map<uint16_t, uint32_t>::iterator it;
1923 auto itRnti = rntiAllocated.find((*it).first);
1925 if (((*it).second > 0) && (itRnti == rntiAllocated.end()))
1944 uint16_t tempRbPerFlow = (ffrUlBandwidth) / (nflows + rntiAllocated.size());
1945 uint16_t rbPerFlow =
1946 (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuousUlBandwidth : tempRbPerFlow;
1953 int rbAllocated = 0;
1976 auto itRnti = rntiAllocated.find((*it).first);
1977 if ((itRnti != rntiAllocated.end()) || ((*it).second == 0))
1980 NS_LOG_DEBUG(
this <<
" UE already allocated in HARQ -> discarded, RNTI "
2004 uldci.
m_rnti = (*it).first;
2006 bool allocated =
false;
2007 NS_LOG_INFO(
this <<
" RB Allocated " << rbAllocated <<
" rbPerFlow " << rbPerFlow
2008 <<
" flows " << nflows);
2009 while ((!allocated) && ((rbAllocated + rbPerFlow -
m_cschedCellConfig.m_ulBandwidth) < 1) &&
2014 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2029 NS_LOG_INFO(
this <<
"RNTI: " << (*it).first <<
" RB Allocated " << rbAllocated
2030 <<
" rbPerFlow " << rbPerFlow <<
" flows " << nflows);
2033 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2037 rbgAllocationMap.at(j) = (*it).first;
2039 rbAllocated += rbPerFlow;
2068 auto itCqi =
m_ueCqi.find((*it).first);
2079 "CQI of RNTI = " << (*it).first <<
" has expired");
2080 double minSinr = (*itCqi).second.at(uldci.
m_rbStart);
2087 double sinr = (*itCqi).second.at(i);
2099 double s = log2(1 + (std::pow(10, minSinr / 10) / ((-std::log(5.0 * 0.00005)) / 1.5)));
2100 cqi =
m_amc->GetCqiFromSpectralEfficiency(s);
2113 rbgAllocationMap.at(i) = 0;
2144 harqId = (*itProcId).second;
2148 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
2151 (*itDci).second.at(harqId) = uldci;
2156 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
2159 (*itStat).second.at(harqId) = 0;
2162 NS_LOG_INFO(
this <<
" UE Allocation RNTI " << (*it).first <<
" startPRB "
2164 <<
" CQI " << cqi <<
" MCS " << (
uint32_t)uldci.
m_mcs <<
" TBsize "
2165 << uldci.
m_tbSize <<
" RbAlloc " << rbAllocated <<
" harqId "
2166 << (uint16_t)harqId);
2172 (*itStats).second.lastTtiBytesTransmitted = uldci.
m_tbSize;
2176 NS_LOG_DEBUG(
this <<
" No Stats for this allocated UE");
2191 }
while (((*it).first !=
m_nextRntiUl) && (rbPerFlow != 0));
2197 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
2200 (*itStats).second.lastAveragedThroughput =
2201 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
2202 ((1.0 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
2203 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
2204 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
2205 (*itStats).second.lastTtiBytesTransmitted = 0;