5G-LENA nr-v4.0
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-fh-control.h
1// Copyright (c) 2023 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#ifndef NR_FH_CONTROL_H
6#define NR_FH_CONTROL_H
7
8#include "nr-eesm-t1.h"
9#include "nr-eesm-t2.h"
10#include "nr-fh-phy-sap.h"
11#include "nr-fh-sched-sap.h"
12
13#include "ns3/object.h"
14
15namespace ns3
16{
17
18class NrFhPhySapUser;
19class NrFhPhySapProvider;
20class NrFhSchedSapUser;
21class NrFhSchedSapProvider;
22
55class NrFhControl : public Object
56{
57 public:
62
66 ~NrFhControl() override;
67
72 static TypeId GetTypeId();
73
81 void SetNrFhPhySapUser(uint16_t bwpId, NrFhPhySapUser* s);
82
88
96 void SetNrFhSchedSapUser(uint16_t bwpId, NrFhSchedSapUser* s);
97
103
108
119
125
134 void SetCellFhCapacity(uint32_t capacity);
135
140 void SetOverheadDyn(uint8_t overhead);
141
146 void SetEnableModComp(bool v);
147
155 void SetErrorModelType(std::string errorModelType);
156
162 void SetPhysicalCellId(uint16_t physCellId);
163
169 void SetFhNumerology(uint16_t bwpId, uint16_t num);
170
171 private:
176 FhControlMethod GetFhControlMethod() const;
177
182 uint8_t DoGetFhControlMethod() const;
183
188 uint16_t DoGetPhysicalCellId() const;
189
199 void DoSetActiveUe(uint16_t bwpId, uint16_t rnti, uint32_t bytes);
200
210 void DoUpdateActiveUesMap(
211 uint16_t bwpId,
212 const std::deque<VarTtiAllocInfo>& allocation,
213 const std::unordered_map<uint16_t, std::shared_ptr<NrMacSchedulerUeInfo>>& ueMap);
214
222 void DoSetActiveHarqUes(uint16_t bwpId, uint16_t rnti);
223
235 bool DoGetDoesAllocationFit(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank);
236
248 uint8_t DoGetMaxMcsAssignable(uint16_t bwpId, uint32_t reg, uint32_t rnti, uint8_t dlRank);
249
261 uint32_t DoGetMaxRegAssignable(uint16_t bwpId, uint32_t mcs, uint32_t rnti, uint8_t dlRank);
262
273 void DoUpdateTracesBasedOnDroppedData(uint16_t bwpId,
274 uint32_t mcs,
275 uint32_t nRbgs,
276 uint32_t nSymb,
277 uint8_t dlRank);
278
285 void DoNotifyEndSlot(uint16_t bwpId, SfnSf currentSlot);
286
297 uint64_t GetFhThr(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank) const;
298
305 uint16_t GetNumberActiveBwps() const;
306
313 uint16_t GetNumberActiveUes(uint16_t bwpId) const;
314
324 uint8_t GetMaxMcs(uint8_t mcsTable, uint16_t modOrder) const;
325
326 uint16_t m_physicalCellId;
327
328 // FH Control - PHY SAP
329 std::map<uint16_t, NrFhPhySapUser*> m_fhPhySapUser;
330 NrFhPhySapProvider* m_fhPhySapProvider;
331
332 // FH Control - SCHEDULER SAP
333 std::map<uint16_t, NrFhSchedSapUser*>
334 m_fhSchedSapUser;
335 NrFhSchedSapProvider* m_fhSchedSapProvider;
336
337 enum FhControlMethod m_fhControlMethod;
338 uint32_t m_fhCapacity{
339 1000};
340 uint8_t m_overheadDyn{32};
341 uint8_t m_mcsTable{2};
342 std::string m_errorModelType;
343 bool m_enableModComp{
344 true};
345
346 std::unordered_map<uint16_t, uint16_t> m_numerologyPerBwp;
347 std::unordered_map<uint32_t, uint32_t>
348 m_rntiQueueSize;
350 // std::unordered_map<uint16_t, uint16_t>
351 std::unordered_map<uint16_t, std::set<uint16_t>>
352 m_activeUesPerBwp;
353 // std::unordered_map<uint16_t, uint16_t>
354 // m_activeBwps; //!< Map of active BWPs - with UEs with new data (bwpId, number of UEs)
355 std::unordered_map<uint16_t, std::set<uint16_t>>
356 m_activeHarqUesPerBwp;
357 // std::unordered_map<uint16_t, uint16_t>
358 // m_activeHarqBwps; //!< Map of active BWPs - with UEs with active HARQ (bwpId, number of
359 // UEs)
360
361 uint64_t m_allocThrPerCell{0};
362 std::unordered_map<uint16_t, uint64_t>
363 m_allocThrPerBwp;
364
365 std::unordered_map<uint16_t, uint64_t>
366 m_reqFhDlThrTracedValuePerBwp;
367 std::unordered_map<uint16_t, uint32_t>
368 m_rbsAirTracedValue;
369 std::unordered_map<uint16_t, SfnSf> m_waitingSlotPerBwp;
370
371 // SfnSf, physicalCellId, bwpId, FH throughput
372 TracedCallback<const SfnSf&, uint16_t, uint16_t, uint64_t>
373 m_reqFhDlThrTrace;
374 // SfnSf, physicalCellId, bwpId, RBs used
375 TracedCallback<const SfnSf&, uint16_t, uint16_t, uint32_t>
376 m_rbsAirTrace;
377
378 NrEesmT1 nrEesmT1;
379 NrEesmT2 nrEesmT2;
380};
381
382} // end namespace ns3
383
384#endif // NR_FH_CONTROL_H
Template for the implementation of the NrFhPhySapProvider as a member of an owner class of type C to ...
Template for the implementation of the NrFhSchedSapProvider as a member of an owner class of type C t...
Fronthaul Capacity Control.
void SetNrFhPhySapUser(uint16_t bwpId, NrFhPhySapUser *s)
Set the Fh control - PHY SAP User PHY is per bwp as such we store in a map the bwpId and the correspo...
NrFhPhySapProvider * GetNrFhPhySapProvider()
Get the Fh control - PHY SAP User ptr.
void SetCellFhCapacity(uint32_t capacity)
Set the available fronthaul capacity of the cell. Notice that throughout the code,...
void SetErrorModelType(std::string errorModelType)
Set the ErrorModelType based on which the MCS Table (1 or 2) will be set." "ns3::NrEesmIrT1 an...
~NrFhControl() override
~NrFhControl deconstructor
NrFhControl()
NrFhControl constructor.
void SetEnableModComp(bool v)
Set modulation compression usage for functional split option 7.2.
NrFhSchedSapProvider * GetNrFhSchedSapProvider()
Get the Fh control - Sched SAP User ptr.
void SetOverheadDyn(uint8_t overhead)
Set the overhead for dynamic modulation compression.
FhControlMethod
The optimization models (FH Control method) of the NrFhControl.
@ Postponing
Postpone sending data (MAC Layer)
@ OptimizeRBs
Optimize RBs allocated.
@ Dropping
Drop DCI + DATA at the PHY Layer.
@ OptimizeMcs
Optimize MCS.
static TypeId GetTypeId()
GetTypeId.
void SetPhysicalCellId(uint16_t physCellId)
Set the physical cell Id of the cell to which this NrFhControl instance belongs to.
void SetFhNumerology(uint16_t bwpId, uint16_t num)
Set the numerology.
void SetFhControlMethod(FhControlMethod model)
Set the FH Control method type.
void SetNrFhSchedSapUser(uint16_t bwpId, NrFhSchedSapUser *s)
Set the Fh control - Sched SAP User Sched is per bwp as such we store in a map the bwpId and the corr...
Service Access Point (SAP) offered by the FhControl instance to the gnb PHY instance.
Service Access Point (SAP) offered by the gnb PHY instance to the FhControl instance.
Service Access Point (SAP) offered by the FhControl instance to the MAC Scheduler instance.
Service Access Point (SAP) offered by the MAC Scheduler instance to the FhControl instance.
The SfnSf class.
Definition sfnsf.h:32