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