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