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-pf.cc
1// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "nr-mac-scheduler-ue-info-pf.h"
6
7#include "ns3/log.h"
8
9namespace ns3
10{
11
12NS_LOG_COMPONENT_DEFINE("NrMacSchedulerUeInfoPF");
13
14void
16 double timeWindow)
17{
18 NS_LOG_FUNCTION(this);
19
21
22 m_currTputDl = static_cast<double>(m_dlTbSize) / (totAssigned.m_sym);
23 m_avgTputDl = ((1.0 - (1.0 / static_cast<double>(timeWindow))) * m_lastAvgTputDl) +
24 ((1.0 / timeWindow) * m_currTputDl);
25
26 NS_LOG_DEBUG("Update DL PF Metric for UE "
27 << m_rnti << " DL TBS: " << m_dlTbSize << " Updated currTputDl " << m_currTputDl
28 << " avgTputDl " << m_avgTputDl << " over n. of syms: " << +totAssigned.m_sym
29 << ", last Avg TH Dl " << m_lastAvgTputDl << " total sym assigned "
30 << static_cast<uint32_t>(totAssigned.m_sym)
31 << " updated DL metric: " << m_potentialTputDl / std::max(1E-9, m_avgTputDl));
32}
33
34void
36 double timeWindow)
37{
38 NS_LOG_FUNCTION(this);
39
41
42 m_currTputUl = static_cast<double>(m_ulTbSize) / (totAssigned.m_sym);
43 m_avgTputUl = ((1.0 - (1.0 / static_cast<double>(timeWindow))) * m_lastAvgTputUl) +
44 ((1.0 / timeWindow) * m_currTputUl);
45
46 NS_LOG_DEBUG("Update UL PF Metric for UE "
47 << m_rnti << " UL TBS: " << m_ulTbSize << " Updated currTputUl " << m_currTputUl
48 << " avgTputUl " << m_avgTputUl << " over n. of syms: " << +totAssigned.m_sym
49 << ", last Avg TH Ul " << m_lastAvgTputUl << " total sym assigned "
50 << static_cast<uint32_t>(totAssigned.m_sym)
51 << " updated UL metric: " << m_potentialTputUl / std::max(1E-9, m_avgTputUl));
52}
53
54void
56 const NrMacSchedulerNs3::FTResources& assignableInIteration)
57{
58 NS_LOG_FUNCTION(this);
59
60 uint32_t rbsAssignable = assignableInIteration.m_rbg * GetNumRbPerRbg();
61 m_potentialTputDl = m_dlAmc->GetPayloadSize(GetDlMcs(), m_dlRank, rbsAssignable);
62 m_potentialTputDl /= assignableInIteration.m_sym;
63
64 NS_LOG_INFO("UE " << m_rnti << " potentialTputDl " << m_potentialTputDl << " lastAvgThDl "
66 << " DL metric: " << m_potentialTputDl / std::max(1E-9, m_avgTputDl));
67}
68
69void
71 const NrMacSchedulerNs3::FTResources& assignableInIteration)
72{
73 NS_LOG_FUNCTION(this);
74
75 uint32_t rbsAssignable = assignableInIteration.m_rbg * GetNumRbPerRbg();
76 m_potentialTputUl = m_ulAmc->GetPayloadSize(m_ulMcs, m_ulRank, rbsAssignable);
77 m_potentialTputUl /= assignableInIteration.m_sym;
78
79 NS_LOG_INFO("UE " << m_rnti << " potentialTputUl " << m_potentialTputUl << " lastAvgThUl "
81 << " UL metric: " << m_potentialTputUl / std::max(1E-9, m_avgTputUl));
82}
83
84} // 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)
uint8_t GetDlMcs() const
Get the downlink MCS, given by the wideband CQI, or the sub-band CQIs of the currently allocated RBGs...
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_avgTputDl
Average throughput in downlink during all the slots.
void UpdateUlPFMetric(const NrMacSchedulerNs3::FTResources &totAssigned, double timeWindow)
Update the PF metric for uplink.
double m_lastAvgTputUl
Last average throughput in uplink.
void CalculatePotentialTPutDl(const NrMacSchedulerNs3::FTResources &assignableInIteration)
Calculate the Potential throughput for downlink.
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.
double m_avgTputUl
Average throughput in uplink during all the slots.
Point in the Frequency/Time plane.
uint32_t m_rbg
Represent the starting RBG.
uint8_t m_sym
Represent the starting symbol.