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