A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-fr-strict-algorithm.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Piotr Gawlowicz
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
7 *
8 */
9
11
12#include "ns3/boolean.h"
13#include <ns3/log.h>
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("LteFrStrictAlgorithm");
19
20NS_OBJECT_ENSURE_REGISTERED(LteFrStrictAlgorithm);
21
22/// FrStrictDownlinkDefaultConfiguration structure
24{
25 uint8_t cellId; ///< cell ID
26 uint8_t dlBandwidth; ///< DL bandwidth
27 uint8_t dlCommonSubBandwidth; ///< DL common subbandwidth
28 uint8_t dlEdgeSubBandOffset; ///< DL edge subband offset
29 uint8_t dlEdgeSubBandwidth; ///< DL edge subbandwidth
30};
31
32/// The strict downlink default configuration
34 {1, 15, 2, 0, 4},
35 {2, 15, 2, 4, 4},
36 {3, 15, 2, 8, 4},
37 {1, 25, 6, 0, 6},
38 {2, 25, 6, 6, 6},
39 {3, 25, 6, 12, 6},
40 {1, 50, 21, 0, 9},
41 {2, 50, 21, 9, 9},
42 {3, 50, 21, 18, 11},
43 {1, 75, 36, 0, 12},
44 {2, 75, 36, 12, 12},
45 {3, 75, 36, 24, 15},
46 {1, 100, 28, 0, 24},
47 {2, 100, 28, 24, 24},
48 {3, 100, 28, 48, 24},
49};
50
51/// FrStrictUplinkDefaultConfiguration structure
53{
54 uint8_t cellId; ///< cell ID
55 uint8_t ulBandwidth; ///< UL bandwidth
56 uint8_t ulCommonSubBandwidth; ///< UL common subbandwidth
57 uint8_t ulEdgeSubBandOffset; ///< UL edge subband offset
58 uint8_t ulEdgeSubBandwidth; ///< UL edge subbandwidth
59};
60
61/// The strict uplink default configuration
63 {1, 15, 3, 0, 4},
64 {2, 15, 3, 4, 4},
65 {3, 15, 3, 8, 4},
66 {1, 25, 6, 0, 6},
67 {2, 25, 6, 6, 6},
68 {3, 25, 6, 12, 6},
69 {1, 50, 21, 0, 9},
70 {2, 50, 21, 9, 9},
71 {3, 50, 21, 18, 11},
72 {1, 75, 36, 0, 12},
73 {2, 75, 36, 12, 12},
74 {3, 75, 36, 24, 15},
75 {1, 100, 28, 0, 24},
76 {2, 100, 28, 24, 24},
77 {3, 100, 28, 48, 24},
78};
79
80/** \returns number of downlink configurations */
83/** \returns number of uplink configurations */
86
88 : m_ffrSapUser(nullptr),
89 m_ffrRrcSapUser(nullptr),
90 m_dlEdgeSubBandOffset(0),
91 m_dlEdgeSubBandwidth(0),
92 m_ulEdgeSubBandOffset(0),
93 m_ulEdgeSubBandwidth(0),
94 m_measId(0)
95{
96 NS_LOG_FUNCTION(this);
99}
100
105
106void
113
114TypeId
116{
117 static TypeId tid =
118 TypeId("ns3::LteFrStrictAlgorithm")
120 .SetGroupName("Lte")
121 .AddConstructor<LteFrStrictAlgorithm>()
122 .AddAttribute(
123 "UlCommonSubBandwidth",
124 "Uplink Common SubBandwidth Configuration in number of Resource Block Groups",
125 UintegerValue(25),
128 .AddAttribute("UlEdgeSubBandOffset",
129 "Uplink Edge SubBand Offset in number of Resource Block Groups",
130 UintegerValue(0),
133 .AddAttribute(
134 "UlEdgeSubBandwidth",
135 "Uplink Edge SubBandwidth Configuration in number of Resource Block Groups",
136 UintegerValue(0),
139 .AddAttribute(
140 "DlCommonSubBandwidth",
141 "Downlink Common SubBandwidth Configuration in number of Resource Block Groups",
142 UintegerValue(25),
145 .AddAttribute("DlEdgeSubBandOffset",
146 "Downlink Edge SubBand Offset in number of Resource Block Groups",
147 UintegerValue(0),
150 .AddAttribute(
151 "DlEdgeSubBandwidth",
152 "Downlink Edge SubBandwidth Configuration in number of Resource Block Groups",
153 UintegerValue(0),
156 .AddAttribute(
157 "RsrqThreshold",
158 "If the RSRQ of is worse than this threshold, UE should be served in Edge sub-band",
159 UintegerValue(20),
162 .AddAttribute("CenterPowerOffset",
163 "PdschConfigDedicated::Pa value for Center Sub-band, default value dB0",
167 .AddAttribute("EdgePowerOffset",
168 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
169 UintegerValue(5),
172 .AddAttribute("CenterAreaTpc",
173 "TPC value which will be set in DL-DCI for UEs in center area"
174 "Absolute mode is used, default value 1 is mapped to -1 according to"
175 "TS36.213 Table 5.1.1.1-2",
176 UintegerValue(1),
179 .AddAttribute("EdgeAreaTpc",
180 "TPC value which will be set in DL-DCI for UEs in edge area"
181 "Absolute mode is used, default value 1 is mapped to -1 according to"
182 "TS36.213 Table 5.1.1.1-2",
183 UintegerValue(1),
186 return tid;
187}
188
189void
195
202
203void
209
216
217void
219{
220 NS_LOG_FUNCTION(this);
222
223 NS_ASSERT_MSG(m_dlBandwidth > 14, "DlBandwidth must be at least 15 to use FFR algorithms");
224 NS_ASSERT_MSG(m_ulBandwidth > 14, "UlBandwidth must be at least 15 to use FFR algorithms");
225
226 if (m_frCellTypeId != 0)
227 {
230 }
231
232 NS_LOG_LOGIC(this << " requesting Event A1 measurements"
233 << " (threshold = 0"
234 << ")");
235 LteRrcSap::ReportConfigEutra reportConfig;
238 reportConfig.threshold1.range = 0;
242}
243
244void
257
258void
273
274void
289
290void
292{
293 m_dlRbgMap.clear();
294 m_dlEdgeRbgMap.clear();
295
296 int rbgSize = GetRbgSize(m_dlBandwidth);
297 m_dlRbgMap.resize(m_dlBandwidth / rbgSize, true);
298 m_dlEdgeRbgMap.resize(m_dlBandwidth / rbgSize, false);
299
301 "DlCommonSubBandwidth higher than DlBandwidth");
303 "DlEdgeSubBandOffset higher than DlBandwidth");
305 "DlEdgeSubBandwidth higher than DlBandwidth");
308 "(DlCommonSubBandwidth+DlEdgeSubBandOffset+DlEdgeSubBandwidth) higher than DlBandwidth");
309
310 for (int i = 0; i < m_dlCommonSubBandwidth / rbgSize; i++)
311 {
312 m_dlRbgMap[i] = false;
313 }
314
315 for (int i = m_dlCommonSubBandwidth / rbgSize + m_dlEdgeSubBandOffset / rbgSize;
316 i < (m_dlCommonSubBandwidth / rbgSize + m_dlEdgeSubBandOffset / rbgSize +
317 m_dlEdgeSubBandwidth / rbgSize);
318 i++)
319 {
320 m_dlRbgMap[i] = false;
321 m_dlEdgeRbgMap[i] = true;
322 }
323}
324
325void
327{
328 m_ulRbgMap.clear();
329 m_ulEdgeRbgMap.clear();
330
332 {
333 m_ulRbgMap.resize(m_ulBandwidth, false);
334 return;
335 }
336
337 m_ulRbgMap.resize(m_ulBandwidth, true);
338 m_ulEdgeRbgMap.resize(m_ulBandwidth, false);
339
341 "UlCommonSubBandwidth higher than UlBandwidth");
343 "UlEdgeSubBandOffset higher than UlBandwidth");
345 "UlEdgeSubBandwidth higher than UlBandwidth");
348 "(UlCommonSubBandwidth+UlEdgeSubBandOffset+UlEdgeSubBandwidth) higher than UlBandwidth");
349
350 for (uint8_t i = 0; i < m_ulCommonSubBandwidth; i++)
351 {
352 m_ulRbgMap[i] = false;
353 }
354
357 i++)
358 {
359 m_ulRbgMap[i] = false;
360 m_ulEdgeRbgMap[i] = true;
361 }
362}
363
364std::vector<bool>
366{
367 NS_LOG_FUNCTION(this);
368
370 {
371 Reconfigure();
372 }
373
374 if (m_dlRbgMap.empty())
375 {
377 }
378
379 return m_dlRbgMap;
380}
381
382bool
384{
385 NS_LOG_FUNCTION(this);
386
387 bool edgeRbg = m_dlEdgeRbgMap[rbgId];
388
389 auto it = m_ues.find(rnti);
390 if (it == m_ues.end())
391 {
392 m_ues.insert(std::pair<uint16_t, uint8_t>(rnti, AreaUnset));
393 return !edgeRbg;
394 }
395
396 bool edgeUe = false;
397 if (it->second == CellEdge)
398 {
399 edgeUe = true;
400 }
401
402 return (edgeRbg && edgeUe) || (!edgeRbg && !edgeUe);
403}
404
405std::vector<bool>
407{
408 NS_LOG_FUNCTION(this);
409
410 if (m_ulRbgMap.empty())
411 {
413 }
414
415 return m_ulRbgMap;
416}
417
418bool
420{
421 NS_LOG_FUNCTION(this);
422
424 {
425 return true;
426 }
427
428 bool edgeRbg = m_ulEdgeRbgMap[rbgId];
429
430 auto it = m_ues.find(rnti);
431 if (it == m_ues.end())
432 {
433 m_ues.insert(std::pair<uint16_t, uint8_t>(rnti, AreaUnset));
434 return !edgeRbg;
435 }
436
437 bool edgeUe = false;
438 if (it->second == CellEdge)
439 {
440 edgeUe = true;
441 }
442
443 return (edgeRbg && edgeUe) || (!edgeRbg && !edgeUe);
444}
445
446void
449{
450 NS_LOG_FUNCTION(this);
451 NS_LOG_WARN("Method should not be called, because it is empty");
452}
453
454void
457{
458 NS_LOG_FUNCTION(this);
459 NS_LOG_WARN("Method should not be called, because it is empty");
460}
461
462void
463LteFrStrictAlgorithm::DoReportUlCqiInfo(std::map<uint16_t, std::vector<double>> ulCqiMap)
464{
465 NS_LOG_FUNCTION(this);
466 NS_LOG_WARN("Method should not be called, because it is empty");
467}
468
469uint8_t
471{
472 NS_LOG_FUNCTION(this);
473
475 {
476 return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213
477 // Table 5.1.1.1-2
478 }
479
480 // TS36.213 Table 5.1.1.1-2
481 // TPC | Accumulated Mode | Absolute Mode
482 //------------------------------------------------
483 // 0 | -1 | -4
484 // 1 | 0 | -1
485 // 2 | 1 | 1
486 // 3 | 3 | 4
487 //------------------------------------------------
488 // here Absolute mode is used
489
490 auto it = m_ues.find(rnti);
491 if (it == m_ues.end())
492 {
493 return 1;
494 }
495
496 if (it->second == CellEdge)
497 {
498 return m_edgeAreaTpc;
499 }
500 else if (it->second == CellCenter)
501 {
502 return m_centerAreaTpc;
503 }
504
505 return 1;
506}
507
508uint16_t
510{
511 NS_LOG_FUNCTION(this);
512
514 {
515 return m_ulBandwidth;
516 }
517
518 uint8_t minContinuousUlBandwidth = m_ulCommonSubBandwidth < m_ulEdgeSubBandwidth
521 NS_LOG_INFO("minContinuousUlBandwidth: " << (int)minContinuousUlBandwidth);
522
523 return minContinuousUlBandwidth;
524}
525
526void
528{
529 NS_LOG_FUNCTION(this << rnti << (uint16_t)measResults.measId);
530 NS_LOG_INFO("RNTI :" << rnti << " MeasId: " << (uint16_t)measResults.measId
531 << " RSRP: " << (uint16_t)measResults.measResultPCell.rsrpResult
532 << " RSRQ: " << (uint16_t)measResults.measResultPCell.rsrqResult);
533
534 if (measResults.measId != m_measId)
535 {
536 NS_LOG_WARN("Ignoring measId " << (uint16_t)measResults.measId);
537 }
538 else
539 {
540 auto it = m_ues.find(rnti);
541 if (it == m_ues.end())
542 {
543 m_ues.insert(std::pair<uint16_t, uint8_t>(rnti, AreaUnset));
544 }
545 it = m_ues.find(rnti);
546
548 {
549 if (it->second != CellEdge)
550 {
551 NS_LOG_INFO("UE RNTI: " << rnti << " will be served in Edge sub-band");
552 it->second = CellEdge;
553
554 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
555 pdschConfigDedicated.pa = m_edgeAreaPowerOffset;
556 m_ffrRrcSapUser->SetPdschConfigDedicated(rnti, pdschConfigDedicated);
557 }
558 }
559 else
560 {
561 if (it->second != CellCenter)
562 {
563 NS_LOG_INFO("UE RNTI: " << rnti << " will be served in Center sub-band");
564 it->second = CellCenter;
565
566 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
567 pdschConfigDedicated.pa = m_centerAreaPowerOffset;
568 m_ffrRrcSapUser->SetPdschConfigDedicated(rnti, pdschConfigDedicated);
569 }
570 }
571 }
572}
573
574void
576{
577 NS_LOG_FUNCTION(this);
578 NS_LOG_WARN("Method should not be called, since it is empty");
579}
580
581} // end of namespace ns3
The abstract base class of a Frequency Reuse algorithm.
bool m_needReconfiguration
If true FR algorithm will be reconfigured.
uint8_t m_frCellTypeId
FFR cell type ID for automatic configuration.
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
bool m_enabledInUplink
If true FR algorithm will also work in Uplink.
uint8_t m_dlBandwidth
downlink bandwidth in RBs
uint8_t m_ulBandwidth
uplink bandwidth in RBs
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
virtual void SetPdschConfigDedicated(uint16_t rnti, LteRrcSap::PdschConfigDedicated pdschConfigDedicated)=0
Instruct the eNodeB RRC entity to perform RrcConnectionReconfiguration to inform UE about new PdschCo...
virtual uint8_t AddUeMeasReportConfigForFfr(LteRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Definition lte-ffr-sap.h:29
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Strict Frequency Reuse algorithm implementation.
LteFfrSapProvider * GetLteFfrSapProvider() override
Export the "provider" part of the LteFfrSap interface.
uint8_t m_centerAreaPowerOffset
center area power offset
std::vector< bool > m_ulRbgMap
UL RBG map.
uint8_t m_ulCommonSubBandwidth
UL common subbandwidth.
void DoInitialize() override
Initialize() implementation.
uint16_t DoGetMinContinuousUlBandwidth() override
DoGetMinContinuousUlBandwidth in number of RB.
void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params) override
DoRecvLoadInformation.
void DoReportDlCqiInfo(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params) override
DoReportDlCqiInfo.
void DoReportUlCqiInfo(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params) override
DoReportUlCqiInfo.
uint8_t m_dlCommonSubBandwidth
DL common subbandwidth.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
uint8_t m_ulEdgeSubBandwidth
UL edge subbandwidth.
uint8_t m_dlEdgeSubBandOffset
DL edge subband offset.
void InitializeUplinkRbgMaps()
Initialize uplink RBG maps.
void DoDispose() override
Destructor implementation.
friend class MemberLteFfrSapProvider< LteFrStrictAlgorithm >
let the forwarder class access the protected and private members
uint8_t m_dlEdgeSubBandwidth
DL edge subbandwidth.
uint8_t m_edgeAreaPowerOffset
edge area power offset
std::vector< bool > DoGetAvailableUlRbg() override
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
void SetLteFfrSapUser(LteFfrSapUser *s) override
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
std::vector< bool > DoGetAvailableDlRbg() override
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
static TypeId GetTypeId()
Get the type ID.
bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
void SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set uplink configuration.
void Reconfigure() override
Automatic FR reconfiguration.
bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
LteFfrRrcSapProvider * GetLteFfrRrcSapProvider() override
Export the "provider" part of the LteFfrRrcSap interface.
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
uint8_t m_centerAreaTpc
center area tpc
uint8_t m_measId
The expected measurement identity.
std::vector< bool > m_dlEdgeRbgMap
DL edge RBG map.
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set downlink configuration.
friend class MemberLteFfrRrcSapProvider< LteFrStrictAlgorithm >
let the forwarder class access the protected and private members
LteFrStrictAlgorithm()
Creates a trivial ffr algorithm instance.
uint8_t m_ulEdgeSubBandOffset
UL edge subband offset.
uint8_t DoGetTpc(uint16_t rnti) override
DoGetTpc for UE.
uint8_t m_edgeSubBandThreshold
Edge subband threshold.
std::vector< bool > m_ulEdgeRbgMap
UL edge RBG map.
std::vector< bool > m_dlRbgMap
DL RBG map.
void InitializeDownlinkRbgMaps()
Initialize downlink RBG maps.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s) override
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
std::map< uint16_t, uint8_t > m_ues
UEs.
virtual void DoInitialize()
Initialize() implementation.
Definition object.cc:440
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
#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:75
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition log.h:250
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
const uint16_t NUM_DOWNLINK_CONFS(sizeof(g_ffrEnhancedDownlinkDefaultConfiguration)/sizeof(FfrEnhancedDownlinkDefaultConfiguration))
static const FrStrictUplinkDefaultConfiguration g_frStrictUplinkDefaultConfiguration[]
The strict uplink default configuration.
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
static const FrStrictDownlinkDefaultConfiguration g_frStrictDownlinkDefaultConfiguration[]
The strict downlink default configuration.
Parameters of the LOAD INFORMATION message.
Definition epc-x2-sap.h:295
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
uint8_t rsrqResult
the RSRQ result
uint8_t rsrpResult
the RSRP result
MeasResults structure.
uint8_t measId
measure ID
MeasResultPCell measResultPCell
measurement result primary cell
PdschConfigDedicated structure.
Specifies criteria for triggering of an E-UTRA measurement reporting event.
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
@ RSRQ
Reference Signal Received Quality.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
enum ns3::LteRrcSap::ReportConfigEutra::@65 reportInterval
Report interval enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@63 triggerQuantity
Trigger type enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t range
Value range used in RSRP/RSRQ threshold.