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