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