5G-LENA nr-v3.3-161-gad18933f
The 5G/NR module for the ns-3 simulator
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
nr-mac-scheduler-harq-rr.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-ns3.h"
8#include "nr-mac-scheduler-ue-info.h"
9#include "nr-phy-mac-common.h"
10
11namespace ns3
12{
13
24{
25 public:
27
32
36 virtual ~NrMacSchedulerHarqRr() = default;
37
42 void InstallGetBwpIdFn(const std::function<uint16_t()>& fn);
43
48 void InstallGetCellIdFn(const std::function<uint16_t()>& fn);
49
54 void InstallGetBwInRBG(const std::function<uint16_t()>& fn);
55
61 void InstallGetFhControlMethodFn(const std::function<uint8_t()>& fn);
62
69 const std::function<bool(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank)>&
70 fn);
71
72 virtual uint8_t ScheduleDlHarq(
74 uint8_t symAvail,
75 const NrMacSchedulerNs3::ActiveHarqMap& activeDlHarq,
76 const std::unordered_map<uint16_t, std::shared_ptr<NrMacSchedulerUeInfo>>& ueMap,
77 std::vector<DlHarqInfo>* dlHarqToRetransmit,
78 const std::vector<DlHarqInfo>& dlHarqFeedback,
79 SlotAllocInfo* slotAlloc) const;
80 virtual uint8_t ScheduleUlHarq(
82 uint8_t symAvail,
83 const std::unordered_map<uint16_t, std::shared_ptr<NrMacSchedulerUeInfo>>& ueMap,
84 std::vector<UlHarqInfo>* ulHarqToRetransmit,
85 const std::vector<UlHarqInfo>& ulHarqFeedback,
86 SlotAllocInfo* slotAlloc) const;
87 virtual void SortDlHarq(NrMacSchedulerNs3::ActiveHarqMap* activeDlHarq) const;
88 virtual void SortUlHarq(NrMacSchedulerNs3::ActiveHarqMap* activeUlHarq) const;
89
90 protected:
91 void BufferHARQFeedback(const std::vector<DlHarqInfo>& dlHarqFeedback,
92 std::vector<DlHarqInfo>* dlHarqToRetransmit,
93 uint16_t rnti,
94 uint8_t harqProcess) const;
99 uint16_t GetBwpId() const;
100
105 uint16_t GetCellId() const;
106
111 uint16_t GetBandwidthInRbg() const;
112
117 uint8_t GetFromSchedFhControlMethod() const;
118
123 bool GetDoesFhAllocationFit(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank) const;
124
125 private:
126 std::function<uint16_t()> m_getBwpId;
127 std::function<uint16_t()> m_getCellId;
128 std::function<uint16_t()> m_getBwInRbg;
129 std::function<uint8_t()> m_getFhControlMethod;
130 std::function<bool(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank)>
131 m_getDoesAllocationFit;
132};
133
134} // namespace ns3
Schedule the HARQ retransmission.
virtual uint8_t ScheduleUlHarq(NrMacSchedulerNs3::PointInFTPlane *startingPoint, uint8_t symAvail, const std::unordered_map< uint16_t, std::shared_ptr< NrMacSchedulerUeInfo > > &ueMap, std::vector< UlHarqInfo > *ulHarqToRetransmit, const std::vector< UlHarqInfo > &ulHarqFeedback, SlotAllocInfo *slotAlloc) const
Schedule the UL HARQ.
uint16_t GetBwpId() const
Get the bwp id of this MAC.
uint16_t GetCellId() const
Get the cell id of this MAC.
void InstallGetBwpIdFn(const std::function< uint16_t()> &fn)
Install a function to retrieve the bwp id.
void InstallDoesFhAllocationFitFn(const std::function< bool(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank)> &fn)
Install a function to retrieve whether the allocation fits when FH Control is enabled.
virtual void SortDlHarq(NrMacSchedulerNs3::ActiveHarqMap *activeDlHarq) const
Sort Dl Harq retx based on their symbol requirement.
uint16_t GetBandwidthInRbg() const
Get the bandwidth in RBG.
NrMacSchedulerHarqRr()
NrMacSchedulerHarqRr constructor.
void BufferHARQFeedback(const std::vector< DlHarqInfo > &dlHarqFeedback, std::vector< DlHarqInfo > *dlHarqToRetransmit, uint16_t rnti, uint8_t harqProcess) const
Find the specified HARQ process and buffer it into a vector.
virtual ~NrMacSchedulerHarqRr()=default
Default deconstructor.
void InstallGetCellIdFn(const std::function< uint16_t()> &fn)
Install a function to retrieve the cell id.
bool GetDoesFhAllocationFit(uint16_t bwpId, uint32_t mcs, uint32_t nRegs, uint8_t dlRank) const
Get from sched if the allocation fits when FH Control is enabled.
void InstallGetFhControlMethodFn(const std::function< uint8_t()> &fn)
Install a function to retrieve the FH Control Method (when enabled)
uint8_t GetFromSchedFhControlMethod() const
Get the FH Control method.
virtual void SortUlHarq(NrMacSchedulerNs3::ActiveHarqMap *activeUlHarq) const
(In theory) sort UL HARQ retx
void InstallGetBwInRBG(const std::function< uint16_t()> &fn)
Install a function to retrieve the bandwidth in RBG.
virtual uint8_t ScheduleDlHarq(NrMacSchedulerNs3::PointInFTPlane *startingPoint, uint8_t symAvail, const NrMacSchedulerNs3::ActiveHarqMap &activeDlHarq, const std::unordered_map< uint16_t, std::shared_ptr< NrMacSchedulerUeInfo > > &ueMap, std::vector< DlHarqInfo > *dlHarqToRetransmit, const std::vector< DlHarqInfo > &dlHarqFeedback, SlotAllocInfo *slotAlloc) const
Schedule DL HARQ in RR fashion.
A general scheduler for nr in NS3.
std::unordered_map< BeamId, HarqVectorIteratorList, BeamIdHash > ActiveHarqMap
Map between a beamID and the HARQ of that beam.
Point in the Frequency/Time plane.
The SlotAllocInfo struct.