A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-fr-soft-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("LteFrSoftAlgorithm");
19
20NS_OBJECT_ENSURE_REGISTERED(LteFrSoftAlgorithm);
21
22/// FrSoftDownlinkDefaultConfiguration structure
24{
25 uint8_t cellId; ///< cell ID
26 uint8_t dlBandwidth; ///< DL bandwidth
27 uint8_t dlEdgeSubBandOffset; ///< DL edge subband offset
28 uint8_t dlEdgeSubBandwidth; ///< Dl edge subbandwidth
29};
30
31/// Soft downlink default configuration
33 {1, 15, 0, 4},
34 {2, 15, 4, 4},
35 {3, 15, 8, 6},
36 {1, 25, 0, 8},
37 {2, 25, 8, 8},
38 {3, 25, 16, 9},
39 {1, 50, 0, 16},
40 {2, 50, 16, 16},
41 {3, 50, 32, 18},
42 {1, 75, 0, 24},
43 {2, 75, 24, 24},
44 {3, 75, 48, 27},
45 {1, 100, 0, 32},
46 {2, 100, 32, 32},
47 {3, 100, 64, 36},
48};
49
50/// soft uplink default configuration
52{
53 uint8_t cellId; ///< cell ID
54 uint8_t ulBandwidth; ///< UL bandwidth
55 uint8_t ulEdgeSubBandOffset; ///< UL edge subband offset
56 uint8_t ulEdgeSubBandwidth; ///< UL edge subbandwidth
57};
58
59/// Soft uplink default configuration
61 {1, 15, 0, 5},
62 {2, 15, 5, 5},
63 {3, 15, 10, 5},
64 {1, 25, 0, 8},
65 {2, 25, 8, 8},
66 {3, 25, 16, 9},
67 {1, 50, 0, 16},
68 {2, 50, 16, 16},
69 {3, 50, 32, 18},
70 {1, 75, 0, 24},
71 {2, 75, 24, 24},
72 {3, 75, 48, 27},
73 {1, 100, 0, 32},
74 {2, 100, 32, 32},
75 {3, 100, 64, 36},
76};
77
78/** \returns number of downlink configurations */
81/** \returns number of uplink configurations */
84
86 : m_ffrSapUser(nullptr),
87 m_ffrRrcSapUser(nullptr),
88 m_dlEdgeSubBandOffset(0),
89 m_dlEdgeSubBandwidth(0),
90 m_ulEdgeSubBandOffset(0),
91 m_ulEdgeSubBandwidth(0),
92 m_measId(0)
93{
94 NS_LOG_FUNCTION(this);
97}
98
103
104void
111
112TypeId
114{
115 static TypeId tid =
116 TypeId("ns3::LteFrSoftAlgorithm")
118 .SetGroupName("Lte")
119 .AddConstructor<LteFrSoftAlgorithm>()
120 .AddAttribute("UlEdgeSubBandOffset",
121 "Uplink Edge SubBand Offset in number of Resource Block Groups",
122 UintegerValue(0),
125 .AddAttribute(
126 "UlEdgeSubBandwidth",
127 "Uplink Edge SubBandwidth Configuration in number of Resource Block Groups",
128 UintegerValue(0),
131 .AddAttribute("DlEdgeSubBandOffset",
132 "Downlink Edge SubBand Offset in number of Resource Block Groups",
133 UintegerValue(0),
136 .AddAttribute(
137 "DlEdgeSubBandwidth",
138 "Downlink Edge SubBandwidth Configuration in number of Resource Block Groups",
139 UintegerValue(0),
142 .AddAttribute("AllowCenterUeUseEdgeSubBand",
143 "If true center UEs can receive on Edge SubBand RBGs",
144 BooleanValue(true),
147 .AddAttribute(
148 "RsrqThreshold",
149 "If the RSRQ of is worse than this threshold, UE should be served in Edge sub-band",
150 UintegerValue(20),
153 .AddAttribute("CenterPowerOffset",
154 "PdschConfigDedicated::Pa value for Center Sub-band, default value dB0",
155 UintegerValue(5),
158 .AddAttribute("EdgePowerOffset",
159 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
160 UintegerValue(5),
163 .AddAttribute("CenterAreaTpc",
164 "TPC value which will be set in DL-DCI for UEs in center area"
165 "Absolute mode is used, default value 1 is mapped to -1 according to"
166 "TS36.213 Table 5.1.1.1-2",
167 UintegerValue(1),
170 .AddAttribute("EdgeAreaTpc",
171 "TPC value which will be set in DL-DCI for UEs in edge area"
172 "Absolute mode is used, default value 1 is mapped to -1 according to"
173 "TS36.213 Table 5.1.1.1-2",
174 UintegerValue(1),
177 return tid;
178}
179
180void
186
193
194void
200
207
208void
210{
211 NS_LOG_FUNCTION(this);
213
214 NS_ASSERT_MSG(m_dlBandwidth > 14, "DlBandwidth must be at least 15 to use FFR algorithms");
215 NS_ASSERT_MSG(m_ulBandwidth > 14, "UlBandwidth must be at least 15 to use FFR algorithms");
216
217 if (m_frCellTypeId != 0)
218 {
221 }
222
223 NS_LOG_LOGIC(this << " requesting Event A1 measurements"
224 << " (threshold = 0"
225 << ")");
226 LteRrcSap::ReportConfigEutra reportConfig;
229 reportConfig.threshold1.range = 0;
233}
234
235void
248
249void
263
264void
265LteFrSoftAlgorithm::SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
266{
267 NS_LOG_FUNCTION(this);
268 for (uint16_t i = 0; i < NUM_UPLINK_CONFS; ++i)
269 {
270 if ((g_frSoftUplinkDefaultConfiguration[i].cellId == cellId) &&
272 {
275 }
276 }
277}
278
279void
281{
282 m_dlRbgMap.clear();
283 m_dlEdgeRbgMap.clear();
284
285 int rbgSize = GetRbgSize(m_dlBandwidth);
286 m_dlRbgMap.resize(m_dlBandwidth / rbgSize, false);
287 m_dlEdgeRbgMap.resize(m_dlBandwidth / rbgSize, false);
288
290 "DlEdgeSubBandOffset higher than DlBandwidth");
292 "DlEdgeSubBandwidth higher than DlBandwidth");
294 "(DlEdgeSubBandOffset+DlEdgeSubBandwidth) higher than DlBandwidth");
295
296 for (int i = m_dlEdgeSubBandOffset / rbgSize;
298 i++)
299 {
300 m_dlEdgeRbgMap[i] = true;
301 }
302}
303
304void
306{
307 m_ulRbgMap.clear();
308 m_ulEdgeRbgMap.clear();
309
310 m_ulRbgMap.resize(m_ulBandwidth, false);
311 m_ulEdgeRbgMap.resize(m_ulBandwidth, false);
312
314 "UlEdgeSubBandOffset higher than DlBandwidth");
316 "UlEdgeSubBandwidth higher than DlBandwidth");
318 "(UlEdgeSubBandOffset+UlEdgeSubBandwidth) higher than DlBandwidth");
319
321 {
322 m_ulEdgeRbgMap[i] = true;
323 }
324}
325
326std::vector<bool>
328{
329 NS_LOG_FUNCTION(this);
330
332 {
333 Reconfigure();
334 }
335
336 if (m_dlRbgMap.empty())
337 {
339 }
340
341 return m_dlRbgMap;
342}
343
344bool
346{
347 NS_LOG_FUNCTION(this);
348
349 bool edgeRbg = m_dlEdgeRbgMap[rbgId];
350
351 auto it = m_ues.find(rnti);
352 if (it == m_ues.end())
353 {
354 m_ues.insert(std::pair<uint16_t, uint8_t>(rnti, AreaUnset));
355 return !edgeRbg;
356 }
357
358 bool edgeUe = false;
359 if (it->second == CellEdge)
360 {
361 edgeUe = true;
362 }
363
364 if (!edgeUe && m_isEdgeSubBandForCenterUe)
365 {
366 return true;
367 }
368
369 return (edgeRbg && edgeUe) || (!edgeRbg && !edgeUe);
370}
371
372std::vector<bool>
374{
375 NS_LOG_FUNCTION(this);
376
377 if (m_ulRbgMap.empty())
378 {
380 }
381
382 return m_ulRbgMap;
383}
384
385bool
387{
388 NS_LOG_FUNCTION(this);
389
391 {
392 return true;
393 }
394
395 bool edgeRbg = m_ulEdgeRbgMap[rbgId];
396
397 auto it = m_ues.find(rnti);
398 if (it == m_ues.end())
399 {
400 m_ues.insert(std::pair<uint16_t, uint8_t>(rnti, AreaUnset));
401 return !edgeRbg;
402 }
403
404 bool edgeUe = false;
405 if (it->second == CellEdge)
406 {
407 edgeUe = true;
408 }
409
410 if (!edgeUe && m_isEdgeSubBandForCenterUe)
411 {
412 return true;
413 }
414
415 return (edgeRbg && edgeUe) || (!edgeRbg && !edgeUe);
416}
417
418void
421{
422 NS_LOG_FUNCTION(this);
423 NS_LOG_WARN("Method should not be called, because it is empty");
424}
425
426void
429{
430 NS_LOG_FUNCTION(this);
431 NS_LOG_WARN("Method should not be called, because it is empty");
432}
433
434void
435LteFrSoftAlgorithm::DoReportUlCqiInfo(std::map<uint16_t, std::vector<double>> ulCqiMap)
436{
437 NS_LOG_FUNCTION(this);
438 NS_LOG_WARN("Method should not be called, because it is empty");
439}
440
441uint8_t
443{
444 NS_LOG_FUNCTION(this);
445
447 {
448 return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213
449 // Table 5.1.1.1-2
450 }
451
452 // TS36.213 Table 5.1.1.1-2
453 // TPC | Accumulated Mode | Absolute Mode
454 //------------------------------------------------
455 // 0 | -1 | -4
456 // 1 | 0 | -1
457 // 2 | 1 | 1
458 // 3 | 3 | 4
459 //------------------------------------------------
460 // here Absolute mode is used
461
462 auto it = m_ues.find(rnti);
463 if (it == m_ues.end())
464 {
465 return 1;
466 }
467
468 if (it->second == CellEdge)
469 {
470 return m_edgeAreaTpc;
471 }
472 else if (it->second == CellCenter)
473 {
474 return m_centerAreaTpc;
475 }
476
477 return 1;
478}
479
480uint16_t
482{
483 NS_LOG_FUNCTION(this);
484
485 uint8_t minContinuousUlBandwidth = m_ulBandwidth;
486
488 {
489 return minContinuousUlBandwidth;
490 }
491
492 uint8_t leftBandwidth = m_ulEdgeSubBandOffset;
493 uint8_t centerBandwidth = m_ulEdgeSubBandwidth;
494 uint8_t rightBandwidth = m_ulBandwidth - m_ulEdgeSubBandwidth - m_ulEdgeSubBandOffset;
495
496 minContinuousUlBandwidth = ((leftBandwidth > 0) && (leftBandwidth < minContinuousUlBandwidth))
497 ? leftBandwidth
498 : minContinuousUlBandwidth;
499
500 minContinuousUlBandwidth =
501 ((centerBandwidth > 0) && (centerBandwidth < minContinuousUlBandwidth))
502 ? centerBandwidth
503 : minContinuousUlBandwidth;
504
505 minContinuousUlBandwidth = ((rightBandwidth > 0) && (rightBandwidth < minContinuousUlBandwidth))
506 ? rightBandwidth
507 : minContinuousUlBandwidth;
508
509 NS_LOG_INFO("minContinuousUlBandwidth: " << (int)minContinuousUlBandwidth);
510
511 return minContinuousUlBandwidth;
512}
513
514void
516{
517 NS_LOG_FUNCTION(this << rnti << (uint16_t)measResults.measId);
518 NS_LOG_INFO("RNTI :" << rnti << " MeasId: " << (uint16_t)measResults.measId
519 << " RSRP: " << (uint16_t)measResults.measResultPCell.rsrpResult
520 << " RSRQ: " << (uint16_t)measResults.measResultPCell.rsrqResult);
521
522 if (measResults.measId != m_measId)
523 {
524 NS_LOG_WARN("Ignoring measId " << (uint16_t)measResults.measId);
525 }
526 else
527 {
528 auto it = m_ues.find(rnti);
529 if (it == m_ues.end())
530 {
531 m_ues.insert(std::pair<uint16_t, uint8_t>(rnti, AreaUnset));
532 }
533 it = m_ues.find(rnti);
534
536 {
537 if (it->second != CellEdge)
538 {
539 NS_LOG_INFO("UE RNTI: " << rnti << " will be served in Edge sub-band");
540 it->second = CellEdge;
541
542 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
543 pdschConfigDedicated.pa = m_edgePowerOffset;
544 m_ffrRrcSapUser->SetPdschConfigDedicated(rnti, pdschConfigDedicated);
545 }
546 }
547 else
548 {
549 if (it->second != CellCenter)
550 {
551 NS_LOG_INFO("UE RNTI: " << rnti << " will be served in Center sub-band");
552 it->second = CellCenter;
553
554 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
555 pdschConfigDedicated.pa = m_centerPowerOffset;
556 m_ffrRrcSapUser->SetPdschConfigDedicated(rnti, pdschConfigDedicated);
557 }
558 }
559 }
560}
561
562void
564{
565 NS_LOG_FUNCTION(this);
566 NS_LOG_WARN("Method should not be called, because it is empty");
567}
568
569} // 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...
Soft Frequency Reuse algorithm implementation.
uint8_t m_dlEdgeSubBandwidth
DL edge subbandwidth.
void Reconfigure() override
Automatic FR reconfiguration.
uint8_t m_centerPowerOffset
center power offset
LteFfrSapProvider * GetLteFfrSapProvider() override
Export the "provider" part of the LteFfrSap interface.
void DoDispose() override
Destructor implementation.
uint8_t m_ulEdgeSubBandOffset
UL edge subband offset.
bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
std::vector< bool > m_dlRbgMap
DL RBG map.
uint8_t m_edgeAreaTpc
edge area tpc
static TypeId GetTypeId()
Get the type ID.
uint8_t m_dlEdgeSubBandOffset
DL edge subband offset.
void SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set uplink configuration.
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set downlink configuration.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
std::vector< bool > m_ulEdgeRbgMap
UL edge RBG map.
uint8_t m_ulEdgeSubBandwidth
UL edge subbandwidth.
friend class MemberLteFfrSapProvider< LteFrSoftAlgorithm >
let the forwarder class access the protected and private members
LteFfrRrcSapProvider * GetLteFfrRrcSapProvider() override
Export the "provider" part of the LteFfrRrcSap interface.
std::vector< bool > DoGetAvailableDlRbg() override
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
void InitializeUplinkRbgMaps()
Initialize uplink RBG maps.
uint16_t DoGetMinContinuousUlBandwidth() override
DoGetMinContinuousUlBandwidth in number of RB.
uint8_t m_edgeSubBandThreshold
Edge subband threshold.
friend class MemberLteFfrRrcSapProvider< LteFrSoftAlgorithm >
let the forwarder class access the protected and private members
uint8_t m_centerAreaTpc
center area tpc
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
std::map< uint16_t, uint8_t > m_ues
UEs.
void InitializeDownlinkRbgMaps()
Initialize downlink RBG maps.
void SetLteFfrSapUser(LteFfrSapUser *s) override
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
uint8_t m_edgePowerOffset
edge power offset
void DoReportDlCqiInfo(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params) override
DoReportDlCqiInfo.
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
void DoInitialize() override
Initialize() implementation.
uint8_t DoGetTpc(uint16_t rnti) override
DoGetTpc for UE.
void DoReportUlCqiInfo(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params) override
DoReportUlCqiInfo.
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
LteFrSoftAlgorithm()
Creates a trivial ffr algorithm instance.
std::vector< bool > m_ulRbgMap
UL RBG map.
bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params) override
DoRecvLoadInformation.
void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s) override
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
std::vector< bool > m_dlEdgeRbgMap
DL edge RBG map.
uint8_t m_measId
The expected measurement identity.
std::vector< bool > DoGetAvailableUlRbg() override
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
bool m_isEdgeSubBandForCenterUe
is edge subband for center UE?
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
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 > MakeBooleanChecker()
Definition boolean.cc:113
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))
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
static const FrSoftDownlinkDefaultConfiguration g_frSoftDownlinkDefaultConfiguration[]
Soft downlink default configuration.
static const FrSoftUplinkDefaultConfiguration g_frSoftUplinkDefaultConfiguration[]
Soft uplink default configuration.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
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.