A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fdbet-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 FDBET_FF_MAC_SCHEDULER_H
11#define FDBET_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 <vector>
24
25namespace ns3
26{
27
28/// fdbetsFlowPerf_t structure
30{
31 Time flowStart; ///< flow start time
32 unsigned long totalBytesTransmitted; ///< total bytes transmitted
33 unsigned int lastTtiBytesTransmitted; ///< last total bytes transmitted
34 double lastAveragedThroughput; ///< last averaged throughput
35};
36
37/**
38 * \ingroup ff-api
39 * \brief Implements the SCHED SAP and CSCHED SAP for a Frequency Domain Blind Equal Throughput
40 * scheduler
41 *
42 * This class implements the interface defined by the FfMacScheduler abstract class
43 */
44
46{
47 public:
48 /**
49 * \brief Constructor
50 *
51 * Creates the MAC Scheduler interface implementation
52 */
54
55 /**
56 * Destructor
57 */
58 ~FdBetFfMacScheduler() override;
59
60 // inherited from Object
61 void DoDispose() override;
62 /**
63 * \brief Get the type ID.
64 * \return the object TypeId
65 */
66 static TypeId GetTypeId();
67
68 // inherited from FfMacScheduler
73
74 // FFR SAPs
77
78 /// allow MemberCschedSapProvider<FdBetFfMacScheduler> class friend access
80 /// allow MemberSchedSapProvider<FdBetFfMacScheduler> class friend access
82
83 /**
84 * Transmission mode configuration update function
85 * \param rnti the RNTI
86 * \param txMode the transmit mode
87 */
88 void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode);
89
90 private:
91 //
92 // Implementation of the CSCHED API primitives
93 // (See 4.1 for description of the primitives)
94 //
95
96 /**
97 * CSched cell config request function
98 * \param params the CSched cell config request parameters
99 */
101
102 /**
103 * Csched UE config request function
104 * \param params the CSched UE config request parameters
105 */
107
108 /**
109 * Csched LC config request function
110 * \param params the CSched LC config request parameters
111 */
113
114 /**
115 * CSched LC release request function
116 * \param params the CSched LC release request parameters
117 */
119
120 /**
121 * CSched UE release request function
122 * \param params the CSChed UE release request parameters
123 */
125
126 //
127 // Implementation of the SCHED API primitives
128 // (See 4.2 for description of the primitives)
129 //
130
131 /**
132 * Sched DL RLC buffer request function
133 * \param params the Sched DL RLC buffer request parameters
134 */
136
137 /**
138 * Sched DL paging buffer request function
139 * \param params the Sched DL paging buffer request parameters
140 */
143
144 /**
145 * Sched DL MAC buffer request function
146 * \param params the Sched DL MAC buffer request parameters
147 */
149
150 /**
151 * Sched DL trigger request function
152 *
153 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters&
154 */
156
157 /**
158 * Sched DL RACH info request function
159 * \param params the Sched DL RACH info request parameters
160 */
162
163 /**
164 * Sched DL CGI info request function
165 * \param params the Sched DL CGI info request parameters
166 */
168
169 /**
170 * Sched UL trigger request function
171 * \param params the Sched UL trigger request parameters
172 */
174
175 /**
176 * Sched UL noise interference request function
177 * \param params the Sched UL noise interference request parameters
178 */
181
182 /**
183 * Sched UL SR info request function
184 * \param params the Schedule UL SR info request parameters
185 */
187
188 /**
189 * Sched UL MAC control info request function
190 * \param params the Sched UL MAC control info request parameters
191 */
194
195 /**
196 * Sched UL CGI info request function
197 * \param params the Sched UL CGI info request parameters
198 */
200
201 /**
202 * Get RBG size function
203 * \param dlbandwidth the DL bandwidth
204 * \returns the RBG size
205 */
206 int GetRbgSize(int dlbandwidth);
207
208 /**
209 * LC active per flow function
210 * \param rnti the RNTI
211 * \returns the LC active per flow
212 */
213 unsigned int LcActivePerFlow(uint16_t rnti);
214
215 /**
216 * Estimate UL SNR
217 * \param rnti the RNTI
218 * \param rb the RB
219 * \returns the UL SINR
220 */
221 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
222
223 /// Refresh DL CQI maps
224 void RefreshDlCqiMaps();
225 /// Refresh UL CQI maps
226 void RefreshUlCqiMaps();
227
228 /**
229 * Update DL RLC buffer info
230 * \param rnti the RNTI
231 * \param lcid the LCID
232 * \param size the size
233 */
234 void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size);
235 /**
236 * Update UL RLC buffer info
237 * \param rnti the RNTI
238 * \param size the size
239 */
240 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
241
242 /**
243 * \brief Update and return a new process Id for the RNTI specified
244 *
245 * \param rnti the RNTI of the UE to be updated
246 * \return the process id value
247 */
248 uint8_t UpdateHarqProcessId(uint16_t rnti);
249
250 /**
251 * \brief Return the availability of free process for the RNTI specified
252 *
253 * \param rnti the RNTI of the UE to be updated
254 * \return the availability
255 */
256 bool HarqProcessAvailability(uint16_t rnti);
257
258 /**
259 * \brief Refresh HARQ processes according to the timers
260 *
261 */
263
265
266 /**
267 * Vectors of UE's LC info
268 */
269 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
270
271 /**
272 * Map of UE statistics (per RNTI basis) in downlink
273 */
274 std::map<uint16_t, fdbetsFlowPerf_t> m_flowStatsDl;
275
276 /**
277 * Map of UE statistics (per RNTI basis)
278 */
279 std::map<uint16_t, fdbetsFlowPerf_t> m_flowStatsUl;
280
281 /**
282 * Map of UE's DL CQI P01 received
283 */
284 std::map<uint16_t, uint8_t> m_p10CqiRxed;
285
286 /**
287 * Map of UE's timers on DL CQI P01 received
288 */
289 std::map<uint16_t, uint32_t> m_p10CqiTimers;
290
291 /**
292 * Map of UE's DL CQI A30 received
293 */
294 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
295
296 /**
297 * Map of UE's timers on DL CQI A30 received
298 */
299 std::map<uint16_t, uint32_t> m_a30CqiTimers;
300
301 /**
302 * Map of previous allocated UE per RBG
303 * (used to retrieve info from UL-CQI)
304 */
305 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
306
307 /**
308 * Map of UEs' UL-CQI per RBG
309 */
310 std::map<uint16_t, std::vector<double>> m_ueCqi;
311
312 /**
313 * Map of UEs' timers on UL-CQI per RBG
314 */
315 std::map<uint16_t, uint32_t> m_ueCqiTimers;
316
317 /**
318 * Map of UE's buffer status reports received
319 */
320 std::map<uint16_t, uint32_t> m_ceBsrRxed;
321
322 // MAC SAPs
323 FfMacCschedSapUser* m_cschedSapUser; ///< csched sap user
324 FfMacSchedSapUser* m_schedSapUser; ///< sched sap user
327
328 // FFR SAPs
329 LteFfrSapUser* m_ffrSapUser; ///< ffr sap user
330 LteFfrSapProvider* m_ffrSapProvider; ///< ffr sap provider
331
332 // Internal parameters
334 m_cschedCellConfig; ///< csched cell config
335
336 double m_timeWindow; ///< time window
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 the 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 HARQ 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
356 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< DL 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 /* FDBET_FF_MAC_SCHEDULER_H */
Implements the SCHED SAP and CSCHED SAP for a Frequency Domain Blind Equal Throughput scheduler.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
std::vector< RachListElement_s > m_rachList
rach list
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RLC buffer info.
void DoSchedDlTriggerReq(const FfMacSchedSapProvider::SchedDlTriggerReqParameters &params)
Sched DL trigger request function.
void DoSchedUlSrInfoReq(const FfMacSchedSapProvider::SchedUlSrInfoReqParameters &params)
Sched UL SR info request function.
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
unsigned int LcActivePerFlow(uint16_t rnti)
LC active per flow function.
void DoCschedCellConfigReq(const FfMacCschedSapProvider::CschedCellConfigReqParameters &params)
CSched cell config request function.
void DoDispose() override
Destructor implementation.
void DoCschedLcConfigReq(const FfMacCschedSapProvider::CschedLcConfigReqParameters &params)
Csched LC config request function.
~FdBetFfMacScheduler() override
Destructor.
void DoSchedDlMacBufferReq(const FfMacSchedSapProvider::SchedDlMacBufferReqParameters &params)
Sched DL MAC buffer request function.
FfMacSchedSapProvider * m_schedSapProvider
sched sap provider
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
LteFfrSapUser * m_ffrSapUser
ffr sap user
std::map< uint16_t, fdbetsFlowPerf_t > m_flowStatsDl
Map of UE statistics (per RNTI basis) in downlink.
bool m_harqOn
m_harqOn when false inhibit the HARQ mechanisms (by default active)
void DoSchedUlMacCtrlInfoReq(const FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters &params)
Sched UL MAC control info request function.
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
csched cell config
void SetLteFfrSapProvider(LteFfrSapProvider *s) override
Set the Provider part of the LteFfrSap that this Scheduler will interact with.
LteFfrSapUser * GetLteFfrSapUser() override
void RefreshUlCqiMaps()
Refresh UL CQI maps.
void DoSchedUlTriggerReq(const FfMacSchedSapProvider::SchedUlTriggerReqParameters &params)
Sched UL trigger request function.
void DoSchedUlCqiInfoReq(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
Sched UL CGI info request function.
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARQ process timer.
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL HARQ current process ID.
FfMacCschedSapProvider * GetFfMacCschedSapProvider() override
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Transmission mode configuration update function.
void DoSchedDlCqiInfoReq(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
Sched DL CGI info request function.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process status.
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
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.
void DoCschedUeConfigReq(const FfMacCschedSapProvider::CschedUeConfigReqParameters &params)
Csched UE config request function.
bool HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
FfMacCschedSapUser * m_cschedSapUser
csched sap user
void DoSchedDlRachInfoReq(const FfMacSchedSapProvider::SchedDlRachInfoReqParameters &params)
Sched DL RACH info request function.
std::map< uint16_t, fdbetsFlowPerf_t > m_flowStatsUl
Map of UE statistics (per RNTI basis)
LteFfrSapProvider * m_ffrSapProvider
ffr sap provider
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL SNR.
FfMacSchedSapProvider * GetFfMacSchedSapProvider() override
std::vector< uint16_t > m_rachAllocationMap
rach allocation map
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
void DoSchedDlPagingBufferReq(const FfMacSchedSapProvider::SchedDlPagingBufferReqParameters &params)
Sched DL paging buffer request function.
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::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU List.
void DoCschedLcReleaseReq(const FfMacCschedSapProvider::CschedLcReleaseReqParameters &params)
CSched LC release request function.
void DoSchedUlNoiseInterferenceReq(const FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters &params)
Sched UL noise interference request function.
void RefreshDlCqiMaps()
Refresh DL CQI maps.
FfMacCschedSapProvider * m_cschedSapProvider
csched sap provider
void SetFfMacCschedSapUser(FfMacCschedSapUser *s) override
set the user part of the FfMacCschedSap that this Scheduler will interact with.
static TypeId GetTypeId()
Get the type ID.
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RLC buffer info.
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
DL HARQ retx buffered.
int GetRbgSize(int dlbandwidth)
Get RBG size function.
FfMacSchedSapUser * m_schedSapUser
sched sap user
void DoCschedUeReleaseReq(const FfMacCschedSapProvider::CschedUeReleaseReqParameters &params)
CSched UE release request function.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
void DoSchedDlRlcBufferReq(const FfMacSchedSapProvider::SchedDlRlcBufferReqParameters &params)
Sched DL RLC buffer request function.
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.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
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.
fdbetsFlowPerf_t structure
unsigned int lastTtiBytesTransmitted
last total bytes transmitted
double lastAveragedThroughput
last averaged throughput
unsigned long totalBytesTransmitted
total bytes transmitted
Time flowStart
flow start time