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