A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
pf-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 */
8
9#ifndef PF_FF_MAC_SCHEDULER_H
10#define PF_FF_MAC_SCHEDULER_H
11
12#include "ff-mac-csched-sap.h"
13#include "ff-mac-sched-sap.h"
14#include "ff-mac-scheduler.h"
15#include "lte-amc.h"
16#include "lte-common.h"
17#include "lte-ffr-sap.h"
18
19#include <ns3/nstime.h>
20
21#include <map>
22#include <vector>
23
24namespace ns3
25{
26
27/// pfsFlowPerf_t structure
29{
30 Time flowStart; ///< flow start time
31 unsigned long totalBytesTransmitted; ///< total bytes transmitted
32 unsigned int lastTtiBytesTransmitted; ///< last total bytes transmitted
33 double lastAveragedThroughput; ///< last averaged throughput
34};
35
36/**
37 * \ingroup ff-api
38 * \brief Implements the SCHED SAP and CSCHED SAP for a Proportional Fair scheduler
39 *
40 * This class implements the interface defined by the FfMacScheduler abstract class
41 */
42
44{
45 public:
46 /**
47 * \brief Constructor
48 *
49 * Creates the MAC Scheduler interface implementation
50 */
52
53 /**
54 * Destructor
55 */
56 ~PfFfMacScheduler() override;
57
58 // inherited from Object
59 void DoDispose() override;
60 /**
61 * \brief Get the type ID.
62 * \return the object TypeId
63 */
64 static TypeId GetTypeId();
65
66 // inherited from FfMacScheduler
71
72 // FFR SAPs
75
76 /// allow MemberCschedSapProvider<PfFfMacScheduler> class friend access
78 /// allow MemberSchedSapProvider<PfFfMacScheduler> class friend access
80
81 /**
82 * \brief transmission mode configuration update
83 *
84 * \param rnti the RNTI
85 * \param txMode the transmit 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 *
98 * \param params FfMacCschedSapProvider::CschedCellConfigReqParameters
99 */
101
102 /**
103 * \brief CSched UE config request
104 *
105 * \param params FfMacCschedSapProvider::CschedUeConfigReqParameters
106 */
108
109 /**
110 * \brief CSched LC config request
111 *
112 * \param params FfMacCschedSapProvider::CschedLcConfigReqParameters
113 */
115
116 /**
117 * \brief CSched LC release request
118 *
119 * \param params FfMacCschedSapProvider::CschedLcReleaseReqParameters
120 */
122
123 /**
124 * \brief CSched UE release request
125 *
126 * \param params FfMacCschedSapProvider::CschedLcReleaseReqParameters
127 */
129
130 //
131 // Implementation of the SCHED API primitives
132 // (See 4.2 for description of the primitives)
133 //
134
135 /**
136 * \brief Sched DL RLC buffer request
137 *
138 * \param params FfMacSchedSapProvider::SchedDlRlcBufferReqParameters
139 */
141
142 /**
143 * \brief Sched DL paging buffer request
144 *
145 * \param params FfMacSchedSapProvider::SchedDlPagingBufferReqParameters
146 */
149
150 /**
151 * \brief Sched DL MAC buffer request
152 *
153 * \param params FfMacSchedSapProvider::SchedDlMacBufferReqParameters
154 */
156
157 /**
158 * \brief Sched DL trigger request
159 *
160 * \param params FfMacSchedSapProvider::SchedDlTriggerReqParameters
161 */
163
164 /**
165 * \brief Sched DL RACH info request
166 *
167 * \param params FfMacSchedSapProvider::SchedDlRachInfoReqParameters
168 */
170
171 /**
172 * \brief Sched DL CQI info request
173 *
174 * \param params FfMacSchedSapProvider::SchedDlCqiInfoReqParameters
175 */
177
178 /**
179 * \brief Sched UL trigger request
180 *
181 * \param params FfMacSchedSapProvider::SchedUlTriggerReqParameters
182 */
184
185 /**
186 * \brief Sched UL noise interference request
187 *
188 * \param params FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters
189 */
192
193 /**
194 * \brief Sched UL SR info request
195 *
196 * \param params FfMacSchedSapProvider::SchedUlSrInfoReqParameters
197 */
199
200 /**
201 * \brief Sched UL MAC control info request
202 *
203 * \param params FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters
204 */
207
208 /**
209 * \brief Sched UL CQI info request
210 *
211 * \param params FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
212 */
214
215 /**
216 * \brief Get RBG size
217 *
218 * \param dlbandwidth dDL bandwidth
219 * \returns the RBG size
220 */
221 int GetRbgSize(int dlbandwidth);
222
223 /**
224 * \brief LC active per flow
225 *
226 * \param rnti the RNTI
227 * \returns the LC active per flow
228 */
229 unsigned int LcActivePerFlow(uint16_t rnti);
230
231 /**
232 * \brief Estimate UL SINR
233 *
234 * \param rnti the RNTI
235 * \param rb the RB
236 * \returns the SINR
237 */
238 double EstimateUlSinr(uint16_t rnti, uint16_t rb);
239
240 /// Refresh DL CQI maps
241 void RefreshDlCqiMaps();
242 /// Refresh UL CQI maps
243 void RefreshUlCqiMaps();
244
245 /**
246 * \brief Update DL RCL buffer info
247 *
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 RCL buffer info
255 *
256 * \param rnti the RNTI
257 * \param size the size
258 */
259 void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size);
260
261 /**
262 * \brief Update and return a new process Id for the RNTI specified
263 *
264 * \param rnti the RNTI of the UE to be updated
265 * \return the process id value
266 */
267 uint8_t UpdateHarqProcessId(uint16_t rnti);
268
269 /**
270 * \brief Return the availability of free process for the RNTI specified
271 *
272 * \param rnti the RNTI of the UE to be updated
273 * \return the availability
274 */
275 bool HarqProcessAvailability(uint16_t rnti);
276
277 /**
278 * \brief Refresh HARQ processes according to the timers
279 *
280 */
282
284
285 /**
286 * Vectors of UE's LC info
287 */
288 std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
289
290 /**
291 * Map of UE statistics (per RNTI basis) in downlink
292 */
293 std::map<uint16_t, pfsFlowPerf_t> m_flowStatsDl;
294
295 /**
296 * Map of UE statistics (per RNTI basis)
297 */
298 std::map<uint16_t, pfsFlowPerf_t> m_flowStatsUl;
299
300 /**
301 * Map of UE's DL CQI P01 received
302 */
303 std::map<uint16_t, uint8_t> m_p10CqiRxed;
304 /**
305 * Map of UE's timers on DL CQI P01 received
306 */
307 std::map<uint16_t, uint32_t> m_p10CqiTimers;
308
309 /**
310 * Map of UE's DL CQI A30 received
311 */
312 std::map<uint16_t, SbMeasResult_s> m_a30CqiRxed;
313 /**
314 * Map of UE's timers on DL CQI A30 received
315 */
316 std::map<uint16_t, uint32_t> m_a30CqiTimers;
317
318 /**
319 * Map of previous allocated UE per RBG
320 * (used to retrieve info from UL-CQI)
321 */
322 std::map<uint16_t, std::vector<uint16_t>> m_allocationMaps;
323
324 /**
325 * Map of UEs' UL-CQI per RBG
326 */
327 std::map<uint16_t, std::vector<double>> m_ueCqi;
328 /**
329 * Map of UEs' timers on UL-CQI per RBG
330 */
331 std::map<uint16_t, uint32_t> m_ueCqiTimers;
332
333 /**
334 * Map of UE's buffer status reports received
335 */
336 std::map<uint16_t, uint32_t> m_ceBsrRxed;
337
338 // MAC SAPs
339 FfMacCschedSapUser* m_cschedSapUser; ///< CSched SAP user
340 FfMacSchedSapUser* m_schedSapUser; ///< Sched SAP user
343
344 // FFR SAPs
345 LteFfrSapUser* m_ffrSapUser; ///< FFR SAP user
346 LteFfrSapProvider* m_ffrSapProvider; ///< FFR SAP provider
347
348 // Internal parameters
350 m_cschedCellConfig; ///< CSched cell config
351
352 double m_timeWindow; ///< time window
353
354 uint16_t m_nextRntiUl; ///< RNTI of the next user to be served next scheduling in UL
355
356 uint32_t m_cqiTimersThreshold; ///< # of TTIs for which a CQI can be considered valid
357
358 std::map<uint16_t, uint8_t> m_uesTxMode; ///< txMode of the UEs
359
360 // HARQ attributes
361 /**
362 * m_harqOn when false inhibit the HARQ mechanisms (by default active)
363 */
365 std::map<uint16_t, uint8_t> m_dlHarqCurrentProcessId; ///< DL HARQ current process ID
366 // HARQ status
367 // 0: process Id available
368 // x>0: process Id equal to `x` transmission count
369 std::map<uint16_t, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus; ///< DL HARQ process status
370 std::map<uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer; ///< DL HARQ process timer
371 std::map<uint16_t, DlHarqProcessesDciBuffer_t>
372 m_dlHarqProcessesDciBuffer; ///< DL HARQ process DCI buffer
373 std::map<uint16_t, DlHarqRlcPduListBuffer_t>
374 m_dlHarqProcessesRlcPduListBuffer; ///< DL HARQ process RLC PDU list buffer
375 std::vector<DlInfoListElement_s> m_dlInfoListBuffered; ///< HARQ retx buffered
376
377 std::map<uint16_t, uint8_t> m_ulHarqCurrentProcessId; ///< UL HARQ current process ID
378 // HARQ status
379 // 0: process Id available
380 // x>0: process Id equal to `x` transmission count
381 std::map<uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus; ///< UL HARQ process status
382 std::map<uint16_t, UlHarqProcessesDciBuffer_t>
383 m_ulHarqProcessesDciBuffer; ///< UL HARQ process DCI buffer
384
385 // RACH attributes
386 std::vector<RachListElement_s> m_rachList; ///< RACH list
387 std::vector<uint16_t> m_rachAllocationMap; ///< RACH allocation map
388 uint8_t m_ulGrantMcs; ///< MCS for UL grant (default 0)
389};
390
391} // namespace ns3
392
393#endif /* PF_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 Proportional Fair scheduler.
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL HARQ current process ID.
void DoCschedCellConfigReq(const FfMacCschedSapProvider::CschedCellConfigReqParameters &params)
CSched cell config request.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
CSched cell config.
static TypeId GetTypeId()
Get the type ID.
~PfFfMacScheduler() override
Destructor.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process status.
void DoSchedDlRlcBufferReq(const FfMacSchedSapProvider::SchedDlRlcBufferReqParameters &params)
Sched DL RLC buffer request.
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL SINR.
void DoCschedLcReleaseReq(const FfMacCschedSapProvider::CschedLcReleaseReqParameters &params)
CSched LC release request.
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
transmission mode configuration update
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
bool m_harqOn
m_harqOn when false inhibit the HARQ mechanisms (by default active)
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
void DoSchedUlTriggerReq(const FfMacSchedSapProvider::SchedUlTriggerReqParameters &params)
Sched UL trigger request.
void DoSchedUlMacCtrlInfoReq(const FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters &params)
Sched UL MAC control info request.
void DoSchedUlNoiseInterferenceReq(const FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters &params)
Sched UL noise interference request.
LteFfrSapUser * GetLteFfrSapUser() override
void DoSchedDlMacBufferReq(const FfMacSchedSapProvider::SchedDlMacBufferReqParameters &params)
Sched DL MAC buffer request.
void SetFfMacSchedSapUser(FfMacSchedSapUser *s) override
set the user part of the FfMacSchedSap that this Scheduler will interact with.
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARQ process timer.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
FfMacSchedSapProvider * m_schedSapProvider
Sched SAP provider.
FfMacCschedSapProvider * GetFfMacCschedSapProvider() override
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
void DoSchedDlRachInfoReq(const FfMacSchedSapProvider::SchedDlRachInfoReqParameters &params)
Sched DL RACH info request.
void DoSchedDlTriggerReq(const FfMacSchedSapProvider::SchedDlTriggerReqParameters &params)
Sched DL trigger request.
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RCL buffer info.
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU list buffer.
void DoSchedUlSrInfoReq(const FfMacSchedSapProvider::SchedUlSrInfoReqParameters &params)
Sched UL SR info request.
std::map< uint16_t, uint32_t > m_ceBsrRxed
Map of UE's buffer status reports received.
void DoDispose() override
Destructor implementation.
FfMacCschedSapUser * m_cschedSapUser
CSched SAP user.
unsigned int LcActivePerFlow(uint16_t rnti)
LC active per flow.
void RefreshDlCqiMaps()
Refresh DL CQI maps.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
std::map< uint16_t, pfsFlowPerf_t > m_flowStatsDl
Map of UE statistics (per RNTI basis) in downlink.
void DoSchedUlCqiInfoReq(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
Sched UL CQI info request.
double m_timeWindow
time window
std::map< uint16_t, pfsFlowPerf_t > m_flowStatsUl
Map of UE statistics (per RNTI basis)
void DoCschedLcConfigReq(const FfMacCschedSapProvider::CschedLcConfigReqParameters &params)
CSched LC config request.
void RefreshUlCqiMaps()
Refresh UL CQI maps.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
std::map< uint16_t, std::vector< uint16_t > > m_allocationMaps
Map of previous allocated UE per RBG (used to retrieve info from UL-CQI)
bool HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
void SetFfMacCschedSapUser(FfMacCschedSapUser *s) override
set the user part of the FfMacCschedSap that this Scheduler will interact with.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RCL buffer info.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
std::vector< RachListElement_s > m_rachList
RACH list.
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
FfMacCschedSapProvider * m_cschedSapProvider
CSched SAP provider.
void SetLteFfrSapProvider(LteFfrSapProvider *s) override
Set the Provider part of the LteFfrSap that this Scheduler will interact with.
void DoCschedUeReleaseReq(const FfMacCschedSapProvider::CschedUeReleaseReqParameters &params)
CSched UE release request.
int GetRbgSize(int dlbandwidth)
Get RBG size.
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
UL HARQ process DCI buffer.
void DoCschedUeConfigReq(const FfMacCschedSapProvider::CschedUeConfigReqParameters &params)
CSched UE config request.
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
FfMacSchedSapProvider * GetFfMacSchedSapProvider() override
void DoSchedDlCqiInfoReq(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
Sched DL CQI info request.
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
void DoSchedDlPagingBufferReq(const FfMacSchedSapProvider::SchedDlPagingBufferReqParameters &params)
Sched DL paging buffer request.
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
HARQ retx buffered.
FfMacSchedSapUser * m_schedSapUser
Sched SAP user.
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.
pfsFlowPerf_t structure
unsigned long totalBytesTransmitted
total bytes transmitted
unsigned int lastTtiBytesTransmitted
last total bytes transmitted
Time flowStart
flow start time
double lastAveragedThroughput
last averaged throughput