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