5G-LENA nr-v3.3-161-gad18933f
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-mac-scheduler-ofdma.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 "nr-mac-scheduler-ofdma-symbol-per-beam.h"
8#include "nr-mac-scheduler-tdma.h"
9
10#include "ns3/traced-value.h"
11
12#include <set>
13#include <unordered_set>
14
15namespace ns3
16{
17class NrMacSchedulerOfdmaSymbolPerBeam;
18class NrSchedOfdmaSymbolPerBeamTestCase;
19
57{
58 public:
63 static TypeId GetTypeId();
64
69
74 {
75 }
76
77 protected:
78 BeamSymbolMap AssignDLRBG(uint32_t symAvail, const ActiveUeMap& activeDl) const override;
79 BeamSymbolMap AssignULRBG(uint32_t symAvail, const ActiveUeMap& activeUl) const override;
80
81 std::shared_ptr<DciInfoElementTdma> CreateDlDci(
82 PointInFTPlane* spoint,
83 const std::shared_ptr<NrMacSchedulerUeInfo>& ueInfo,
84 uint32_t maxSym) const override;
85 std::shared_ptr<DciInfoElementTdma> CreateUlDci(
86 PointInFTPlane* spoint,
87 const std::shared_ptr<NrMacSchedulerUeInfo>& ueInfo,
88 uint32_t maxSym) const override;
89
96 void ChangeDlBeam(PointInFTPlane* spoint, uint32_t symOfBeam) const override;
97
98 void ChangeUlBeam(PointInFTPlane* spoint, uint32_t symOfBeam) const override;
99
108 const ActiveUeMap& activeDl) const;
109
110 uint8_t GetTpc() const override;
111
115 enum class SymPerBeamType
116 {
117 LOAD_BASED,
120 };
121
122 private:
128 std::vector<bool> CreateRbgBitmaskFromAllocatedRbgs(
129 const std::vector<uint16_t>& allocatedRbgs) const;
130
151 bool AdvanceToNextUeToSchedule(std::vector<UePtrAndBufferReq>::iterator& schedInfoIt,
152 const std::vector<UePtrAndBufferReq>::iterator end,
153 uint32_t resourcesAssignable) const;
164 bool ShouldScheduleUeBasedOnFronthaul(
165 const std::vector<UePtrAndBufferReq>::iterator& schedInfoIt,
166 uint32_t resourcesAssignable) const;
167
176 void DeallocateResourcesDueToFronthaulConstraint(const std::vector<UePtrAndBufferReq>& ueVector,
177 const uint32_t& beamSym,
178 FTResources& assignedResources,
179 std::vector<bool>& availableRbgs) const;
189 static void AllocateCurrentResourceToUe(std::shared_ptr<NrMacSchedulerUeInfo> currentUe,
190 const uint32_t& currentRbg,
191 const uint32_t beamSym,
192 FTResources& assignedResources,
193 std::vector<bool>& availableRbgs);
203 static void DeallocateCurrentResourceFromUe(std::shared_ptr<NrMacSchedulerUeInfo> currentUe,
204 const uint32_t& currentRbg,
205 const uint32_t beamSym,
206 FTResources& assignedResources,
207 std::vector<bool>& availableRbgs);
218 bool AttemptAllocationOfCurrentResourceToUe(
219 std::vector<UePtrAndBufferReq>::iterator schedInfoIt,
220 std::set<uint32_t>& remainingRbgSet,
221 const uint32_t beamSym,
222 FTResources& assignedResources,
223 std::vector<bool>& availableRbgs) const;
224
225 void SetSymPerBeamType(SymPerBeamType type);
226 TracedValue<uint32_t>
227 m_tracedValueSymPerBeam;
228
229 SymPerBeamType m_symPerBeamType;
230 Ptr<NrMacSchedulerOfdmaSymbolPerBeam> m_symPerBeam;
233};
234} // namespace ns3
std::unordered_map< BeamId, uint32_t, BeamIdHash > BeamSymbolMap
Map between a BeamId and the symbol assigned to that beam.
std::unordered_map< BeamId, std::vector< UePtrAndBufferReq >, BeamIdHash > ActiveUeMap
Map between a BeamId and a vector of UE (the UE are in that beam)
PointInFTPlane FTResources
Represent an amount of RBG/symbols that can be, or is, assigned.
The base for all the OFDMA schedulers.
std::shared_ptr< DciInfoElementTdma > CreateDlDci(PointInFTPlane *spoint, const std::shared_ptr< NrMacSchedulerUeInfo > &ueInfo, uint32_t maxSym) const override
Create the DL DCI in OFDMA mode.
void ChangeDlBeam(PointInFTPlane *spoint, uint32_t symOfBeam) const override
Advance the starting point by the number of symbols specified, resetting the RB count to 0.
~NrMacSchedulerOfdma() override
Deconstructor.
friend class NrSchedOfdmaSymbolPerBeamTestCase
Make it friend of the test case, so that the test case can access m_symPerBeam.
NrMacSchedulerOfdma()
NrMacSchedulerOfdma constructor.
std::shared_ptr< DciInfoElementTdma > CreateUlDci(PointInFTPlane *spoint, const std::shared_ptr< NrMacSchedulerUeInfo > &ueInfo, uint32_t maxSym) const override
Create a DCI for the specified UE for UL data.
NrMacSchedulerOfdma::BeamSymbolMap GetSymPerBeam(uint32_t symAvail, const ActiveUeMap &activeDl) const
Calculate the number of symbols to assign to each beam by calling using the technique selected in m_s...
BeamSymbolMap AssignULRBG(uint32_t symAvail, const ActiveUeMap &activeUl) const override
Assign the UL RBG to the active UE, and return the distribution of symbols per beam.
BeamSymbolMap AssignDLRBG(uint32_t symAvail, const ActiveUeMap &activeDl) const override
Assign the available DL RBG to the UEs.
SymPerBeamType
Enumeration of techniques to distribute the available symbols to the active beams.
@ ROUND_ROBIN
Distributes all symbols to the first active beam in the m_rrBeams queue.
@ PROPORTIONAL_FAIR
Distributes symbols to beams proportionally to mean achievable rate.
@ LOAD_BASED
Distributes symbols to beams proportionally to the buffer size of its users.
uint8_t GetTpc() const override
Returns TPC command.
static TypeId GetTypeId()
GetTypeId.
void ChangeUlBeam(PointInFTPlane *spoint, uint32_t symOfBeam) const override
Perform a custom operation on the starting point each time all the UE of an UL beam have been schedul...
The base for all the TDMA schedulers.