7#include "nr-mac-scheduler-ue-info-rr.h"
139 NS_ASSERT_MSG(lQoSMetric > 0,
"Weight must be greater than zero");
140 NS_ASSERT_MSG(rQoSMetric > 0,
"Weight must be greater than zero");
142 return (lQoSMetric > rQoSMetric);
161 for (
const auto& ueLcg : ue.first->m_dlLCG)
163 std::vector<uint8_t> ueActiveLCs = ueLcg.second->GetActiveLCIds();
165 for (
const auto lcId : ueActiveLCs)
167 std::unique_ptr<NrMacSchedulerLC>&
LCPtr = ueLcg.second->GetLC(lcId);
168 double delayBudgetFactor = 1.0;
170 if (
LCPtr->m_resourceType == nr::LogicalChannelConfigListElement_s::QBT_DGBR)
174 LCPtr->m_rlcTransmissionQueueHolDelay);
176 weight += (100 -
LCPtr->m_priority) *
177 std::pow(uePtr->m_potentialTputDl, uePtr->m_alpha) /
178 std::max(1E-9, uePtr->m_avgTputDl) * delayBudgetFactor;
179 NS_ASSERT_MSG(weight > 0,
"Weight must be greater than zero");
200 double denominator = hol >= pdb ? 0.1 :
static_cast<double>(pdb) -
static_cast<double>(hol);
201 double delayBudgetFactor =
static_cast<double>(pdb) / denominator;
203 return delayBudgetFactor;
230 NS_ABORT_IF(leftP == 0);
231 NS_ABORT_IF(rightP == 0);
233 double lQoSMetric = (100 - leftP) * std::pow(luePtr->m_potentialTputUl, luePtr->m_alpha) /
234 std::max(1E-9, luePtr->m_avgTputUl);
235 double rQoSMetric = (100 - rightP) * std::pow(ruePtr->m_potentialTputUl, ruePtr->m_alpha) /
236 std::max(1E-9, ruePtr->m_avgTputUl);
238 return (lQoSMetric > rQoSMetric);
254 uint8_t ueMinPriority = 100;
256 for (
const auto& ueLcg : ue.first->m_dlLCG)
258 std::vector<uint8_t> ueActiveLCs = ueLcg.second->GetActiveLCIds();
260 for (
const auto lcId : ueActiveLCs)
262 std::unique_ptr<NrMacSchedulerLC>&
LCPtr = ueLcg.second->GetLC(lcId);
264 if (ueMinPriority >
LCPtr->m_priority)
266 ueMinPriority =
LCPtr->m_priority;
269 ue.first->PrintLcInfo(ue.first->m_rnti,
277 return ueMinPriority;
293 uint8_t ueMinPriority = 100;
295 for (
const auto& ueLcg : ue.first->m_ulLCG)
297 std::vector<uint8_t> ueActiveLCs = ueLcg.second->GetActiveLCIds();
299 for (
const auto lcId : ueActiveLCs)
301 std::unique_ptr<NrMacSchedulerLC>&
LCPtr = ueLcg.second->GetLC(lcId);
303 if (ueMinPriority >
LCPtr->m_priority)
305 ueMinPriority =
LCPtr->m_priority;
308 ue.first->PrintLcInfo(ue.first->m_rnti,
316 return ueMinPriority;
Representation of a beam id.
std::pair< UePtr, uint32_t > UePtrAndBufferReq
Pair between a pointer to NrMacSchedulerUeInfo and its buffer occupancy.
The representation of an user for any Mac scheduler.
virtual void ResetDlSchedInfo()
Reset DL information.
virtual void ResetUlMetric()
ResetUlMetric.
virtual void ResetDlMetric()
ResetDlMetric.
virtual void ResetUlSchedInfo()
Reset UL information.
UE representation for a QoS-based scheduler.
static uint8_t CalculateDlMinPriority(const NrMacSchedulerNs3::UePtrAndBufferReq &ue)
This function calculates the min Priority for the DL.
static bool CompareUeWeightsUl(const NrMacSchedulerNs3::UePtrAndBufferReq &lue, const NrMacSchedulerNs3::UePtrAndBufferReq &rue)
comparison function object (i.e. an object that satisfies the requirements of Compare) which returns ...
double m_currTputDl
Current slot throughput in downlink.
double m_currTputUl
Current slot throughput in uplink.
double m_avgTputDl
Average throughput in downlink during all the slots.
float m_alpha
PF fairness metric.
void ResetUlSchedInfo() override
Reset UL QoS scheduler info.
void ResetDlSchedInfo() override
Reset DL QoS scheduler info.
static double CalculateDlWeight(const NrMacSchedulerNs3::UePtrAndBufferReq &ue)
comparison function object (i.e. an object that satisfies the requirements of Compare) which returns ...
void UpdateUlQosMetric(const NrMacSchedulerNs3::FTResources &totAssigned, double timeWindow)
Update the QoS metric for uplink.
double m_avgTputUl
Average throughput in uplink during all the slots.
double m_lastAvgTputDl
Last average throughput in downlink.
double m_lastAvgTputUl
Last average throughput in uplink.
NrMacSchedulerUeInfoQos(float alpha, uint16_t rnti, BeamId beamId, const GetRbPerRbgFn &fn)
NrMacSchedulerUeInfoQos constructor.
static double CalculateDelayBudgetFactor(uint64_t pdb, uint16_t hol)
This function calculates the Delay Budget Factor for the case of DC-GBR LC. This value will then be u...
void UpdateDlQosMetric(const NrMacSchedulerNs3::FTResources &totAssigned, double timeWindow)
Update the QoS metric for downlink.
static uint8_t CalculateUlMinPriority(const NrMacSchedulerNs3::UePtrAndBufferReq &ue)
This function calculates the min Priority for the UL.
void CalculatePotentialTPutUl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for uplink.
void ResetDlMetric() override
Reset the DL avg Th to the last value.
void CalculatePotentialTPutDl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for downlink.
void ResetUlMetric() override
Reset the UL avg Th to the last value.
static bool CompareUeWeightsDl(const NrMacSchedulerNs3::UePtrAndBufferReq &lue, const NrMacSchedulerNs3::UePtrAndBufferReq &rue)
comparison function object (i.e. an object that satisfies the requirements of Compare) which returns ...
std::unique_ptr< NrMacSchedulerLC > LCPtr
Unique pointer to an instance of NrMacSchedulerLC.
Point in the Frequency/Time plane.