A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fdmt-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 FDMT_FF_MAC_SCHEDULER_H
11#define FDMT_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 Frequency Domain Maximize Throughput
32 * scheduler
33 *
34 * This class implements the interface defined by the FfMacScheduler abstract class
35 */
36
38{
39 public:
40 /**
41 * \brief Constructor
42 *
43 * Creates the MAC Scheduler interface implementation
44 */
46
47 /**
48 * Destructor
49 */
50 ~FdMtFfMacScheduler() override;
51
52 // inherited from Object
53 void DoDispose() override;
54 /**
55 * \brief Get the type ID.
56 * \return the object TypeId
57 */
58 static TypeId GetTypeId();
59
60 // inherited from FfMacScheduler
65
66 // FFR SAPs
69
70 /// allow MemberCschedSapProvider<FdMtFfMacScheduler> class friend access
72 /// allow MemberSchedSapProvider<FdMtFfMacScheduler> clss friend access
74
75 /**
76 * Transmission mode configuration update
77 * \param rnti the RNTI
78 * \param txMode the transmit mode
79 */
80 void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode);
81
82 private:
83 //
84 // Implementation of the CSCHED API primitives
85 // (See 4.1 for description of the primitives)
86 //
87
88 /**
89 * Csched cell config request function
90 * \param params the CSched cell config request parameters
91 */
93
94 /**
95 * CSched UE config request function
96 * \param params the CSChed UE config request parameters
97 */
99
100 /**
101 * CSched LC config request function
102 * \param params the CSChed LC config request parameters
103 */
105
106 /**
107 * CSched LC release request function
108 * \param params the CSched LC release request parameters
109 */
111
112 /**
113 * CSched UE release request function
114 * \param params th CSched UE release request parameters
115 */
117
118 //
119 // Implementation of the SCHED API primitives
120 // (See 4.2 for description of the primitives)
121 //
122
123 /**
124 * Sched DL RLC buffer request function
125 * \param params the Sched DL RLC buffer request parameters
126 */
128
129 /**
130 * Sched DL paging buffer request function
131 * \param params the Sched DL paging buffer request parameters
132 */
135
136 /**
137 * Sched DL MAC buffer request function
138 * \param params the Sched DL MAC buffer request parameters
139 */
141
142 /**
143 * Sched DL trigger request function
144 *
145 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters&
146 */
148
149 /**
150 * Sched DL RACH info request function
151 * \param params the Sched DL RACH info request parameters
152 */
154
155 /**
156 * Sched DL CQI info request function
157 * \param params the Sched DL CQI info request parameters
158 */
160
161 /**
162 * Sched UL trigger request function
163 * \param params the Sched UL trigger request parameters
164 */
166
167 /**
168 * Sched UL noise interference request function
169 * \param params the Sched UL noise interference request parameters
170 */
173
174 /**
175 * Sched UL SR info request function
176 * \param params the Sched UL SR info request parameters
177 */
179
180 /**
181 * Sched UL MAC control info request function
182 * \param params the Sched UL MAC control info request parameters
183 */
186
187 /**
188 * Sched UL CQI info request function
189 * \param params the Sched UL CQI info request parameters
190 */
192
193 /**
194 * Get RBG size function
195 * \param dlbandwidth the DL bandwidth
196 * \returns the RBG size
197 */
198 int GetRbgSize(int dlbandwidth);
199
200 /**
201 * LC Active per flow function
202 * \param rnti the RNTI
203 * \returns the LC active per flow
204 */
205 unsigned int LcActivePerFlow(uint16_t rnti);
206
207 /**
208 * Estimate UL SNR function
209 * \param rnti the RNTI
210 * \param rb the RB
211 * \returns the UL SINR
212 */
213 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
214
215 /// Refresh DL CGI maps function
216 void RefreshDlCqiMaps();
217 /// Refresh UL CGI maps function
218 void RefreshUlCqiMaps();
219
220 /**
221 * Update DL RLC buffer info function
222 * \param rnti the RNTI
223 * \param lcid the LCID
224 * \param size the size
225 */
226 void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size);
227 /**
228 * Update UL RLC buffer info function
229 * \param rnti the RNTI
230 * \param size the size
231 */
232 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
233
234 /**
235 * \brief Update and return a new process Id for the RNTI specified
236 *
237 * \param rnti the RNTI of the UE to be updated
238 * \return the process id value
239 */
240 uint8_t UpdateHarqProcessId(uint16_t rnti);
241
242 /**
243 * \brief Return the availability of free process for the RNTI specified
244 *
245 * \param rnti the RNTI of the UE to be updated
246 * \return the availability
247 */
248 bool HarqProcessAvailability(uint16_t rnti);
249
250 /**
251 * \brief Refresh HARQ processes according to the timers
252 *
253 */
255
257
258 /**
259 * Vectors of UE's LC info
260 */
261 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
262
263 /**
264 * Set of UE statistics (per RNTI basis) in downlink
265 */
266 std::set<uint16_t> m_flowStatsDl;
267
268 /**
269 * Set of UE statistics (per RNTI basis)
270 */
271 std::set<uint16_t> m_flowStatsUl;
272
273 /**
274 * Map of UE's DL CQI P01 received
275 */
276 std::map<uint16_t, uint8_t> m_p10CqiRxed;
277
278 /**
279 * Map of UE's timers on DL CQI P01 received
280 */
281 std::map<uint16_t, uint32_t> m_p10CqiTimers;
282
283 /**
284 * Map of UE's DL CQI A30 received
285 */
286 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
287
288 /**
289 * Map of UE's timers on DL CQI A30 received
290 */
291 std::map<uint16_t, uint32_t> m_a30CqiTimers;
292
293 /**
294 * Map of previous allocated UE per RBG
295 * (used to retrieve info from UL-CQI)
296 */
297 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
298
299 /**
300 * Map of UEs' UL-CQI per RBG
301 */
302 std::map<uint16_t, std::vector<double>> m_ueCqi;
303
304 /**
305 * Map of UEs' timers on UL-CQI per RBG
306 */
307 std::map<uint16_t, uint32_t> m_ueCqiTimers;
308
309 /**
310 * Map of UE's buffer status reports received
311 */
312 std::map<uint16_t, uint32_t> m_ceBsrRxed;
313
314 // MAC SAPs
315 FfMacCschedSapUser* m_cschedSapUser; ///< csched SAP user
316 FfMacSchedSapUser* m_schedSapUser; ///< sched SAP user
319
320 // FFR SAPs
321 LteFfrSapUser* m_ffrSapUser; ///< FFR SAP user
322 LteFfrSapProvider* m_ffrSapProvider; ///< FFR SAP provider
323
324 // Internal parameters
326
327 uint16_t m_nextRntiUl; ///< RNTI of the next user to be served next scheduling in UL
328
329 uint32_t m_cqiTimersThreshold; ///< # of TTIs for which a CQI can be considered valid
330
331 std::map<uint16_t, uint8_t> m_uesTxMode; ///< txMode of the UEs
332
333 // HARQ attributes
334 bool m_harqOn; ///< m_harqOn when false inhibit tte HARQ mechanisms (by default active)
335 std::map<uint16_t, uint8_t> m_dlHarqCurrentProcessId; ///< DL HARQ current process ID
336 // HARQ status
337 // 0: process Id available
338 // x>0: process Id equal to `x` transmission count
339 std::map<uint16_t, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus; ///< DL HARQ process status
340 std::map<uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer; ///< DL HARDQ process timer
341 std::map<uint16_t, DlHarqProcessesDciBuffer_t>
342 m_dlHarqProcessesDciBuffer; ///< DL HARQ process DCI buffer
343 std::map<uint16_t, DlHarqRlcPduListBuffer_t>
344 m_dlHarqProcessesRlcPduListBuffer; ///< DL HARQ process RLC PDU list buffer
345 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< HARQ retx buffered
346
347 std::map<uint16_t, uint8_t> m_ulHarqCurrentProcessId; ///< UL HARQ current process ID
348 // HARQ status
349 // 0: process Id available
350 // x>0: process Id equal to `x` transmission count
351 std::map<uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus; ///< UL HARQ process status
352 std::map<uint16_t, UlHarqProcessesDciBuffer_t>
353 m_ulHarqProcessesDciBuffer; ///< UL HARQ process DCI buffer
354
355 // RACH attributes
356 std::vector<RachListElement_s> m_rachList; ///< RACH list
357 std::vector<uint16_t> m_rachAllocationMap; ///< RACH allocation map
358 uint8_t m_ulGrantMcs; ///< MCS for UL grant (default 0)
359};
360
361} // namespace ns3
362
363#endif /* FDMT_FF_MAC_SCHEDULER_H */
Implements the SCHED SAP and CSCHED SAP for a Frequency Domain Maximize Throughput scheduler.
FfMacCschedSapProvider * GetFfMacCschedSapProvider() override
void DoSchedUlMacCtrlInfoReq(const FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters &params)
Sched UL MAC control info request function.
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL SNR function.
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU list buffer.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
static TypeId GetTypeId()
Get the type ID.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RLC buffer info function.
std::vector< RachListElement_s > m_rachList
RACH list.
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
void RefreshUlCqiMaps()
Refresh UL CGI maps function.
~FdMtFfMacScheduler() override
Destructor.
void DoSchedUlNoiseInterferenceReq(const FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters &params)
Sched UL noise interference request function.
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Transmission mode configuration update.
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
void DoCschedCellConfigReq(const FfMacCschedSapProvider::CschedCellConfigReqParameters &params)
Csched cell config request function.
unsigned int LcActivePerFlow(uint16_t rnti)
LC Active per flow function.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL HARQ current process ID.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
int GetRbgSize(int dlbandwidth)
Get RBG size function.
void DoCschedLcConfigReq(const FfMacCschedSapProvider::CschedLcConfigReqParameters &params)
CSched LC config request function.
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
UL HARQ process DCI buffer.
std::map< uint16_t, uint32_t > m_ceBsrRxed
Map of UE's buffer status reports received.
std::set< uint16_t > m_flowStatsUl
Set of UE statistics (per RNTI basis)
FfMacCschedSapProvider * m_cschedSapProvider
csched SAP provider
void DoSchedDlRlcBufferReq(const FfMacSchedSapProvider::SchedDlRlcBufferReqParameters &params)
Sched DL RLC buffer request function.
void DoSchedDlTriggerReq(const FfMacSchedSapProvider::SchedDlTriggerReqParameters &params)
Sched DL trigger request function.
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
void SetFfMacCschedSapUser(FfMacCschedSapUser *s) override
set the user part of the FfMacCschedSap that this Scheduler will interact with.
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
void DoSchedUlCqiInfoReq(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
Sched UL CQI info request function.
FfMacSchedSapProvider * GetFfMacSchedSapProvider() override
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
FfMacSchedSapProvider * m_schedSapProvider
sched SAP provider
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
void DoSchedUlSrInfoReq(const FfMacSchedSapProvider::SchedUlSrInfoReqParameters &params)
Sched UL SR info request function.
void DoSchedDlCqiInfoReq(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
Sched DL CQI info request function.
std::set< uint16_t > m_flowStatsDl
Set of UE statistics (per RNTI basis) in downlink.
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process status.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
sched cell config
void DoCschedUeReleaseReq(const FfMacCschedSapProvider::CschedUeReleaseReqParameters &params)
CSched UE release request function.
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
void DoDispose() override
Destructor implementation.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
bool m_harqOn
m_harqOn when false inhibit tte HARQ mechanisms (by default active)
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
std::map< uint16_t, std::vector< uint16_t > > m_allocationMaps
Map of previous allocated UE per RBG (used to retrieve info from UL-CQI)
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
HARQ retx buffered.
FfMacSchedSapUser * m_schedSapUser
sched SAP user
FfMacCschedSapUser * m_cschedSapUser
csched SAP user
void DoCschedUeConfigReq(const FfMacCschedSapProvider::CschedUeConfigReqParameters &params)
CSched UE config request function.
void DoSchedDlRachInfoReq(const FfMacSchedSapProvider::SchedDlRachInfoReqParameters &params)
Sched DL RACH info request function.
bool HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
void SetLteFfrSapProvider(LteFfrSapProvider *s) override
Set the Provider part of the LteFfrSap that this Scheduler will interact with.
void DoSchedDlMacBufferReq(const FfMacSchedSapProvider::SchedDlMacBufferReqParameters &params)
Sched DL MAC buffer request function.
void DoSchedUlTriggerReq(const FfMacSchedSapProvider::SchedUlTriggerReqParameters &params)
Sched UL trigger request function.
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARDQ process timer.
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
LteFfrSapUser * GetLteFfrSapUser() override
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RLC buffer info function.
void DoSchedDlPagingBufferReq(const FfMacSchedSapProvider::SchedDlPagingBufferReqParameters &params)
Sched DL paging buffer request function.
void RefreshDlCqiMaps()
Refresh DL CGI maps function.
void DoCschedLcReleaseReq(const FfMacCschedSapProvider::CschedLcReleaseReqParameters &params)
CSched LC release request function.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
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.
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.