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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Marco Miozzo <marco.miozzo@cttc.es>
18 * Modification: Dizhi Zhou <dizhi.zhou@gmail.com> // modify codes related to downlink scheduler
19 */
20
21#ifndef FDMT_FF_MAC_SCHEDULER_H
22#define FDMT_FF_MAC_SCHEDULER_H
23
24#include "ff-mac-csched-sap.h"
25#include "ff-mac-sched-sap.h"
26#include "ff-mac-scheduler.h"
27#include "lte-amc.h"
28#include "lte-common.h"
29#include "lte-ffr-sap.h"
30
31#include <ns3/nstime.h>
32
33#include <map>
34#include <set>
35#include <vector>
36
37namespace ns3
38{
39
40/**
41 * \ingroup ff-api
42 * \brief Implements the SCHED SAP and CSCHED SAP for a Frequency Domain Maximize Throughput
43 * scheduler
44 *
45 * This class implements the interface defined by the FfMacScheduler abstract class
46 */
47
49{
50 public:
51 /**
52 * \brief Constructor
53 *
54 * Creates the MAC Scheduler interface implementation
55 */
57
58 /**
59 * Destructor
60 */
61 ~FdMtFfMacScheduler() override;
62
63 // inherited from Object
64 void DoDispose() override;
65 /**
66 * \brief Get the type ID.
67 * \return the object TypeId
68 */
69 static TypeId GetTypeId();
70
71 // inherited from FfMacScheduler
76
77 // FFR SAPs
80
81 /// allow MemberCschedSapProvider<FdMtFfMacScheduler> class friend access
83 /// allow MemberSchedSapProvider<FdMtFfMacScheduler> clss friend access
85
86 /**
87 * Transmission mode configuration update
88 * \param rnti the RNTI
89 * \param txMode the transmit mode
90 */
91 void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode);
92
93 private:
94 //
95 // Implementation of the CSCHED API primitives
96 // (See 4.1 for description of the primitives)
97 //
98
99 /**
100 * Csched cell config request function
101 * \param params the CSched cell config request parameters
102 */
104
105 /**
106 * CSched UE config request function
107 * \param params the CSChed UE config request parameters
108 */
110
111 /**
112 * CSched LC config request function
113 * \param params the CSChed LC config request parameters
114 */
116
117 /**
118 * CSched LC release request function
119 * \param params the CSched LC release request parameters
120 */
122
123 /**
124 * CSched UE release request function
125 * \param params th CSched UE release request parameters
126 */
128
129 //
130 // Implementation of the SCHED API primitives
131 // (See 4.2 for description of the primitives)
132 //
133
134 /**
135 * Sched DL RLC buffer request function
136 * \param params the Sched DL RLC buffer request parameters
137 */
139
140 /**
141 * Sched DL paging buffer request function
142 * \param params the Sched DL paging buffer request parameters
143 */
146
147 /**
148 * Sched DL MAC buffer request function
149 * \param params the Sched DL MAC buffer request parameters
150 */
152
153 /**
154 * Sched DL trigger request function
155 *
156 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters&
157 */
159
160 /**
161 * Sched DL RACH info request function
162 * \param params the Sched DL RACH info request parameters
163 */
165
166 /**
167 * Sched DL CQI info request function
168 * \param params the Sched DL CQI info request parameters
169 */
171
172 /**
173 * Sched UL trigger request function
174 * \param params the Sched UL trigger request parameters
175 */
177
178 /**
179 * Sched UL noise interference request function
180 * \param params the Sched UL noise interference request parameters
181 */
184
185 /**
186 * Sched UL SR info request function
187 * \param params the Sched UL SR info request parameters
188 */
190
191 /**
192 * Sched UL MAC control info request function
193 * \param params the Sched UL MAC control info request parameters
194 */
197
198 /**
199 * Sched UL CQI info request function
200 * \param params the Sched UL CQI info request parameters
201 */
203
204 /**
205 * Get RBG size function
206 * \param dlbandwidth the DL bandwidth
207 * \returns the RBG size
208 */
209 int GetRbgSize(int dlbandwidth);
210
211 /**
212 * LC Active per flow function
213 * \param rnti the RNTI
214 * \returns the LC active per flow
215 */
216 unsigned int LcActivePerFlow(uint16_t rnti);
217
218 /**
219 * Estimate UL SNR function
220 * \param rnti the RNTI
221 * \param rb the RB
222 * \returns the UL SINR
223 */
224 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
225
226 /// Refresh DL CGI maps function
227 void RefreshDlCqiMaps();
228 /// Refresh UL CGI maps function
229 void RefreshUlCqiMaps();
230
231 /**
232 * Update DL RLC buffer info function
233 * \param rnti the RNTI
234 * \param lcid the LCID
235 * \param size the size
236 */
237 void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size);
238 /**
239 * Update UL RLC buffer info function
240 * \param rnti the RNTI
241 * \param size the size
242 */
243 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
244
245 /**
246 * \brief Update and return a new process Id for the RNTI specified
247 *
248 * \param rnti the RNTI of the UE to be updated
249 * \return the process id value
250 */
251 uint8_t UpdateHarqProcessId(uint16_t rnti);
252
253 /**
254 * \brief Return the availability of free process for the RNTI specified
255 *
256 * \param rnti the RNTI of the UE to be updated
257 * \return the availability
258 */
259 bool HarqProcessAvailability(uint16_t rnti);
260
261 /**
262 * \brief Refresh HARQ processes according to the timers
263 *
264 */
266
268
269 /**
270 * Vectors of UE's LC info
271 */
272 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
273
274 /**
275 * Set of UE statistics (per RNTI basis) in downlink
276 */
277 std::set<uint16_t> m_flowStatsDl;
278
279 /**
280 * Set of UE statistics (per RNTI basis)
281 */
282 std::set<uint16_t> m_flowStatsUl;
283
284 /**
285 * Map of UE's DL CQI P01 received
286 */
287 std::map<uint16_t, uint8_t> m_p10CqiRxed;
288
289 /**
290 * Map of UE's timers on DL CQI P01 received
291 */
292 std::map<uint16_t, uint32_t> m_p10CqiTimers;
293
294 /**
295 * Map of UE's DL CQI A30 received
296 */
297 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
298
299 /**
300 * Map of UE's timers on DL CQI A30 received
301 */
302 std::map<uint16_t, uint32_t> m_a30CqiTimers;
303
304 /**
305 * Map of previous allocated UE per RBG
306 * (used to retrieve info from UL-CQI)
307 */
308 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
309
310 /**
311 * Map of UEs' UL-CQI per RBG
312 */
313 std::map<uint16_t, std::vector<double>> m_ueCqi;
314
315 /**
316 * Map of UEs' timers on UL-CQI per RBG
317 */
318 std::map<uint16_t, uint32_t> m_ueCqiTimers;
319
320 /**
321 * Map of UE's buffer status reports received
322 */
323 std::map<uint16_t, uint32_t> m_ceBsrRxed;
324
325 // MAC SAPs
326 FfMacCschedSapUser* m_cschedSapUser; ///< csched SAP user
327 FfMacSchedSapUser* m_schedSapUser; ///< sched SAP user
330
331 // FFR SAPs
332 LteFfrSapUser* m_ffrSapUser; ///< FFR SAP user
333 LteFfrSapProvider* m_ffrSapProvider; ///< FFR SAP provider
334
335 // Internal parameters
337
338 uint16_t m_nextRntiUl; ///< RNTI of the next user to be served next scheduling in UL
339
340 uint32_t m_cqiTimersThreshold; ///< # of TTIs for which a CQI can be considered valid
341
342 std::map<uint16_t, uint8_t> m_uesTxMode; ///< txMode of the UEs
343
344 // HARQ attributes
345 bool m_harqOn; ///< m_harqOn when false inhibit tte HARQ mechanisms (by default active)
346 std::map<uint16_t, uint8_t> m_dlHarqCurrentProcessId; ///< DL 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, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus; ///< DL HARQ process status
351 std::map<uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer; ///< DL HARDQ process timer
352 std::map<uint16_t, DlHarqProcessesDciBuffer_t>
353 m_dlHarqProcessesDciBuffer; ///< DL HARQ process DCI buffer
354 std::map<uint16_t, DlHarqRlcPduListBuffer_t>
355 m_dlHarqProcessesRlcPduListBuffer; ///< DL HARQ process RLC PDU list buffer
356 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< HARQ retx buffered
357
358 std::map<uint16_t, uint8_t> m_ulHarqCurrentProcessId; ///< UL HARQ current process ID
359 // HARQ status
360 // 0: process Id available
361 // x>0: process Id equal to `x` transmission count
362 std::map<uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus; ///< UL HARQ process status
363 std::map<uint16_t, UlHarqProcessesDciBuffer_t>
364 m_ulHarqProcessesDciBuffer; ///< UL HARQ process DCI buffer
365
366 // RACH attributes
367 std::vector<RachListElement_s> m_rachList; ///< RACH list
368 std::vector<uint16_t> m_rachAllocationMap; ///< RACH allocation map
369 uint8_t m_ulGrantMcs; ///< MCS for UL grant (default 0)
370};
371
372} // namespace ns3
373
374#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:40
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Definition: lte-ffr-sap.h:140
MemberCschedSapProvider class.
MemberSchedSapProvider class.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
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.