author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 17 Jun 2011 17:32:20 +0200 | |
changeset 8148 | 09e2d03022a2 |
parent 8086 | 8a03b3d2fa43 |
child 8264 | e3a90cfb6ac2 |
permissions | -rw-r--r-- |
7886 | 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 |
*/ |
|
20 |
||
21 |
#include <ns3/log.h> |
|
22 |
#include <ns3/pointer.h> |
|
23 |
||
7887 | 24 |
#include "lte-amc.h" |
7886 | 25 |
#include "rr-ff-mac-scheduler.h" |
26 |
||
7906
d58de34e41d3
MAC, RRC and Scheduler created by LenaHelper
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7897
diff
changeset
|
27 |
NS_LOG_COMPONENT_DEFINE ("RrFfMacScheduler"); |
7886 | 28 |
|
29 |
namespace ns3 { |
|
30 |
||
31 |
int Type0AllocationRbg[4] = { |
|
32 |
10, // RGB size 1 |
|
33 |
26, // RGB size 2 |
|
34 |
63, // RGB size 3 |
|
35 |
110 // RGB size 4 |
|
36 |
}; // see table 7.1.6.1-1 of 36.213 |
|
37 |
||
38 |
||
7906
d58de34e41d3
MAC, RRC and Scheduler created by LenaHelper
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7897
diff
changeset
|
39 |
NS_OBJECT_ENSURE_REGISTERED (RrFfMacScheduler); |
7886 | 40 |
|
41 |
||
7888 | 42 |
class RrSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider |
7886 | 43 |
{ |
44 |
public: |
|
7888 | 45 |
RrSchedulerMemberCschedSapProvider (RrFfMacScheduler* scheduler); |
7886 | 46 |
|
47 |
// inherited from FfMacCschedSapProvider |
|
48 |
virtual void CschedCellConfigReq (const struct CschedCellConfigReqParameters& params); |
|
49 |
virtual void CschedUeConfigReq (const struct CschedUeConfigReqParameters& params); |
|
50 |
virtual void CschedLcConfigReq (const struct CschedLcConfigReqParameters& params); |
|
51 |
virtual void CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params); |
|
52 |
virtual void CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params); |
|
53 |
||
54 |
private: |
|
7888 | 55 |
RrSchedulerMemberCschedSapProvider (); |
7886 | 56 |
RrFfMacScheduler* m_scheduler; |
57 |
}; |
|
58 |
||
7888 | 59 |
RrSchedulerMemberCschedSapProvider::RrSchedulerMemberCschedSapProvider () |
7886 | 60 |
{ |
61 |
} |
|
62 |
||
7888 | 63 |
RrSchedulerMemberCschedSapProvider::RrSchedulerMemberCschedSapProvider (RrFfMacScheduler* scheduler) : m_scheduler (scheduler) |
7886 | 64 |
{ |
65 |
} |
|
66 |
||
67 |
||
68 |
void |
|
7888 | 69 |
RrSchedulerMemberCschedSapProvider::CschedCellConfigReq (const struct CschedCellConfigReqParameters& params) |
7886 | 70 |
{ |
71 |
m_scheduler->DoCschedCellConfigReq (params); |
|
72 |
} |
|
73 |
||
74 |
void |
|
7888 | 75 |
RrSchedulerMemberCschedSapProvider::CschedUeConfigReq (const struct CschedUeConfigReqParameters& params) |
7886 | 76 |
{ |
77 |
m_scheduler->DoCschedUeConfigReq (params); |
|
78 |
} |
|
79 |
||
80 |
||
81 |
void |
|
7888 | 82 |
RrSchedulerMemberCschedSapProvider::CschedLcConfigReq (const struct CschedLcConfigReqParameters& params) |
7886 | 83 |
{ |
84 |
m_scheduler->DoCschedLcConfigReq (params); |
|
85 |
} |
|
86 |
||
87 |
void |
|
7888 | 88 |
RrSchedulerMemberCschedSapProvider::CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params) |
7886 | 89 |
{ |
90 |
m_scheduler->DoCschedLcReleaseReq (params); |
|
91 |
} |
|
92 |
||
93 |
void |
|
7888 | 94 |
RrSchedulerMemberCschedSapProvider::CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params) |
7886 | 95 |
{ |
96 |
m_scheduler->DoCschedUeReleaseReq (params); |
|
97 |
} |
|
98 |
||
99 |
||
100 |
||
101 |
||
7888 | 102 |
class RrSchedulerMemberSchedSapProvider : public FfMacSchedSapProvider |
7886 | 103 |
{ |
104 |
public: |
|
7888 | 105 |
RrSchedulerMemberSchedSapProvider (RrFfMacScheduler* scheduler); |
7886 | 106 |
|
107 |
// inherited from FfMacSchedSapProvider |
|
108 |
virtual void SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params); |
|
109 |
virtual void SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params); |
|
110 |
virtual void SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params); |
|
111 |
virtual void SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params); |
|
112 |
virtual void SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params); |
|
113 |
virtual void SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params); |
|
114 |
virtual void SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params); |
|
115 |
virtual void SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params); |
|
116 |
virtual void SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params); |
|
117 |
virtual void SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params); |
|
118 |
virtual void SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params); |
|
119 |
||
120 |
||
121 |
private: |
|
7888 | 122 |
RrSchedulerMemberSchedSapProvider (); |
7886 | 123 |
RrFfMacScheduler* m_scheduler; |
124 |
}; |
|
125 |
||
126 |
||
127 |
||
7888 | 128 |
RrSchedulerMemberSchedSapProvider::RrSchedulerMemberSchedSapProvider () |
7886 | 129 |
{ |
130 |
} |
|
131 |
||
132 |
||
7888 | 133 |
RrSchedulerMemberSchedSapProvider::RrSchedulerMemberSchedSapProvider (RrFfMacScheduler* scheduler) |
7886 | 134 |
: m_scheduler (scheduler) |
135 |
{ |
|
136 |
} |
|
137 |
||
138 |
void |
|
7888 | 139 |
RrSchedulerMemberSchedSapProvider::SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params) |
7886 | 140 |
{ |
141 |
m_scheduler->DoSchedDlRlcBufferReq (params); |
|
142 |
} |
|
143 |
||
144 |
void |
|
7888 | 145 |
RrSchedulerMemberSchedSapProvider::SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params) |
7886 | 146 |
{ |
147 |
m_scheduler->DoSchedDlPagingBufferReq (params); |
|
148 |
} |
|
149 |
||
150 |
void |
|
7888 | 151 |
RrSchedulerMemberSchedSapProvider::SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params) |
7886 | 152 |
{ |
153 |
m_scheduler->DoSchedDlMacBufferReq (params); |
|
154 |
} |
|
155 |
||
156 |
void |
|
7888 | 157 |
RrSchedulerMemberSchedSapProvider::SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params) |
7886 | 158 |
{ |
159 |
m_scheduler->DoSchedDlTriggerReq (params); |
|
160 |
} |
|
161 |
||
162 |
void |
|
7888 | 163 |
RrSchedulerMemberSchedSapProvider::SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params) |
7886 | 164 |
{ |
165 |
m_scheduler->DoSchedDlRachInfoReq (params); |
|
166 |
} |
|
167 |
||
168 |
void |
|
7888 | 169 |
RrSchedulerMemberSchedSapProvider::SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params) |
7886 | 170 |
{ |
171 |
m_scheduler->DoSchedDlCqiInfoReq (params); |
|
172 |
} |
|
173 |
||
174 |
void |
|
7888 | 175 |
RrSchedulerMemberSchedSapProvider::SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params) |
7886 | 176 |
{ |
177 |
m_scheduler->DoSchedUlTriggerReq (params); |
|
178 |
} |
|
179 |
||
180 |
void |
|
7888 | 181 |
RrSchedulerMemberSchedSapProvider::SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params) |
7886 | 182 |
{ |
183 |
m_scheduler->DoSchedUlNoiseInterferenceReq (params); |
|
184 |
} |
|
185 |
||
186 |
void |
|
7888 | 187 |
RrSchedulerMemberSchedSapProvider::SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params) |
7886 | 188 |
{ |
189 |
m_scheduler->DoSchedUlSrInfoReq (params); |
|
190 |
} |
|
191 |
||
192 |
void |
|
7888 | 193 |
RrSchedulerMemberSchedSapProvider::SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params) |
7886 | 194 |
{ |
195 |
m_scheduler->DoSchedUlMacCtrlInfoReq (params); |
|
196 |
} |
|
197 |
||
198 |
void |
|
7888 | 199 |
RrSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params) |
7886 | 200 |
{ |
201 |
m_scheduler->DoSchedUlCqiInfoReq (params); |
|
202 |
} |
|
203 |
||
204 |
||
205 |
||
206 |
||
207 |
||
208 |
RrFfMacScheduler::RrFfMacScheduler () |
|
209 |
: m_cschedSapUser (0), |
|
7948 | 210 |
m_schedSapUser (0), |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
211 |
m_schedTtiDelay (2), |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
212 |
// WILD ACK: based on a m_macChTtiDelay = 1 |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
213 |
m_nextRntiDl (0), |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
214 |
m_nextRntiUl (0) |
7886 | 215 |
{ |
7888 | 216 |
m_cschedSapProvider = new RrSchedulerMemberCschedSapProvider (this); |
217 |
m_schedSapProvider = new RrSchedulerMemberSchedSapProvider (this); |
|
7886 | 218 |
} |
219 |
||
220 |
RrFfMacScheduler::~RrFfMacScheduler () |
|
221 |
{ |
|
222 |
NS_LOG_FUNCTION (this); |
|
223 |
} |
|
224 |
||
225 |
void |
|
226 |
RrFfMacScheduler::DoDispose () |
|
227 |
{ |
|
228 |
NS_LOG_FUNCTION (this); |
|
229 |
delete m_cschedSapProvider; |
|
230 |
delete m_schedSapProvider; |
|
231 |
} |
|
232 |
||
233 |
TypeId |
|
234 |
RrFfMacScheduler::GetTypeId (void) |
|
235 |
{ |
|
7983
b91d5a39aabc
scheduler and propagation model configurable through ConfigStore
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
236 |
static TypeId tid = TypeId ("ns3::RrFfMacScheduler") |
7886 | 237 |
.SetParent<FfMacScheduler> () |
238 |
.AddConstructor<RrFfMacScheduler> (); |
|
239 |
return tid; |
|
240 |
} |
|
241 |
||
242 |
||
243 |
||
244 |
void |
|
245 |
RrFfMacScheduler::SetFfMacCschedSapUser (FfMacCschedSapUser* s) |
|
246 |
{ |
|
247 |
m_cschedSapUser = s; |
|
248 |
} |
|
249 |
||
250 |
void |
|
251 |
RrFfMacScheduler::SetFfMacSchedSapUser (FfMacSchedSapUser* s) |
|
252 |
{ |
|
253 |
m_schedSapUser = s; |
|
254 |
} |
|
255 |
||
256 |
FfMacCschedSapProvider* |
|
257 |
RrFfMacScheduler::GetFfMacCschedSapProvider () |
|
258 |
{ |
|
259 |
return m_cschedSapProvider; |
|
260 |
} |
|
261 |
||
262 |
FfMacSchedSapProvider* |
|
263 |
RrFfMacScheduler::GetFfMacSchedSapProvider () |
|
264 |
{ |
|
265 |
return m_schedSapProvider; |
|
266 |
} |
|
267 |
||
268 |
void |
|
269 |
RrFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::CschedCellConfigReqParameters& params) |
|
270 |
{ |
|
271 |
NS_LOG_FUNCTION (this); |
|
272 |
// Read the subset of parameters used |
|
273 |
m_cschedCellConfig = params; |
|
274 |
FfMacCschedSapUser::CschedUeConfigCnfParameters cnf; |
|
275 |
cnf.m_result = SUCCESS; |
|
276 |
m_cschedSapUser->CschedUeConfigCnf (cnf); |
|
277 |
return; |
|
278 |
} |
|
279 |
||
280 |
void |
|
281 |
RrFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::CschedUeConfigReqParameters& params) |
|
282 |
{ |
|
283 |
NS_LOG_FUNCTION (this); |
|
284 |
// Not used at this stage |
|
285 |
return; |
|
286 |
} |
|
287 |
||
288 |
void |
|
289 |
RrFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params) |
|
290 |
{ |
|
291 |
NS_LOG_FUNCTION (this); |
|
292 |
// Not used at this stage |
|
293 |
return; |
|
294 |
} |
|
295 |
||
296 |
void |
|
297 |
RrFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params) |
|
298 |
{ |
|
299 |
NS_LOG_FUNCTION (this); |
|
300 |
// TODO: Implementation of the API |
|
301 |
return; |
|
302 |
} |
|
303 |
||
304 |
void |
|
305 |
RrFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params) |
|
306 |
{ |
|
307 |
NS_LOG_FUNCTION (this); |
|
308 |
// TODO: Implementation of the API |
|
309 |
return; |
|
310 |
} |
|
311 |
||
312 |
||
313 |
void |
|
314 |
RrFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters& params) |
|
315 |
{ |
|
316 |
NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity); |
|
317 |
// API generated by RLC for updating RLC parameters on a LC (tx and retx queues) |
|
318 |
std::vector<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it; |
|
7972
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
319 |
bool newLc = true; |
7886 | 320 |
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++) |
321 |
{ |
|
322 |
// remove old entries of this UE-LC |
|
323 |
if (((*it).m_rnti == params.m_rnti)&&((*it).m_logicalChannelIdentity == params.m_logicalChannelIdentity)) |
|
324 |
{ |
|
325 |
m_rlcBufferReq.erase (it); |
|
7972
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
326 |
newLc = false; |
7886 | 327 |
} |
328 |
} |
|
7972
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
329 |
// add the new parameters |
7886 | 330 |
m_rlcBufferReq.insert (it, params); |
7972
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
331 |
// initialize statistics of the flow in case of new flows |
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
332 |
if (newLc == true) |
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
333 |
{ |
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
334 |
m_p10CqiRxed.insert ( std::pair<uint16_t, uint8_t > (params.m_rnti, 1)); // only codeword 0 at this stage (SISO) |
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
335 |
// initialized to 1 (i.e., the lowest value for transmitting a signal) |
6d24eb482e41
LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7966
diff
changeset
|
336 |
} |
7886 | 337 |
|
338 |
return; |
|
339 |
} |
|
340 |
||
341 |
void |
|
342 |
RrFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params) |
|
343 |
{ |
|
344 |
NS_LOG_FUNCTION (this); |
|
345 |
// TODO: Implementation of the API |
|
346 |
return; |
|
347 |
} |
|
348 |
||
349 |
void |
|
350 |
RrFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params) |
|
351 |
{ |
|
352 |
NS_LOG_FUNCTION (this); |
|
353 |
// TODO: Implementation of the API |
|
354 |
return; |
|
355 |
} |
|
356 |
||
357 |
int |
|
358 |
RrFfMacScheduler::GetRbgSize (int dlbandwidth) |
|
359 |
{ |
|
360 |
for (int i = 0; i < 4; i++) |
|
361 |
{ |
|
362 |
if (dlbandwidth < Type0AllocationRbg[i]) |
|
363 |
{ |
|
364 |
return (i + 1); |
|
365 |
} |
|
366 |
} |
|
367 |
||
368 |
return (-1); |
|
369 |
} |
|
370 |
||
371 |
||
372 |
void |
|
373 |
RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params) |
|
374 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
375 |
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf)); |
7886 | 376 |
// API generated by RLC for triggering the scheduling of a DL subframe |
377 |
||
378 |
// Get the actual active flows (queue!=0) |
|
379 |
std::vector<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it; |
|
380 |
int nflows = 0; |
|
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
381 |
std::map <uint16_t,uint8_t> lcActivesPerRnti; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
382 |
std::map <uint16_t,uint8_t>::iterator itLcRnti; |
7886 | 383 |
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++) |
384 |
{ |
|
385 |
// remove old entries of this UE-LC |
|
386 |
if ( ((*it).m_rlcTransmissionQueueSize > 0) |
|
387 |
|| ((*it).m_rlcRetransmissionQueueSize > 0) |
|
388 |
|| ((*it).m_rlcStatusPduSize > 0) ) |
|
389 |
{ |
|
7966
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
390 |
std::map <uint16_t,uint8_t>::iterator itCqi = m_p10CqiRxed.find ((*it).m_rnti); |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
391 |
if (itCqi != m_p10CqiRxed.end ()) |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
392 |
{ |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
393 |
if ((*itCqi).second != 0) |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
394 |
{ |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
395 |
// CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213) |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
396 |
nflows++; |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
397 |
itLcRnti = lcActivesPerRnti.find ((*it).m_rnti); |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
398 |
if (itLcRnti != lcActivesPerRnti.end ()) |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
399 |
{ |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
400 |
(*itLcRnti).second++; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
401 |
} |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
402 |
else |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
403 |
{ |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
404 |
lcActivesPerRnti.insert (std::pair<uint16_t, uint8_t > ((*it).m_rnti, 1)); |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
405 |
} |
7966
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
406 |
} |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
407 |
} |
7886 | 408 |
} |
409 |
} |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
410 |
|
7886 | 411 |
if (nflows == 0) |
412 |
{ |
|
413 |
return; |
|
414 |
} |
|
415 |
// Divide the resource equally among the active users according to |
|
416 |
// Resource allocation type 0 (see sec 7.1.6.1 of 36.213) |
|
417 |
int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); |
|
418 |
int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; |
|
419 |
int rbgPerFlow = rbgNum / nflows; |
|
420 |
if (rbgPerFlow == 0) |
|
421 |
{ |
|
422 |
rbgPerFlow = 1; // at least 1 rbg per flow (till available resource) |
|
423 |
} |
|
424 |
int rbgAllocated = 0; |
|
425 |
||
426 |
FfMacSchedSapUser::SchedDlConfigIndParameters ret; |
|
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
427 |
// round robin assignment to all UE-LC registered starting from the subsequent of the one |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
428 |
// served last scheduling trigger |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
429 |
//NS_LOG_DEBUG (this << " next to be served " << m_nextRntiDl << " nflows " << nflows); |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
430 |
if (m_nextRntiDl != 0) |
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
431 |
{ |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
432 |
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++) |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
433 |
{ |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
434 |
if ((*it).m_rnti == m_nextRntiDl) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
435 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
436 |
break; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
437 |
} |
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
438 |
} |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
439 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
440 |
if (it == m_rlcBufferReq.end ()) |
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
441 |
{ |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
442 |
NS_LOG_ERROR (this << " no user found"); |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
443 |
} |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
444 |
} |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
445 |
else |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
446 |
{ |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
447 |
it = m_rlcBufferReq.begin (); |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
448 |
m_nextRntiDl = (*it).m_rnti; |
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
449 |
} |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
450 |
do |
7886 | 451 |
{ |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
452 |
itLcRnti = lcActivesPerRnti.find ((*it).m_rnti); |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
453 |
if (itLcRnti == lcActivesPerRnti.end ()) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
454 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
455 |
// skip this entry |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
456 |
it++; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
457 |
if (it == m_rlcBufferReq.end ()) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
458 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
459 |
// restart from the first |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
460 |
it = m_rlcBufferReq.begin (); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
461 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
462 |
continue; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
463 |
} |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
464 |
int lcNum = (*itLcRnti).second; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
465 |
// create new BuildDataListElement_s for this RNTI |
7886 | 466 |
BuildDataListElement_s newEl; |
467 |
newEl.m_rnti = (*it).m_rnti; |
|
468 |
// create the DlDciListElement_s |
|
469 |
DlDciListElement_s newDci; |
|
470 |
newDci.m_rnti = (*it).m_rnti; |
|
471 |
newDci.m_resAlloc = 0; |
|
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
472 |
newDci.m_rbBitmap = 0; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
473 |
std::map <uint16_t,uint8_t>::iterator itCqi = m_p10CqiRxed.find (newEl.m_rnti); |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
474 |
if (itCqi == m_p10CqiRxed.end ()) |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
475 |
{ |
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
476 |
newDci.m_mcs.push_back (0); // no info on this user -> lowest MCS |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
477 |
} |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
478 |
else |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
479 |
{ |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
480 |
newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*itCqi).second) ); |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
481 |
} |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
482 |
// group the LCs of this RNTI |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
483 |
std::vector <struct RlcPduListElement_s> newRlcPduLe; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
484 |
int totRbg = lcNum * rbgPerFlow; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
485 |
int tbSize = (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (0), totRbg * rbgSize) / 8); |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
486 |
// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " PRBs " << totRbg * rbgSize << " mcs " << (uint16_t) newDci.m_mcs.at (0)); |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
487 |
uint16_t rlcPduSize = tbSize / lcNum; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
488 |
for (int i = 0; i < lcNum ; i++) |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
489 |
{ |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
490 |
RlcPduListElement_s newRlcEl; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
491 |
newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
492 |
//NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize); |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
493 |
newRlcEl.m_size = rlcPduSize; |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
494 |
newRlcPduLe.push_back (newRlcEl); |
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
495 |
it++; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
496 |
if (it == m_rlcBufferReq.end ()) |
8020
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
497 |
{ |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
498 |
// restart from the first |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
499 |
it = m_rlcBufferReq.begin (); |
fc705bc87348
Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7983
diff
changeset
|
500 |
} |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
501 |
} |
7886 | 502 |
uint32_t rbgMask = 0; |
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
503 |
for (int i = 0; i < totRbg; i++) |
7886 | 504 |
{ |
505 |
rbgMask = rbgMask + (0x1 << rbgAllocated); |
|
506 |
rbgAllocated++; |
|
507 |
} |
|
508 |
newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213) |
|
509 |
||
510 |
int nbOfTbsInNewDci = 1; // SISO -> only one TB |
|
511 |
for (int i = 0; i < nbOfTbsInNewDci; i++) |
|
512 |
{ |
|
7977
9a44dfd0056d
LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7972
diff
changeset
|
513 |
newDci.m_tbsSize.push_back (tbSize); |
7886 | 514 |
newDci.m_ndi.push_back (1); // TBD (new data indicator) |
515 |
newDci.m_rv.push_back (0); // TBD (redundancy version) |
|
516 |
} |
|
517 |
newEl.m_dci = newDci; |
|
7897 | 518 |
// ...more parameters -> ignored in this version |
7886 | 519 |
|
520 |
||
7953 | 521 |
|
7886 | 522 |
|
523 |
newEl.m_rlcPduList.push_back (newRlcPduLe); |
|
524 |
ret.m_buildDataList.push_back (newEl); |
|
525 |
if (rbgAllocated == rbgNum) |
|
526 |
{ |
|
8035
d2e70680881a
LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8020
diff
changeset
|
527 |
//NS_LOG_DEBUG (this << " FULL " << (*it).m_rnti); |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
528 |
m_nextRntiDl = (*it).m_rnti; // store last RNTI served |
7886 | 529 |
break; // no more RGB to be allocated |
530 |
} |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
531 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
532 |
while ((*it).m_rnti != m_nextRntiDl); |
7886 | 533 |
|
534 |
ret.m_nrOfPdcchOfdmSymbols = 1; // TODO: check correct value according the DCIs txed |
|
535 |
||
536 |
m_schedSapUser->SchedDlConfigInd (ret); |
|
537 |
return; |
|
538 |
} |
|
539 |
||
540 |
void |
|
541 |
RrFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params) |
|
542 |
{ |
|
543 |
NS_LOG_FUNCTION (this); |
|
544 |
// TODO: Implementation of the API |
|
545 |
return; |
|
546 |
} |
|
547 |
||
548 |
void |
|
549 |
RrFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters& params) |
|
550 |
{ |
|
551 |
NS_LOG_FUNCTION (this); |
|
552 |
||
553 |
std::map <uint16_t,uint8_t>::iterator it; |
|
554 |
for (unsigned int i = 0; i < params.m_cqiList.size (); i++) |
|
555 |
{ |
|
556 |
if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 ) |
|
557 |
{ |
|
558 |
// wideband CQI reporting |
|
7895
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
559 |
std::map <uint16_t,uint8_t>::iterator it; |
7886 | 560 |
uint16_t rnti = params.m_cqiList.at (i).m_rnti; |
561 |
it = m_p10CqiRxed.find (rnti); |
|
562 |
if (it == m_p10CqiRxed.end ()) |
|
563 |
{ |
|
564 |
// create the new entry |
|
565 |
m_p10CqiRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, params.m_cqiList.at (i).m_wbCqi.at (0)) ); // only codeword 0 at this stage (SISO) |
|
566 |
} |
|
567 |
else |
|
568 |
{ |
|
569 |
// update the CQI value |
|
570 |
(*it).second = params.m_cqiList.at (i).m_wbCqi.at (0); |
|
571 |
} |
|
572 |
} |
|
7895
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
573 |
else if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::A30 ) |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
574 |
{ |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
575 |
// subband CQI reporting high layer configured |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
576 |
// Not used by RR Scheduler |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
577 |
} |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
578 |
else |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
579 |
{ |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
580 |
NS_LOG_ERROR (this << " CQI type unknown"); |
f20bb71f9b71
Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7888
diff
changeset
|
581 |
} |
7886 | 582 |
} |
583 |
||
584 |
return; |
|
585 |
} |
|
586 |
||
587 |
void |
|
588 |
RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params) |
|
589 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
590 |
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf)); |
8080
62d2fccef672
Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8077
diff
changeset
|
591 |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
592 |
|
7886 | 593 |
std::map <uint16_t,uint8_t>::iterator it; |
594 |
int nflows = 0; |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
595 |
|
7886 | 596 |
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
597 |
{ |
|
598 |
// remove old entries of this UE-LC |
|
599 |
if ((*it).second > 0) |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
600 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
601 |
nflows++; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
602 |
} |
7886 | 603 |
} |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
604 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
605 |
if (nflows == 0) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
606 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
607 |
return ; // no flows to be scheduled |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
608 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
609 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
610 |
|
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
611 |
// Divide the resource equally among the active users starting from the subsequent one served last scheduling trigger |
7886 | 612 |
int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows; |
613 |
if (rbPerFlow == 0) |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
614 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
615 |
rbPerFlow = 1; // at least 1 rbg per flow (till available resource) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
616 |
} |
7886 | 617 |
int rbAllocated = 0; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
618 |
|
7886 | 619 |
FfMacSchedSapUser::SchedUlConfigIndParameters ret; |
7948 | 620 |
std::vector <uint16_t> rbgAllocationMap; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
621 |
if (m_nextRntiUl != 0) |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
622 |
{ |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
623 |
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
624 |
{ |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
625 |
if ((*it).first == m_nextRntiUl) |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
626 |
{ |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
627 |
break; |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
628 |
} |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
629 |
} |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
630 |
if (it == m_ceBsrRxed.end ()) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
631 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
632 |
NS_LOG_ERROR (this << " no user found"); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
633 |
} |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
634 |
} |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
635 |
else |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
636 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
637 |
it = m_ceBsrRxed.begin (); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
638 |
m_nextRntiUl = (*it).first; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
639 |
} |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
640 |
do |
7886 | 641 |
{ |
642 |
if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth) |
|
643 |
{ |
|
644 |
// limit to physical resources last resource assignment |
|
645 |
rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; |
|
646 |
} |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
647 |
// store info on allocation for managing ul-cqi interpretation |
7948 | 648 |
for (int i = 0; i < rbPerFlow; i++) |
649 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
650 |
rbgAllocationMap.push_back ((*it).first); |
7948 | 651 |
} |
7886 | 652 |
UlDciListElement_s uldci; |
653 |
uldci.m_rnti = (*it).first; |
|
654 |
uldci.m_rbStart = rbAllocated; |
|
655 |
uldci.m_rbLen = rbPerFlow; |
|
656 |
rbAllocated += rbPerFlow; |
|
7948 | 657 |
std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find ((*it).first); |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
658 |
int cqi = 0; |
7948 | 659 |
if (itCqi == m_ueCqi.end ()) |
660 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
661 |
// no cqi info about this UE |
7948 | 662 |
uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD |
663 |
//NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first ); |
|
664 |
} |
|
665 |
else |
|
666 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
667 |
// take the lowest CQI value (worst RB) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
668 |
double minSinr = (*itCqi).second.at (uldci.m_rbStart); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
669 |
for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
670 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
671 |
//NS_LOG_DEBUG (this << " UE " << (*it).first << " has CQI " << (*itCqi).second.at(i)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
672 |
if ((*itCqi).second.at (i) < minSinr) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
673 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
674 |
minSinr = (*itCqi).second.at (i); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
675 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
676 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
677 |
// translate SINR -> cqi: WILD ACK: same as DL |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
678 |
double s = log2 ( 1 + ( |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
679 |
pow (10, minSinr / 10 ) / |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
680 |
( (-log (5.0 * 0.00005 )) / 1.5) )); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
681 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
682 |
|
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
683 |
cqi = LteAmc::GetCqiFromSpectralEfficiency (s); |
7966
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
684 |
if (cqi == 0) |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
685 |
{ |
8080
62d2fccef672
Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8077
diff
changeset
|
686 |
it++; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
687 |
if (it == m_ceBsrRxed.end ()) |
8080
62d2fccef672
Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8077
diff
changeset
|
688 |
{ |
62d2fccef672
Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8077
diff
changeset
|
689 |
// restart from the first |
62d2fccef672
Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8077
diff
changeset
|
690 |
it = m_ceBsrRxed.begin (); |
62d2fccef672
Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8077
diff
changeset
|
691 |
} |
7966
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
692 |
continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213) |
c2cfb1a64d66
LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents:
7953
diff
changeset
|
693 |
} |
7948 | 694 |
uldci.m_mcs = LteAmc::GetMcsFromCqi (cqi); |
695 |
//NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
696 |
|
7948 | 697 |
} |
7887 | 698 |
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD |
8086
8a03b3d2fa43
LenaTestPfFfMacSchedulerSuite updated with uplink tests (work in progress)
mmiozzo
parents:
8084
diff
changeset
|
699 |
// NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize); |
7886 | 700 |
uldci.m_ndi = 1; |
701 |
uldci.m_cceIndex = 0; |
|
702 |
uldci.m_aggrLevel = 1; |
|
703 |
uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF |
|
704 |
uldci.m_hopping = false; |
|
705 |
uldci.m_n2Dmrs = 0; |
|
706 |
uldci.m_tpc = 0; // no power control |
|
707 |
uldci.m_cqiRequest = false; // only period CQI at this stage |
|
708 |
uldci.m_ulIndex = 0; // TDD parameter |
|
709 |
uldci.m_dai = 1; // TDD parameter |
|
710 |
uldci.m_freqHopping = 0; |
|
711 |
uldci.m_pdcchPowerOffset = 0; // not used |
|
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
712 |
ret.m_dciList.push_back (uldci); |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
713 |
it++; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
714 |
if (it == m_ceBsrRxed.end ()) |
8077
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
715 |
{ |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
716 |
// restart from the first |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
717 |
it = m_ceBsrRxed.begin (); |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
718 |
} |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
719 |
if (rbAllocated == m_cschedCellConfig.m_ulBandwidth) |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
720 |
{ |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
721 |
// Stop allocation: no more PRBs |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
722 |
m_nextRntiUl = (*it).first; |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
723 |
break; |
6416d09febbf
RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8067
diff
changeset
|
724 |
} |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
725 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
726 |
while ((*it).first != m_nextRntiUl); |
7948 | 727 |
m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap)); |
7886 | 728 |
m_schedSapUser->SchedUlConfigInd (ret); |
729 |
return; |
|
730 |
} |
|
731 |
||
732 |
void |
|
733 |
RrFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params) |
|
734 |
{ |
|
735 |
NS_LOG_FUNCTION (this); |
|
736 |
// TODO: Implementation of the API |
|
737 |
return; |
|
738 |
} |
|
739 |
||
740 |
void |
|
741 |
RrFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params) |
|
742 |
{ |
|
743 |
NS_LOG_FUNCTION (this); |
|
744 |
// TODO: Implementation of the API |
|
745 |
return; |
|
746 |
} |
|
747 |
||
748 |
void |
|
749 |
RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params) |
|
750 |
{ |
|
751 |
NS_LOG_FUNCTION (this); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
752 |
|
7886 | 753 |
std::map <uint16_t,uint8_t>::iterator it; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
754 |
|
7886 | 755 |
for (unsigned int i = 0; i < params.m_macCeList.size (); i++) |
756 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
757 |
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR ) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
758 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
759 |
// buffer status report |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
760 |
uint16_t rnti = params.m_macCeList.at (i).m_rnti; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
761 |
it = m_ceBsrRxed.find (rnti); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
762 |
if (it == m_ceBsrRxed.end ()) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
763 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
764 |
// create the new entry |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
765 |
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
766 |
m_ceBsrRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
767 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
768 |
else |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
769 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
770 |
// update the CQI value |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
771 |
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
772 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
773 |
} |
7886 | 774 |
} |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
775 |
|
7886 | 776 |
return; |
777 |
} |
|
778 |
||
779 |
void |
|
780 |
RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params) |
|
781 |
{ |
|
782 |
NS_LOG_FUNCTION (this); |
|
7948 | 783 |
//NS_LOG_DEBUG (this << " RX UL CQI at " << params.m_sfnSf); |
784 |
// correlate info on UL-CQIs with previous scheduling -> calculate m_sfnSf of transmission |
|
785 |
uint32_t frameNo = (0xFF & params.m_sfnSf) >> 4; |
|
786 |
uint32_t subframeNo = (0xF & params.m_sfnSf); |
|
787 |
//NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo); |
|
788 |
if (subframeNo - m_schedTtiDelay < 0) |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
789 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
790 |
frameNo--; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
791 |
} |
7948 | 792 |
subframeNo = (subframeNo - m_schedTtiDelay) % 10; |
793 |
//NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo); |
|
794 |
uint16_t sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); |
|
795 |
// retrieve the allocation for this subframe |
|
796 |
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap; |
|
797 |
std::map <uint16_t, std::vector <double> >::iterator itCqi; |
|
798 |
itMap = m_allocationMaps.find (sfnSf); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
799 |
if (itMap == m_allocationMaps.end ()) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
800 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
801 |
NS_LOG_DEBUG (this << " Does not find info on allocation"); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
802 |
return; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
803 |
} |
7948 | 804 |
for (uint32_t i = 0; i < (*itMap).second.size (); i++) |
805 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
806 |
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
807 |
double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
808 |
//NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
809 |
itCqi = m_ueCqi.find ((*itMap).second.at (i)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
810 |
if (itCqi == m_ueCqi.end ()) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
811 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
812 |
// create a new entry |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
813 |
std::vector <double> newCqi; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
814 |
for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
815 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
816 |
if (i == j) |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
817 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
818 |
newCqi.push_back (sinr); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
819 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
820 |
else |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
821 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
822 |
// initialize with maximum value according to the fixed point notation |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
823 |
newCqi.push_back (30.0); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
824 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
825 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
826 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
827 |
m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
828 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
829 |
else |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
830 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
831 |
// update the value |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
832 |
(*itCqi).second.at (i) = sinr; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
833 |
} |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
834 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8086
diff
changeset
|
835 |
} |
7948 | 836 |
// remove obsolete info on allocation |
837 |
m_allocationMaps.erase (m_allocationMaps.begin (), ++itMap); |
|
838 |
||
7886 | 839 |
return; |
840 |
} |
|
841 |
||
842 |
} |