621 NS_LOG_FUNCTION(
this <<
" Frame no. " << (params.m_sfnSf >> 4) <<
" subframe no. "
622 << (0xF & params.m_sfnSf));
632 std::map<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>
633 allocationMapPerRntiPerLCId;
634 allocationMapPerRntiPerLCId.clear();
638 int grouping_parameter = 1000;
639 double tolerance = 1.1;
640 std::map<LteFlowId_t, int> UEtoHOL;
641 std::vector<bool> rbgMap;
642 uint16_t rbgAllocatedNum = 0;
643 std::set<uint16_t> rntiAllocated;
647 for (
auto it = rbgMap.begin(); it != rbgMap.end(); it++)
662 (*itProcId).second = ((*itProcId).second + 1) %
HARQ_PROC_NUM;
666 std::vector<bool> ulRbMap;
669 uint8_t maxContinuousUlBandwidth = 0;
670 uint8_t tmpMinBandwidth = 0;
671 uint16_t ffrRbStartOffset = 0;
672 uint16_t tmpFfrRbStartOffset = 0;
675 for (
auto it = ulRbMap.begin(); it != ulRbMap.end(); it++)
679 if (tmpMinBandwidth > maxContinuousUlBandwidth)
681 maxContinuousUlBandwidth = tmpMinBandwidth;
682 ffrRbStartOffset = tmpFfrRbStartOffset;
688 if (tmpMinBandwidth == 0)
690 tmpFfrRbStartOffset = index;
697 if (tmpMinBandwidth > maxContinuousUlBandwidth)
699 maxContinuousUlBandwidth = tmpMinBandwidth;
700 ffrRbStartOffset = tmpFfrRbStartOffset;
704 uint16_t rbStart = 0;
705 rbStart = ffrRbStartOffset;
709 (*itRach).m_estimatedSize,
710 " Default UL Grant MCS does not allow to send RACH messages");
712 newRar.
m_rnti = (*itRach).m_rnti;
719 uint16_t tbSizeBits = 0;
721 while ((tbSizeBits < (*itRach).m_estimatedSize) &&
722 (rbStart + rbLen < (ffrRbStartOffset + maxContinuousUlBandwidth)))
727 if (tbSizeBits < (*itRach).m_estimatedSize)
739 NS_LOG_INFO(
this <<
" UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart "
740 << rbStart <<
" rbLen " << rbLen <<
" MCS " <<
m_ulGrantMcs <<
" tbSize "
742 for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
775 harqId = (*itProcId).second;
779 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
782 (*itDci).second.at(harqId) = uldci;
785 rbStart = rbStart + rbLen;
795 if (!params.m_dlInfoList.empty())
799 params.m_dlInfoList.begin(),
800 params.m_dlInfoList.end());
805 if (!params.m_dlInfoList.empty())
815 std::vector<DlInfoListElement_s> dlInfoListUntxed;
819 if (itRnti != rntiAllocated.end())
825 std::vector<bool> retx;
827 NS_LOG_INFO(
this <<
" Processing DLHARQ feedback");
832 retx.push_back(
false);
841 if (retx.at(0) || retx.at(1))
846 NS_LOG_INFO(
this <<
" HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId);
855 if (dci.
m_rv.size() == 1)
867 NS_LOG_INFO(
"Maximum number of retransmissions reached -> drop process");
871 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
874 (*it).second.at(harqId) = 0;
878 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
881 for (std::size_t k = 0; k < (*itRlcPdu).second.size(); k++)
883 (*itRlcPdu).second.at(k).at(harqId).clear();
889 std::vector<int> dciRbg;
892 for (
int j = 0; j < 32; j++)
902 for (std::size_t j = 0; j < dciRbg.size(); j++)
904 if (rbgMap.at(dciRbg.at(j)))
914 for (std::size_t j = 0; j < dciRbg.size(); j++)
916 rbgMap.at(dciRbg.at(j)) =
true;
917 NS_LOG_INFO(
"RBG " << dciRbg.at(j) <<
" assigned");
921 NS_LOG_INFO(
this <<
" Send retx in the same RBGs");
927 uint8_t rbgId = (dciRbg.at(dciRbg.size() - 1) + 1) % numberOfRBGs;
928 uint8_t startRbg = dciRbg.at(dciRbg.size() - 1);
929 std::vector<bool> rbgMapCopy = rbgMap;
930 while ((j < dciRbg.size()) && (startRbg != rbgId))
932 if (!rbgMapCopy.at(rbgId))
934 rbgMapCopy.at(rbgId) =
true;
935 dciRbg.at(j) = rbgId;
938 rbgId = (rbgId + 1) % numberOfRBGs;
940 if (j == dciRbg.size())
944 for (std::size_t k = 0; k < dciRbg.size(); k++)
946 rbgMask = rbgMask + (0x1 << dciRbg.at(k));
951 NS_LOG_INFO(
this <<
" Move retx in RBGs " << dciRbg.size());
957 NS_LOG_INFO(
this <<
" No resource for this retx -> buffer it");
965 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
967 for (std::size_t j = 0; j < nLayers; j++)
971 if (j >= dci.
m_ndi.size())
974 dci.
m_ndi.push_back(0);
975 dci.
m_rv.push_back(0);
976 dci.
m_mcs.push_back(0);
979 <<
" no txed (MIMO transition)");
985 (*itHarq).second.at(harqId).m_rv.at(j)++;
986 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" RV "
987 << (uint16_t)dci.
m_rv.at(j));
997 NS_LOG_INFO(
this <<
" layer " << (uint16_t)j <<
" no retx");
1000 for (std::size_t k = 0; k < (*itRlcPdu).second.at(0).at(dci.
m_harqProcess).size(); k++)
1002 std::vector<RlcPduListElement_s> rlcPduListPerLc;
1003 for (std::size_t j = 0; j < nLayers; j++)
1007 if (j < dci.
m_ndi.size())
1009 NS_LOG_INFO(
" layer " << (uint16_t)j <<
" tb size "
1011 rlcPduListPerLc.push_back(
1024 .m_logicalChannelIdentity;
1026 rlcPduListPerLc.push_back(emptyElement);
1030 if (!rlcPduListPerLc.empty())
1037 (*itHarq).second.at(harqId).
m_rv = dci.
m_rv;
1042 NS_FATAL_ERROR(
"Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
1044 (*itHarqTimer).second.at(harqId) = 0;
1046 rntiAllocated.insert(rnti);
1063 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1066 for (std::size_t k = 0; k < (*itRlcPdu).second.size(); k++)
1075 if (rbgAllocatedNum == numberOfRBGs)
1087 itLogicalChannels++)
1089 auto itRnti = rntiAllocated.find(itLogicalChannels->first.m_rnti);
1090 if ((itRnti != rntiAllocated.end()) ||
1094 if (itRnti != rntiAllocated.end())
1097 << (uint16_t)(itLogicalChannels->first.m_rnti));
1102 << (uint16_t)(itLogicalChannels->first.m_rnti));
1107 auto itRlcBufferReq =
m_rlcBufferReq.find(itLogicalChannels->first);
1116 if (itRlcBufferReq->second.m_rlcRetransmissionQueueSize > 0)
1118 delay = itRlcBufferReq->second.m_rlcRetransmissionHolDelay;
1119 group = delay / grouping_parameter;
1121 else if (itRlcBufferReq->second.m_rlcTransmissionQueueSize > 0)
1123 delay = itRlcBufferReq->second.m_rlcTransmissionQueueHolDelay;
1124 group = delay / grouping_parameter;
1131 UEtoHOL.insert(std::pair<LteFlowId_t, int>(itLogicalChannels->first, delay));
1133 if (itLogicalChannels->second.m_qosBearerType ==
1136 if (map_nonGBRHOLgroupToUE.count(group) == 0)
1138 std::set<LteFlowId_t>
v;
1139 v.insert(itRlcBufferReq->first);
1140 map_nonGBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group,
v));
1144 map_nonGBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1147 else if (itLogicalChannels->second.m_qosBearerType ==
1149 itLogicalChannels->second.m_qosBearerType ==
1152 if (map_GBRHOLgroupToUE.count(group) == 0)
1154 std::set<LteFlowId_t>
v;
1155 v.insert(itRlcBufferReq->first);
1156 map_GBRHOLgroupToUE.insert(std::pair<
int, std::set<LteFlowId_t>>(group,
v));
1160 map_GBRHOLgroupToUE.find(group)->second.insert(itRlcBufferReq->first);
1167 std::map<LteFlowId_t, int> UeToAmountOfDataToTransfer;
1169 std::map<LteFlowId_t, int> UeToAmountOfAssignedResources;
1172 std::map<uint16_t, uint8_t> sbCqiSum;
1179 auto itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1182 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1187 for (
int k = 0; k < numberOfRBGs; k++)
1189 for (uint8_t j = 0; j < nLayer; j++)
1197 cqiSum += (*itCqi).second.m_higherLayerSelected.at(k).m_sbCqi.at(j);
1204 NS_LOG_INFO(
"Skip this flow, CQI==0, rnti:" << (*itrbr).first.m_rnti);
1209 int amountOfDataToTransfer =
1211 (
int)
m_rlcBufferReq.find(flowId)->second.m_rlcTransmissionQueueSize);
1213 UeToAmountOfDataToTransfer.insert(
1214 std::pair<LteFlowId_t, int>(flowId, amountOfDataToTransfer));
1215 UeToAmountOfAssignedResources.insert(std::pair<LteFlowId_t, int>(flowId, 0));
1218 for (
int i = 0; i < numberOfRBGs; i++)
1221 auto itTxMode =
m_uesTxMode.find((*itrbr).first.m_rnti);
1224 NS_FATAL_ERROR(
"No Transmission Mode info on user " << (*itrbr).first.m_rnti);
1227 std::vector<uint8_t> sbCqis;
1230 sbCqis = std::vector<uint8_t>(nLayer, 1);
1234 sbCqis = (*itCqi).second.m_higherLayerSelected.at(i).m_sbCqi;
1237 uint8_t cqi1 = sbCqis.at(0);
1239 if (sbCqis.size() > 1)
1241 cqi2 = sbCqis.at(1);
1248 for (uint8_t k = 0; k < nLayer; k++)
1250 if (sbCqis.size() > k)
1252 sbCqi = sbCqis.at(k);
1264 sbCqiSum.insert(std::pair<uint16_t, uint8_t>((*itrbr).first.m_rnti, sum));
1268 std::set<int> availableRBGs;
1269 for (
int i = 0; i < numberOfRBGs; i++)
1273 availableRBGs.insert(i);
1277 auto itGBRgroups = map_GBRHOLgroupToUE.begin();
1278 auto itnonGBRgroups = map_nonGBRHOLgroupToUE.begin();
1282 while (!availableRBGs.empty())
1284 if (UeToAmountOfDataToTransfer.empty())
1286 NS_LOG_INFO(
"No UEs to be scheduled (no data or CQI==0),");
1289 std::set<LteFlowId_t> vUEs;
1292 if (itGBRgroups != map_GBRHOLgroupToUE.end())
1294 itCurrentGroup = itGBRgroups;
1297 else if (itnonGBRgroups !=
1298 map_nonGBRHOLgroupToUE
1302 itCurrentGroup = itnonGBRgroups;
1307 NS_LOG_INFO(
"Available RBGs:" << availableRBGs.size() <<
"but no users");
1312 while (!availableRBGs.empty() && !itCurrentGroup->second.empty())
1314 bool currentRBchecked =
false;
1315 int currentRB = *(availableRBGs.begin());
1316 std::map<LteFlowId_t, CQI_value> UeToCQIValue;
1317 std::map<LteFlowId_t, double> UeToCoitaMetric;
1318 std::map<LteFlowId_t, bool> UeHasReachedGBR;
1319 double maximumValueMetric = 0;
1321 UeToCQIValue.clear();
1322 UeToCoitaMetric.clear();
1326 for (
auto it = itCurrentGroup->second.begin(); it != itCurrentGroup->second.end(); it++)
1329 uint8_t cqi_value = 1;
1330 double coita_metric = 1;
1331 double coita_sum = 0;
1333 uint8_t worstCQIAmongRBGsAllocatedForThisUser = 15;
1334 int numberOfRBGAllocatedForThisUser = 0;
1348 currentRBchecked =
true;
1352 (*itStats).second.targetThroughput / (*itStats).second.lastAveragedThroughput;
1353 if (tbr_weight < 1.0)
1360 for (
auto it = availableRBGs.begin(); it != availableRBGs.end(); it++)
1365 (itRntiCQIsMap->second.m_higherLayerSelected.at(*it).m_sbCqi.at(0));
1370 if (*it == currentRB)
1376 catch (std::out_of_range&)
1380 <<
" rnti:" << flowId.
m_rnti
1381 <<
" at subband:" << currentRB);
1386 coita_metric = cqi_value / coita_sum;
1387 UeToCQIValue.insert(std::pair<LteFlowId_t, CQI_value>(flowId, cqi_value));
1388 UeToCoitaMetric.insert(std::pair<LteFlowId_t, double>(flowId, coita_metric));
1391 if (allocationMapPerRntiPerLCId.find(flowId.
m_rnti) ==
1392 allocationMapPerRntiPerLCId.end())
1394 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1398 numberOfRBGAllocatedForThisUser =
1399 (allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.size());
1402 allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.begin();
1403 itRBG != allocationMapPerRntiPerLCId.find(flowId.
m_rnti)->second.end();
1413 if (cqi_value < worstCQIAmongRBGsAllocatedForThisUser)
1415 worstCQIAmongRBGsAllocatedForThisUser = cqi_value;
1419 int mcsForThisUser =
m_amc->GetMcsFromCqi(worstCQIAmongRBGsAllocatedForThisUser);
1421 m_amc->GetDlTbSizeFromMcs(mcsForThisUser,
1422 (numberOfRBGAllocatedForThisUser + 1) * rbgSize) /
1426 double achievableRate =
1427 ((
m_amc->GetDlTbSizeFromMcs(mcsForThisUser, rbgSize) / 8) / 0.001);
1428 double pf_weight = achievableRate / (*itStats).second.secondLastAveragedThroughput;
1430 UeToAmountOfAssignedResources.find(flowId)->second = 8 * tbSize;
1434 if (UeToAmountOfDataToTransfer.find(flowId)->second -
1435 UeToAmountOfAssignedResources.find(flowId)->second <
1438 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1441 double bitRateWithNewRBG = 0;
1453 bitRateWithNewRBG = (1.0 /
m_timeWindow) * (
double)(tbSize * 1000);
1458 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
true));
1462 UeHasReachedGBR.insert(std::pair<LteFlowId_t, bool>(flowId,
false));
1465 int hol = UEtoHOL.find(flowId)->second;
1474 metric = coita_metric * tbr_weight * hol;
1478 metric = tbr_weight * pf_weight * hol;
1485 if (metric >= maximumValueMetric)
1487 maximumValueMetric = metric;
1488 userWithMaximumMetric = flowId;
1492 if (!currentRBchecked)
1495 availableRBGs.erase(currentRB);
1500 const auto ueToCqiIt = UeToCQIValue.find(userWithMaximumMetric);
1501 s.
cqi_value_for_lc = ueToCqiIt != UeToCQIValue.end() ? ueToCqiIt->second : 1;
1504 auto itMap = allocationMapPerRntiPerLCId.find(userWithMaximumMetric.
m_rnti);
1506 if (itMap == allocationMapPerRntiPerLCId.end())
1508 std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc> tempMap;
1510 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1512 allocationMapPerRntiPerLCId.insert(
1513 std::pair<uint16_t, std::multimap<uint8_t, qos_rb_and_CQI_assigned_to_lc>>(
1514 userWithMaximumMetric.
m_rnti,
1519 itMap->second.insert(
1520 std::pair<uint8_t, qos_rb_and_CQI_assigned_to_lc>(userWithMaximumMetric.
m_lcId,
1525 availableRBGs.erase(currentRB);
1527 if (UeToAmountOfDataToTransfer.find(userWithMaximumMetric)->second <=
1528 UeToAmountOfAssignedResources.find(userWithMaximumMetric)->second * tolerance)
1531 itCurrentGroup->second.erase(userWithMaximumMetric);
1539 (*itStats).second.lastTtiBytesTransmitted = 0;
1545 auto itMap = allocationMapPerRntiPerLCId.begin();
1546 std::map<uint16_t, double> m_rnti_per_ratio;
1548 while (itMap != allocationMapPerRntiPerLCId.end())
1552 newEl.
m_rnti = (*itMap).first;
1556 std::vector<RlcPduListElement_s> newRlcPduLe;
1557 newDci.
m_rnti = (*itMap).first;
1565 uint16_t RbgPerRnti = (*itMap).second.size();
1566 double doubleRBgPerRnti = RbgPerRnti;
1567 double doubleRbgNum = numberOfRBGs;
1568 double rrRatio = doubleRBgPerRnti / doubleRbgNum;
1569 m_rnti_per_ratio.insert(std::pair<uint16_t, double>((*itMap).first, rrRatio));
1570 uint8_t worstCqi = 15;
1573 for (
auto it = (*itMap).second.begin(); it != (*itMap).second.end(); it++)
1575 if (it->second.cqi_value_for_lc < worstCqi)
1577 worstCqi = it->second.cqi_value_for_lc;
1581 newDci.
m_mcs.push_back(
m_amc->GetMcsFromCqi(worstCqi));
1582 int tbSize = (
m_amc->GetDlTbSizeFromMcs(newDci.
m_mcs.at(0), RbgPerRnti * rbgSize) /
1588 for (
auto itRBGsPerRNTI = (*itMap).second.begin(); itRBGsPerRNTI != (*itMap).second.end();
1591 rbgMask = rbgMask + (0x1 << itRBGsPerRNTI->second.resource_block_index);
1598 if (((*itBufReq).first.m_rnti == (*itMap).first) &&
1599 (((*itBufReq).second.m_rlcTransmissionQueueSize > 0) ||
1600 ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0) ||
1601 ((*itBufReq).second.m_rlcStatusPduSize > 0)))
1603 std::vector<RlcPduListElement_s> newRlcPduLe;
1609 newRlcEl.
m_size = tbSize / lcActives;
1612 newRlcPduLe.push_back(newRlcEl);
1622 NS_FATAL_ERROR(
"Unable to find RlcPdcList in HARQ buffer for RNTI "
1626 (*itRlcPdu).second.at(j).at(newDci.
m_harqProcess).push_back(newRlcEl);
1631 if ((*itBufReq).first.m_rnti > (*itMap).first)
1638 newDci.
m_ndi.push_back(1);
1639 newDci.
m_rv.push_back(0);
1644 newEl.
m_dci = newDci;
1652 NS_FATAL_ERROR(
"Unable to find RNTI entry in DCI HARQ buffer for RNTI "
1672 (*it).second.lastTtiBytesTransmitted = tbSize;
1687 if (allocationMapPerRntiPerLCId.find(itStats->first) != allocationMapPerRntiPerLCId.end())
1689 (*itStats).second.secondLastAveragedThroughput =
1690 ((1.0 - (1 /
m_timeWindow)) * (*itStats).second.secondLastAveragedThroughput) +
1691 ((1 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1694 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
1697 (*itStats).second.lastAveragedThroughput =
1698 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
1699 ((1.0 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
1700 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
1701 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
1702 (*itStats).second.lastTtiBytesTransmitted = 0;
1707 int count_allocated_resource_blocks = 0;
1708 for (
auto itMap = allocationMapPerRntiPerLCId.begin();
1709 itMap != allocationMapPerRntiPerLCId.end();
1712 count_allocated_resource_blocks += itMap->second.size();
1714 NS_LOG_INFO(
this <<
" Allocated RBs:" << count_allocated_resource_blocks);
1818 NS_LOG_FUNCTION(
this <<
" UL - Frame no. " << (params.m_sfnSf >> 4) <<
" subframe no. "
1819 << (0xF & params.m_sfnSf) <<
" size " << params.m_ulInfoList.size());
1826 std::vector<bool> rbMap;
1827 uint16_t rbAllocatedNum = 0;
1828 std::set<uint16_t> rntiAllocated;
1829 std::vector<uint16_t> rbgAllocationMap;
1840 for (
auto it = rbMap.begin(); it != rbMap.end(); it++)
1848 uint8_t minContinuousUlBandwidth =
m_ffrSapProvider->GetMinContinuousUlBandwidth();
1854 if (rbgAllocationMap.at(i) != 0)
1864 for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++)
1869 uint16_t rnti = params.m_ulInfoList.at(i).m_rnti;
1873 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1876 NS_LOG_INFO(
this <<
" UL-HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId
1877 <<
" i " << i <<
" size " << params.m_ulInfoList.size());
1881 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1888 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1890 if ((*itStat).second.at(harqId) >= 3)
1892 NS_LOG_INFO(
"Max number of retransmissions reached (UL)-> drop process");
1911 rbgAllocationMap.at(j) = dci.
m_rnti;
1917 << (*itStat).second.at(harqId) + 1);
1921 NS_LOG_INFO(
"Cannot allocate retx due to RACH allocations for UE " << rnti);
1926 (*itStat).second.at((*itProcId).second) = (*itStat).second.at(harqId) + 1;
1927 (*itStat).second.at(harqId) = 0;
1928 (*itHarq).second.at((*itProcId).second) = dci;
1930 rntiAllocated.insert(dci.
m_rnti);
1934 NS_LOG_INFO(
this <<
" HARQ-ACK feedback from RNTI "
1935 << params.m_ulInfoList.at(i).m_rnti);
1940 std::map<uint16_t, uint32_t>::iterator it;
1945 auto itRnti = rntiAllocated.find((*it).first);
1947 if (((*it).second > 0) && (itRnti == rntiAllocated.end()))
1966 uint16_t tempRbPerFlow = (ffrUlBandwidth) / (nflows + rntiAllocated.size());
1967 uint16_t rbPerFlow =
1968 (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuousUlBandwidth : tempRbPerFlow;
1975 int rbAllocated = 0;
1998 auto itRnti = rntiAllocated.find((*it).first);
1999 if ((itRnti != rntiAllocated.end()) || ((*it).second == 0))
2002 NS_LOG_DEBUG(
this <<
" UE already allocated in HARQ -> discarded, RNTI "
2026 uldci.
m_rnti = (*it).first;
2028 bool allocated =
false;
2029 NS_LOG_INFO(
this <<
" RB Allocated " << rbAllocated <<
" rbPerFlow " << rbPerFlow
2030 <<
" flows " << nflows);
2031 while ((!allocated) && ((rbAllocated + rbPerFlow -
m_cschedCellConfig.m_ulBandwidth) < 1) &&
2036 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2051 NS_LOG_INFO(
this <<
"RNTI: " << (*it).first <<
" RB Allocated " << rbAllocated
2052 <<
" rbPerFlow " << rbPerFlow <<
" flows " << nflows);
2055 for (
int j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
2059 rbgAllocationMap.at(j) = (*it).first;
2061 rbAllocated += rbPerFlow;
2090 auto itCqi =
m_ueCqi.find((*it).first);
2101 "CQI of RNTI = " << (*it).first <<
" has expired");
2102 double minSinr = (*itCqi).second.at(uldci.
m_rbStart);
2109 double sinr = (*itCqi).second.at(i);
2121 double s = log2(1 + (std::pow(10, minSinr / 10) / ((-std::log(5.0 * 0.00005)) / 1.5)));
2122 cqi =
m_amc->GetCqiFromSpectralEfficiency(s);
2135 rbgAllocationMap.at(i) = 0;
2166 harqId = (*itProcId).second;
2170 NS_FATAL_ERROR(
"Unable to find RNTI entry in UL DCI HARQ buffer for RNTI "
2173 (*itDci).second.at(harqId) = uldci;
2178 NS_LOG_ERROR(
"No info find in HARQ buffer for UE (might change eNB) "
2181 (*itStat).second.at(harqId) = 0;
2184 NS_LOG_INFO(
this <<
" UE Allocation RNTI " << (*it).first <<
" startPRB "
2186 <<
" CQI " << cqi <<
" MCS " << (
uint32_t)uldci.
m_mcs <<
" TBsize "
2187 << uldci.
m_tbSize <<
" RbAlloc " << rbAllocated <<
" harqId "
2188 << (uint16_t)harqId);
2194 (*itStats).second.lastTtiBytesTransmitted = uldci.
m_tbSize;
2198 NS_LOG_DEBUG(
this <<
" No Stats for this allocated UE");
2213 }
while (((*it).first !=
m_nextRntiUl) && (rbPerFlow != 0));
2219 (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
2222 (*itStats).second.lastAveragedThroughput =
2223 ((1.0 - (1.0 /
m_timeWindow)) * (*itStats).second.lastAveragedThroughput) +
2224 ((1.0 /
m_timeWindow) * (
double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
2225 NS_LOG_INFO(
this <<
" UE total bytes " << (*itStats).second.totalBytesTransmitted);
2226 NS_LOG_INFO(
this <<
" UE average throughput " << (*itStats).second.lastAveragedThroughput);
2227 (*itStats).second.lastTtiBytesTransmitted = 0;