5#include "nr-mac-scheduler-lc-rr.h"
12NS_LOG_COMPONENT_DEFINE(
"NrMacSchedulerLcRR");
13NS_OBJECT_ENSURE_REGISTERED(NrMacSchedulerLcRR);
18 NS_LOG_FUNCTION(
this);
28 static TypeId tid = TypeId(
"ns3::NrMacSchedulerLcRR")
30 .AddConstructor<NrMacSchedulerLcRR>();
34std::vector<NrMacSchedulerLcAlgorithm::Assignation>
37 [[maybe_unused]] Time slotPeriod)
const
39 return AssignBytesToLC(ueLCG, tbs);
42std::vector<NrMacSchedulerLcAlgorithm::Assignation>
46 return AssignBytesToLC(ueLCG, tbs);
49std::vector<NrMacSchedulerLcAlgorithm::Assignation>
50NrMacSchedulerLcRR::AssignBytesToLC(
const std::unordered_map<uint8_t, LCGPtr>& ueLCG,
53 NS_LOG_FUNCTION(
this);
57 std::vector<NrMacSchedulerLcAlgorithm::Assignation> ret;
59 NS_LOG_INFO(
"To distribute: " << tbs <<
" bytes over " << ueLCG.size() <<
" LCG");
61 uint32_t activeLc = 0;
62 for (
const auto& lcg : ueLCG)
64 std::vector<uint8_t> lcs = GetLCG(lcg)->GetLCId();
65 for (
const auto& lcId : lcs)
67 if (GetLCG(lcg)->GetTotalSizeOfLC(lcId) > 0)
79 uint32_t amountPerLC = tbs / activeLc;
80 NS_LOG_INFO(
"Total LC: " << activeLc <<
" each one will receive " << amountPerLC <<
" bytes");
82 for (
const auto& lcg : ueLCG)
84 std::vector<uint8_t> lcs = GetLCG(lcg)->GetLCId();
85 for (
const auto& lcId : lcs)
87 if (GetLCG(lcg)->GetTotalSizeOfLC(lcId) > 0)
89 NS_LOG_INFO(
"Assigned to LCID " <<
static_cast<uint32_t
>(lcId) <<
" inside LCG "
90 <<
static_cast<uint32_t
>(GetLCGID(lcg))
91 <<
" an amount of " << amountPerLC <<
" B");
92 ret.emplace_back(GetLCGID(lcg), lcId, amountPerLC);
This class is the interface for the creation of various scheduling algorithms for the distribution of...
std::vector< Assignation > AssignBytesToUlLC(const std::unordered_map< uint8_t, LCGPtr > &ueLCG, uint32_t tbs) const override
Method to decide how to distribute the assigned bytes to the different LCs for the UL direction....
std::vector< Assignation > AssignBytesToDlLC(const std::unordered_map< uint8_t, LCGPtr > &ueLCG, uint32_t tbs, Time slotPeriod) const override
Method to decide how to distribute the assigned bytes to the different LCs for the DL direction....
NrMacSchedulerLcRR()
NrMacSchedulerLcRR constructor.
~NrMacSchedulerLcRR() override
NrMacSchedulerLcRR deconstructor.
static TypeId GetTypeId()
Get the type ID.