5G-LENA nr-v3.3-81-g75c7590d
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-fh-phy-sap.h"
9#include "nr-fh-sched-sap.h"
10
11#include <ns3/object.h>
12
13namespace ns3
14{
15
16class NrFhPhySapUser;
17class NrFhPhySapProvider;
18class NrFhSchedSapUser;
19class NrFhSchedSapProvider;
20
53class NrFhControl : public Object
54{
55 public:
60
64 ~NrFhControl() override;
65
70 static TypeId GetTypeId();
71
79 void SetNrFhPhySapUser(uint16_t bwpId, NrFhPhySapUser* s);
80
86
94 void SetNrFhSchedSapUser(uint16_t bwpId, NrFhSchedSapUser* s);
95
101
106
117
123
132 void SetCellFhCapacity(uint32_t capacity);
133
138 void SetOverheadDyn(uint8_t overhead);
139
147 void SetErrorModelType(std::string errorModelType);
148
154 void SetPhysicalCellId(uint16_t physCellId);
155
161 void SetFhNumerology(uint16_t bwpId, uint16_t num);
162
163 private:
168 FhControlMethod GetFhControlMethod() const;
169
174 uint8_t DoGetFhControlMethod() const;
175
180 uint16_t DoGetPhysicalCellId() const;
181
191 void DoSetActiveUe(uint16_t bwpId, uint16_t rnti, uint32_t bytes);
192
202 void DoUpdateActiveUesMap(
203 uint16_t bwpId,
204 const std::deque<VarTtiAllocInfo>& allocation,
205 const std::unordered_map<uint16_t, std::shared_ptr<NrMacSchedulerUeInfo>>& ueMap);
206
214 void DoSetActiveHarqUes(uint16_t bwpId, uint16_t rnti);
215
227 bool DoGetDoesAllocationFit(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank);
228
240 uint8_t DoGetMaxMcsAssignable(uint16_t bwpId, uint32_t reg, uint32_t rnti, uint8_t dlRank);
241
253 uint32_t DoGetMaxRegAssignable(uint16_t bwpId, uint32_t mcs, uint32_t rnti, uint8_t dlRank);
254
265 void DoUpdateTracesBasedOnDroppedData(uint16_t bwpId,
266 uint32_t mcs,
267 uint32_t nRbgs,
268 uint32_t nSymb,
269 uint8_t dlRank);
270
277 void DoNotifyEndSlot(uint16_t bwpId, SfnSf currentSlot);
278
289 uint64_t GetFhThr(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank) const;
290
297 uint16_t GetNumberActiveBwps() const;
298
305 uint16_t GetNumberActiveUes(uint16_t bwpId) const;
306
316 uint8_t GetMaxMcs(uint8_t mcsTable, uint16_t modOrder) const;
317
321 uint32_t GetModulationOrderTable1(const uint32_t mcs) const;
322
326 uint32_t GetModulationOrderTable2(const uint32_t mcs) const;
327
331 uint8_t GetMcsTable1(const uint8_t modOrder) const;
332
336 uint8_t GetMcsTable2(const uint8_t modOrder) const;
337
338 uint16_t m_physicalCellId;
339
340 // FH Control - PHY SAP
341 std::map<uint16_t, NrFhPhySapUser*> m_fhPhySapUser;
342 NrFhPhySapProvider* m_fhPhySapProvider;
343
344 // FH Control - SCHEDULER SAP
345 std::map<uint16_t, NrFhSchedSapUser*>
346 m_fhSchedSapUser;
347 NrFhSchedSapProvider* m_fhSchedSapProvider;
348
349 enum FhControlMethod m_fhControlMethod;
350 uint32_t m_fhCapacity{
351 1000};
352 uint8_t m_overheadDyn{32};
353 uint8_t m_mcsTable{2};
354 std::string m_errorModelType;
355
356 std::unordered_map<uint16_t, uint16_t> m_numerologyPerBwp;
357 std::unordered_map<uint32_t, uint32_t>
358 m_rntiQueueSize;
360 // std::unordered_map<uint16_t, uint16_t>
361 std::unordered_map<uint16_t, std::set<uint16_t>>
362 m_activeUesPerBwp;
363 // std::unordered_map<uint16_t, uint16_t>
364 // m_activeBwps; //!< Map of active BWPs - with UEs with new data (bwpId, number of UEs)
365 std::unordered_map<uint16_t, std::set<uint16_t>>
366 m_activeHarqUesPerBwp;
367 // std::unordered_map<uint16_t, uint16_t>
368 // m_activeHarqBwps; //!< Map of active BWPs - with UEs with active HARQ (bwpId, number of
369 // UEs)
370
371 uint64_t m_allocThrPerCell{0};
372 std::unordered_map<uint16_t, uint64_t>
373 m_allocThrPerBwp;
374
375 std::unordered_map<uint16_t, uint64_t>
376 m_reqFhDlThrTracedValuePerBwp;
377 std::unordered_map<uint16_t, uint32_t>
378 m_rbsAirTracedValue;
379 std::unordered_map<uint16_t, SfnSf> m_waitingSlotPerBwp;
380
381 // SfnSf, physicalCellId, bwpId, FH throughput
382 TracedCallback<const SfnSf&, uint16_t, uint16_t, uint64_t>
383 m_reqFhDlThrTrace;
384 // SfnSf, physicalCellId, bwpId, RBs used
385 TracedCallback<const SfnSf&, uint16_t, uint16_t, uint32_t>
386 m_rbsAirTrace;
387};
388
389} // end namespace ns3
390
391#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.
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