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