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