5#include "nr-mac-scheduler-ue-info.h"
14NS_LOG_COMPONENT_DEFINE(
"NrMacSchedulerUeInfo");
61 std::function<uint8_t(double)> postProcessing)
64 const auto sum = std::transform_reduce(
68 [](
auto a,
auto b) { return a + b; },
69 [ueInfo, field](
auto a) {
70 return ueInfo->m_dlSbMcsInfo.at(ueInfo->m_rbgToSb.at(a)).*field;
72 const auto avg = sum / ueInfo->
m_dlRBG.size();
73 return postProcessing(avg);
96 return ComputeMcs(
this, &SbMcsInfo::mcs, [](
double avg) {
return (uint8_t)floor(avg); });
100 return ComputeMcs(
this,
106 return ComputeMcs(
this, &SbMcsInfo::sinr, [amc =
m_dlAmc](
double avgSinr) {
107 return amc->GetMcsFromSpectralEfficiency(amc->GetSpectralEfficiencyForSinr(avgSinr));
111 NS_ABORT_MSG(
"Invalid csi source for MCS computation");
124 return ue->m_dlTbSize;
127std::unordered_map<uint8_t, LCGPtr>&
133std::unordered_map<uint8_t, LCGPtr>&
159 NS_LOG_DEBUG(
"UE " << ue <<
" LCG ID: " <<
static_cast<uint32_t
>(lcgId) <<
" LC ID "
160 <<
static_cast<uint32_t
>(lcId) <<
" QCI: " <<
static_cast<uint32_t
>(qci)
161 <<
" P: " <<
static_cast<uint32_t
>(P) <<
" minP: " << +minP);
222NrMacSchedulerUeInfo::GetTotalDlBuffer()
const
224 uint32_t totBuffer = 0;
225 for (
const auto& lcgInfo :
m_dlLCG)
227 const auto& lcg = lcgInfo.second;
228 totBuffer += lcg->GetTotalSize();
236 return m_getNumRbPerRbg();
240NrMacSchedulerUeInfo::ReleaseLC(uint8_t lcid)
242 for (
auto lcgIt =
m_dlLCG.begin(); lcgIt !=
m_dlLCG.end(); lcgIt++)
244 lcgIt->second->ReleaseLC(lcid);
246 for (
auto lcgIt =
m_ulLCG.begin(); lcgIt !=
m_ulLCG.end(); lcgIt++)
248 lcgIt->second->ReleaseLC(lcid);
253 if (it->second->GetLCId().empty())
266 if (it->second->GetLCId().empty())
Representation of a beam id.
uint8_t GetMcsFromSpectralEfficiency(double s) const
Get MCS from a SpectralEfficiency value.
Data structure to save all the HARQ process of an UE.
The representation of an user for any Mac scheduler.
std::vector< uint16_t > m_ulRBG
UL Resource Block Group assigned in this slot.
std::vector< uint16_t > m_dlRBG
DL Resource Block Group assigned in this slot.
uint32_t GetNumRbPerRbg() const
Retrieve the number of RB per RBG.
static std::vector< uint8_t > & GetUlSym(const UePtr &ue)
GetUlSym.
Ptr< NrAmc > m_dlAmc
AMC instance of scheduler associated with DL.
virtual void ResetDlSchedInfo()
Reset DL information.
uint8_t m_ulRank
UL rank (number of MIMO layers)
virtual void ResetUlMetric()
ResetUlMetric.
virtual void UpdateUlMetric()
Update UL metrics after resources have been assigned.
virtual void ResetDlMetric()
ResetDlMetric.
static std::unordered_map< uint8_t, LCGPtr > & GetUlLCG(const UePtr &ue)
GetUlLCG.
static void PrintLcInfo(uint16_t ue, uint8_t lcgId, uint8_t lcId, uint8_t cqi, uint8_t P, uint8_t minP)
Prints information related to the QCI of a UEs LC.
static std::vector< uint16_t > & GetUlRBG(const UePtr &ue)
GetUlRBG.
static NrMacHarqVector & GetUlHarqVector(const UePtr &ue)
GetUlHarqVector.
uint8_t m_dlRank
DL rank (number of MIMO layers)
@ AVG_MCS
Estimate MCS based on the average MCS of allocated RBGs.
@ AVG_SPEC_EFF
Estimate MCS based on the average spectral efficiency of allocated RBGs.
@ AVG_SINR
Estimate MCS based on the average SINR of allocated RBGs.
@ WIDEBAND_MCS
Wideband MCS.
std::vector< uint8_t > m_ulSym
Corresponding symbol of m_ulRBG in this slot.
static std::vector< uint16_t > & GetDlRBG(const UePtr &ue)
GetDlRBG.
std::optional< uint8_t > m_fhMaxMcsAssignable
Maximum DL MCS assignable due to FH limitations.
NrMacSchedulerUeInfo()=delete
Default Constructor (deleted)
virtual ~NrMacSchedulerUeInfo()
~NrMacSchedulerUeInfo deconstructor
std::vector< SbMcsInfo > m_dlSbMcsInfo
static std::unordered_map< uint8_t, LCGPtr > & GetDlLCG(const UePtr &ue)
GetDlLCG.
uint8_t GetDlMcs() const
Get the downlink MCS, given by the wideband CQI, or the sub-band CQIs of the currently allocated RBGs...
std::vector< uint8_t > m_dlSym
Corresponding symbol of m_dlRBG in this slot.
static uint8_t & GetUlMcs(const UePtr &ue)
GetUlMcs.
std::unordered_map< uint8_t, LCGPtr > m_dlLCG
DL LCG.
static std::vector< uint8_t > & GetDlSym(const UePtr &ue)
GetDlSym.
std::unordered_map< uint8_t, LCGPtr > m_ulLCG
UL LCG.
virtual void UpdateDlMetric()
Update DL metrics after resources have been assigned.
virtual void ResetUlSchedInfo()
Reset UL information.
static NrMacHarqVector & GetDlHarqVector(const UePtr &ue)
GetDlHarqVector.
static uint32_t & GetDlTBS(const UePtr &ue)
GetDlTBS.
Ptr< NrAmc > m_ulAmc
AMC instance of scheduler associated with UL.
McsCsiSource m_mcsCsiSource
Source of MCS computation based on CSI feedback.