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