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.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 "beam-id.h"
8#include "nr-amc.h"
9#include "nr-mac-harq-vector.h"
10#include "nr-mac-sched-sap.h"
11#include "nr-mac-scheduler-lcg.h"
12
13#include "ns3/matrix-array.h"
14
15#include <functional>
16#include <optional>
17#include <unordered_map>
18
19namespace ns3
20{
21
22class NrMacSchedulerUeInfo;
26typedef std::shared_ptr<NrMacSchedulerUeInfo> UePtr;
27
53{
54 public:
59
60 typedef std::function<uint32_t()> GetRbPerRbgFn;
61
67 NrMacSchedulerUeInfo(uint16_t rnti, BeamId beamId, const GetRbPerRbgFn& fn);
68
72 virtual ~NrMacSchedulerUeInfo();
73
79 static std::vector<uint16_t>& GetDlRBG(const UePtr& ue);
85 static std::vector<uint16_t>& GetUlRBG(const UePtr& ue);
91 static std::vector<uint8_t>& GetDlSym(const UePtr& ue);
97 static std::vector<uint8_t>& GetUlSym(const UePtr& ue);
98
99 enum class McsCsiSource
100 {
101 AVG_MCS,
103 AVG_SINR,
105 };
111 uint8_t GetDlMcs() const;
117 static uint8_t& GetDlMcs(const UePtr& ue);
123 static uint8_t& GetUlMcs(const UePtr& ue);
129 static uint32_t& GetDlTBS(const UePtr& ue);
130
136 static uint32_t& GetUlTBS(const UePtr& ue)
137 {
138 return ue->m_ulTbSize;
139 }
140
146 static std::unordered_map<uint8_t, LCGPtr>& GetDlLCG(const UePtr& ue);
152 static std::unordered_map<uint8_t, LCGPtr>& GetUlLCG(const UePtr& ue);
158 static NrMacHarqVector& GetDlHarqVector(const UePtr& ue);
164 static NrMacHarqVector& GetUlHarqVector(const UePtr& ue);
165
175 static void PrintLcInfo(uint16_t ue,
176 uint8_t lcgId,
177 uint8_t lcId,
178 uint8_t cqi,
179 uint8_t P,
180 uint8_t minP);
181
182 typedef std::function<std::unordered_map<uint8_t, LCGPtr>&(const UePtr& ue)> GetLCGFn;
183 typedef std::function<NrMacHarqVector&(const UePtr& ue)> GetHarqVectorFn;
184
191 virtual void ResetDlSchedInfo();
192
199 virtual void ResetUlSchedInfo();
200
206 virtual void UpdateDlMetric();
207
215 virtual void ResetDlMetric();
216
222 virtual void UpdateUlMetric();
223
231 virtual void ResetUlMetric();
232
233 uint32_t GetTotalDlBuffer() const;
234
238 struct CqiInfo
239 {
244 {
246 SB
247 } m_cqiType{WB};
248
249 std::vector<double> m_sinr;
250 uint8_t m_wbCqi{0};
251 std::vector<uint8_t> m_sbCqi;
252 uint32_t m_timer{0};
254 };
255
256 void ReleaseLC(uint8_t lcid);
257
258 uint16_t m_rnti{0};
260
261 std::unordered_map<uint8_t, LCGPtr> m_dlLCG;
262 std::unordered_map<uint8_t, LCGPtr> m_ulLCG;
263
264 uint32_t m_dlMRBRetx{0};
266 uint32_t m_ulMRBRetx{0};
268 std::vector<uint16_t> m_dlRBG;
269 std::vector<uint16_t> m_ulRBG;
270 std::vector<uint8_t> m_dlSym;
271 std::vector<uint8_t> m_ulSym;
272
273 uint8_t m_dlMcs{0};
274 std::optional<uint8_t>
276 uint8_t m_ulMcs{0};
277
279 {
280 uint8_t cqi;
281 uint8_t mcs;
282 float specEff;
283 float sinr;
284 };
285
286 std::vector<SbMcsInfo> m_dlSbMcsInfo;
288 std::vector<uint8_t> m_rbgToSb;
289
290 uint32_t m_dlTbSize{0};
292 uint32_t m_ulTbSize{0};
294 uint8_t m_dlRank{1};
295 uint8_t m_ulRank{1};
296 Ptr<const ComplexMatrixArray> m_dlPrecMats{nullptr};
297 Ptr<const ComplexMatrixArray> m_ulPrecMats{nullptr};
298
301
304
305 uint32_t m_srsPeriodicity{0};
306 uint32_t m_srsOffset{0};
307 uint8_t m_startMcsDlUe{0};
308
309 // Settings from the scheduler, that affects MCS, TBS and throughput computation
310 Ptr<NrAmc> m_dlAmc;
311 Ptr<NrAmc> m_ulAmc;
313
314 protected:
320 uint32_t GetNumRbPerRbg() const;
321
322 private:
323 const GetRbPerRbgFn m_getNumRbPerRbg;
325};
326
327} // namespace ns3
Representation of a beam id.
Definition beam-id.h:26
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.
static uint32_t & GetUlTBS(const UePtr &ue)
GetUlTBS.
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.
std::vector< uint8_t > m_rbgToSb
Precomputed RBG to SB mapping.
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.
NrMacHarqVector m_dlHarq
HARQ process vector for DL.
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.
Ptr< const ComplexMatrixArray > m_ulPrecMats
UL Precoding matrices.
uint32_t m_srsPeriodicity
SRS periodicity.
NrMacHarqVector m_ulHarq
HARQ process vector for UL.
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.
CqiInfo m_ulCqi
UL CQI information.
uint8_t m_startMcsDlUe
Starting DL MCS to be used.
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.
CqiInfo m_dlCqi
DL CQI information.
Ptr< const ComplexMatrixArray > m_dlPrecMats
DL Precoding matrices.
BeamId m_beamId
Beam ID of the UE (kept updated as much as possible by MAC)
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.
std::vector< uint8_t > m_sbCqi
Sub-band CQI reported values.
std::vector< double > m_sinr
Vector of SINR for the entire band.
enum ns3::NrMacSchedulerUeInfo::CqiInfo::CqiType WB
CQI type.