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