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