5G-LENA nr-v3.3-120-gdac69c56
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-mac-scheduler-ue-info-qos.cc
1// Copyright (c) 2022 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "nr-mac-scheduler-ue-info-qos.h"
6
7#include "ns3/log.h"
8
9namespace ns3
10{
11
12NS_LOG_COMPONENT_DEFINE("NrMacSchedulerUeInfoQos");
13
14void
16 double timeWindow)
17{
18 NS_LOG_FUNCTION(this);
19
21 m_currTputDl = static_cast<double>(m_dlTbSize) / (totAssigned.m_sym);
22 m_avgTputDl = ((1.0 - (1.0 / static_cast<double>(timeWindow))) * m_lastAvgTputDl) +
23 ((1.0 / timeWindow) * m_currTputDl);
24
25 NS_LOG_DEBUG("Update DL QoS Metric for UE "
26 << m_rnti << " DL TBS: " << m_dlTbSize << " Updated currTputDl " << m_currTputDl
27 << " avgTputDl " << m_avgTputDl << " over n. of syms: " << +totAssigned.m_sym
28 << ", last Avg TH Dl " << m_lastAvgTputDl << " total sym assigned "
29 << static_cast<uint32_t>(totAssigned.m_sym)
30 << " updated DL metric: " << m_potentialTputDl / std::max(1E-9, m_avgTputDl));
31}
32
33void
35 double timeWindow)
36{
37 NS_LOG_FUNCTION(this);
38
40
41 m_currTputUl = static_cast<double>(m_ulTbSize) / (totAssigned.m_sym);
42 m_avgTputUl = ((1.0 - (1.0 / static_cast<double>(timeWindow))) * m_lastAvgTputUl) +
43 ((1.0 / timeWindow) * m_currTputUl);
44
45 NS_LOG_DEBUG("Update UL PF Metric for UE "
46 << m_rnti << " UL TBS: " << m_ulTbSize << " Updated currTputUl " << m_currTputUl
47 << " avgTputUl " << m_avgTputUl << " over n. of syms: " << +totAssigned.m_sym
48 << ", last Avg TH Ul " << m_lastAvgTputUl << " total sym assigned "
49 << static_cast<uint32_t>(totAssigned.m_sym)
50 << " updated UL metric: " << m_potentialTputUl / std::max(1E-9, m_avgTputUl));
51}
52
53void
55 const NrMacSchedulerNs3::FTResources& assignableInIteration)
56{
57 NS_LOG_FUNCTION(this);
58
59 uint32_t rbsAssignable = assignableInIteration.m_rbg * GetNumRbPerRbg();
60 // Since we compute a new potential throughput every time, there is no harm
61 // in initializing it to zero here.
63 m_potentialTputDl = m_dlAmc->GetPayloadSize(m_dlMcs, m_dlRank, rbsAssignable);
64 m_potentialTputDl /= assignableInIteration.m_sym;
65
66 NS_LOG_INFO("UE " << m_rnti << " potentialTputDl " << m_potentialTputDl << " lastAvgThDl "
67 << m_lastAvgTputDl << " DL PF metric (partial part of QoS metric): "
68 << m_potentialTputDl / std::max(1E-9, m_avgTputDl));
69}
70
71void
73 const NrMacSchedulerNs3::FTResources& assignableInIteration)
74{
75 NS_LOG_FUNCTION(this);
76
77 uint32_t rbsAssignable = assignableInIteration.m_rbg * GetNumRbPerRbg();
78 m_potentialTputUl = m_ulAmc->GetPayloadSize(m_ulMcs, m_ulRank, rbsAssignable);
79 m_potentialTputUl /= assignableInIteration.m_sym;
80
81 NS_LOG_INFO("UE " << m_rnti << " potentialTputUl " << m_potentialTputUl << " lastAvgThUl "
82 << m_lastAvgTputUl << " UL PF metric (partial part of QoS metric): "
83 << m_potentialTputUl / std::max(1E-9, m_avgTputUl));
84}
85
86} // namespace ns3
uint32_t GetNumRbPerRbg() const
Retrieve the number of RB per RBG.
Ptr< NrAmc > m_dlAmc
AMC instance of scheduler associated with DL.
uint8_t m_ulRank
UL rank (number of MIMO layers)
virtual void UpdateUlMetric()
Update UL metrics after resources have been assigned.
uint8_t m_dlRank
DL rank (number of MIMO layers)
virtual void UpdateDlMetric()
Update DL metrics after resources have been assigned.
Ptr< NrAmc > m_ulAmc
AMC instance of scheduler associated with UL.
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.
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.
void UpdateDlQosMetric(const NrMacSchedulerNs3::FTResources &totAssigned, double timeWindow)
Update the QoS metric for downlink.
void CalculatePotentialTPutUl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for uplink.
void CalculatePotentialTPutDl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for downlink.
Point in the Frequency/Time plane.
uint32_t m_rbg
Represent the starting RBG.
uint8_t m_sym
Represent the starting symbol.