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