A Discrete-Event Network Simulator
API
fdmt-ff-mac-scheduler.cc
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  * Modification: Dizhi Zhou <dizhi.zhou@gmail.com> // modify codes related to downlink scheduler
20  */
21 
22 #include <ns3/log.h>
23 #include <ns3/pointer.h>
24 #include <ns3/math.h>
25 
26 #include <ns3/simulator.h>
27 #include <ns3/lte-amc.h>
28 #include <ns3/fdmt-ff-mac-scheduler.h>
29 #include <ns3/lte-vendor-specific-parameters.h>
30 #include <ns3/boolean.h>
31 #include <set>
32 #include <cfloat>
33 
34 namespace ns3 {
35 
36 NS_LOG_COMPONENT_DEFINE ("FdMtFfMacScheduler");
37 
39 static const int FdMtType0AllocationRbg[4] = {
40  10, // RGB size 1
41  26, // RGB size 2
42  63, // RGB size 3
43  110 // RGB size 4
44 }; // see table 7.1.6.1-1 of 36.213
45 
46 
47 NS_OBJECT_ENSURE_REGISTERED (FdMtFfMacScheduler);
48 
49 
50 
52  : m_cschedSapUser (0),
53  m_schedSapUser (0),
54  m_nextRntiUl (0)
55 {
56  m_amc = CreateObject <LteAmc> ();
59 }
60 
62 {
63  NS_LOG_FUNCTION (this);
64 }
65 
66 void
68 {
69  NS_LOG_FUNCTION (this);
71  m_dlHarqProcessesTimer.clear ();
73  m_dlInfoListBuffered.clear ();
74  m_ulHarqCurrentProcessId.clear ();
75  m_ulHarqProcessesStatus.clear ();
77  delete m_cschedSapProvider;
78  delete m_schedSapProvider;
79 }
80 
81 TypeId
83 {
84  static TypeId tid = TypeId ("ns3::FdMtFfMacScheduler")
86  .SetGroupName("Lte")
87  .AddConstructor<FdMtFfMacScheduler> ()
88  .AddAttribute ("CqiTimerThreshold",
89  "The number of TTIs a CQI is valid (default 1000 - 1 sec.)",
90  UintegerValue (1000),
92  MakeUintegerChecker<uint32_t> ())
93  .AddAttribute ("HarqEnabled",
94  "Activate/Deactivate the HARQ [by default is active].",
95  BooleanValue (true),
98  .AddAttribute ("UlGrantMcs",
99  "The MCS of the UL grant, must be [0..15] (default 0)",
100  UintegerValue (0),
102  MakeUintegerChecker<uint8_t> ())
103  ;
104  return tid;
105 }
106 
107 
108 
109 void
111 {
112  m_cschedSapUser = s;
113 }
114 
115 void
117 {
118  m_schedSapUser = s;
119 }
120 
123 {
124  return m_cschedSapProvider;
125 }
126 
129 {
130  return m_schedSapProvider;
131 }
132 
133 void
135 {
136  m_ffrSapProvider = s;
137 }
138 
141 {
142  return m_ffrSapUser;
143 }
144 
145 void
147 {
148  NS_LOG_FUNCTION (this);
149  // Read the subset of parameters used
150  m_cschedCellConfig = params;
153  cnf.m_result = SUCCESS;
155  return;
156 }
157 
158 void
160 {
161  NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode);
162  std::map <uint16_t,uint8_t>::iterator it = m_uesTxMode.find (params.m_rnti);
163  if (it == m_uesTxMode.end ())
164  {
165  m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
166  // generate HARQ buffers
167  m_dlHarqCurrentProcessId.insert (std::pair <uint16_t,uint8_t > (params.m_rnti, 0));
168  DlHarqProcessesStatus_t dlHarqPrcStatus;
169  dlHarqPrcStatus.resize (8,0);
170  m_dlHarqProcessesStatus.insert (std::pair <uint16_t, DlHarqProcessesStatus_t> (params.m_rnti, dlHarqPrcStatus));
171  DlHarqProcessesTimer_t dlHarqProcessesTimer;
172  dlHarqProcessesTimer.resize (8,0);
173  m_dlHarqProcessesTimer.insert (std::pair <uint16_t, DlHarqProcessesTimer_t> (params.m_rnti, dlHarqProcessesTimer));
174  DlHarqProcessesDciBuffer_t dlHarqdci;
175  dlHarqdci.resize (8);
176  m_dlHarqProcessesDciBuffer.insert (std::pair <uint16_t, DlHarqProcessesDciBuffer_t> (params.m_rnti, dlHarqdci));
177  DlHarqRlcPduListBuffer_t dlHarqRlcPdu;
178  dlHarqRlcPdu.resize (2);
179  dlHarqRlcPdu.at (0).resize (8);
180  dlHarqRlcPdu.at (1).resize (8);
181  m_dlHarqProcessesRlcPduListBuffer.insert (std::pair <uint16_t, DlHarqRlcPduListBuffer_t> (params.m_rnti, dlHarqRlcPdu));
182  m_ulHarqCurrentProcessId.insert (std::pair <uint16_t,uint8_t > (params.m_rnti, 0));
183  UlHarqProcessesStatus_t ulHarqPrcStatus;
184  ulHarqPrcStatus.resize (8,0);
185  m_ulHarqProcessesStatus.insert (std::pair <uint16_t, UlHarqProcessesStatus_t> (params.m_rnti, ulHarqPrcStatus));
186  UlHarqProcessesDciBuffer_t ulHarqdci;
187  ulHarqdci.resize (8);
188  m_ulHarqProcessesDciBuffer.insert (std::pair <uint16_t, UlHarqProcessesDciBuffer_t> (params.m_rnti, ulHarqdci));
189  }
190  else
191  {
192  (*it).second = params.m_transmissionMode;
193  }
194  return;
195 }
196 
197 void
199 {
200  NS_LOG_FUNCTION (this << " New LC, rnti: " << params.m_rnti);
201 
202  std::set <uint16_t>::iterator it;
203  for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++)
204  {
205  it = m_flowStatsDl.find (params.m_rnti);
206 
207  if (it == m_flowStatsDl.end ())
208  {
209  m_flowStatsDl.insert (params.m_rnti);
210  m_flowStatsUl.insert (params.m_rnti);
211  }
212  }
213 
214  return;
215 }
216 
217 void
219 {
220  NS_LOG_FUNCTION (this);
221  for (uint16_t i = 0; i < params.m_logicalChannelIdentity.size (); i++)
222  {
223  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
224  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
225  while (it!=m_rlcBufferReq.end ())
226  {
227  if (((*it).first.m_rnti == params.m_rnti) && ((*it).first.m_lcId == params.m_logicalChannelIdentity.at (i)))
228  {
229  temp = it;
230  it++;
231  m_rlcBufferReq.erase (temp);
232  }
233  else
234  {
235  it++;
236  }
237  }
238  }
239  return;
240 }
241 
242 void
244 {
245  NS_LOG_FUNCTION (this);
246 
247  m_uesTxMode.erase (params.m_rnti);
248  m_dlHarqCurrentProcessId.erase (params.m_rnti);
249  m_dlHarqProcessesStatus.erase (params.m_rnti);
250  m_dlHarqProcessesTimer.erase (params.m_rnti);
251  m_dlHarqProcessesDciBuffer.erase (params.m_rnti);
253  m_ulHarqCurrentProcessId.erase (params.m_rnti);
254  m_ulHarqProcessesStatus.erase (params.m_rnti);
255  m_ulHarqProcessesDciBuffer.erase (params.m_rnti);
256  m_flowStatsDl.erase (params.m_rnti);
257  m_flowStatsUl.erase (params.m_rnti);
258  m_ceBsrRxed.erase (params.m_rnti);
259  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
260  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
261  while (it!=m_rlcBufferReq.end ())
262  {
263  if ((*it).first.m_rnti == params.m_rnti)
264  {
265  temp = it;
266  it++;
267  m_rlcBufferReq.erase (temp);
268  }
269  else
270  {
271  it++;
272  }
273  }
274  if (m_nextRntiUl == params.m_rnti)
275  {
276  m_nextRntiUl = 0;
277  }
278 
279  return;
280 }
281 
282 
283 void
285 {
286  NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
287  // API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
288 
289  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
290 
291  LteFlowId_t flow (params.m_rnti, params.m_logicalChannelIdentity);
292 
293  it = m_rlcBufferReq.find (flow);
294 
295  if (it == m_rlcBufferReq.end ())
296  {
297  m_rlcBufferReq.insert (std::pair <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> (flow, params));
298  }
299  else
300  {
301  (*it).second = params;
302  }
303 
304  return;
305 }
306 
307 void
309 {
310  NS_LOG_FUNCTION (this);
311  NS_FATAL_ERROR ("method not implemented");
312  return;
313 }
314 
315 void
317 {
318  NS_LOG_FUNCTION (this);
319  NS_FATAL_ERROR ("method not implemented");
320  return;
321 }
322 
323 int
325 {
326  for (int i = 0; i < 4; i++)
327  {
328  if (dlbandwidth < FdMtType0AllocationRbg[i])
329  {
330  return (i + 1);
331  }
332  }
333 
334  return (-1);
335 }
336 
337 
338 unsigned int
340 {
341  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
342  unsigned int lcActive = 0;
343  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
344  {
345  if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0)
346  || ((*it).second.m_rlcRetransmissionQueueSize > 0)
347  || ((*it).second.m_rlcStatusPduSize > 0) ))
348  {
349  lcActive++;
350  }
351  if ((*it).first.m_rnti > rnti)
352  {
353  break;
354  }
355  }
356  return (lcActive);
357 
358 }
359 
360 
361 uint8_t
363 {
364  NS_LOG_FUNCTION (this << rnti);
365 
366  std::map <uint16_t, uint8_t>::iterator it = m_dlHarqCurrentProcessId.find (rnti);
367  if (it == m_dlHarqCurrentProcessId.end ())
368  {
369  NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti);
370  }
371  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find (rnti);
372  if (itStat == m_dlHarqProcessesStatus.end ())
373  {
374  NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti);
375  }
376  uint8_t i = (*it).second;
377  do
378  {
379  i = (i + 1) % HARQ_PROC_NUM;
380  }
381  while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
382  if ((*itStat).second.at (i) == 0)
383  {
384  return (true);
385  }
386  else
387  {
388  return (false); // return a not valid harq proc id
389  }
390 }
391 
392 
393 
394 uint8_t
396 {
397  NS_LOG_FUNCTION (this << rnti);
398 
399  if (m_harqOn == false)
400  {
401  return (0);
402  }
403 
404 
405  std::map <uint16_t, uint8_t>::iterator it = m_dlHarqCurrentProcessId.find (rnti);
406  if (it == m_dlHarqCurrentProcessId.end ())
407  {
408  NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti);
409  }
410  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find (rnti);
411  if (itStat == m_dlHarqProcessesStatus.end ())
412  {
413  NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti);
414  }
415  uint8_t i = (*it).second;
416  do
417  {
418  i = (i + 1) % HARQ_PROC_NUM;
419  }
420  while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
421  if ((*itStat).second.at (i) == 0)
422  {
423  (*it).second = i;
424  (*itStat).second.at (i) = 1;
425  }
426  else
427  {
428  NS_FATAL_ERROR ("No HARQ process available for RNTI " << rnti << " check before update with HarqProcessAvailability");
429  }
430 
431  return ((*it).second);
432 }
433 
434 
435 void
437 {
438  NS_LOG_FUNCTION (this);
439 
440  std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itTimers;
441  for (itTimers = m_dlHarqProcessesTimer.begin (); itTimers != m_dlHarqProcessesTimer.end (); itTimers ++)
442  {
443  for (uint16_t i = 0; i < HARQ_PROC_NUM; i++)
444  {
445  if ((*itTimers).second.at (i) == HARQ_DL_TIMEOUT)
446  {
447  // reset HARQ process
448 
449  NS_LOG_DEBUG (this << " Reset HARQ proc " << i << " for RNTI " << (*itTimers).first);
450  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find ((*itTimers).first);
451  if (itStat == m_dlHarqProcessesStatus.end ())
452  {
453  NS_FATAL_ERROR ("No Process Id Status found for this RNTI " << (*itTimers).first);
454  }
455  (*itStat).second.at (i) = 0;
456  (*itTimers).second.at (i) = 0;
457  }
458  else
459  {
460  (*itTimers).second.at (i)++;
461  }
462  }
463  }
464 
465 }
466 
467 
468 void
470 {
471  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
472  // API generated by RLC for triggering the scheduling of a DL subframe
473 
474 
475  // evaluate the relative channel quality indicator for each UE per each RBG
476  // (since we are using allocation type 0 the small unit of allocation is RBG)
477  // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
478 
479  RefreshDlCqiMaps ();
480 
482  int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
483  std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNTI
484  std::vector <bool> rbgMap; // global RBGs map
485  uint16_t rbgAllocatedNum = 0;
486  std::set <uint16_t> rntiAllocated;
487  rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false);
489 
490  // update UL HARQ proc id
491  std::map <uint16_t, uint8_t>::iterator itProcId;
492  for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++)
493  {
494  (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM;
495  }
496 
497  // RACH Allocation
499  uint16_t rbStart = 0;
500  std::vector <struct RachListElement_s>::iterator itRach;
501  for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++)
502  {
503  NS_ASSERT_MSG (m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, m_cschedCellConfig.m_ulBandwidth) > (*itRach).m_estimatedSize, " Default UL Grant MCS does not allow to send RACH messages");
504  BuildRarListElement_s newRar;
505  newRar.m_rnti = (*itRach).m_rnti;
506  // DL-RACH Allocation
507  // Ideal: no needs of configuring m_dci
508  // UL-RACH Allocation
509  newRar.m_grant.m_rnti = newRar.m_rnti;
510  newRar.m_grant.m_mcs = m_ulGrantMcs;
511  uint16_t rbLen = 1;
512  uint16_t tbSizeBits = 0;
513  // find lowest TB size that fits UL grant estimated size
514  while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cschedCellConfig.m_ulBandwidth))
515  {
516  rbLen++;
517  tbSizeBits = m_amc->GetUlTbSizeFromMcs (m_ulGrantMcs, rbLen);
518  }
519  if (tbSizeBits < (*itRach).m_estimatedSize)
520  {
521  // no more allocation space: finish allocation
522  break;
523  }
524  newRar.m_grant.m_rbStart = rbStart;
525  newRar.m_grant.m_rbLen = rbLen;
526  newRar.m_grant.m_tbSize = tbSizeBits / 8;
527  newRar.m_grant.m_hopping = false;
528  newRar.m_grant.m_tpc = 0;
529  newRar.m_grant.m_cqiRequest = false;
530  newRar.m_grant.m_ulDelay = false;
531  NS_LOG_INFO (this << " UL grant allocated to RNTI " << (*itRach).m_rnti << " rbStart " << rbStart << " rbLen " << rbLen << " MCS " << m_ulGrantMcs << " tbSize " << newRar.m_grant.m_tbSize);
532  for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
533  {
534  m_rachAllocationMap.at (i) = (*itRach).m_rnti;
535  }
536 
537  if (m_harqOn == true)
538  {
539  // generate UL-DCI for HARQ retransmissions
540  UlDciListElement_s uldci;
541  uldci.m_rnti = newRar.m_rnti;
542  uldci.m_rbLen = rbLen;
543  uldci.m_rbStart = rbStart;
544  uldci.m_mcs = m_ulGrantMcs;
545  uldci.m_tbSize = tbSizeBits / 8;
546  uldci.m_ndi = 1;
547  uldci.m_cceIndex = 0;
548  uldci.m_aggrLevel = 1;
549  uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
550  uldci.m_hopping = false;
551  uldci.m_n2Dmrs = 0;
552  uldci.m_tpc = 0; // no power control
553  uldci.m_cqiRequest = false; // only period CQI at this stage
554  uldci.m_ulIndex = 0; // TDD parameter
555  uldci.m_dai = 1; // TDD parameter
556  uldci.m_freqHopping = 0;
557  uldci.m_pdcchPowerOffset = 0; // not used
558 
559  uint8_t harqId = 0;
560  std::map <uint16_t, uint8_t>::iterator itProcId;
561  itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti);
562  if (itProcId == m_ulHarqCurrentProcessId.end ())
563  {
564  NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti);
565  }
566  harqId = (*itProcId).second;
567  std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti);
568  if (itDci == m_ulHarqProcessesDciBuffer.end ())
569  {
570  NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti);
571  }
572  (*itDci).second.at (harqId) = uldci;
573  }
574 
575  rbStart = rbStart + rbLen;
576  ret.m_buildRarList.push_back (newRar);
577  }
578  m_rachList.clear ();
579 
580 
581  // Process DL HARQ feedback
583  // retrieve past HARQ retx buffered
584  if (m_dlInfoListBuffered.size () > 0)
585  {
586  if (params.m_dlInfoList.size () > 0)
587  {
588  NS_LOG_INFO (this << " Received DL-HARQ feedback");
589  m_dlInfoListBuffered.insert (m_dlInfoListBuffered.end (), params.m_dlInfoList.begin (), params.m_dlInfoList.end ());
590  }
591  }
592  else
593  {
594  if (params.m_dlInfoList.size () > 0)
595  {
597  }
598  }
599  if (m_harqOn == false)
600  {
601  // Ignore HARQ feedback
602  m_dlInfoListBuffered.clear ();
603  }
604  std::vector <struct DlInfoListElement_s> dlInfoListUntxed;
605  for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++)
606  {
607  std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti);
608  if (itRnti != rntiAllocated.end ())
609  {
610  // RNTI already allocated for retx
611  continue;
612  }
613  uint8_t nLayers = m_dlInfoListBuffered.at (i).m_harqStatus.size ();
614  std::vector <bool> retx;
615  NS_LOG_INFO (this << " Processing DLHARQ feedback");
616  if (nLayers == 1)
617  {
618  retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK);
619  retx.push_back (false);
620  }
621  else
622  {
623  retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK);
624  retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (1) == DlInfoListElement_s::NACK);
625  }
626  if (retx.at (0) || retx.at (1))
627  {
628  // retrieve HARQ process information
629  uint16_t rnti = m_dlInfoListBuffered.at (i).m_rnti;
630  uint8_t harqId = m_dlInfoListBuffered.at (i).m_harqProcessId;
631  NS_LOG_INFO (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId);
632  std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itHarq = m_dlHarqProcessesDciBuffer.find (rnti);
633  if (itHarq == m_dlHarqProcessesDciBuffer.end ())
634  {
635  NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti);
636  }
637 
638  DlDciListElement_s dci = (*itHarq).second.at (harqId);
639  int rv = 0;
640  if (dci.m_rv.size () == 1)
641  {
642  rv = dci.m_rv.at (0);
643  }
644  else
645  {
646  rv = (dci.m_rv.at (0) > dci.m_rv.at (1) ? dci.m_rv.at (0) : dci.m_rv.at (1));
647  }
648 
649  if (rv == 3)
650  {
651  // maximum number of retx reached -> drop process
652  NS_LOG_INFO ("Maximum number of retransmissions reached -> drop process");
653  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator it = m_dlHarqProcessesStatus.find (rnti);
654  if (it == m_dlHarqProcessesStatus.end ())
655  {
656  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << m_dlInfoListBuffered.at (i).m_rnti);
657  }
658  (*it).second.at (harqId) = 0;
659  std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti);
660  if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
661  {
662  NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti);
663  }
664  for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
665  {
666  (*itRlcPdu).second.at (k).at (harqId).clear ();
667  }
668  continue;
669  }
670  // check the feasibility of retransmitting on the same RBGs
671  // translate the DCI to Spectrum framework
672  std::vector <int> dciRbg;
673  uint32_t mask = 0x1;
674  NS_LOG_INFO ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti);
675  for (int j = 0; j < 32; j++)
676  {
677  if (((dci.m_rbBitmap & mask) >> j) == 1)
678  {
679  dciRbg.push_back (j);
680  NS_LOG_INFO ("\t" << j);
681  }
682  mask = (mask << 1);
683  }
684  bool free = true;
685  for (uint8_t j = 0; j < dciRbg.size (); j++)
686  {
687  if (rbgMap.at (dciRbg.at (j)) == true)
688  {
689  free = false;
690  break;
691  }
692  }
693  if (free)
694  {
695  // use the same RBGs for the retx
696  // reserve RBGs
697  for (uint8_t j = 0; j < dciRbg.size (); j++)
698  {
699  rbgMap.at (dciRbg.at (j)) = true;
700  NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned");
701  rbgAllocatedNum++;
702  }
703 
704  NS_LOG_INFO (this << " Send retx in the same RBGs");
705  }
706  else
707  {
708  // find RBGs for sending HARQ retx
709  uint8_t j = 0;
710  uint8_t rbgId = (dciRbg.at (dciRbg.size () - 1) + 1) % rbgNum;
711  uint8_t startRbg = dciRbg.at (dciRbg.size () - 1);
712  std::vector <bool> rbgMapCopy = rbgMap;
713  while ((j < dciRbg.size ())&&(startRbg != rbgId))
714  {
715  if (rbgMapCopy.at (rbgId) == false)
716  {
717  rbgMapCopy.at (rbgId) = true;
718  dciRbg.at (j) = rbgId;
719  j++;
720  }
721  rbgId = (rbgId + 1) % rbgNum;
722  }
723  if (j == dciRbg.size ())
724  {
725  // find new RBGs -> update DCI map
726  uint32_t rbgMask = 0;
727  for (uint16_t k = 0; k < dciRbg.size (); k++)
728  {
729  rbgMask = rbgMask + (0x1 << dciRbg.at (k));
730  rbgAllocatedNum++;
731  }
732  dci.m_rbBitmap = rbgMask;
733  rbgMap = rbgMapCopy;
734  NS_LOG_INFO (this << " Move retx in RBGs " << dciRbg.size ());
735  }
736  else
737  {
738  // HARQ retx cannot be performed on this TTI -> store it
739  dlInfoListUntxed.push_back (m_dlInfoListBuffered.at (i));
740  NS_LOG_INFO (this << " No resource for this retx -> buffer it");
741  }
742  }
743  // retrieve RLC PDU list for retx TBsize and update DCI
745  std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti);
746  if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
747  {
748  NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
749  }
750  for (uint8_t j = 0; j < nLayers; j++)
751  {
752  if (retx.at (j))
753  {
754  if (j >= dci.m_ndi.size ())
755  {
756  // for avoiding errors in MIMO transient phases
757  dci.m_ndi.push_back (0);
758  dci.m_rv.push_back (0);
759  dci.m_mcs.push_back (0);
760  dci.m_tbsSize.push_back (0);
761  NS_LOG_INFO (this << " layer " << (uint16_t)j << " no txed (MIMO transition)");
762  }
763  else
764  {
765  dci.m_ndi.at (j) = 0;
766  dci.m_rv.at (j)++;
767  (*itHarq).second.at (harqId).m_rv.at (j)++;
768  NS_LOG_INFO (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j));
769  }
770  }
771  else
772  {
773  // empty TB of layer j
774  dci.m_ndi.at (j) = 0;
775  dci.m_rv.at (j) = 0;
776  dci.m_mcs.at (j) = 0;
777  dci.m_tbsSize.at (j) = 0;
778  NS_LOG_INFO (this << " layer " << (uint16_t)j << " no retx");
779  }
780  }
781  for (uint16_t k = 0; k < (*itRlcPdu).second.at (0).at (dci.m_harqProcess).size (); k++)
782  {
783  std::vector <struct RlcPduListElement_s> rlcPduListPerLc;
784  for (uint8_t j = 0; j < nLayers; j++)
785  {
786  if (retx.at (j))
787  {
788  if (j < dci.m_ndi.size ())
789  {
790  NS_LOG_INFO (" layer " << (uint16_t)j << " tb size " << dci.m_tbsSize.at (j));
791  rlcPduListPerLc.push_back ((*itRlcPdu).second.at (j).at (dci.m_harqProcess).at (k));
792  }
793  }
794  else
795  { // if no retx needed on layer j, push an RlcPduListElement_s object with m_size=0 to keep the size of rlcPduListPerLc vector = 2 in case of MIMO
796  NS_LOG_INFO (" layer " << (uint16_t)j << " tb size "<<dci.m_tbsSize.at (j));
797  RlcPduListElement_s emptyElement;
798  emptyElement.m_logicalChannelIdentity = (*itRlcPdu).second.at (j).at (dci.m_harqProcess).at (k).m_logicalChannelIdentity;
799  emptyElement.m_size = 0;
800  rlcPduListPerLc.push_back (emptyElement);
801  }
802  }
803 
804  if (rlcPduListPerLc.size () > 0)
805  {
806  newEl.m_rlcPduList.push_back (rlcPduListPerLc);
807  }
808  }
809  newEl.m_rnti = rnti;
810  newEl.m_dci = dci;
811  (*itHarq).second.at (harqId).m_rv = dci.m_rv;
812  // refresh timer
813  std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer = m_dlHarqProcessesTimer.find (rnti);
814  if (itHarqTimer== m_dlHarqProcessesTimer.end ())
815  {
816  NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
817  }
818  (*itHarqTimer).second.at (harqId) = 0;
819  ret.m_buildDataList.push_back (newEl);
820  rntiAllocated.insert (rnti);
821  }
822  else
823  {
824  // update HARQ process status
825  NS_LOG_INFO (this << " HARQ received ACK for UE " << m_dlInfoListBuffered.at (i).m_rnti);
826  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator it = m_dlHarqProcessesStatus.find (m_dlInfoListBuffered.at (i).m_rnti);
827  if (it == m_dlHarqProcessesStatus.end ())
828  {
829  NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti);
830  }
831  (*it).second.at (m_dlInfoListBuffered.at (i).m_harqProcessId) = 0;
832  std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (m_dlInfoListBuffered.at (i).m_rnti);
833  if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
834  {
835  NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti);
836  }
837  for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
838  {
839  (*itRlcPdu).second.at (k).at (m_dlInfoListBuffered.at (i).m_harqProcessId).clear ();
840  }
841  }
842  }
843  m_dlInfoListBuffered.clear ();
844  m_dlInfoListBuffered = dlInfoListUntxed;
845 
846  if (rbgAllocatedNum == rbgNum)
847  {
848  // all the RBGs are already allocated -> exit
849  if ((ret.m_buildDataList.size () > 0) || (ret.m_buildRarList.size () > 0))
850  {
852  }
853  return;
854  }
855 
856 
857 
858  for (int i = 0; i < rbgNum; i++)
859  {
860  NS_LOG_INFO (this << " ALLOCATION for RBG " << i << " of " << rbgNum);
861  if (rbgMap.at (i) == false)
862  {
863  std::set <uint16_t>::iterator it;
864  std::set <uint16_t>::iterator itMax = m_flowStatsDl.end ();
865  double rcqiMax = 0.0;
866  for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++)
867  {
868  std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it));
869  if ((itRnti != rntiAllocated.end ())||(!HarqProcessAvailability ((*it))))
870  {
871  // UE already allocated for HARQ or without HARQ process available -> drop it
872  if (itRnti != rntiAllocated.end ())
873  {
874  NS_LOG_DEBUG (this << " RNTI discared for HARQ tx" << (uint16_t)(*it));
875  }
876  if (!HarqProcessAvailability ((*it)))
877  {
878  NS_LOG_DEBUG (this << " RNTI discared for HARQ id" << (uint16_t)(*it));
879  }
880  continue;
881  }
882 
883  std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
884  itCqi = m_a30CqiRxed.find ((*it));
885  std::map <uint16_t,uint8_t>::iterator itTxMode;
886  itTxMode = m_uesTxMode.find ((*it));
887  if (itTxMode == m_uesTxMode.end ())
888  {
889  NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it));
890  }
891  int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
892  std::vector <uint8_t> sbCqi;
893  if (itCqi == m_a30CqiRxed.end ())
894  {
895  for (uint8_t k = 0; k < nLayer; k++)
896  {
897  sbCqi.push_back (1); // start with lowest value
898  }
899  }
900  else
901  {
902  sbCqi = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
903  }
904  uint8_t cqi1 = sbCqi.at (0);
905  uint8_t cqi2 = 0;
906  if (sbCqi.size () > 1)
907  {
908  cqi2 = sbCqi.at (1);
909  }
910  if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
911  {
912  if (LcActivePerFlow ((*it)) > 0)
913  {
914  // this UE has data to transmit
915  double achievableRate = 0.0;
916  uint8_t mcs = 0;
917  for (uint8_t k = 0; k < nLayer; k++)
918  {
919  if (sbCqi.size () > k)
920  {
921  mcs = m_amc->GetMcsFromCqi (sbCqi.at (k));
922  }
923  else
924  {
925  // no info on this subband -> worst MCS
926  mcs = 0;
927  }
928  achievableRate += ((m_amc->GetDlTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
929  }
930 
931  double rcqi = achievableRate;
932  NS_LOG_INFO (this << " RNTI " << (*it) << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " RCQI " << rcqi);
933 
934  if (rcqi > rcqiMax)
935  {
936  rcqiMax = rcqi;
937  itMax = it;
938  }
939  }
940  } // end if cqi
941 
942  } // end for m_rlcBufferReq
943 
944  if (itMax == m_flowStatsDl.end ())
945  {
946  // no UE available for this RB
947  NS_LOG_INFO (this << " any UE found");
948  }
949  else
950  {
951  rbgMap.at (i) = true;
952  std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
953  itMap = allocationMap.find ((*itMax));
954  if (itMap == allocationMap.end ())
955  {
956  // insert new element
957  std::vector <uint16_t> tempMap;
958  tempMap.push_back (i);
959  allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax), tempMap));
960  }
961  else
962  {
963  (*itMap).second.push_back (i);
964  }
965  NS_LOG_INFO (this << " UE assigned " << (*itMax));
966  }
967  } // end for RBG free
968  } // end for RBGs
969 
970  // generate the transmission opportunities by grouping the RBGs of the same RNTI and
971  // creating the correspondent DCIs
972  std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.begin ();
973  while (itMap != allocationMap.end ())
974  {
975  // create new BuildDataListElement_s for this LC
977  newEl.m_rnti = (*itMap).first;
978  // create the DlDciListElement_s
979  DlDciListElement_s newDci;
980  newDci.m_rnti = (*itMap).first;
981  newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first);
982 
983  uint16_t lcActives = LcActivePerFlow ((*itMap).first);
984  NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
985  if (lcActives == 0)
986  {
987  // Set to max value, to avoid divide by 0 below
988  lcActives = (uint16_t)65535; // UINT16_MAX;
989  }
990  uint16_t RgbPerRnti = (*itMap).second.size ();
991  std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
992  itCqi = m_a30CqiRxed.find ((*itMap).first);
993  std::map <uint16_t,uint8_t>::iterator itTxMode;
994  itTxMode = m_uesTxMode.find ((*itMap).first);
995  if (itTxMode == m_uesTxMode.end ())
996  {
997  NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first);
998  }
999  int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
1000  std::vector <uint8_t> worstCqi (2, 15);
1001  if (itCqi != m_a30CqiRxed.end ())
1002  {
1003  for (uint16_t k = 0; k < (*itMap).second.size (); k++)
1004  {
1005  if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
1006  {
1007  NS_LOG_INFO (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) );
1008  for (uint8_t j = 0; j < nLayer; j++)
1009  {
1010  if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size () > j)
1011  {
1012  if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j)) < worstCqi.at (j))
1013  {
1014  worstCqi.at (j) = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j));
1015  }
1016  }
1017  else
1018  {
1019  // no CQI for this layer of this suband -> worst one
1020  worstCqi.at (j) = 1;
1021  }
1022  }
1023  }
1024  else
1025  {
1026  for (uint8_t j = 0; j < nLayer; j++)
1027  {
1028  worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel
1029  }
1030  }
1031  }
1032  }
1033  else
1034  {
1035  for (uint8_t j = 0; j < nLayer; j++)
1036  {
1037  worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel
1038  }
1039  }
1040  for (uint8_t j = 0; j < nLayer; j++)
1041  {
1042  NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (uint16_t)worstCqi.at (j));
1043  }
1044  for (uint8_t j = 0; j < nLayer; j++)
1045  {
1046  newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j)));
1047  int tbSize = (m_amc->GetDlTbSizeFromMcs (newDci.m_mcs.at (j), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
1048  newDci.m_tbsSize.push_back (tbSize);
1049  NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_amc->GetMcsFromCqi (worstCqi.at (j)));
1050  }
1051 
1052  newDci.m_resAlloc = 0; // only allocation type 0 at this stage
1053  newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213)
1054  uint32_t rbgMask = 0;
1055  for (uint16_t k = 0; k < (*itMap).second.size (); k++)
1056  {
1057  rbgMask = rbgMask + (0x1 << (*itMap).second.at (k));
1058  NS_LOG_INFO (this << " Allocated RBG " << (*itMap).second.at (k));
1059  }
1060  newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213)
1061 
1062  // create the rlc PDUs -> equally divide resources among actives LCs
1063  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itBufReq;
1064  for (itBufReq = m_rlcBufferReq.begin (); itBufReq != m_rlcBufferReq.end (); itBufReq++)
1065  {
1066  if (((*itBufReq).first.m_rnti == (*itMap).first)
1067  && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
1068  || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
1069  || ((*itBufReq).second.m_rlcStatusPduSize > 0) ))
1070  {
1071  std::vector <struct RlcPduListElement_s> newRlcPduLe;
1072  for (uint8_t j = 0; j < nLayer; j++)
1073  {
1074  RlcPduListElement_s newRlcEl;
1075  newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
1076  newRlcEl.m_size = newDci.m_tbsSize.at (j) / lcActives;
1077  NS_LOG_INFO (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << newRlcEl.m_size << " layer " << (uint16_t)j);
1078  newRlcPduLe.push_back (newRlcEl);
1079  UpdateDlRlcBufferInfo (newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size);
1080  if (m_harqOn == true)
1081  {
1082  // store RLC PDU list for HARQ
1083  std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find ((*itMap).first);
1084  if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
1085  {
1086  NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << (*itMap).first);
1087  }
1088  (*itRlcPdu).second.at (j).at (newDci.m_harqProcess).push_back (newRlcEl);
1089  }
1090  }
1091  newEl.m_rlcPduList.push_back (newRlcPduLe);
1092  }
1093  if ((*itBufReq).first.m_rnti > (*itMap).first)
1094  {
1095  break;
1096  }
1097  }
1098  for (uint8_t j = 0; j < nLayer; j++)
1099  {
1100  newDci.m_ndi.push_back (1);
1101  newDci.m_rv.push_back (0);
1102  }
1103 
1104  newDci.m_tpc = 1; //1 is mapped to 0 in Accumulated Mode and to -1 in Absolute Mode
1105 
1106  newEl.m_dci = newDci;
1107 
1108  if (m_harqOn == true)
1109  {
1110  // store DCI for HARQ
1111  std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itDci = m_dlHarqProcessesDciBuffer.find (newEl.m_rnti);
1112  if (itDci == m_dlHarqProcessesDciBuffer.end ())
1113  {
1114  NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for RNTI " << newEl.m_rnti);
1115  }
1116  (*itDci).second.at (newDci.m_harqProcess) = newDci;
1117  // refresh timer
1118  std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer = m_dlHarqProcessesTimer.find (newEl.m_rnti);
1119  if (itHarqTimer== m_dlHarqProcessesTimer.end ())
1120  {
1121  NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t)newEl.m_rnti);
1122  }
1123  (*itHarqTimer).second.at (newDci.m_harqProcess) = 0;
1124  }
1125 
1126  // ...more parameters -> ignored in this version
1127 
1128  ret.m_buildDataList.push_back (newEl);
1129 
1130  itMap++;
1131  } // end while allocation
1132  ret.m_nrOfPdcchOfdmSymbols = 1;
1133 
1135 
1136 
1137  return;
1138 }
1139 
1140 void
1142 {
1143  NS_LOG_FUNCTION (this);
1144 
1145  m_rachList = params.m_rachList;
1146 
1147  return;
1148 }
1149 
1150 void
1152 {
1153  NS_LOG_FUNCTION (this);
1154 
1155  for (unsigned int i = 0; i < params.m_cqiList.size (); i++)
1156  {
1157  if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 )
1158  {
1159  NS_LOG_LOGIC ("wideband CQI " << (uint32_t) params.m_cqiList.at (i).m_wbCqi.at (0) << " reported");
1160  std::map <uint16_t,uint8_t>::iterator it;
1161  uint16_t rnti = params.m_cqiList.at (i).m_rnti;
1162  it = m_p10CqiRxed.find (rnti);
1163  if (it == m_p10CqiRxed.end ())
1164  {
1165  // create the new entry
1166  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)
1167  // generate correspondent timer
1168  m_p10CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
1169  }
1170  else
1171  {
1172  // update the CQI value and refresh correspondent timer
1173  (*it).second = params.m_cqiList.at (i).m_wbCqi.at (0);
1174  // update correspondent timer
1175  std::map <uint16_t,uint32_t>::iterator itTimers;
1176  itTimers = m_p10CqiTimers.find (rnti);
1177  (*itTimers).second = m_cqiTimersThreshold;
1178  }
1179  }
1180  else if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::A30 )
1181  {
1182  // subband CQI reporting high layer configured
1183  std::map <uint16_t,SbMeasResult_s>::iterator it;
1184  uint16_t rnti = params.m_cqiList.at (i).m_rnti;
1185  it = m_a30CqiRxed.find (rnti);
1186  if (it == m_a30CqiRxed.end ())
1187  {
1188  // create the new entry
1189  m_a30CqiRxed.insert ( std::pair<uint16_t, SbMeasResult_s > (rnti, params.m_cqiList.at (i).m_sbMeasResult) );
1190  m_a30CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
1191  }
1192  else
1193  {
1194  // update the CQI value and refresh correspondent timer
1195  (*it).second = params.m_cqiList.at (i).m_sbMeasResult;
1196  std::map <uint16_t,uint32_t>::iterator itTimers;
1197  itTimers = m_a30CqiTimers.find (rnti);
1198  (*itTimers).second = m_cqiTimersThreshold;
1199  }
1200  }
1201  else
1202  {
1203  NS_LOG_ERROR (this << " CQI type unknown");
1204  }
1205  }
1206 
1207  return;
1208 }
1209 
1210 
1211 double
1212 FdMtFfMacScheduler::EstimateUlSinr (uint16_t rnti, uint16_t rb)
1213 {
1214  std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find (rnti);
1215  if (itCqi == m_ueCqi.end ())
1216  {
1217  // no cqi info about this UE
1218  return (NO_SINR);
1219 
1220  }
1221  else
1222  {
1223  // take the average SINR value among the available
1224  double sinrSum = 0;
1225  unsigned int sinrNum = 0;
1226  for (uint32_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
1227  {
1228  double sinr = (*itCqi).second.at (i);
1229  if (sinr != NO_SINR)
1230  {
1231  sinrSum += sinr;
1232  sinrNum++;
1233  }
1234  }
1235  double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
1236  // store the value
1237  (*itCqi).second.at (rb) = estimatedSinr;
1238  return (estimatedSinr);
1239  }
1240 }
1241 
1242 void
1244 {
1245  NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf) << " size " << params.m_ulInfoList.size ());
1246 
1247  RefreshUlCqiMaps ();
1248 
1249  // Generate RBs map
1251  std::vector <bool> rbMap;
1252  uint16_t rbAllocatedNum = 0;
1253  std::set <uint16_t> rntiAllocated;
1254  std::vector <uint16_t> rbgAllocationMap;
1255  // update with RACH allocation map
1256  rbgAllocationMap = m_rachAllocationMap;
1257  //rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
1258  m_rachAllocationMap.clear ();
1260 
1261  rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false);
1262  // remove RACH allocation
1263  for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
1264  {
1265  if (rbgAllocationMap.at (i) != 0)
1266  {
1267  rbMap.at (i) = true;
1268  NS_LOG_DEBUG (this << " Allocated for RACH " << i);
1269  }
1270  }
1271 
1272 
1273  if (m_harqOn == true)
1274  {
1275  // Process UL HARQ feedback
1276  for (uint16_t i = 0; i < params.m_ulInfoList.size (); i++)
1277  {
1278  if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk)
1279  {
1280  // retx correspondent block: retrieve the UL-DCI
1281  uint16_t rnti = params.m_ulInfoList.at (i).m_rnti;
1282  std::map <uint16_t, uint8_t>::iterator itProcId = m_ulHarqCurrentProcessId.find (rnti);
1283  if (itProcId == m_ulHarqCurrentProcessId.end ())
1284  {
1285  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
1286  }
1287  uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM;
1288  NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId << " i " << i << " size " << params.m_ulInfoList.size ());
1289  std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti);
1290  if (itHarq == m_ulHarqProcessesDciBuffer.end ())
1291  {
1292  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
1293  continue;
1294  }
1295  UlDciListElement_s dci = (*itHarq).second.at (harqId);
1296  std::map <uint16_t, UlHarqProcessesStatus_t>::iterator itStat = m_ulHarqProcessesStatus.find (rnti);
1297  if (itStat == m_ulHarqProcessesStatus.end ())
1298  {
1299  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
1300  }
1301  if ((*itStat).second.at (harqId) >= 3)
1302  {
1303  NS_LOG_INFO ("Max number of retransmissions reached (UL)-> drop process");
1304  continue;
1305  }
1306  bool free = true;
1307  for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++)
1308  {
1309  if (rbMap.at (j) == true)
1310  {
1311  free = false;
1312  NS_LOG_INFO (this << " BUSY " << j);
1313  }
1314  }
1315  if (free)
1316  {
1317  // retx on the same RBs
1318  for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++)
1319  {
1320  rbMap.at (j) = true;
1321  rbgAllocationMap.at (j) = dci.m_rnti;
1322  NS_LOG_INFO ("\tRB " << j);
1323  rbAllocatedNum++;
1324  }
1325  NS_LOG_INFO (this << " Send retx in the same RBs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen << " RV " << (*itStat).second.at (harqId) + 1);
1326  }
1327  else
1328  {
1329  NS_LOG_INFO ("Cannot allocate retx due to RACH allocations for UE " << rnti);
1330  continue;
1331  }
1332  dci.m_ndi = 0;
1333  // Update HARQ buffers with new HarqId
1334  (*itStat).second.at ((*itProcId).second) = (*itStat).second.at (harqId) + 1;
1335  (*itStat).second.at (harqId) = 0;
1336  (*itHarq).second.at ((*itProcId).second) = dci;
1337  ret.m_dciList.push_back (dci);
1338  rntiAllocated.insert (dci.m_rnti);
1339  }
1340  else
1341  {
1342  NS_LOG_INFO (this << " HARQ-ACK feedback from RNTI " << params.m_ulInfoList.at (i).m_rnti);
1343  }
1344  }
1345  }
1346 
1347  std::map <uint16_t,uint32_t>::iterator it;
1348  int nflows = 0;
1349 
1350  for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
1351  {
1352  std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
1353  // select UEs with queues not empty and not yet allocated for HARQ
1354  if (((*it).second > 0)&&(itRnti == rntiAllocated.end ()))
1355  {
1356  nflows++;
1357  }
1358  }
1359 
1360  if (nflows == 0)
1361  {
1362  if (ret.m_dciList.size () > 0)
1363  {
1364  m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
1366  }
1367 
1368  return; // no flows to be scheduled
1369  }
1370 
1371 
1372  // Divide the remaining resources equally among the active users starting from the subsequent one served last scheduling trigger
1373  uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAllocated.size ());
1374  if (rbPerFlow < 3)
1375  {
1376  rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to ensure TxOpportunity >= 7 bytes
1377  }
1378  int rbAllocated = 0;
1379 
1380  if (m_nextRntiUl != 0)
1381  {
1382  for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
1383  {
1384  if ((*it).first == m_nextRntiUl)
1385  {
1386  break;
1387  }
1388  }
1389  if (it == m_ceBsrRxed.end ())
1390  {
1391  NS_LOG_ERROR (this << " no user found");
1392  }
1393  }
1394  else
1395  {
1396  it = m_ceBsrRxed.begin ();
1397  m_nextRntiUl = (*it).first;
1398  }
1399  do
1400  {
1401  std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
1402  if ((itRnti != rntiAllocated.end ())||((*it).second == 0))
1403  {
1404  // UE already allocated for UL-HARQ -> skip it
1405  NS_LOG_DEBUG (this << " UE already allocated in HARQ -> discared, RNTI " << (*it).first);
1406  it++;
1407  if (it == m_ceBsrRxed.end ())
1408  {
1409  // restart from the first
1410  it = m_ceBsrRxed.begin ();
1411  }
1412  continue;
1413  }
1414  if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
1415  {
1416  // limit to physical resources last resource assignment
1417  rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
1418  // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
1419  if (rbPerFlow < 3)
1420  {
1421  // terminate allocation
1422  rbPerFlow = 0;
1423  }
1424  }
1425 
1426  UlDciListElement_s uldci;
1427  uldci.m_rnti = (*it).first;
1428  uldci.m_rbLen = rbPerFlow;
1429  bool allocated = false;
1430  NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
1431  while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
1432  {
1433  // check availability
1434  bool free = true;
1435  for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
1436  {
1437  if (rbMap.at (j) == true)
1438  {
1439  free = false;
1440  break;
1441  }
1442  }
1443  if (free)
1444  {
1445  uldci.m_rbStart = rbAllocated;
1446 
1447  for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
1448  {
1449  rbMap.at (j) = true;
1450  // store info on allocation for managing ul-cqi interpretation
1451  rbgAllocationMap.at (j) = (*it).first;
1452  }
1453  rbAllocated += rbPerFlow;
1454  allocated = true;
1455  break;
1456  }
1457  rbAllocated++;
1458  if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
1459  {
1460  // limit to physical resources last resource assignment
1461  rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
1462  // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
1463  if (rbPerFlow < 3)
1464  {
1465  // terminate allocation
1466  rbPerFlow = 0;
1467  }
1468  }
1469  }
1470  if (!allocated)
1471  {
1472  // unable to allocate new resource: finish scheduling
1473  m_nextRntiUl = (*it).first;
1474  if (ret.m_dciList.size () > 0)
1475  {
1477  }
1478  m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
1479  return;
1480  }
1481 
1482 
1483 
1484  std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find ((*it).first);
1485  int cqi = 0;
1486  if (itCqi == m_ueCqi.end ())
1487  {
1488  // no cqi info about this UE
1489  uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
1490  }
1491  else
1492  {
1493  // take the lowest CQI value (worst RB)
1494  NS_ABORT_MSG_IF ((*itCqi).second.size() == 0, "CQI of RNTI = " << (*it).first << " has expired");
1495  double minSinr = (*itCqi).second.at (uldci.m_rbStart);
1496  if (minSinr == NO_SINR)
1497  {
1498  minSinr = EstimateUlSinr ((*it).first, uldci.m_rbStart);
1499  }
1500  for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
1501  {
1502  double sinr = (*itCqi).second.at (i);
1503  if (sinr == NO_SINR)
1504  {
1505  sinr = EstimateUlSinr ((*it).first, i);
1506  }
1507  if (sinr < minSinr)
1508  {
1509  minSinr = sinr;
1510  }
1511  }
1512 
1513  // translate SINR -> cqi: WILD ACK: same as DL
1514  double s = log2 ( 1 + (
1515  std::pow (10, minSinr / 10 ) /
1516  ( (-std::log (5.0 * 0.00005 )) / 1.5) ));
1517  cqi = m_amc->GetCqiFromSpectralEfficiency (s);
1518  if (cqi == 0)
1519  {
1520  it++;
1521  if (it == m_ceBsrRxed.end ())
1522  {
1523  // restart from the first
1524  it = m_ceBsrRxed.begin ();
1525  }
1526  NS_LOG_DEBUG (this << " UE discarded for CQI = 0, RNTI " << uldci.m_rnti);
1527  // remove UE from allocation map
1528  for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
1529  {
1530  rbgAllocationMap.at (i) = 0;
1531  }
1532  continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
1533  }
1534  uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
1535  }
1536 
1537  uldci.m_tbSize = (m_amc->GetUlTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
1538  UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
1539  uldci.m_ndi = 1;
1540  uldci.m_cceIndex = 0;
1541  uldci.m_aggrLevel = 1;
1542  uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
1543  uldci.m_hopping = false;
1544  uldci.m_n2Dmrs = 0;
1545  uldci.m_tpc = 0; // no power control
1546  uldci.m_cqiRequest = false; // only period CQI at this stage
1547  uldci.m_ulIndex = 0; // TDD parameter
1548  uldci.m_dai = 1; // TDD parameter
1549  uldci.m_freqHopping = 0;
1550  uldci.m_pdcchPowerOffset = 0; // not used
1551  ret.m_dciList.push_back (uldci);
1552  // store DCI for HARQ_PERIOD
1553  uint8_t harqId = 0;
1554  if (m_harqOn == true)
1555  {
1556  std::map <uint16_t, uint8_t>::iterator itProcId;
1557  itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti);
1558  if (itProcId == m_ulHarqCurrentProcessId.end ())
1559  {
1560  NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti);
1561  }
1562  harqId = (*itProcId).second;
1563  std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti);
1564  if (itDci == m_ulHarqProcessesDciBuffer.end ())
1565  {
1566  NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti);
1567  }
1568  (*itDci).second.at (harqId) = uldci;
1569  // Update HARQ process status (RV 0)
1570  std::map <uint16_t, UlHarqProcessesStatus_t>::iterator itStat = m_ulHarqProcessesStatus.find (uldci.m_rnti);
1571  if (itStat == m_ulHarqProcessesStatus.end ())
1572  {
1573  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << uldci.m_rnti);
1574  }
1575  (*itStat).second.at (harqId) = 0;
1576  }
1577 
1578  NS_LOG_INFO (this << " UE Allocation RNTI " << (*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 << " RbAlloc " << rbAllocated << " harqId " << (uint16_t)harqId);
1579 
1580 
1581  it++;
1582  if (it == m_ceBsrRxed.end ())
1583  {
1584  // restart from the first
1585  it = m_ceBsrRxed.begin ();
1586  }
1587  if ((rbAllocated == m_cschedCellConfig.m_ulBandwidth) || (rbPerFlow == 0))
1588  {
1589  // Stop allocation: no more PRBs
1590  m_nextRntiUl = (*it).first;
1591  break;
1592  }
1593  }
1594  while (((*it).first != m_nextRntiUl)&&(rbPerFlow!=0));
1595 
1596 
1597  m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
1599 
1600  return;
1601 }
1602 
1603 void
1605 {
1606  NS_LOG_FUNCTION (this);
1607  return;
1608 }
1609 
1610 void
1612 {
1613  NS_LOG_FUNCTION (this);
1614  return;
1615 }
1616 
1617 void
1619 {
1620  NS_LOG_FUNCTION (this);
1621 
1622  std::map <uint16_t,uint32_t>::iterator it;
1623 
1624  for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
1625  {
1626  if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
1627  {
1628  // buffer status report
1629  // note that this scheduler does not differentiate the
1630  // allocation according to which LCGs have more/less bytes
1631  // to send.
1632  // Hence the BSR of different LCGs are just summed up to get
1633  // a total queue size that is used for allocation purposes.
1634 
1635  uint32_t buffer = 0;
1636  for (uint8_t lcg = 0; lcg < 4; ++lcg)
1637  {
1638  uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (lcg);
1639  buffer += BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
1640  }
1641 
1642  uint16_t rnti = params.m_macCeList.at (i).m_rnti;
1643  NS_LOG_LOGIC (this << "RNTI=" << rnti << " buffer=" << buffer);
1644  it = m_ceBsrRxed.find (rnti);
1645  if (it == m_ceBsrRxed.end ())
1646  {
1647  // create the new entry
1648  m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
1649  }
1650  else
1651  {
1652  // update the buffer size value
1653  (*it).second = buffer;
1654  }
1655  }
1656  }
1657 
1658  return;
1659 }
1660 
1661 void
1663 {
1664  NS_LOG_FUNCTION (this);
1665 // retrieve the allocation for this subframe
1666  switch (m_ulCqiFilter)
1667  {
1669  {
1670  // filter all the CQIs that are not SRS based
1671  if (params.m_ulCqi.m_type != UlCqi_s::SRS)
1672  {
1673  return;
1674  }
1675  }
1676  break;
1678  {
1679  // filter all the CQIs that are not SRS based
1680  if (params.m_ulCqi.m_type != UlCqi_s::PUSCH)
1681  {
1682  return;
1683  }
1684  }
1685  break;
1686  default:
1687  NS_FATAL_ERROR ("Unknown UL CQI type");
1688  }
1689 
1690  switch (params.m_ulCqi.m_type)
1691  {
1692  case UlCqi_s::PUSCH:
1693  {
1694  std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
1695  std::map <uint16_t, std::vector <double> >::iterator itCqi;
1696  NS_LOG_DEBUG (this << " Collect PUSCH CQIs of Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
1697  itMap = m_allocationMaps.find (params.m_sfnSf);
1698  if (itMap == m_allocationMaps.end ())
1699  {
1700  return;
1701  }
1702  for (uint32_t i = 0; i < (*itMap).second.size (); i++)
1703  {
1704  // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
1705  double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
1706  itCqi = m_ueCqi.find ((*itMap).second.at (i));
1707  if (itCqi == m_ueCqi.end ())
1708  {
1709  // create a new entry
1710  std::vector <double> newCqi;
1711  for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
1712  {
1713  if (i == j)
1714  {
1715  newCqi.push_back (sinr);
1716  }
1717  else
1718  {
1719  // initialize with NO_SINR value.
1720  newCqi.push_back (NO_SINR);
1721  }
1722 
1723  }
1724  m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
1725  // generate correspondent timer
1726  m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
1727  }
1728  else
1729  {
1730  // update the value
1731  (*itCqi).second.at (i) = sinr;
1732  NS_LOG_DEBUG (this << " RNTI " << (*itMap).second.at (i) << " RB " << i << " SINR " << sinr);
1733  // update correspondent timer
1734  std::map <uint16_t, uint32_t>::iterator itTimers;
1735  itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
1736  (*itTimers).second = m_cqiTimersThreshold;
1737 
1738  }
1739 
1740  }
1741  // remove obsolete info on allocation
1742  m_allocationMaps.erase (itMap);
1743  }
1744  break;
1745  case UlCqi_s::SRS:
1746  {
1747  // get the RNTI from vendor specific parameters
1748  uint16_t rnti = 0;
1749  NS_ASSERT (params.m_vendorSpecificList.size () > 0);
1750  for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++)
1751  {
1752  if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP)
1753  {
1754  Ptr<SrsCqiRntiVsp> vsp = DynamicCast<SrsCqiRntiVsp> (params.m_vendorSpecificList.at (i).m_value);
1755  rnti = vsp->GetRnti ();
1756  }
1757  }
1758  std::map <uint16_t, std::vector <double> >::iterator itCqi;
1759  itCqi = m_ueCqi.find (rnti);
1760  if (itCqi == m_ueCqi.end ())
1761  {
1762  // create a new entry
1763  std::vector <double> newCqi;
1764  for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
1765  {
1766  double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
1767  newCqi.push_back (sinr);
1768  NS_LOG_INFO (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr);
1769 
1770  }
1771  m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
1772  // generate correspondent timer
1773  m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
1774  }
1775  else
1776  {
1777  // update the values
1778  for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
1779  {
1780  double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
1781  (*itCqi).second.at (j) = sinr;
1782  NS_LOG_INFO (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr);
1783  }
1784  // update correspondent timer
1785  std::map <uint16_t, uint32_t>::iterator itTimers;
1786  itTimers = m_ueCqiTimers.find (rnti);
1787  (*itTimers).second = m_cqiTimersThreshold;
1788 
1789  }
1790 
1791 
1792  }
1793  break;
1794  case UlCqi_s::PUCCH_1:
1795  case UlCqi_s::PUCCH_2:
1796  case UlCqi_s::PRACH:
1797  {
1798  NS_FATAL_ERROR ("FdMtFfMacScheduler supports only PUSCH and SRS UL-CQIs");
1799  }
1800  break;
1801  default:
1802  NS_FATAL_ERROR ("Unknown type of UL-CQI");
1803  }
1804  return;
1805 }
1806 
1807 void
1809 {
1810  // refresh DL CQI P01 Map
1811  std::map <uint16_t,uint32_t>::iterator itP10 = m_p10CqiTimers.begin ();
1812  while (itP10 != m_p10CqiTimers.end ())
1813  {
1814  NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold);
1815  if ((*itP10).second == 0)
1816  {
1817  // delete correspondent entries
1818  std::map <uint16_t,uint8_t>::iterator itMap = m_p10CqiRxed.find ((*itP10).first);
1819  NS_ASSERT_MSG (itMap != m_p10CqiRxed.end (), " Does not find CQI report for user " << (*itP10).first);
1820  NS_LOG_INFO (this << " P10-CQI expired for user " << (*itP10).first);
1821  m_p10CqiRxed.erase (itMap);
1822  std::map <uint16_t,uint32_t>::iterator temp = itP10;
1823  itP10++;
1824  m_p10CqiTimers.erase (temp);
1825  }
1826  else
1827  {
1828  (*itP10).second--;
1829  itP10++;
1830  }
1831  }
1832 
1833  // refresh DL CQI A30 Map
1834  std::map <uint16_t,uint32_t>::iterator itA30 = m_a30CqiTimers.begin ();
1835  while (itA30 != m_a30CqiTimers.end ())
1836  {
1837  NS_LOG_INFO (this << " A30-CQI for user " << (*itA30).first << " is " << (uint32_t)(*itA30).second << " thr " << (uint32_t)m_cqiTimersThreshold);
1838  if ((*itA30).second == 0)
1839  {
1840  // delete correspondent entries
1841  std::map <uint16_t,SbMeasResult_s>::iterator itMap = m_a30CqiRxed.find ((*itA30).first);
1842  NS_ASSERT_MSG (itMap != m_a30CqiRxed.end (), " Does not find CQI report for user " << (*itA30).first);
1843  NS_LOG_INFO (this << " A30-CQI expired for user " << (*itA30).first);
1844  m_a30CqiRxed.erase (itMap);
1845  std::map <uint16_t,uint32_t>::iterator temp = itA30;
1846  itA30++;
1847  m_a30CqiTimers.erase (temp);
1848  }
1849  else
1850  {
1851  (*itA30).second--;
1852  itA30++;
1853  }
1854  }
1855 
1856  return;
1857 }
1858 
1859 
1860 void
1862 {
1863  // refresh UL CQI Map
1864  std::map <uint16_t,uint32_t>::iterator itUl = m_ueCqiTimers.begin ();
1865  while (itUl != m_ueCqiTimers.end ())
1866  {
1867  NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold);
1868  if ((*itUl).second == 0)
1869  {
1870  // delete correspondent entries
1871  std::map <uint16_t, std::vector <double> >::iterator itMap = m_ueCqi.find ((*itUl).first);
1872  NS_ASSERT_MSG (itMap != m_ueCqi.end (), " Does not find CQI report for user " << (*itUl).first);
1873  NS_LOG_INFO (this << " UL-CQI exired for user " << (*itUl).first);
1874  (*itMap).second.clear ();
1875  m_ueCqi.erase (itMap);
1876  std::map <uint16_t,uint32_t>::iterator temp = itUl;
1877  itUl++;
1878  m_ueCqiTimers.erase (temp);
1879  }
1880  else
1881  {
1882  (*itUl).second--;
1883  itUl++;
1884  }
1885  }
1886 
1887  return;
1888 }
1889 
1890 void
1891 FdMtFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
1892 {
1893  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
1894  LteFlowId_t flow (rnti, lcid);
1895  it = m_rlcBufferReq.find (flow);
1896  if (it != m_rlcBufferReq.end ())
1897  {
1898  NS_LOG_INFO (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
1899  // Update queues: RLC tx order Status, ReTx, Tx
1900  // Update status queue
1901  if (((*it).second.m_rlcStatusPduSize > 0) && (size >= (*it).second.m_rlcStatusPduSize))
1902  {
1903  (*it).second.m_rlcStatusPduSize = 0;
1904  }
1905  else if (((*it).second.m_rlcRetransmissionQueueSize > 0) && (size >= (*it).second.m_rlcRetransmissionQueueSize))
1906  {
1907  (*it).second.m_rlcRetransmissionQueueSize = 0;
1908  }
1909  else if ((*it).second.m_rlcTransmissionQueueSize > 0)
1910  {
1911  uint32_t rlcOverhead;
1912  if (lcid == 1)
1913  {
1914  // for SRB1 (using RLC AM) it's better to
1915  // overestimate RLC overhead rather than
1916  // underestimate it and risk unneeded
1917  // segmentation which increases delay
1918  rlcOverhead = 4;
1919  }
1920  else
1921  {
1922  // minimum RLC overhead due to header
1923  rlcOverhead = 2;
1924  }
1925  // update transmission queue
1926  if ((*it).second.m_rlcTransmissionQueueSize <= size - rlcOverhead)
1927  {
1928  (*it).second.m_rlcTransmissionQueueSize = 0;
1929  }
1930  else
1931  {
1932  (*it).second.m_rlcTransmissionQueueSize -= size - rlcOverhead;
1933  }
1934  }
1935  }
1936  else
1937  {
1938  NS_LOG_ERROR (this << " Does not find DL RLC Buffer Report of UE " << rnti);
1939  }
1940 }
1941 
1942 void
1943 FdMtFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
1944 {
1945 
1946  size = size - 2; // remove the minimum RLC overhead
1947  std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
1948  if (it != m_ceBsrRxed.end ())
1949  {
1950  NS_LOG_INFO (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);
1951  if ((*it).second >= size)
1952  {
1953  (*it).second -= size;
1954  }
1955  else
1956  {
1957  (*it).second = 0;
1958  }
1959  }
1960  else
1961  {
1962  NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti);
1963  }
1964 
1965 }
1966 
1967 void
1969 {
1970  NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode);
1972  params.m_rnti = rnti;
1973  params.m_transmissionMode = txMode;
1975 }
1976 
1977 
1978 }
AttributeValue implementation for Boolean.
Definition: boolean.h:37
static uint32_t BsrId2BufferSize(uint8_t val)
Convert BSR ID to buffer size.
Definition: lte-common.cc:184
Implements the SCHED SAP and CSCHED SAP for a Frequency Domain Maximize Throughput scheduler.
void DoSchedDlMacBufferReq(const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters &params)
Sched DL MAC buffer request function.
virtual LteFfrSapUser * GetLteFfrSapUser()
void DoCschedCellConfigReq(const struct FfMacCschedSapProvider::CschedCellConfigReqParameters &params)
Csched cell config request function.
std::map< uint16_t, uint32_t > m_ceBsrRxed
Map of UE's buffer status reports received.
uint8_t HarqProcessAvailability(uint16_t rnti)
Return the availability of free process for the RNTI specified.
virtual ~FdMtFfMacScheduler()
Destructor.
double EstimateUlSinr(uint16_t rnti, uint16_t rb)
Estimate UL SNR function.
virtual void DoDispose(void)
Destructor implementation.
std::map< uint16_t, DlHarqRlcPduListBuffer_t > m_dlHarqProcessesRlcPduListBuffer
DL HARQ process RLC PDU list buffer.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void UpdateDlRlcBufferInfo(uint16_t rnti, uint8_t lcid, uint16_t size)
Update DL RLC buffer info function.
std::vector< struct RachListElement_s > m_rachList
RACH list.
std::map< uint16_t, SbMeasResult_s > m_a30CqiRxed
Map of UE's DL CQI A30 received.
std::map< uint16_t, UlHarqProcessesStatus_t > m_ulHarqProcessesStatus
UL HARQ process status.
void DoSchedDlTriggerReq(const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters &params)
Sched DL trigger request function.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
void RefreshHarqProcesses()
Refresh HARQ processes according to the timers.
void TransmissionModeConfigurationUpdate(uint16_t rnti, uint8_t txMode)
Transmission mode configuration update.
void DoSchedDlRlcBufferReq(const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters &params)
Sched DL RLC buffer request function.
unsigned int LcActivePerFlow(uint16_t rnti)
LC Active per flow function.
std::map< uint16_t, uint8_t > m_dlHarqCurrentProcessId
DL HARQ current process ID.
int GetRbgSize(int dlbandwidth)
Get RBG size function.
void RefreshUlCqiMaps(void)
Refresh UL CGI maps function.
std::map< uint16_t, UlHarqProcessesDciBuffer_t > m_ulHarqProcessesDciBuffer
UL HARQ process DCI buffer.
void DoSchedUlNoiseInterferenceReq(const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters &params)
Sched UL noise interference request function.
std::map< uint16_t, std::vector< double > > m_ueCqi
Map of UEs' UL-CQI per RBG.
std::set< uint16_t > m_flowStatsUl
Set of UE statistics (per RNTI basis)
virtual FfMacCschedSapProvider * GetFfMacCschedSapProvider()
FfMacCschedSapProvider * m_cschedSapProvider
csched SAP provider
std::map< uint16_t, uint32_t > m_p10CqiTimers
Map of UE's timers on DL CQI P01 received.
void DoSchedUlCqiInfoReq(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
Sched UL CQI info request function.
std::map< uint16_t, uint8_t > m_p10CqiRxed
Map of UE's DL CQI P01 received.
void DoSchedUlSrInfoReq(const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters &params)
Sched UL SR info request function.
std::map< uint16_t, uint32_t > m_ueCqiTimers
Map of UEs' timers on UL-CQI per RBG.
virtual FfMacSchedSapProvider * GetFfMacSchedSapProvider()
void DoCschedLcConfigReq(const struct FfMacCschedSapProvider::CschedLcConfigReqParameters &params)
CSched LC config request function.
static TypeId GetTypeId(void)
Get the type ID.
virtual void SetFfMacSchedSapUser(FfMacSchedSapUser *s)
set the user part of the FfMacSchedSap that this Scheduler will interact with.
std::map< uint16_t, DlHarqProcessesDciBuffer_t > m_dlHarqProcessesDciBuffer
DL HARQ process DCI buffer.
FfMacSchedSapProvider * m_schedSapProvider
sched SAP provider
std::map< uint16_t, std::vector< uint16_t > > m_allocationMaps
Map of previous allocated UE per RBG (used to retrieve info from UL-CQI)
std::set< uint16_t > m_flowStatsDl
Set of UE statistics (per RNTI basis) in downlink.
std::map< uint16_t, DlHarqProcessesStatus_t > m_dlHarqProcessesStatus
DL HARQ process status.
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig
sched cell config
void DoSchedDlCqiInfoReq(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
Sched DL CQI info request function.
std::vector< uint16_t > m_rachAllocationMap
RACH allocation map.
std::map< uint16_t, uint8_t > m_uesTxMode
txMode of the UEs
void DoSchedUlMacCtrlInfoReq(const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters &params)
Sched UL MAC control info request function.
uint8_t m_ulGrantMcs
MCS for UL grant (default 0)
void RefreshDlCqiMaps(void)
Refresh DL CGI maps function.
bool m_harqOn
m_harqOn when false inhibit tte HARQ mechanisms (by default active)
std::map< uint16_t, uint8_t > m_ulHarqCurrentProcessId
UL HARQ current process ID.
friend class MemberSchedSapProvider< FdMtFfMacScheduler >
allow MemberSchedSapProvider<FdMtFfMacScheduler> clss friend access
std::vector< DlInfoListElement_s > m_dlInfoListBuffered
HARQ retx buffered.
FfMacSchedSapUser * m_schedSapUser
sched SAP user
FfMacCschedSapUser * m_cschedSapUser
csched SAP user
void DoSchedDlPagingBufferReq(const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters &params)
Sched DL paging buffer request function.
void DoSchedUlTriggerReq(const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters &params)
Sched UL trigger request function.
void DoCschedUeReleaseReq(const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters &params)
CSched UE release request function.
virtual void SetFfMacCschedSapUser(FfMacCschedSapUser *s)
set the user part of the FfMacCschedSap that this Scheduler will interact with.
void DoCschedUeConfigReq(const struct FfMacCschedSapProvider::CschedUeConfigReqParameters &params)
CSched UE config request function.
std::map< uint16_t, DlHarqProcessesTimer_t > m_dlHarqProcessesTimer
DL HARDQ process timer.
uint16_t m_nextRntiUl
RNTI of the next user to be served next scheduling in UL.
std::map< LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters > m_rlcBufferReq
Vectors of UE's LC info.
std::map< uint16_t, uint32_t > m_a30CqiTimers
Map of UE's timers on DL CQI A30 received.
void UpdateUlRlcBufferInfo(uint16_t rnti, uint16_t size)
Update UL RLC b uffer info function.
void DoSchedDlRachInfoReq(const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters &params)
Sched DL RACH info request function.
void DoCschedLcReleaseReq(const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters &params)
CSched LC release request function.
friend class MemberCschedSapProvider< FdMtFfMacScheduler >
allow MemberCschedSapProvider<FdMtFfMacScheduler> class friend access
virtual void SetLteFfrSapProvider(LteFfrSapProvider *s)
Set the Provider part of the LteFfrSap that this Scheduler will interact with.
uint8_t UpdateHarqProcessId(uint16_t rnti)
Update and return a new process Id for the RNTI specified.
Provides the CSCHED SAP.
FfMacCschedSapUser class.
virtual void CschedUeConfigUpdateInd(const struct CschedUeConfigUpdateIndParameters &params)=0
CSCHED_UE_UPDATE_IND.
virtual void CschedUeConfigCnf(const struct CschedUeConfigCnfParameters &params)=0
CSCHED_UE_CONFIG_CNF.
Provides the SCHED SAP.
FfMacSchedSapUser class.
virtual void SchedUlConfigInd(const struct SchedUlConfigIndParameters &params)=0
SCHED_UL_CONFIG_IND.
virtual void SchedDlConfigInd(const struct SchedDlConfigIndParameters &params)=0
SCHED_DL_CONFIG_IND.
This abstract base class identifies the interface by means of which the helper object can plug on the...
UlCqiFilter_t m_ulCqiFilter
UL CQI filter.
static double fpS11dot3toDouble(uint16_t val)
Convert from fixed point S11.3 notation to double.
Definition: lte-common.cc:155
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:139
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
static uint8_t TxMode2LayerNum(uint8_t txMode)
Transmit mode 2 layer number.
Definition: lte-common.cc:212
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Hold an unsigned integer type.
Definition: uinteger.h:44
#define NO_SINR
#define HARQ_PROC_NUM
#define HARQ_DL_TIMEOUT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:257
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
#define HARQ_PERIOD
Definition: lte-common.h:30
#define SRS_CQI_RNTI_VSP
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< UlDciListElement_s > UlHarqProcessesDciBuffer_t
UL HARQ process DCI buffer vector.
std::vector< uint8_t > DlHarqProcessesTimer_t
DL HARQ process timer vector typedef.
std::vector< uint8_t > DlHarqProcessesStatus_t
DL HARQ process status vector typedef.
std::vector< RlcPduList_t > DlHarqRlcPduListBuffer_t
vector of the 8 HARQ processes per UE
@ SUCCESS
Definition: ff-mac-common.h:62
static const int FdMtType0AllocationRbg[4]
FdMtType0AllocationRbg size array.
std::vector< DlDciListElement_s > DlHarqProcessesDciBuffer_t
DL HARQ process DCI buffer vector typedef.
std::vector< uint8_t > UlHarqProcessesStatus_t
UL HARQ process status vector.
See section 4.3.8 builDataListElement.
struct DlDciListElement_s m_dci
DCI.
std::vector< std::vector< struct RlcPduListElement_s > > m_rlcPduList
RLC PDU list.
See section 4.3.10 buildRARListElement.
See section 4.3.1 dlDciListElement.
Definition: ff-mac-common.h:94
std::vector< uint8_t > m_ndi
New data indicator.
uint8_t m_harqProcess
HARQ process.
uint32_t m_rbBitmap
RB bitmap.
Definition: ff-mac-common.h:96
std::vector< uint8_t > m_mcs
MCS.
uint8_t m_resAlloc
The type of resource allocation.
Definition: ff-mac-common.h:98
std::vector< uint16_t > m_tbsSize
The TBs size.
Definition: ff-mac-common.h:99
std::vector< uint8_t > m_rv
Redundancy version.
uint8_t m_tpc
Tx power control command.
Parameters of the CSCHED_LC_CONFIG_REQ primitive.
std::vector< struct LogicalChannelConfigListElement_s > m_logicalChannelConfigList
logicalChannelConfigList
Parameters of the CSCHED_LC_RELEASE_REQ primitive.
std::vector< uint8_t > m_logicalChannelIdentity
logical channel identity
Parameters of the CSCHED_UE_CONFIG_REQ primitive.
Parameters of the CSCHED_UE_RELEASE_REQ primitive.
Parameters of the CSCHED_UE_CONFIG_CNF primitive.
Parameters of the CSCHED_UE_CONFIG_UPDATE_IND primitive.
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
std::vector< struct CqiListElement_s > m_cqiList
CQI list.
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.
std::vector< struct RachListElement_s > m_rachList
RACH list.
Parameters of the SCHED_DL_TRIGGER_REQ primitive.
std::vector< struct DlInfoListElement_s > m_dlInfoList
DL info list.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
std::vector< struct VendorSpecificListElement_s > m_vendorSpecificList
vendor specific list
Parameters of the SCHED_UL_MAC_CTRL_INFO_REQ primitive.
std::vector< struct MacCeListElement_s > m_macCeList
MAC CE list.
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.
std::vector< struct UlInfoListElement_s > m_ulInfoList
UL info list.
uint8_t m_nrOfPdcchOfdmSymbols
number of PDCCH OFDM symbols
std::vector< struct BuildDataListElement_s > m_buildDataList
build data list
std::vector< struct BuildRarListElement_s > m_buildRarList
build rar list
Parameters of the SCHED_UL_CONFIG_IND primitive.
std::vector< struct UlDciListElement_s > m_dciList
DCI list.
LteFlowId structure.
Definition: lte-common.h:37
See section 4.3.9 rlcPDU_ListElement.
uint8_t m_logicalChannelIdentity
logical channel identity
std::vector< uint16_t > m_sinr
SINR.
See section 4.3.2 ulDciListElement.
int8_t m_pdcchPowerOffset
CCH power offset.
int8_t m_tpc
Tx power control command.
uint8_t m_dai
DL assignment index.
uint8_t m_cceIndex
Control Channel Element index.
uint8_t m_ulIndex
UL index.
uint8_t m_ueTxAntennaSelection
UE antenna selection.
bool m_cqiRequest
CQI request.
uint8_t m_n2Dmrs
n2 DMRS
uint8_t m_freqHopping
freq hopping
uint8_t m_aggrLevel
The aggregation level.
bool m_ulDelay
UL delay?
int8_t m_tpc
Tx power control command.
bool m_cqiRequest
CQI request?
bool m_hopping
hopping?
uint16_t m_tbSize
size
uint8_t m_rbLen
length
uint8_t m_mcs
MCS.
uint8_t m_rbStart
start
uint16_t m_rnti
RNTI.