23 #include <ns3/pointer.h>
26 #include <ns3/simulator.h>
27 #include <ns3/lte-amc.h>
28 #include <ns3/tdtbfq-ff-mac-scheduler.h>
29 #include <ns3/lte-vendor-specific-parameters.h>
30 #include <ns3/boolean.h>
31 #include <ns3/integer.h>
143 : m_scheduler (scheduler)
218 : m_cschedSapUser (0),
223 m_amc = CreateObject <LteAmc> ();
251 static TypeId tid =
TypeId (
"ns3::TdTbfqFfMacScheduler")
253 .AddConstructor<TdTbfqFfMacScheduler> ()
254 .AddAttribute (
"CqiTimerThreshold",
255 "The number of TTIs a CQI is valid (default 1000 - 1 sec.)",
258 MakeUintegerChecker<uint32_t> ())
259 .AddAttribute (
"DebtLimit",
260 "Flow debt limit (default -625000 bytes)",
263 MakeIntegerChecker<int> ())
264 .AddAttribute (
"CreditLimit",
265 "Flow credit limit (default 625000 bytes)",
268 MakeUintegerChecker<uint32_t> ())
269 .AddAttribute (
"TokenPoolSize",
270 "The maximum value of flow token pool (default 1 bytes)",
273 MakeUintegerChecker<uint32_t> ())
274 .AddAttribute (
"CreditableThreshold",
275 "Threshold of flow credit (default 0 bytes)",
278 MakeUintegerChecker<uint32_t> ())
280 .AddAttribute (
"HarqEnabled",
281 "Activate/Deactivate the HARQ [by default is active].",
284 MakeBooleanChecker ())
285 .AddAttribute (
"UlGrantMcs",
286 "The MCS of the UL grant, must be [0..15] (default 0)",
289 MakeUintegerChecker<uint8_t> ())
344 dlHarqPrcStatus.resize (8,0);
347 dlHarqProcessesTimer.resize (8,0);
350 dlHarqdci.resize (8);
353 dlHarqRlcPdu.resize (2);
354 dlHarqRlcPdu.at (0).resize (8);
355 dlHarqRlcPdu.at (1).resize (8);
359 ulHarqPrcStatus.resize (8,0);
362 ulHarqdci.resize (8);
377 std::map <uint16_t, tdtbfqsFlowPerf_t>::iterator it;
397 m_flowStatsDl.insert (std::pair<uint16_t, tdtbfqsFlowPerf_t> (params.
m_rnti, flowStatsDl));
408 m_flowStatsUl.insert (std::pair<uint16_t, tdtbfqsFlowPerf_t> (params.
m_rnti, flowStatsUl));
415 m_flowStatsDl[(*it).first].tokenGenerationRate = mbrDlInBytes;
416 m_flowStatsUl[(*it).first].tokenGenerationRate = mbrUlInBytes;
430 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it =
m_rlcBufferReq.begin ();
431 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
466 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it =
m_rlcBufferReq.begin ();
467 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
470 if ((*it).first.m_rnti == params.
m_rnti)
496 std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
504 m_rlcBufferReq.insert (std::pair <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> (flow, params));
508 (*it).second = params;
533 for (
int i = 0; i < 4; i++)
548 std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
552 if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0)
553 || ((*it).second.m_rlcRetransmissionQueueSize > 0)
554 || ((*it).second.m_rlcStatusPduSize > 0) ))
558 if ((*it).first.m_rnti > rnti)
581 NS_FATAL_ERROR (
"No Process Id Statusfound for this RNTI " << rnti);
583 uint8_t i = (*it).second;
588 while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
589 if ((*itStat).second.at (i) == 0)
620 NS_FATAL_ERROR (
"No Process Id Statusfound for this RNTI " << rnti);
622 uint8_t i = (*it).second;
627 while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
628 if ((*itStat).second.at (i) == 0)
631 (*itStat).second.at (i) = 1;
635 NS_FATAL_ERROR (
"No HARQ process available for RNTI " << rnti <<
" check before update with HarqProcessAvailability");
638 return ((*it).second);
647 std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itTimers;
656 NS_LOG_DEBUG (
this <<
" Reset HARQ proc " << i <<
" for RNTI " << (*itTimers).first);
657 std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat =
m_dlHarqProcessesStatus.find ((*itTimers).first);
660 NS_FATAL_ERROR (
"No Process Id Status found for this RNTI " << (*itTimers).first);
662 (*itStat).second.at (i) = 0;
663 (*itTimers).second.at (i) = 0;
667 (*itTimers).second.at (i)++;
690 std::map <uint16_t, std::vector <uint16_t> > allocationMap;
691 std::vector <bool> rbgMap;
692 uint16_t rbgAllocatedNum = 0;
693 std::set <uint16_t> rntiAllocated;
699 uint16_t rbStart = 0;
700 std::vector <struct RachListElement_s>::iterator itRach;
705 newRar.
m_rnti = (*itRach).m_rnti;
709 newRar.m_grant.m_rnti = newRar.m_rnti;
712 uint16_t tbSizeBits = 0;
719 if (tbSizeBits < (*itRach).m_estimatedSize)
724 newRar.m_grant.m_rbStart = rbStart;
725 newRar.m_grant.m_rbLen = rbLen;
726 newRar.m_grant.m_tbSize = tbSizeBits / 8;
727 newRar.m_grant.m_hopping =
false;
728 newRar.m_grant.m_tpc = 0;
729 newRar.m_grant.m_cqiRequest =
false;
730 newRar.m_grant.m_ulDelay =
false;
731 NS_LOG_INFO (
this <<
" UL grant allocated to RNTI " << (*itRach).m_rnti <<
" rbStart " << rbStart <<
" rbLen " << rbLen <<
" MCS " <<
m_ulGrantMcs <<
" tbSize " << newRar.m_grant.m_tbSize);
732 for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
736 rbStart = rbStart + rbLen;
750 NS_LOG_INFO (
this <<
" Received DL-HARQ feedback");
766 std::vector <struct DlInfoListElement_s> dlInfoListUntxed;
770 if (itRnti != rntiAllocated.end ())
776 std::vector <bool> retx;
777 NS_LOG_INFO (
this <<
" Processing DLHARQ feedback");
781 retx.push_back (
false);
788 if (retx.at (0) || retx.at (1))
793 NS_LOG_INFO (
this <<
" HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId);
802 if (dci.
m_rv.size () == 1)
804 rv = dci.
m_rv.at (0);
808 rv = (dci.
m_rv.at (0) > dci.
m_rv.at (1) ? dci.
m_rv.at (0) : dci.
m_rv.at (1));
814 NS_LOG_INFO (
"Maximum number of retransmissions reached -> drop process");
820 (*it).second.at (harqId) = 0;
826 for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
828 (*itRlcPdu).second.at (k).at (harqId).clear ();
834 std::vector <int> dciRbg;
837 for (
int j = 0; j < 32; j++)
841 dciRbg.push_back (j);
847 for (uint8_t j = 0; j < dciRbg.size (); j++)
849 if (rbgMap.at (dciRbg.at (j)) ==
true)
859 for (uint8_t j = 0; j < dciRbg.size (); j++)
861 rbgMap.at (dciRbg.at (j)) =
true;
862 NS_LOG_INFO (
"RBG " << dciRbg.at (j) <<
" assigned");
866 NS_LOG_INFO (
this <<
" Send retx in the same RBGs");
872 uint8_t rbgId = (dciRbg.at (dciRbg.size () - 1) + 1) % rbgNum;
873 uint8_t startRbg = dciRbg.at (dciRbg.size () - 1);
874 std::vector <bool> rbgMapCopy = rbgMap;
875 while ((j < dciRbg.size ())&&(startRbg != rbgId))
877 if (rbgMapCopy.at (rbgId) ==
false)
879 rbgMapCopy.at (rbgId) =
true;
880 dciRbg.at (j) = rbgId;
885 if (j == dciRbg.size ())
888 uint32_t rbgMask = 0;
889 for (uint16_t k = 0; k < dciRbg.size (); k++)
891 rbgMask = rbgMask + (0x1 << dciRbg.at (k));
896 NS_LOG_INFO (
this <<
" Move retx in RBGs " << dciRbg.size ());
901 dlInfoListUntxed.push_back (params.
m_dlInfoList.at (i));
902 NS_LOG_INFO (
this <<
" No resource for this retx -> buffer it");
910 NS_FATAL_ERROR (
"Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
912 for (uint8_t j = 0; j < nLayers; j++)
916 if (j >= dci.
m_ndi.size ())
919 dci.
m_ndi.push_back (0);
920 dci.
m_rv.push_back (0);
921 dci.
m_mcs.push_back (0);
923 NS_LOG_INFO (
this <<
" layer " << (uint16_t)j <<
" no txed (MIMO transition)");
927 dci.
m_ndi.at (j) = 0;
929 (*itHarq).second.at (harqId).m_rv.at (j)++;
930 NS_LOG_INFO (
this <<
" layer " << (uint16_t)j <<
" RV " << (uint16_t)dci.
m_rv.at (j));
936 dci.
m_ndi.at (j) = 0;
938 dci.
m_mcs.at (j) = 0;
940 NS_LOG_INFO (
this <<
" layer " << (uint16_t)j <<
" no retx");
943 for (uint16_t k = 0; k < (*itRlcPdu).second.at (0).at (dci.
m_harqProcess).size (); k++)
945 std::vector <struct RlcPduListElement_s> rlcPduListPerLc;
946 for (uint8_t j = 0; j < nLayers; j++)
950 if (j < dci.
m_ndi.size ())
952 rlcPduListPerLc.push_back ((*itRlcPdu).second.at (j).at (dci.
m_harqProcess).at (k));
957 if (rlcPduListPerLc.size () > 0)
964 (*itHarq).second.at (harqId).
m_rv = dci.
m_rv;
969 NS_FATAL_ERROR (
"Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
971 (*itHarqTimer).second.at (harqId) = 0;
973 rntiAllocated.insert (rnti);
990 for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
1001 std::map <uint16_t, tdtbfqsFlowPerf_t>::iterator itStats;
1004 if ( (*itStats).second.tokenGenerationRate / 1000 + (*itStats).second.tokenPoolSize > (*itStats).second.maxTokenPoolSize )
1006 (*itStats).second.counter += (*itStats).second.tokenGenerationRate / 1000 - ( (*itStats).second.maxTokenPoolSize - (*itStats).second.tokenPoolSize );
1007 (*itStats).second.tokenPoolSize = (*itStats).second.maxTokenPoolSize;
1008 bankSize += (*itStats).second.tokenGenerationRate / 1000 - ( (*itStats).second.maxTokenPoolSize - (*itStats).second.tokenPoolSize );
1012 (*itStats).second.tokenPoolSize += (*itStats).second.tokenGenerationRate / 1000;
1018 std::map <uint16_t, tdtbfqsFlowPerf_t>::iterator it;
1019 std::map <uint16_t, tdtbfqsFlowPerf_t>::iterator itMax =
m_flowStatsDl.end ();
1020 double metricMax = 0.0;
1021 bool firstRnti =
true;
1024 std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
1028 if (itRnti != rntiAllocated.end ())
1030 NS_LOG_DEBUG (
this <<
" RNTI discared for HARQ tx" << (uint16_t)(*it).first);
1034 NS_LOG_DEBUG (
this <<
" RNTI discared for HARQ id" << (uint16_t)(*it).first);
1046 double metric = ( ( (double)(*it).second.counter ) / ( (double)(*it).second.tokenGenerationRate ) );
1048 if (firstRnti ==
true)
1055 if (metric > metricMax)
1070 std::vector <uint16_t> tempMap;
1071 for (
int i = 0; i < rbgNum; i++)
1073 if ( rbgMap.at (i) ==
true)
1076 tempMap.push_back (i);
1077 rbgMap.at (i) =
true;
1079 allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax).first, tempMap));
1086 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.begin ();
1087 while (itMap != allocationMap.end ())
1091 newEl.
m_rnti = (*itMap).first;
1094 newDci.
m_rnti = (*itMap).first;
1102 lcActives = (uint16_t)65535;
1104 uint16_t RgbPerRnti = (*itMap).second.size ();
1105 std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
1107 std::map <uint16_t,uint8_t>::iterator itTxMode;
1111 NS_FATAL_ERROR (
"No Transmission Mode info on user " << (*itMap).first);
1114 std::vector <uint8_t> worstCqi (2, 15);
1117 for (uint16_t k = 0; k < (*itMap).second.size (); k++)
1119 if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
1121 for (uint8_t j = 0; j < nLayer; j++)
1123 if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size () > j)
1125 if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j)) < worstCqi.at (j))
1127 worstCqi.at (j) = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j));
1133 worstCqi.at (j) = 1;
1139 for (uint8_t j = 0; j < nLayer; j++)
1141 worstCqi.at (j) = 1;
1148 for (uint8_t j = 0; j < nLayer; j++)
1150 worstCqi.at (j) = 1;
1153 uint32_t bytesTxed = 0;
1154 for (uint8_t j = 0; j < nLayer; j++)
1156 newDci.
m_mcs.push_back (
m_amc->GetMcsFromCqi (worstCqi.at (j)));
1157 int tbSize = (
m_amc->GetTbSizeFromMcs (newDci.
m_mcs.at (j), RgbPerRnti * rbgSize) / 8);
1159 bytesTxed += tbSize;
1164 uint32_t rbgMask = 0;
1165 for (uint16_t k = 0; k < (*itMap).second.size (); k++)
1167 rbgMask = rbgMask + (0x1 << (*itMap).second.at (k));
1168 NS_LOG_INFO (
this <<
" Allocated RBG " << (*itMap).second.at (k));
1173 std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itBufReq;
1176 if (((*itBufReq).first.m_rnti == (*itMap).first)
1177 && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
1178 || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
1179 || ((*itBufReq).second.m_rlcStatusPduSize > 0) ))
1181 std::vector <struct RlcPduListElement_s> newRlcPduLe;
1182 for (uint8_t j = 0; j < nLayer; j++)
1188 newRlcPduLe.push_back (newRlcEl);
1196 NS_FATAL_ERROR (
"Unable to find RlcPdcList in HARQ buffer for RNTI " << (*itMap).first);
1198 (*itRlcPdu).second.at (j).at (newDci.
m_harqProcess).push_back (newRlcEl);
1203 if ((*itBufReq).first.m_rnti > (*itMap).first)
1208 for (uint8_t j = 0; j < nLayer; j++)
1210 newDci.
m_ndi.push_back (1);
1211 newDci.
m_rv.push_back (0);
1214 newEl.
m_dci = newDci;
1236 if ( bytesTxed <= (*itMax).second.tokenPoolSize )
1238 (*itMax).second.tokenPoolSize -= bytesTxed;
1242 (*itMax).second.counter = (*itMax).second.counter - ( bytesTxed - (*itMax).second.tokenPoolSize );
1243 (*itMax).second.tokenPoolSize = 0;
1244 if (
bankSize <= ( bytesTxed - (*itMax).second.tokenPoolSize ))
1280 for (
unsigned int i = 0; i < params.
m_cqiList.size (); i++)
1285 std::map <uint16_t,uint8_t>::iterator it;
1286 uint16_t rnti = params.
m_cqiList.at (i).m_rnti;
1291 m_p10CqiRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, params.
m_cqiList.at (i).m_wbCqi.at (0)) );
1298 (*it).second = params.
m_cqiList.at (i).m_wbCqi.at (0);
1300 std::map <uint16_t,uint32_t>::iterator itTimers;
1308 std::map <uint16_t,SbMeasResult_s>::iterator it;
1309 uint16_t rnti = params.
m_cqiList.at (i).m_rnti;
1314 m_a30CqiRxed.insert ( std::pair<uint16_t, SbMeasResult_s > (rnti, params.
m_cqiList.at (i).m_sbMeasResult) );
1320 (*it).second = params.
m_cqiList.at (i).m_sbMeasResult;
1321 std::map <uint16_t,uint32_t>::iterator itTimers;
1339 std::map <uint16_t, std::vector <double> >::iterator itCqi =
m_ueCqi.find (rnti);
1353 double sinr = (*itCqi).second.at (i);
1360 double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
1362 (*itCqi).second.at (rb) = estimatedSinr;
1363 return (estimatedSinr);
1376 std::vector <bool> rbMap;
1377 uint16_t rbAllocatedNum = 0;
1378 std::set <uint16_t> rntiAllocated;
1379 std::vector <uint16_t> rbgAllocationMap;
1390 if (rbgAllocationMap.at (i) != 0)
1392 rbMap.at (i) =
true;
1402 std::map <uint16_t, uint8_t>::iterator itProcId;
1405 (*itProcId).second = ((*itProcId).second + 1) %
HARQ_PROC_NUM;
1408 for (uint16_t i = 0; i < params.
m_ulInfoList.size (); i++)
1417 NS_LOG_ERROR (
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1420 NS_LOG_INFO (
this <<
" UL-HARQ retx RNTI " << rnti <<
" harqId " << (uint16_t)harqId <<
" i " << i <<
" size " << params.
m_ulInfoList.size ());
1424 NS_LOG_ERROR (
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1431 NS_LOG_ERROR (
"No info find in HARQ buffer for UE (might change eNB) " << rnti);
1433 if ((*itStat).second.at (harqId) >= 3)
1435 NS_LOG_INFO (
"Max number of retransmissions reached (UL)-> drop process");
1441 if (rbMap.at (j) ==
true)
1452 rbMap.at (j) =
true;
1453 rbgAllocationMap.at (j) = dci.
m_rnti;
1461 NS_LOG_INFO (
"Cannot allocate retx due to RACH allocations for UE " << rnti);
1466 (*itStat).second.at ((*itProcId).second) = (*itStat).second.at (harqId) + 1;
1467 (*itStat).second.at (harqId) = 0;
1468 (*itHarq).second.at ((*itProcId).second) = dci;
1470 rntiAllocated.insert (dci.
m_rnti);
1479 std::map <uint16_t,uint32_t>::iterator it;
1484 std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
1486 if (((*it).second > 0)&&(itRnti == rntiAllocated.end ()))
1509 int rbAllocated = 0;
1511 std::map <uint16_t, tdtbfqsFlowPerf_t>::iterator itStats;
1533 std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
1534 if ((itRnti != rntiAllocated.end ())||((*it).second == 0))
1537 NS_LOG_DEBUG (
this <<
" UE already allocated in HARQ -> discared, RNTI " << (*it).first);
1559 uldci.
m_rnti = (*it).first;
1561 bool allocated =
false;
1562 NS_LOG_INFO (
this <<
" RB Allocated " << rbAllocated <<
" rbPerFlow " << rbPerFlow <<
" flows " << nflows);
1567 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
1569 if (rbMap.at (j) ==
true)
1579 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
1581 rbMap.at (j) =
true;
1583 rbgAllocationMap.at (j) = (*it).first;
1585 rbAllocated += rbPerFlow;
1616 std::map <uint16_t, std::vector <double> >::iterator itCqi =
m_ueCqi.find ((*it).first);
1626 double minSinr = (*itCqi).second.at (uldci.
m_rbStart);
1633 double sinr = (*itCqi).second.at (i);
1638 if ((*itCqi).second.at (i) < minSinr)
1640 minSinr = (*itCqi).second.at (i);
1645 double s = log2 ( 1 + (
1646 std::pow (10, minSinr / 10 ) /
1647 ( (-std::log (5.0 * 0.00005 )) / 1.5) ));
1648 cqi =
m_amc->GetCqiFromSpectralEfficiency (s);
1661 rbgAllocationMap.at (i) = 0;
1687 std::map <uint16_t, uint8_t>::iterator itProcId;
1693 harqId = (*itProcId).second;
1699 (*itDci).second.at (harqId) = uldci;
1702 NS_LOG_INFO (
this <<
" UE Allocation RNTI " << (*it).first <<
" startPRB " << (uint32_t)uldci.
m_rbStart <<
" nPRB " << (uint32_t)uldci.
m_rbLen <<
" CQI " << cqi <<
" MCS " << (uint32_t)uldci.
m_mcs <<
" TBsize " << uldci.
m_tbSize <<
" RbAlloc " << rbAllocated <<
" harqId " << (uint16_t)harqId);
1745 std::map <uint16_t,uint32_t>::iterator it;
1747 for (
unsigned int i = 0; i < params.
m_macCeList.size (); i++)
1758 uint32_t buffer = 0;
1759 for (uint8_t lcg = 0; lcg < 4; ++lcg)
1761 uint8_t bsrId = params.
m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (lcg);
1766 NS_LOG_LOGIC (
this <<
"RNTI=" << rnti <<
" buffer=" << buffer);
1771 m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
1776 (*it).second = buffer;
1819 std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
1820 std::map <uint16_t, std::vector <double> >::iterator itCqi;
1821 NS_LOG_DEBUG (
this <<
" Collect PUSCH CQIs of Frame no. " << (params.
m_sfnSf >> 4) <<
" subframe no. " << (0xF & params.
m_sfnSf));
1827 for (uint32_t i = 0; i < (*itMap).second.size (); i++)
1831 itCqi =
m_ueCqi.find ((*itMap).second.at (i));
1835 std::vector <double> newCqi;
1840 newCqi.push_back (sinr);
1849 m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
1856 (*itCqi).second.at (i) = sinr;
1857 NS_LOG_DEBUG (
this <<
" RNTI " << (*itMap).second.at (i) <<
" RB " << i <<
" SINR " << sinr);
1859 std::map <uint16_t, uint32_t>::iterator itTimers;
1880 rnti = vsp->GetRnti ();
1883 std::map <uint16_t, std::vector <double> >::iterator itCqi;
1888 std::vector <double> newCqi;
1892 newCqi.push_back (sinr);
1893 NS_LOG_INFO (
this <<
" RNTI " << rnti <<
" new SRS-CQI for RB " << j <<
" value " << sinr);
1896 m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
1906 (*itCqi).second.at (j) = sinr;
1907 NS_LOG_INFO (
this <<
" RNTI " << rnti <<
" update SRS-CQI for RB " << j <<
" value " << sinr);
1910 std::map <uint16_t, uint32_t>::iterator itTimers;
1923 NS_FATAL_ERROR (
"TdTbfqFfMacScheduler supports only PUSCH and SRS UL-CQIs");
1936 std::map <uint16_t,uint32_t>::iterator itP10 =
m_p10CqiTimers.begin ();
1940 if ((*itP10).second == 0)
1943 std::map <uint16_t,uint8_t>::iterator itMap =
m_p10CqiRxed.find ((*itP10).first);
1945 NS_LOG_INFO (
this <<
" P10-CQI expired for user " << (*itP10).first);
1947 std::map <uint16_t,uint32_t>::iterator temp = itP10;
1959 std::map <uint16_t,uint32_t>::iterator itA30 =
m_a30CqiTimers.begin ();
1963 if ((*itA30).second == 0)
1966 std::map <uint16_t,SbMeasResult_s>::iterator itMap =
m_a30CqiRxed.find ((*itA30).first);
1968 NS_LOG_INFO (
this <<
" A30-CQI expired for user " << (*itA30).first);
1970 std::map <uint16_t,uint32_t>::iterator temp = itA30;
1989 std::map <uint16_t,uint32_t>::iterator itUl =
m_ueCqiTimers.begin ();
1993 if ((*itUl).second == 0)
1996 std::map <uint16_t, std::vector <double> >::iterator itMap =
m_ueCqi.find ((*itUl).first);
1997 NS_ASSERT_MSG (itMap !=
m_ueCqi.end (),
" Does not find CQI report for user " << (*itUl).first);
1998 NS_LOG_INFO (
this <<
" UL-CQI exired for user " << (*itUl).first);
1999 (*itMap).second.clear ();
2001 std::map <uint16_t,uint32_t>::iterator temp = itUl;
2018 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
2023 NS_LOG_INFO (
this <<
" UE " << rnti <<
" LC " << (uint16_t)lcid <<
" txqueue " << (*it).second.m_rlcTransmissionQueueSize <<
" retxqueue " << (*it).second.m_rlcRetransmissionQueueSize <<
" status " << (*it).second.m_rlcStatusPduSize <<
" decrease " << size);
2026 if (((*it).second.m_rlcStatusPduSize > 0) && (size >= (*it).second.m_rlcStatusPduSize))
2028 (*it).second.m_rlcStatusPduSize = 0;
2030 else if (((*it).second.m_rlcRetransmissionQueueSize > 0) && (size >= (*it).second.m_rlcRetransmissionQueueSize))
2032 (*it).second.m_rlcRetransmissionQueueSize = 0;
2034 else if ((*it).second.m_rlcTransmissionQueueSize > 0)
2036 uint32_t rlcOverhead;
2051 if ((*it).second.m_rlcTransmissionQueueSize <= size - rlcOverhead)
2053 (*it).second.m_rlcTransmissionQueueSize = 0;
2057 (*it).second.m_rlcTransmissionQueueSize -= size - rlcOverhead;
2063 NS_LOG_ERROR (
this <<
" Does not find DL RLC Buffer Report of UE " << rnti);
2072 std::map <uint16_t,uint32_t>::iterator it =
m_ceBsrRxed.find (rnti);
2075 NS_LOG_INFO (
this <<
" UE " << rnti <<
" size " << size <<
" BSR " << (*it).second);
2076 if ((*it).second >= size)
2078 (*it).second -= size;
2087 NS_LOG_ERROR (
this <<
" Does not find BSR report info of UE " << rnti);
2095 NS_LOG_FUNCTION (
this <<
" RNTI " << rnti <<
" txMode " << (uint16_t)txMode);
void DoSchedUlNoiseInterferenceReq(const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters ¶ms)
void RefreshUlCqiMaps(void)
std::vector< struct UlInfoListElement_s > m_ulInfoList
See section 4.3.1 dlDciListElement.
void DoCschedLcReleaseReq(const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters ¶ms)
TdTbfqFfMacScheduler * m_scheduler
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
virtual void DoDispose(void)
void DoSchedDlRlcBufferReq(const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters ¶ms)
TdTbfqFfMacScheduler * m_scheduler
void DoCschedUeConfigReq(const struct FfMacCschedSapProvider::CschedUeConfigReqParameters ¶ms)
virtual FfMacCschedSapProvider * GetFfMacCschedSapProvider()
friend class TdTbfqSchedulerMemberCschedSapProvider
void DoSchedDlRachInfoReq(const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters ¶ms)
TdTbfqSchedulerMemberCschedSapProvider()
uint32_t burstCredit
the number of token borrow or given to token bank
FfMacSchedSapProvider * m_schedSapProvider
enum ns3::UlCqi_s::Type_e m_type
friend class TdTbfqSchedulerMemberSchedSapProvider
std::vector< UlDciListElement_s > UlHarqProcessesDciBuffer_t
uint32_t maxTokenPoolSize
current size of token pool (byte)
std::vector< struct LogicalChannelConfigListElement_s > m_logicalChannelConfigList
std::vector< uint16_t > m_sinr
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
std::vector< uint8_t > DlHarqProcessesTimer_t
#define NS_ASSERT(condition)
virtual ~TdTbfqFfMacScheduler()
Hold a signed integer type.
virtual void CschedLcReleaseReq(const struct CschedLcReleaseReqParameters ¶ms)
#define NS_LOG_COMPONENT_DEFINE(name)
uint8_t HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
std::vector< uint8_t > m_mcs
TdTbfqSchedulerMemberSchedSapProvider()
See section 4.3.2 ulDciListElement.
std::vector< struct UlDciListElement_s > m_dciList
void DoCschedLcConfigReq(const struct FfMacCschedSapProvider::CschedLcConfigReqParameters ¶ms)
See section 4.3.10 buildRARListElement.
int counter
maximum size of token pool (byte)
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
virtual void CschedLcConfigReq(const struct CschedLcConfigReqParameters ¶ms)
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
std::vector< std::vector< struct RlcPduListElement_s > > m_rlcPduList
uint8_t m_transmissionMode
Implements the SCHED SAP and CSCHED SAP for a Time Domain Token Bank Fair Queue scheduler.
std::vector< struct RachListElement_s > m_rachList
uint8_t m_logicalChannelIdentity
#define NS_FATAL_ERROR(msg)
fatal error handling
FfMacCschedSapUser * m_cschedSapUser
TdTbfqFfMacScheduler()
Constructor.
void DoSchedUlTriggerReq(const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters ¶ms)
virtual void SchedUlNoiseInterferenceReq(const struct SchedUlNoiseInterferenceReqParameters ¶ms)
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
virtual void SchedUlMacCtrlInfoReq(const struct SchedUlMacCtrlInfoReqParameters ¶ms)
void RefreshDlCqiMaps(void)
std::vector< RlcPduList_t > DlHarqRlcPduListBuffer_t
virtual void CschedUeConfigUpdateInd(const struct CschedUeConfigUpdateIndParameters ¶ms)=0
void DoSchedUlSrInfoReq(const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters ¶ms)
std::vector< struct VendorSpecificListElement_s > m_vendorSpecificList
std::map< uint16_t, std::vector< uint16_t > > m_allocationMaps
int debtLimit
the maximum number of tokens connection i can borrow from the bank each time
Hold an unsigned integer type.
static uint8_t TxMode2LayerNum(uint8_t txMode)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
std::map< uint16_t, uint32_t > m_a30CqiTimers
virtual void SchedDlCqiInfoReq(const struct SchedDlCqiInfoReqParameters ¶ms)
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
std::vector< uint8_t > m_ndi
virtual void SchedDlTriggerReq(const struct SchedDlTriggerReqParameters ¶ms)
void DoSchedDlCqiInfoReq(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)
void DoSchedDlMacBufferReq(const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters ¶ms)
virtual void CschedUeConfigCnf(const struct CschedUeConfigCnfParameters ¶ms)=0
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
std::vector< uint8_t > m_logicalChannelIdentity
#define NS_LOG_LOGIC(msg)
uint8_t m_logicalChannelIdentity
std::vector< struct CqiListElement_s > m_cqiList
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
std::vector< struct DlInfoListElement_s > m_dlInfoList
FfMacSchedSapUser * m_schedSapUser
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
virtual FfMacSchedSapProvider * GetFfMacSchedSapProvider()
virtual void SchedDlConfigInd(const struct SchedDlConfigIndParameters ¶ms)=0
virtual void SetFfMacSchedSapUser(FfMacSchedSapUser *s)
int8_t m_pdcchPowerOffset
std::vector< uint16_t > m_tbsSize
See section 4.3.9 rlcPDU_ListElement.
uint64_t tokenGenerationRate
packet arrival rate( byte/s)
virtual void SchedDlPagingBufferReq(const struct SchedDlPagingBufferReqParameters ¶ms)
std::map< uint16_t, std::vector< double > > m_ueCqi
virtual void SchedDlRachInfoReq(const struct SchedDlRachInfoReqParameters ¶ms)
std::vector< DlDciListElement_s > DlHarqProcessesDciBuffer_t
virtual void SchedDlRlcBufferReq(const struct SchedDlRlcBufferReqParameters ¶ms)
std::vector< uint8_t > m_rv
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
std::map< uint16_t, uint8_t > m_p10CqiRxed
virtual void SchedUlConfigInd(const struct SchedUlConfigIndParameters ¶ms)=0
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
uint32_t creditableThreshold
counter threshold that the flow cannot further borrow tokens from bank
UlCqiFilter_t m_ulCqiFilter
uint32_t tokenPoolSize
token generation rate ( byte/s )
virtual void CschedCellConfigReq(const struct CschedCellConfigReqParameters ¶ms)
CSCHED_CELL_CONFIG_REQ.
virtual void SetFfMacCschedSapUser(FfMacCschedSapUser *s)
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
#define NS_ASSERT_MSG(condition, message)
virtual void CschedUeConfigReq(const struct CschedUeConfigReqParameters ¶ms)
uint8_t m_nrOfPdcchOfdmSymbols
void DoCschedUeReleaseReq(const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters ¶ms)
std::vector< struct MacCeListElement_s > m_macCeList
std::map< uint16_t, tdtbfqsFlowPerf_t > m_flowStatsDl
std::vector< struct RachListElement_s > m_rachList
static double fpS11dot3toDouble(uint16_t val)
virtual void SchedUlSrInfoReq(const struct SchedUlSrInfoReqParameters ¶ms)
std::map< uint16_t, uint8_t > m_uesTxMode
std::vector< uint8_t > UlHarqProcessesStatus_t
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
std::map< uint16_t, uint32_t > m_ueCqiTimers
std::vector< uint8_t > DlHarqProcessesStatus_t
static uint32_t BsrId2BufferSize(uint8_t val)
uint8_t m_transmissionMode
virtual void SchedDlMacBufferReq(const struct SchedDlMacBufferReqParameters ¶ms)
#define NS_LOG_DEBUG(msg)
virtual void CschedUeReleaseReq(const struct CschedUeReleaseReqParameters ¶ms)
int LcActivePerFlow(uint16_t rnti)
uint32_t m_cqiTimersThreshold
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
int TdTbfqType0AllocationRbg[4]
void DoSchedUlCqiInfoReq(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)
void DoCschedCellConfigReq(const struct FfMacCschedSapProvider::CschedCellConfigReqParameters ¶ms)
virtual void SchedUlTriggerReq(const struct SchedUlTriggerReqParameters ¶ms)
FfMacCschedSapProvider * m_cschedSapProvider
#define NS_LOG_ERROR(msg)
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
uint32_t m_creditableThreshold
void DoSchedDlPagingBufferReq(const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters ¶ms)
virtual void SchedUlCqiInfoReq(const struct SchedUlCqiInfoReqParameters ¶ms)
uint64_t packetArrivalRate
void DoSchedUlMacCtrlInfoReq(const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters ¶ms)
std::vector< uint16_t > m_rachAllocationMap
struct DlDciListElement_s m_dci
std::vector< struct BuildRarListElement_s > m_buildRarList
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
std::map< uint16_t, uint32_t > m_ceBsrRxed
a unique identifier for an interface.
void DoSchedDlTriggerReq(const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters ¶ms)
std::map< uint16_t, uint32_t > m_p10CqiTimers
TypeId SetParent(TypeId tid)
int GetRbgSize(int dlbandwidth)
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
std::vector< struct BuildDataListElement_s > m_buildDataList
std::map< uint16_t, tdtbfqsFlowPerf_t > m_flowStatsUl
uint8_t m_ueTxAntennaSelection
static TypeId GetTypeId(void)
See section 4.3.8 builDataListElement.