5G-LENA nr-v3.3-159-ga6832aa7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-mac-scheduler-ue-info-pf.h
1// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#pragma once
6
7#include "nr-mac-scheduler-ue-info-rr.h"
8
9namespace ns3
10{
11
24{
25 public:
32 NrMacSchedulerUeInfoPF(float alpha, uint16_t rnti, BeamId beamId, const GetRbPerRbgFn& fn)
33 : NrMacSchedulerUeInfo(rnti, beamId, fn),
34 m_alpha(alpha)
35 {
36 }
37
54
71
80
89
99 void UpdateDlPFMetric(const NrMacSchedulerNs3::FTResources& totAssigned, double timeWindow);
100
110 void UpdateUlPFMetric(const NrMacSchedulerNs3::FTResources& totAssigned, double timeWindow);
111
116 void CalculatePotentialTPutDl(const NrMacSchedulerNs3::FTResources& assignableInIteration);
117
122 void CalculatePotentialTPutUl(const NrMacSchedulerNs3::FTResources& assignableInIteration);
123
141 {
142 auto luePtr = dynamic_cast<NrMacSchedulerUeInfoPF*>(lue.first.get());
143 auto ruePtr = dynamic_cast<NrMacSchedulerUeInfoPF*>(rue.first.get());
144
145 double lPfMetric = std::pow(luePtr->m_potentialTputDl, luePtr->m_alpha) /
146 std::max(1E-9, luePtr->m_avgTputDl);
147 double rPfMetric = std::pow(ruePtr->m_potentialTputDl, ruePtr->m_alpha) /
148 std::max(1E-9, ruePtr->m_avgTputDl);
149
150 return (lPfMetric > rPfMetric);
151 }
152
170 {
171 auto luePtr = dynamic_cast<NrMacSchedulerUeInfoPF*>(lue.first.get());
172 auto ruePtr = dynamic_cast<NrMacSchedulerUeInfoPF*>(rue.first.get());
173
174 double lPfMetric = std::pow(luePtr->m_potentialTputUl, luePtr->m_alpha) /
175 std::max(1E-9, luePtr->m_avgTputUl);
176 double rPfMetric = std::pow(ruePtr->m_potentialTputUl, ruePtr->m_alpha) /
177 std::max(1E-9, ruePtr->m_avgTputUl);
178
179 return (lPfMetric > rPfMetric);
180 }
181
182 double m_currTputDl{0.0};
183 double m_avgTputDl{0.0};
184 double m_lastAvgTputDl{0.0};
185 double m_potentialTputDl{0.0};
187 float m_alpha{0.0};
188
189 double m_currTputUl{0.0};
190 double m_avgTputUl{0.0};
191 double m_lastAvgTputUl{0.0};
192 double m_potentialTputUl{0.0};
194};
195
196} // namespace ns3
Representation of a beam id.
Definition beam-id.h:26
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 proportional fair scheduler.
NrMacSchedulerUeInfoPF(float alpha, uint16_t rnti, BeamId beamId, const GetRbPerRbgFn &fn)
NrMacSchedulerUeInfoPF constructor.
double m_currTputDl
Current slot throughput in downlink.
double m_avgTputDl
Average throughput in downlink during all the slots.
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 ...
void ResetUlMetric() override
Reset the UL avg Th to the last value.
void UpdateUlPFMetric(const NrMacSchedulerNs3::FTResources &totAssigned, double timeWindow)
Update the PF metric for uplink.
double m_lastAvgTputUl
Last average throughput in uplink.
void ResetDlSchedInfo() override
Reset DL PF scheduler info.
void ResetDlMetric() override
Reset the DL avg Th to the last value.
void CalculatePotentialTPutDl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for downlink.
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 ...
void UpdateDlPFMetric(const NrMacSchedulerNs3::FTResources &totAssigned, double timeWindow)
Update the PF metric for downlink.
double m_lastAvgTputDl
Last average throughput in downlink.
double m_currTputUl
Current slot throughput in uplink.
void CalculatePotentialTPutUl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for uplink.
void ResetUlSchedInfo() override
Reset UL PF scheduler info.
double m_avgTputUl
Average throughput in uplink during all the slots.
Point in the Frequency/Time plane.