A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rr-ff-mac-scheduler.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Marco Miozzo <marco.miozzo@cttc.es>
19  * Nicola Baldo <nbaldo@cttc.es>
20  */
21 
22 #ifndef RR_FF_MAC_SCHEDULER_H
23 #define RR_FF_MAC_SCHEDULER_H
24 
25 #include <ns3/ff-mac-csched-sap.h>
26 #include <ns3/ff-mac-sched-sap.h>
27 #include <ns3/ff-mac-scheduler.h>
28 #include <vector>
29 #include <map>
30 #include <ns3/lte-common.h>
31 #include <ns3/lte-amc.h>
32 
33 #define HARQ_PROC_NUM 8
34 #define HARQ_DL_TIMEOUT 11
35 
36 namespace ns3 {
37 
38 
39 typedef std::vector < uint8_t > DlHarqProcessesStatus_t;
40 typedef std::vector < uint8_t > DlHarqProcessesTimer_t;
41 typedef std::vector < DlDciListElement_s > DlHarqProcessesDciBuffer_t;
42 typedef std::vector < std::vector <struct RlcPduListElement_s> > RlcPduList_t; // vector of the LCs and layers per UE
43 typedef std::vector < RlcPduList_t > DlHarqRlcPduListBuffer_t; // vector of the 8 HARQ processes per UE
44 
45 typedef std::vector < UlDciListElement_s > UlHarqProcessesDciBuffer_t;
46 typedef std::vector < uint8_t > UlHarqProcessesStatus_t;
47 
48 
49 
50 
63 {
64 public:
71 
75  virtual ~RrFfMacScheduler ();
76 
77  // inherited from Object
78  virtual void DoDispose (void);
79  static TypeId GetTypeId (void);
80 
81  // inherited from FfMacScheduler
82  virtual void SetFfMacCschedSapUser (FfMacCschedSapUser* s);
83  virtual void SetFfMacSchedSapUser (FfMacSchedSapUser* s);
86 
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 
99 
101 
103 
105 
107 
108  //
109  // Implementation of the SCHED API primitives
110  // (See 4.2 for description of the primitives)
111  //
112 
114 
116 
118 
120 
122 
124 
126 
128 
130 
132 
134 
135 
136  int GetRbgSize (int dlbandwidth);
137 
139 
140  void RefreshDlCqiMaps (void);
141  void RefreshUlCqiMaps (void);
142 
143  void UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size);
144  void UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size);
145 
152  uint8_t UpdateHarqProcessId (uint16_t rnti);
153 
160  uint8_t HarqProcessAvailability (uint16_t rnti);
161 
166  void RefreshHarqProcesses ();
167 
169 
170  /*
171  * Vectors of UE's RLC info
172  */
173  std::list <FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
174 
175  /*
176  * Map of UE's DL CQI P01 received
177  */
178  std::map <uint16_t,uint8_t> m_p10CqiRxed;
179  /*
180  * Map of UE's timers on DL CQI P01 received
181  */
182  std::map <uint16_t,uint32_t> m_p10CqiTimers;
183 
184  /*
185  * Map of previous allocated UE per RBG
186  * (used to retrieve info from UL-CQI)
187  */
188  std::map <uint16_t, std::vector <uint16_t> > m_allocationMaps;
189 
190  /*
191  * Map of UEs' UL-CQI per RBG
192  */
193  std::map <uint16_t, std::vector <double> > m_ueCqi;
194  /*
195  * Map of UEs' timers on UL-CQI per RBG
196  */
197  std::map <uint16_t, uint32_t> m_ueCqiTimers;
198 
199 
200 
201  /*
202  * Map of UE's buffer status reports received
203  */
204  std::map <uint16_t,uint32_t> m_ceBsrRxed;
205 
206  // MAC SAPs
211 
212 
213  // Internal parameters
215 
216  uint16_t m_nextRntiDl; // RNTI of the next user to be served next scheduling in DL
217  uint16_t m_nextRntiUl; // RNTI of the next user to be served next scheduling in UL
218 
219  uint32_t m_cqiTimersThreshold; // # of TTIs for which a CQI canbe considered valid
220 
221  std::map <uint16_t,uint8_t> m_uesTxMode; // txMode of the UEs
222 
223 
224 
225  // HARQ attributes
229  bool m_harqOn;
230  std::map <uint16_t, uint8_t> m_dlHarqCurrentProcessId;
231  //HARQ status
232  // 0: process Id available
233  // x>0: process Id equal to `x` trasmission count
234  std::map <uint16_t, DlHarqProcessesStatus_t> m_dlHarqProcessesStatus;
235  std::map <uint16_t, DlHarqProcessesTimer_t> m_dlHarqProcessesTimer;
236  std::map <uint16_t, DlHarqProcessesDciBuffer_t> m_dlHarqProcessesDciBuffer;
237  std::map <uint16_t, DlHarqRlcPduListBuffer_t> m_dlHarqProcessesRlcPduListBuffer;
238  std::vector <DlInfoListElement_s> m_dlInfoListBuffered; // HARQ retx buffered
239 
240  std::map <uint16_t, uint8_t> m_ulHarqCurrentProcessId;
241  //HARQ status
242  // 0: process Id available
243  // x>0: process Id equal to `x` trasmission count
244  std::map <uint16_t, UlHarqProcessesStatus_t> m_ulHarqProcessesStatus;
245  std::map <uint16_t, UlHarqProcessesDciBuffer_t> m_ulHarqProcessesDciBuffer;
246 
247 
248  // RACH attributes
249  std::vector <struct RachListElement_s> m_rachList;
250  std::vector <uint16_t> m_rachAllocationMap;
251  uint8_t m_ulGrantMcs; // MCS for UL grant (default 0)
252 };
253 
254 } // namespace ns3
255 
256 #endif /* RR_FF_MAC_SCHEDULER_H */