A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tdmt-ff-mac-scheduler.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7 * Modification: Dizhi Zhou <dizhi.zhou@gmail.com> // modify codes related to downlink scheduler
8 */
9
10#ifndef TDMT_FF_MAC_SCHEDULER_H
11#define TDMT_FF_MAC_SCHEDULER_H
12
13#include "ff-mac-csched-sap.h"
14#include "ff-mac-sched-sap.h"
15#include "ff-mac-scheduler.h"
16#include "lte-amc.h"
17#include "lte-common.h"
18#include "lte-ffr-sap.h"
19
20#include <ns3/nstime.h>
21
22#include <map>
23#include <set>
24#include <vector>
25
26namespace ns3
27{
28
29/**
30 * \ingroup ff-api
31 * \brief Implements the SCHED SAP and CSCHED SAP for a Time Domain Maximize Throughput scheduler
32 *
33 * This class implements the interface defined by the FfMacScheduler abstract class
34 */
35
37{
38 public:
39 /**
40 * \brief Constructor
41 *
42 * Creates the MAC Scheduler interface implementation
43 */
45
46 /**
47 * Destructor
48 */
49 ~TdMtFfMacScheduler() override;
50
51 // inherited from Object
52 void DoDispose() override;
53 /**
54 * \brief Get the type ID.
55 * \return the object TypeId
56 */
57 static TypeId GetTypeId();
58
59 // inherited from FfMacScheduler
64
65 // FFR SAPs
68
69 /// allow MemberCschedSapProvider<TdMtFfMacScheduler> class friend access
71 /// allow MemberSchedSapProvider<TdMtFfMacScheduler> class friend access
73
74 /**
75 * \brief Transmission mode configuration update function
76 * \param rnti the RNTI
77 * \param txMode the transmission mode
78 */
79 void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode);
80
81 private:
82 //
83 // Implementation of the CSCHED API primitives
84 // (See 4.1 for description of the primitives)
85 //
86
87 /**
88 * \brief CSched cell config request
89 * \param params FfMacCschedSapProvider::CschedCellConfigReqParameters
90 */
92
93 /**
94 * \brief CSched UE config request
95 * \param params FfMacCschedSapProvider::CschedUeConfigReqParameters
96 */
98
99 /**
100 * \brief CSched LC config request
101 * \param params FfMacCschedSapProvider::CschedLcConfigReqParameters
102 */
104
105 /**
106 * \brief CSched LC release request
107 * \param params FfMacCschedSapProvider::CschedLcReleaseReqParameters
108 */
110
111 /**
112 * \brief CSched UE release request
113 * \param params FfMacCschedSapProvider::CschedUeReleaseReqParameters
114 */
116
117 //
118 // Implementation of the SCHED API primitives
119 // (See 4.2 for description of the primitives)
120 //
121
122 /**
123 * \brief Sched DL RLC buffer request
124 * \param params FfMacSchedSapProvider::SchedDlRlcBufferReqParameters
125 */
127
128 /**
129 * \brief Sched DL paging buffer request
130 * \param params FfMacSchedSapProvider::SchedDlPagingBufferReqParameters
131 */
134
135 /**
136 * \brief Sched DL MAC buffer request
137 * \param params FfMacSchedSapProvider::SchedDlMacBufferReqParameters
138 */
140
141 /**
142 * \brief Sched DL trigger request
143 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters
144 */
146
147 /**
148 * \brief Sched DL RACH info request
149 * \param params FfMacSchedSapProvider::SchedDlRachInfoReqParameters
150 */
152
153 /**
154 * \brief Sched DL CQI info request
155 * \param params FfMacSchedSapProvider::SchedDlCqiInfoReqParameters
156 */
158
159 /**
160 * \brief Sched UL trigger request
161 * \param params FfMacSchedSapProvider::SchedUlTriggerReqParameters
162 */
164
165 /**
166 * \brief Sched UL noise interference request
167 * \param params FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters
168 */
171
172 /**
173 * \brief Sched UL SR info request
174 * \param params FfMacSchedSapProvider::SchedUlSrInfoReqParameters
175 */
177
178 /**
179 * \brief Sched UL MAC control info request
180 * \param params FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters
181 */
184
185 /**
186 * \brief Sched UL CQI info request
187 * \param params FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
188 */
190
191 /**
192 * \brief Get RBG size function
193 * \param dlbandwidth the DL bandwidth
194 * \returns the RBG size
195 */
196 int GetRbgSize(int dlbandwidth);
197
198 /**
199 * \brief LC active flow function
200 * \param rnti the RNTI
201 * \returns the LC active flow
202 */
203 unsigned int LcActivePerFlow(uint16_t rnti);
204
205 /**
206 * \brief Estimate UL SINR function
207 * \param rnti the RNTI
208 * \param rb the RB
209 * \returns the SINR
210 */
211 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
212
213 /// Refresh DL CQI maps function
214 void RefreshDlCqiMaps();
215 /// Refresh UL CQI maps function
216 void RefreshUlCqiMaps();
217
218 /**
219 * \brief Update DL RLC buffer info function
220 * \param rnti the RNTI
221 * \param lcid the LCID
222 * \param size the size
223 */
224 void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size);
225 /**
226 * \brief Update UL RLC buffer info function
227 * \param rnti the RNTI
228 * \param size the size
229 */
230 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
231
232 /**
233 * \brief Update and return a new process Id for the RNTI specified
234 *
235 * \param rnti the RNTI of the UE to be updated
236 * \return the process id value
237 */
238 uint8_t UpdateHarqProcessId(uint16_t rnti);
239
240 /**
241 * \brief Return the availability of free process for the RNTI specified
242 *
243 * \param rnti the RNTI of the UE to be updated
244 * \return the availability
245 */
246 bool HarqProcessAvailability(uint16_t rnti);
247
248 /**
249 * \brief Refresh HARQ processes according to the timers
250 *
251 */
253
255
256 /**
257 * Vectors of UE's LC info
258 */
259 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
260
261 /**
262 * Set of UE statistics (per RNTI basis) in downlink
263 */
264 std::set<uint16_t> m_flowStatsDl;
265
266 /**
267 * Set of UE statistics (per RNTI basis)
268 */
269 std::set<uint16_t> m_flowStatsUl;
270
271 /**
272 * Map of UE's DL CQI P01 received
273 */
274 std::map<uint16_t, uint8_t> m_p10CqiRxed;
275 /**
276 * Map of UE's timers on DL CQI P01 received
277 */
278 std::map<uint16_t, uint32_t> m_p10CqiTimers;
279
280 /**
281 * Map of UE's DL CQI A30 received
282 */
283 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
284 /**
285 * Map of UE's timers on DL CQI A30 received
286 */
287 std::map<uint16_t, uint32_t> m_a30CqiTimers;
288
289 /**
290 * Map of previous allocated UE per RBG
291 * (used to retrieve info from UL-CQI)
292 */
293 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
294
295 /**
296 * Map of UEs' UL-CQI per RBG
297 */
298 std::map<uint16_t, std::vector<double>> m_ueCqi;
299 /**
300 * Map of UEs' timers on UL-CQI per RBG
301 */
302 std::map<uint16_t, uint32_t> m_ueCqiTimers;
303
304 /**
305 * Map of UE's buffer status reports received
306 */
307 std::map<uint16_t, uint32_t> m_ceBsrRxed;
308
309 // MAC SAPs
310 FfMacCschedSapUser* m_cschedSapUser; ///< CSched SAP user
311 FfMacSchedSapUser* m_schedSapUser; ///< Sched SAP user
314
315 // FFR SAPs
316 LteFfrSapUser* m_ffrSapUser; ///< FFR SAP user
317 LteFfrSapProvider* m_ffrSapProvider; ///< FFR SAP provider
318
319 // Internal parameters
321 m_cschedCellConfig; ///< CSched cell config
322
323 uint16_t m_nextRntiUl; ///< RNTI of the next user to be served next scheduling in UL
324
325 uint32_t m_cqiTimersThreshold; ///< # of TTIs for which a CQI can be considered valid
326
327 std::map<uint16_t, uint8_t> m_uesTxMode; ///< txMode of the UEs
328
329 // HARQ attributes
330 /**
331 * m_harqOn when false inhibit the HARQ mechanisms (by default active)
332 */
334 std::map<uint16_t, uint8_t> m_dlHarqCurrentProcessId; ///< DL HARQ current process ID
335 // HARQ status
336 // 0: process Id available
337 // x>0: process Id equal to `x` transmission count
338 std::map<uint16_t, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus; ///< DL HARQ process status
339 std::map<uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer; ///< DL HARQ process timer
340 std::map<uint16_t, DlHarqProcessesDciBuffer_t>
341 m_dlHarqProcessesDciBuffer; ///< DL HARQ process DCI buffer
342 std::map<uint16_t, DlHarqRlcPduListBuffer_t>
343 m_dlHarqProcessesRlcPduListBuffer; ///< DL HARQ process RLC PDU list buffer
344 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< HARQ retx buffered
345
346 std::map<uint16_t, uint8_t> m_ulHarqCurrentProcessId; ///< UL HARQ current process ID
347 // HARQ status
348 // 0: process Id available
349 // x>0: process Id equal to `x` transmission count
350 std::map<uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus; ///< UL HARQ process status
351 std::map<uint16_t, UlHarqProcessesDciBuffer_t>
352 m_ulHarqProcessesDciBuffer; ///< UL HARQ process DCI buffer
353
354 // RACH attributes
355 std::vector<RachListElement_s> m_rachList; ///< RACH list
356 std::vector<uint16_t> m_rachAllocationMap; ///< RACH allocation map
357 uint8_t m_ulGrantMcs; ///< MCS for UL grant (default 0)
358};
359
360} // namespace ns3
361
362#endif /* TDMT_FF_MAC_SCHEDULER_H */
Provides the CSCHED SAP.
FfMacCschedSapUser class.
Provides the SCHED SAP.
FfMacSchedSapUser class.
This abstract base class identifies the interface by means of which the helper object can plug on the...
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Definition lte-ffr-sap.h:29
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
MemberCschedSapProvider class.
MemberSchedSapProvider class.
Smart pointer class similar to boost::intrusive_ptr.
Implements the SCHED SAP and CSCHED SAP for a Time Domain Maximize Throughput scheduler.
FfMacCschedSapProvider * m_cschedSapProvider
CSched SAP provider.
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
HARQ retx buffered.
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
UL HARQ process DCI buffer.
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
void DoSchedUlCqiInfoReq(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
Sched UL CQI info request.
FfMacCschedSapUser * m_cschedSapUser
CSched SAP user.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
void DoSchedUlTriggerReq(const FfMacSchedSapProvider::SchedUlTriggerReqParameters &params)
Sched UL trigger request.
void DoCschedCellConfigReq(const FfMacCschedSapProvider::CschedCellConfigReqParameters &params)
CSched cell config request.
void DoCschedLcConfigReq(const FfMacCschedSapProvider::CschedLcConfigReqParameters &params)
CSched LC config request.
void DoCschedUeReleaseReq(const FfMacCschedSapProvider::CschedUeReleaseReqParameters &params)
CSched UE release request.
LteFfrSapUser * GetLteFfrSapUser() override
void DoSchedDlRlcBufferReq(const FfMacSchedSapProvider::SchedDlRlcBufferReqParameters &params)
Sched DL RLC buffer request.
void DoSchedUlSrInfoReq(const FfMacSchedSapProvider::SchedUlSrInfoReqParameters &params)
Sched UL SR info request.
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Transmission mode configuration update function.
FfMacCschedSapProvider * GetFfMacCschedSapProvider() override
FfMacSchedSapProvider * m_schedSapProvider
Sched SAP provider.
std::set< uint16_t > m_flowStatsDl
Set of UE statistics (per RNTI basis) in downlink.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
CSched cell config.
int GetRbgSize(int dlbandwidth)
Get RBG size function.
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
void SetFfMacCschedSapUser(FfMacCschedSapUser *s) override
set the user part of the FfMacCschedSap that this Scheduler will interact with.
FfMacSchedSapUser * m_schedSapUser
Sched SAP user.
bool HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
void DoSchedDlPagingBufferReq(const FfMacSchedSapProvider::SchedDlPagingBufferReqParameters &params)
Sched DL paging buffer request.
std::map< uint16_t, std::vector< uint16_t > > m_allocationMaps
Map of previous allocated UE per RBG (used to retrieve info from UL-CQI)
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RLC buffer info function.
void DoSchedUlNoiseInterferenceReq(const FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters &params)
Sched UL noise interference request.
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU list buffer.
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
void DoSchedDlMacBufferReq(const FfMacSchedSapProvider::SchedDlMacBufferReqParameters &params)
Sched DL MAC buffer request.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process status.
std::set< uint16_t > m_flowStatsUl
Set of UE statistics (per RNTI basis)
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RLC buffer info function.
FfMacSchedSapProvider * GetFfMacSchedSapProvider() override
unsigned int LcActivePerFlow(uint16_t rnti)
LC active flow function.
void DoSchedDlCqiInfoReq(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
Sched DL CQI info request.
std::map< uint16_t, uint32_t > m_ceBsrRxed
Map of UE's buffer status reports received.
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
void DoSchedDlRachInfoReq(const FfMacSchedSapProvider::SchedDlRachInfoReqParameters &params)
Sched DL RACH info request.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
void DoSchedUlMacCtrlInfoReq(const FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters &params)
Sched UL MAC control info request.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
void DoCschedLcReleaseReq(const FfMacCschedSapProvider::CschedLcReleaseReqParameters &params)
CSched LC release request.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL HARQ current process ID.
static TypeId GetTypeId()
Get the type ID.
void SetLteFfrSapProvider(LteFfrSapProvider *s) override
Set the Provider part of the LteFfrSap that this Scheduler will interact with.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
void DoDispose() override
Destructor implementation.
void DoCschedUeConfigReq(const FfMacCschedSapProvider::CschedUeConfigReqParameters &params)
CSched UE config request.
bool m_harqOn
m_harqOn when false inhibit the HARQ mechanisms (by default active)
void RefreshDlCqiMaps()
Refresh DL CQI maps function.
~TdMtFfMacScheduler() override
Destructor.
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL SINR function.
void DoSchedDlTriggerReq(const FfMacSchedSapProvider::SchedDlTriggerReqParameters &params)
Sched DL trigger request.
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
void RefreshUlCqiMaps()
Refresh UL CQI maps function.
std::vector< RachListElement_s > m_rachList
RACH list.
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARQ process timer.
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Parameters of the CSCHED_LC_CONFIG_REQ primitive.
Parameters of the CSCHED_LC_RELEASE_REQ primitive.
Parameters of the CSCHED_UE_CONFIG_REQ primitive.
Parameters of the CSCHED_UE_RELEASE_REQ primitive.
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Parameters of the SCHED_DL_MAC_BUFFER_REQ primitive.
Parameters of the SCHED_DL_PAGING_BUFFER_REQ primitive.
Parameters of the SCHED_DL_RACH_INFO_REQ primitive.
Parameters of the SCHED_DL_TRIGGER_REQ primitive.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
Parameters of the SCHED_UL_MAC_CTRL_INFO_REQ primitive.
Parameters of the SCHED_UL_NOISE_INTERFERENCE_REQ primitive.
Parameters of the SCHED_UL_SR_INFO_REQ primitive.
Parameters of the SCHED_UL_TRIGGER_REQ primitive.