A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-fr-hard-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/log.h>
13
14namespace ns3
15{
16
17NS_LOG_COMPONENT_DEFINE("LteFrHardAlgorithm");
18
19NS_OBJECT_ENSURE_REGISTERED(LteFrHardAlgorithm);
20
21/// FrHardDownlinkDefaultConfiguration structure
23{
24 uint8_t m_cellId; ///< cell ID
25 uint8_t m_dlBandwidth; ///< DL bandwidth
26 uint8_t m_dlOffset; ///< DL offset
27 uint8_t m_dlSubBand; ///< DL subband
28};
29
30/// The hard downlink default configuration
32 {1, 15, 0, 4},
33 {2, 15, 4, 4},
34 {3, 15, 8, 6},
35 {1, 25, 0, 8},
36 {2, 25, 8, 8},
37 {3, 25, 16, 9},
38 {1, 50, 0, 16},
39 {2, 50, 16, 16},
40 {3, 50, 32, 18},
41 {1, 75, 0, 24},
42 {2, 75, 24, 24},
43 {3, 75, 48, 27},
44 {1, 100, 0, 32},
45 {2, 100, 32, 32},
46 {3, 100, 64, 36},
47};
48
49/// FrHardUplinkDefaultConfiguration structure
51{
52 uint8_t m_cellId; ///< cell ID
53 uint8_t m_ulBandwidth; ///< UL bandwidth
54 uint8_t m_ulOffset; ///< Ul offset
55 uint8_t m_ulSubBand; ///< UL subband
56};
57
58/// The hard uplink default configuration
60 {1, 15, 0, 5},
61 {2, 15, 5, 5},
62 {3, 15, 10, 5},
63 {1, 25, 0, 8},
64 {2, 25, 8, 8},
65 {3, 25, 16, 9},
66 {1, 50, 0, 16},
67 {2, 50, 16, 16},
68 {3, 50, 32, 18},
69 {1, 75, 0, 24},
70 {2, 75, 24, 24},
71 {3, 75, 48, 27},
72 {1, 100, 0, 32},
73 {2, 100, 32, 32},
74 {3, 100, 64, 36},
75};
76
77/** \returns number of downlink configurations */
80/** \returns number of uplink configurations */
83
85 : m_ffrSapUser(nullptr),
86 m_ffrRrcSapUser(nullptr),
87 m_dlOffset(0),
88 m_dlSubBand(0),
89 m_ulOffset(0),
90 m_ulSubBand(0)
91{
92 NS_LOG_FUNCTION(this);
95}
96
101
102void
109
110TypeId
112{
113 static TypeId tid =
114 TypeId("ns3::LteFrHardAlgorithm")
116 .SetGroupName("Lte")
117 .AddConstructor<LteFrHardAlgorithm>()
118 .AddAttribute("UlSubBandOffset",
119 "Uplink Offset in number of Resource Block Groups",
120 UintegerValue(0),
123 .AddAttribute(
124 "UlSubBandwidth",
125 "Uplink Transmission SubBandwidth Configuration in number of Resource Block Groups",
126 UintegerValue(25),
129 .AddAttribute("DlSubBandOffset",
130 "Downlink Offset in number of Resource Block Groups",
131 UintegerValue(0),
134 .AddAttribute("DlSubBandwidth",
135 "Downlink Transmission SubBandwidth Configuration in number of Resource "
136 "Block Groups",
137 UintegerValue(25),
140 return tid;
141}
142
143void
149
156
157void
163
170
171void
173{
174 NS_LOG_FUNCTION(this);
176
177 NS_ASSERT_MSG(m_dlBandwidth > 14, "DlBandwidth must be at least 15 to use FFR algorithms");
178 NS_ASSERT_MSG(m_ulBandwidth > 14, "UlBandwidth must be at least 15 to use FFR algorithms");
179
180 if (m_frCellTypeId != 0)
181 {
184 }
185}
186
187void
200
201void
215
216void
230
231void
233{
234 m_dlRbgMap.clear();
235
236 int rbgSize = GetRbgSize(m_dlBandwidth);
237 m_dlRbgMap.resize(m_dlBandwidth / rbgSize, true);
238
239 NS_ASSERT_MSG(m_dlOffset <= m_dlBandwidth, "DlOffset higher than DlBandwidth");
240 NS_ASSERT_MSG(m_dlSubBand <= m_dlBandwidth, "DlBandwidth higher than DlBandwidth");
242 "(DlOffset+DlSubBand) higher than DlBandwidth");
243
244 for (int i = m_dlOffset / rbgSize; i < (m_dlOffset / rbgSize + m_dlSubBand / rbgSize); i++)
245 {
246 m_dlRbgMap[i] = false;
247 }
248}
249
250void
252{
253 m_ulRbgMap.clear();
254
256 {
257 m_ulRbgMap.resize(m_ulBandwidth, false);
258 return;
259 }
260
261 m_ulRbgMap.resize(m_ulBandwidth, true);
262
263 NS_ASSERT_MSG(m_ulOffset <= m_ulBandwidth, "UlOffset higher than UlBandwidth");
264 NS_ASSERT_MSG(m_ulSubBand <= m_ulBandwidth, "UlBandwidth higher than UlBandwidth");
266 "(UlOffset+UlSubBand) higher than UlBandwidth");
267
268 for (uint8_t i = m_ulOffset; i < (m_ulOffset + m_ulSubBand); i++)
269 {
270 m_ulRbgMap[i] = false;
271 }
272}
273
274std::vector<bool>
276{
277 NS_LOG_FUNCTION(this);
278
280 {
281 Reconfigure();
282 }
283
284 if (m_dlRbgMap.empty())
285 {
287 }
288
289 return m_dlRbgMap;
290}
291
292bool
294{
295 NS_LOG_FUNCTION(this);
296 return !m_dlRbgMap[rbId];
297}
298
299std::vector<bool>
301{
302 NS_LOG_FUNCTION(this);
303
304 if (m_ulRbgMap.empty())
305 {
307 }
308
309 return m_ulRbgMap;
310}
311
312bool
314{
315 NS_LOG_FUNCTION(this);
316
318 {
319 return true;
320 }
321
322 return !m_ulRbgMap[rbId];
323}
324
325void
328{
329 NS_LOG_FUNCTION(this);
330 NS_LOG_WARN("Method should not be called, because it is empty");
331}
332
333void
336{
337 NS_LOG_FUNCTION(this);
338 NS_LOG_WARN("Method should not be called, because it is empty");
339}
340
341void
342LteFrHardAlgorithm::DoReportUlCqiInfo(std::map<uint16_t, std::vector<double>> ulCqiMap)
343{
344 NS_LOG_FUNCTION(this);
345 NS_LOG_WARN("Method should not be called, because it is empty");
346}
347
348uint8_t
350{
351 NS_LOG_FUNCTION(this);
352 return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213
353 // Table 5.1.1.1-2
354}
355
356uint16_t
358{
359 NS_LOG_FUNCTION(this);
360
362 {
363 return m_ulBandwidth;
364 }
365
366 return m_ulSubBand;
367}
368
369void
371{
372 NS_LOG_FUNCTION(this << rnti << (uint16_t)measResults.measId);
373 NS_LOG_WARN("Method should not be called, because it is empty");
374}
375
376void
378{
379 NS_LOG_FUNCTION(this);
380 NS_LOG_WARN("Method should not be called, because it is empty");
381}
382
383} // 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...
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...
Hard Frequency Reuse algorithm implementation which uses only 1 sub-band.
void DoReportDlCqiInfo(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params) override
DoReportDlCqiInfo.
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set downlink configuration.
uint16_t DoGetMinContinuousUlBandwidth() override
DoGetMinContinuousUlBandwidth in number of RB.
void DoDispose() override
Destructor implementation.
std::vector< bool > m_dlRbgMap
DL RBG Map.
void InitializeDownlinkRbgMaps()
Initialize downlink rbg maps.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void InitializeUplinkRbgMaps()
Initialize uplink rbg maps.
bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
static TypeId GetTypeId()
Get the type ID.
friend class MemberLteFfrSapProvider< LteFrHardAlgorithm >
let the forwarder class access the protected and private members
uint8_t DoGetTpc(uint16_t rnti) override
DoGetTpc for UE.
void SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set uplink configuration.
void DoReportUlCqiInfo(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params) override
DoReportUlCqiInfo.
void DoInitialize() override
Initialize() implementation.
void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params) override
DoRecvLoadInformation.
std::vector< bool > DoGetAvailableUlRbg() override
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
LteFfrSapProvider * GetLteFfrSapProvider() override
Export the "provider" part of the LteFfrSap interface.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
friend class MemberLteFfrRrcSapProvider< LteFrHardAlgorithm >
let the forwarder class access the protected and private members
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
std::vector< bool > m_ulRbgMap
UL RBG Map.
LteFrHardAlgorithm()
Creates a trivial ffr algorithm instance.
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.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
LteFfrRrcSapProvider * GetLteFfrRrcSapProvider() override
Export the "provider" part of the LteFfrRrcSap interface.
void Reconfigure() override
Automatic FR reconfiguration.
void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s) override
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
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
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition uinteger.h:35
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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_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.
static const FrHardDownlinkDefaultConfiguration g_frHardDownlinkDefaultConfiguration[]
The hard downlink default configuration.
const uint16_t NUM_DOWNLINK_CONFS(sizeof(g_ffrEnhancedDownlinkDefaultConfiguration)/sizeof(FfrEnhancedDownlinkDefaultConfiguration))
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
static const FrHardUplinkDefaultConfiguration g_frHardUplinkDefaultConfiguration[]
The hard uplink 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.
MeasResults structure.
uint8_t measId
measure ID