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