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 * 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 FDBET_FF_MAC_SCHEDULER_H
22#define FDBET_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 <vector>
35
36namespace ns3
37{
38
39/// fdbetsFlowPerf_t structure
41{
42 Time flowStart; ///< flow start time
43 unsigned long totalBytesTransmitted; ///< total bytes transmitted
44 unsigned int lastTtiBytesTransmitted; ///< last total bytes transmitted
45 double lastAveragedThroughput; ///< last averaged throughput
46};
47
48/**
49 * \ingroup ff-api
50 * \brief Implements the SCHED SAP and CSCHED SAP for a Frequency Domain Blind Equal Throughput
51 * scheduler
52 *
53 * This class implements the interface defined by the FfMacScheduler abstract class
54 */
55
57{
58 public:
59 /**
60 * \brief Constructor
61 *
62 * Creates the MAC Scheduler interface implementation
63 */
65
66 /**
67 * Destructor
68 */
69 ~FdBetFfMacScheduler() override;
70
71 // inherited from Object
72 void DoDispose() override;
73 /**
74 * \brief Get the type ID.
75 * \return the object TypeId
76 */
77 static TypeId GetTypeId();
78
79 // inherited from FfMacScheduler
84
85 // FFR SAPs
88
89 /// allow MemberCschedSapProvider<FdBetFfMacScheduler> class friend access
91 /// allow MemberSchedSapProvider<FdBetFfMacScheduler> class friend access
93
94 /**
95 * Transmission mode configuration update function
96 * \param rnti the RNTI
97 * \param txMode the transmit mode
98 */
99 void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode);
100
101 private:
102 //
103 // Implementation of the CSCHED API primitives
104 // (See 4.1 for description of the primitives)
105 //
106
107 /**
108 * CSched cell config request function
109 * \param params the CSched cell config request parameters
110 */
112
113 /**
114 * Csched UE config request function
115 * \param params the CSched UE config request parameters
116 */
118
119 /**
120 * Csched LC config request function
121 * \param params the CSched LC config request parameters
122 */
124
125 /**
126 * CSched LC release request function
127 * \param params the CSched LC release request parameters
128 */
130
131 /**
132 * CSched UE release request function
133 * \param params the CSChed UE release request parameters
134 */
136
137 //
138 // Implementation of the SCHED API primitives
139 // (See 4.2 for description of the primitives)
140 //
141
142 /**
143 * Sched DL RLC buffer request function
144 * \param params the Sched DL RLC buffer request parameters
145 */
147
148 /**
149 * Sched DL paging buffer request function
150 * \param params the Sched DL paging buffer request parameters
151 */
154
155 /**
156 * Sched DL MAC buffer request function
157 * \param params the Sched DL MAC buffer request parameters
158 */
160
161 /**
162 * Sched DL trigger request function
163 *
164 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters&
165 */
167
168 /**
169 * Sched DL RACH info request function
170 * \param params the Sched DL RACH info request parameters
171 */
173
174 /**
175 * Sched DL CGI info request function
176 * \param params the Sched DL CGI info request parameters
177 */
179
180 /**
181 * Sched UL trigger request function
182 * \param params the Sched UL trigger request parameters
183 */
185
186 /**
187 * Sched UL noise interference request function
188 * \param params the Sched UL noise interference request parameters
189 */
192
193 /**
194 * Sched UL SR info request function
195 * \param params the Schedul UL SR info request parameters
196 */
198
199 /**
200 * Sched UL MAC control info request function
201 * \param params the Sched UL MAC control info request parameters
202 */
205
206 /**
207 * Sched UL CGI info request function
208 * \param params the Sched UL CGI info request parameters
209 */
211
212 /**
213 * Get RBG size function
214 * \param dlbandwidth the DL bandwidth
215 * \returns the RBG size
216 */
217 int GetRbgSize(int dlbandwidth);
218
219 /**
220 * LC active per flow function
221 * \param rnti the RNTI
222 * \returns the LC active per flow
223 */
224 unsigned int LcActivePerFlow(uint16_t rnti);
225
226 /**
227 * Estimate UL SNR
228 * \param rnti the RNTI
229 * \param rb the RB
230 * \returns the UL SINR
231 */
232 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
233
234 /// Refresh DL CQI maps
235 void RefreshDlCqiMaps();
236 /// Refresh UL CQI maps
237 void RefreshUlCqiMaps();
238
239 /**
240 * Update DL RLC buffer info
241 * \param rnti the RNTI
242 * \param lcid the LCID
243 * \param size the size
244 */
245 void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size);
246 /**
247 * Update UL RLC buffer info
248 * \param rnti the RNTI
249 * \param size the size
250 */
251 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
252
253 /**
254 * \brief Update and return a new process Id for the RNTI specified
255 *
256 * \param rnti the RNTI of the UE to be updated
257 * \return the process id value
258 */
259 uint8_t UpdateHarqProcessId(uint16_t rnti);
260
261 /**
262 * \brief Return the availability of free process for the RNTI specified
263 *
264 * \param rnti the RNTI of the UE to be updated
265 * \return the availability
266 */
267 bool HarqProcessAvailability(uint16_t rnti);
268
269 /**
270 * \brief Refresh HARQ processes according to the timers
271 *
272 */
274
276
277 /**
278 * Vectors of UE's LC info
279 */
280 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
281
282 /**
283 * Map of UE statistics (per RNTI basis) in downlink
284 */
285 std::map<uint16_t, fdbetsFlowPerf_t> m_flowStatsDl;
286
287 /**
288 * Map of UE statistics (per RNTI basis)
289 */
290 std::map<uint16_t, fdbetsFlowPerf_t> m_flowStatsUl;
291
292 /**
293 * Map of UE's DL CQI P01 received
294 */
295 std::map<uint16_t, uint8_t> m_p10CqiRxed;
296
297 /**
298 * Map of UE's timers on DL CQI P01 received
299 */
300 std::map<uint16_t, uint32_t> m_p10CqiTimers;
301
302 /**
303 * Map of UE's DL CQI A30 received
304 */
305 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
306
307 /**
308 * Map of UE's timers on DL CQI A30 received
309 */
310 std::map<uint16_t, uint32_t> m_a30CqiTimers;
311
312 /**
313 * Map of previous allocated UE per RBG
314 * (used to retrieve info from UL-CQI)
315 */
316 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
317
318 /**
319 * Map of UEs' UL-CQI per RBG
320 */
321 std::map<uint16_t, std::vector<double>> m_ueCqi;
322
323 /**
324 * Map of UEs' timers on UL-CQI per RBG
325 */
326 std::map<uint16_t, uint32_t> m_ueCqiTimers;
327
328 /**
329 * Map of UE's buffer status reports received
330 */
331 std::map<uint16_t, uint32_t> m_ceBsrRxed;
332
333 // MAC SAPs
334 FfMacCschedSapUser* m_cschedSapUser; ///< csched sap user
335 FfMacSchedSapUser* m_schedSapUser; ///< sched sap user
338
339 // FFR SAPs
340 LteFfrSapUser* m_ffrSapUser; ///< ffr sap user
341 LteFfrSapProvider* m_ffrSapProvider; ///< ffr sap provider
342
343 // Internal parameters
345 m_cschedCellConfig; ///< csched cell config
346
347 double m_timeWindow; ///< time window
348
349 uint16_t m_nextRntiUl; ///< RNTI of the next user to be served next scheduling in UL
350
351 uint32_t m_cqiTimersThreshold; ///< # of TTIs for which a CQI can be considered valid
352
353 std::map<uint16_t, uint8_t> m_uesTxMode; ///< txMode of the UEs
354
355 // HARQ attributes
356 bool m_harqOn; ///< m_harqOn when false inhibit the HARQ mechanisms (by default active)
357 std::map<uint16_t, uint8_t> m_dlHarqCurrentProcessId; ///< DL HARQ current process ID
358 // HARQ status
359 // 0: process Id available
360 // x>0: process Id equal to `x` transmission count
361 std::map<uint16_t, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus; ///< DL HARQ process status
362 std::map<uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer; ///< DL HARQ process timer
363 std::map<uint16_t, DlHarqProcessesDciBuffer_t>
364 m_dlHarqProcessesDciBuffer; ///< DL HARQ process DCI buffer
365 std::map<uint16_t, DlHarqRlcPduListBuffer_t>
366 m_dlHarqProcessesRlcPduListBuffer; ///< DL HARQ process RLC PDU List
367 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< DL HARQ retx buffered
368
369 std::map<uint16_t, uint8_t> m_ulHarqCurrentProcessId; ///< UL HARQ current process ID
370 // HARQ status
371 // 0: process Id available
372 // x>0: process Id equal to `x` transmission count
373 std::map<uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus; ///< UL HARQ process status
374 std::map<uint16_t, UlHarqProcessesDciBuffer_t>
375 m_ulHarqProcessesDciBuffer; ///< UL HARQ process DCI Buffer
376
377 // RACH attributes
378 std::vector<RachListElement_s> m_rachList; ///< rach list
379 std::vector<uint16_t> m_rachAllocationMap; ///< rach allocation map
380 uint8_t m_ulGrantMcs; ///< MCS for UL grant (default 0)
381};
382
383} // namespace ns3
384
385#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: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
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
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.
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