A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tdtbfq-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 TDTBFQ_FF_MAC_SCHEDULER_H
11#define TDTBFQ_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/**
29 * Flow information
30 */
32{
33 Time flowStart; ///< flow start time
34 uint64_t packetArrivalRate; ///< packet arrival rate( byte/s)
35 uint64_t tokenGenerationRate; ///< token generation rate ( byte/s )
36 uint32_t tokenPoolSize; ///< current size of token pool (byte)
37 uint32_t maxTokenPoolSize; ///< maximum size of token pool (byte)
38 int counter; ///< the number of token borrow or given to token bank
39 uint32_t burstCredit; ///< the maximum number of tokens connection i can borrow from the bank
40 ///< each time
41 int debtLimit; ///< counter threshold that the flow cannot further borrow tokens from bank
42 uint32_t creditableThreshold; ///< the flow cannot borrow token from bank until the number of
43 ///< token it has deposited to bank reaches this threshold
44};
45
46/**
47 * \ingroup ff-api
48 * \brief Implements the SCHED SAP and CSCHED SAP for a Time Domain Token Bank Fair Queue scheduler
49 *
50 * This class implements the interface defined by the FfMacScheduler abstract class
51 */
52
54{
55 public:
56 /**
57 * \brief Constructor
58 *
59 * Creates the MAC Scheduler interface implementation
60 */
62
63 /**
64 * Destructor
65 */
66 ~TdTbfqFfMacScheduler() override;
67
68 // inherited from Object
69 void DoDispose() override;
70 /**
71 * \brief Get the type ID.
72 * \return the object TypeId
73 */
74 static TypeId GetTypeId();
75
76 // inherited from FfMacScheduler
81
82 // FFR SAPs
85
86 /// allow MemberCschedSapProvider<TdTbfqFfMacScheduler> class friend access
88 /// allow MemberSchedSapProvider<TdTbfqFfMacScheduler> class friend access
90
91 /**
92 * \brief Transmission mde configuration update function
93 * \param rnti the RNTI
94 * \param txMode the transmission mode
95 */
96 void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode);
97
98 private:
99 //
100 // Implementation of the CSCHED API primitives
101 // (See 4.1 for description of the primitives)
102 //
103
104 /**
105 * \brief CSched cell config request
106 * \param params FfMacCschedSapProvider::CschedCellConfigReqParameters
107 */
109
110 /**
111 * \brief CSched UE config request
112 * \param params FfMacCschedSapProvider::CschedUeConfigReqParameters
113 */
115
116 /**
117 * \brief CSched LC config request
118 * \param params FfMacCschedSapProvider::CschedLcConfigReqParameters
119 */
121
122 /**
123 * \brief CSched LC release request
124 * \param params FfMacCschedSapProvider::CschedLcReleaseReqParameters
125 */
127
128 /**
129 * \brief CSched UE release request
130 * \param params FfMacCschedSapProvider::CschedUeReleaseReqParameters
131 */
133
134 //
135 // Implementation of the SCHED API primitives
136 // (See 4.2 for description of the primitives)
137 //
138
139 /**
140 * \brief Sched DL RLC buffer request
141 * \param params FfMacSchedSapProvider::SchedDlRlcBufferReqParameters
142 */
144
145 /**
146 * \brief Sched DL paging buffer request
147 * \param params FfMacSchedSapProvider::SchedDlPagingBufferReqParameters
148 */
151
152 /**
153 * \brief Sched DL MAC buffer request
154 * \param params FfMacSchedSapProvider::SchedDlMacBufferReqParameters
155 */
157
158 /**
159 * \brief Sched DL trigger request
160 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters
161 */
163
164 /**
165 * \brief Sched DL RACH info request
166 * \param params FfMacSchedSapProvider::SchedDlRachInfoReqParameters
167 */
169
170 /**
171 * \brief Sched DL CQI info request
172 * \param params FfMacSchedSapProvider::SchedDlCqiInfoReqParameters
173 */
175
176 /**
177 * \brief Sched UL trigger request
178 * \param params FfMacSchedSapProvider::SchedUlTriggerReqParameters
179 */
181
182 /**
183 * \brief Sched UL noise interference request
184 * \param params FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters
185 */
188
189 /**
190 * \brief Sched UL SR info request
191 * \param params FfMacSchedSapProvider::SchedUlSrInfoReqParameters
192 */
194
195 /**
196 * \brief Sched UL MAC control info request
197 * \param params FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters
198 */
201
202 /**
203 * \brief Sched UL CQI info request
204 * \param params FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
205 */
207
208 /**
209 * \brief Get RBG size
210 * \param dlbandwidth he DL bandwidth
211 * \returns the RBG size
212 */
213 int GetRbgSize(int dlbandwidth);
214
215 /**
216 * \brief LC active flow size
217 * \param rnti the RNTI
218 * \returns the LC active flow
219 */
220 unsigned int LcActivePerFlow(uint16_t rnti);
221
222 /**
223 * \brief Estimate UL SINR function
224 * \param rnti the RNTI
225 * \param rb the RB
226 * \returns the SINR
227 */
228 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
229
230 /// Refresh DL CQI maps function
231 void RefreshDlCqiMaps();
232 /// Refresh UL CQI maps function
233 void RefreshUlCqiMaps();
234
235 /**
236 * \brief Update DL RLC buffer info function
237 * \param rnti the RNTI
238 * \param lcid the LCID
239 * \param size the size
240 */
241 void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size);
242 /**
243 * \brief Update UL RLC buffer info function
244 * \param rnti the RNTI
245 * \param size the size
246 */
247 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
248
249 /**
250 * \brief Update and return a new process Id for the RNTI specified
251 *
252 * \param rnti the RNTI of the UE to be updated
253 * \return the process id value
254 */
255 uint8_t UpdateHarqProcessId(uint16_t rnti);
256
257 /**
258 * \brief Return the availability of free process for the RNTI specified
259 *
260 * \param rnti the RNTI of the UE to be updated
261 * \return the availability
262 */
263 bool HarqProcessAvailability(uint16_t rnti);
264
265 /**
266 * \brief Refresh HARQ processes according to the timers
267 *
268 */
270
272
273 /**
274 * Vectors of UE's LC info
275 */
276 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
277
278 /**
279 * Map of UE statistics (per RNTI basis) in downlink
280 */
281 std::map<uint16_t, tdtbfqsFlowPerf_t> m_flowStatsDl;
282
283 /**
284 * Map of UE statistics (per RNTI basis)
285 */
286 std::map<uint16_t, tdtbfqsFlowPerf_t> m_flowStatsUl;
287
288 /**
289 * Map of UE's DL CQI P01 received
290 */
291 std::map<uint16_t, uint8_t> m_p10CqiRxed;
292 /**
293 * Map of UE's timers on DL CQI P01 received
294 */
295 std::map<uint16_t, uint32_t> m_p10CqiTimers;
296
297 /**
298 * Map of UE's DL CQI A30 received
299 */
300 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
301 /**
302 * Map of UE's timers on DL CQI A30 received
303 */
304 std::map<uint16_t, uint32_t> m_a30CqiTimers;
305
306 /**
307 * Map of previous allocated UE per RBG
308 * (used to retrieve info from UL-CQI)
309 */
310 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
311
312 /**
313 * Map of UEs' UL-CQI per RBG
314 */
315 std::map<uint16_t, std::vector<double>> m_ueCqi;
316 /**
317 * Map of UEs' timers on UL-CQI per RBG
318 */
319 std::map<uint16_t, uint32_t> m_ueCqiTimers;
320
321 /**
322 * Map of UE's buffer status reports received
323 */
324 std::map<uint16_t, uint32_t> m_ceBsrRxed;
325
326 // MAC SAPs
327 FfMacCschedSapUser* m_cschedSapUser; ///< CSched SAP user
328 FfMacSchedSapUser* m_schedSapUser; ///< A=Sched SAP user
331
332 // FFR SAPs
333 LteFfrSapUser* m_ffrSapUser; ///< FFR SAP user
334 LteFfrSapProvider* m_ffrSapProvider; ///< FFR SAP provider
335
336 // Internal parameters
338 m_cschedCellConfig; ///< CSched cell config
339
340 uint16_t m_nextRntiUl; ///< RNTI of the next user to be served next scheduling in UL
341
342 uint32_t m_cqiTimersThreshold; ///< # of TTIs for which a CQI can be considered valid
343
344 std::map<uint16_t, uint8_t> m_uesTxMode; ///< txMode of the UEs
345
346 uint64_t bankSize; ///< the number of bytes in token bank
347
348 int m_debtLimit; ///< flow debt limit (byte)
349
350 uint32_t m_creditLimit; ///< flow credit limit (byte)
351
352 uint32_t m_tokenPoolSize; ///< maximum size of token pool (byte)
353
354 uint32_t m_creditableThreshold; ///< threshold of flow credit
355
356 // HARQ attributes
357 /**
358 * m_harqOn when false inhibit the HARQ mechanisms (by default active)
359 */
361 std::map<uint16_t, uint8_t> m_dlHarqCurrentProcessId; ///< DL HARQ current process ID
362 // HARQ status
363 // 0: process Id available
364 // x>0: process Id equal to `x` transmission count
365 std::map<uint16_t, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus; ///< DL HARQ process status
366 std::map<uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer; ///< DL HARQ process timer
367 std::map<uint16_t, DlHarqProcessesDciBuffer_t>
368 m_dlHarqProcessesDciBuffer; ///< DL HARQ process DCI buffer
369 std::map<uint16_t, DlHarqRlcPduListBuffer_t>
370 m_dlHarqProcessesRlcPduListBuffer; ///< DL HARQ process RLC PDU list buffer
371 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< HARQ retx buffered
372
373 std::map<uint16_t, uint8_t> m_ulHarqCurrentProcessId; ///< UL HARQ current process ID
374 // HARQ status
375 // 0: process Id available
376 // x>0: process Id equal to `x` transmission count
377 std::map<uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus; ///< UL HARQ process status
378 std::map<uint16_t, UlHarqProcessesDciBuffer_t>
379 m_ulHarqProcessesDciBuffer; ///< UL HARQ process DCI buffer
380
381 // RACH attributes
382 std::vector<RachListElement_s> m_rachList; ///< RACH list
383 std::vector<uint16_t> m_rachAllocationMap; ///< RACH allocation map
384 uint8_t m_ulGrantMcs; ///< MCS for UL grant (default 0)
385};
386
387} // namespace ns3
388
389#endif /* TDTBFQ_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: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.
Implements the SCHED SAP and CSCHED SAP for a Time Domain Token Bank Fair Queue scheduler.
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
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.
static TypeId GetTypeId()
Get the type ID.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARQ process timer.
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RLC buffer info function.
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RLC buffer info function.
~TdTbfqFfMacScheduler() override
Destructor.
FfMacSchedSapProvider * m_schedSapProvider
Sched SAP provider.
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
UL HARQ process DCI buffer.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
CSched cell config.
FfMacSchedSapUser * m_schedSapUser
A=Sched SAP user.
unsigned int LcActivePerFlow(uint16_t rnti)
LC active flow size.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU list buffer.
uint32_t m_creditLimit
flow credit limit (byte)
void DoSchedUlMacCtrlInfoReq(const FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters &params)
Sched UL MAC control info request.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
void DoSchedUlTriggerReq(const FfMacSchedSapProvider::SchedUlTriggerReqParameters &params)
Sched UL trigger request.
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
std::map< uint16_t, uint32_t > m_ceBsrRxed
Map of UE's buffer status reports received.
int GetRbgSize(int dlbandwidth)
Get RBG size.
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
void DoSchedDlPagingBufferReq(const FfMacSchedSapProvider::SchedDlPagingBufferReqParameters &params)
Sched DL paging buffer request.
void RefreshDlCqiMaps()
Refresh DL CQI maps function.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
FfMacSchedSapProvider * GetFfMacSchedSapProvider() override
uint32_t m_creditableThreshold
threshold of flow credit
void DoSchedDlTriggerReq(const FfMacSchedSapProvider::SchedDlTriggerReqParameters &params)
Sched DL trigger request.
std::map< uint16_t, tdtbfqsFlowPerf_t > m_flowStatsUl
Map of UE statistics (per RNTI basis)
LteFfrSapUser * GetLteFfrSapUser() override
FfMacCschedSapProvider * GetFfMacCschedSapProvider() override
void DoSchedDlMacBufferReq(const FfMacSchedSapProvider::SchedDlMacBufferReqParameters &params)
Sched DL MAC buffer request.
void DoCschedLcConfigReq(const FfMacCschedSapProvider::CschedLcConfigReqParameters &params)
CSched LC config request.
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Transmission mde configuration update function.
void DoSchedDlRachInfoReq(const FfMacSchedSapProvider::SchedDlRachInfoReqParameters &params)
Sched DL RACH info request.
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
FfMacCschedSapProvider * m_cschedSapProvider
CSched SAP provider.
void RefreshUlCqiMaps()
Refresh UL CQI maps function.
void DoSchedUlCqiInfoReq(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
Sched UL CQI info request.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
int m_debtLimit
flow debt limit (byte)
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL SINR function.
std::vector< RachListElement_s > m_rachList
RACH list.
void DoCschedLcReleaseReq(const FfMacCschedSapProvider::CschedLcReleaseReqParameters &params)
CSched LC release request.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void DoSchedUlSrInfoReq(const FfMacSchedSapProvider::SchedUlSrInfoReqParameters &params)
Sched UL SR info request.
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
void DoCschedUeConfigReq(const FfMacCschedSapProvider::CschedUeConfigReqParameters &params)
CSched UE config request.
uint32_t m_tokenPoolSize
maximum size of token pool (byte)
void DoCschedUeReleaseReq(const FfMacCschedSapProvider::CschedUeReleaseReqParameters &params)
CSched UE release request.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process status.
void DoSchedDlRlcBufferReq(const FfMacSchedSapProvider::SchedDlRlcBufferReqParameters &params)
Sched DL RLC buffer request.
FfMacCschedSapUser * m_cschedSapUser
CSched SAP user.
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
void DoDispose() override
Destructor implementation.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL 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)
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
void SetFfMacCschedSapUser(FfMacCschedSapUser *s) override
set the user part of the FfMacCschedSap that this Scheduler will interact with.
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
HARQ retx buffered.
void DoSchedUlNoiseInterferenceReq(const FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters &params)
Sched UL noise interference request.
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
void DoCschedCellConfigReq(const FfMacCschedSapProvider::CschedCellConfigReqParameters &params)
CSched cell config request.
void DoSchedDlCqiInfoReq(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
Sched DL CQI info request.
std::map< uint16_t, tdtbfqsFlowPerf_t > m_flowStatsDl
Map of UE statistics (per RNTI basis) in downlink.
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
uint64_t bankSize
the number of bytes in token bank
bool m_harqOn
m_harqOn when false inhibit the HARQ mechanisms (by default active)
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.
uint32_t tokenPoolSize
current size of token pool (byte)
int debtLimit
counter threshold that the flow cannot further borrow tokens from bank
uint32_t maxTokenPoolSize
maximum size of token pool (byte)
int counter
the number of token borrow or given to token bank
uint32_t creditableThreshold
the flow cannot borrow token from bank until the number of token it has deposited to bank reaches thi...
uint64_t packetArrivalRate
packet arrival rate( byte/s)
uint64_t tokenGenerationRate
token generation rate ( byte/s )
uint32_t burstCredit
the maximum number of tokens connection i can borrow from the bank each time