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