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 * 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: Piotr Gawlowicz <gawlowicz.p@gmail.com>
18 *
19 */
20
22
23#include <ns3/log.h>
24
25namespace ns3
26{
27
28NS_LOG_COMPONENT_DEFINE("LteFrHardAlgorithm");
29
30NS_OBJECT_ENSURE_REGISTERED(LteFrHardAlgorithm);
31
32/// FrHardDownlinkDefaultConfiguration structure
34{
35 uint8_t m_cellId; ///< cell ID
36 uint8_t m_dlBandwidth; ///< DL bandwidth
37 uint8_t m_dlOffset; ///< DL offset
38 uint8_t m_dlSubBand; ///< DL subband
39};
40
41/// The hard downlink default configuration
43 {1, 15, 0, 4},
44 {2, 15, 4, 4},
45 {3, 15, 8, 6},
46 {1, 25, 0, 8},
47 {2, 25, 8, 8},
48 {3, 25, 16, 9},
49 {1, 50, 0, 16},
50 {2, 50, 16, 16},
51 {3, 50, 32, 18},
52 {1, 75, 0, 24},
53 {2, 75, 24, 24},
54 {3, 75, 48, 27},
55 {1, 100, 0, 32},
56 {2, 100, 32, 32},
57 {3, 100, 64, 36},
58};
59
60/// FrHardUplinkDefaultConfiguration structure
62{
63 uint8_t m_cellId; ///< cell ID
64 uint8_t m_ulBandwidth; ///< UL bandwidth
65 uint8_t m_ulOffset; ///< Ul offset
66 uint8_t m_ulSubBand; ///< UL subband
67};
68
69/// The hard uplink default configuration
71 {1, 15, 0, 5},
72 {2, 15, 5, 5},
73 {3, 15, 10, 5},
74 {1, 25, 0, 8},
75 {2, 25, 8, 8},
76 {3, 25, 16, 9},
77 {1, 50, 0, 16},
78 {2, 50, 16, 16},
79 {3, 50, 32, 18},
80 {1, 75, 0, 24},
81 {2, 75, 24, 24},
82 {3, 75, 48, 27},
83 {1, 100, 0, 32},
84 {2, 100, 32, 32},
85 {3, 100, 64, 36},
86};
87
88/** \returns number of downlink configurations */
91/** \returns number of uplink configurations */
94
96 : m_ffrSapUser(nullptr),
97 m_ffrRrcSapUser(nullptr),
98 m_dlOffset(0),
99 m_dlSubBand(0),
100 m_ulOffset(0),
101 m_ulSubBand(0)
102{
103 NS_LOG_FUNCTION(this);
106}
107
109{
110 NS_LOG_FUNCTION(this);
111}
112
113void
115{
116 NS_LOG_FUNCTION(this);
117 delete m_ffrSapProvider;
118 delete m_ffrRrcSapProvider;
119}
120
121TypeId
123{
124 static TypeId tid =
125 TypeId("ns3::LteFrHardAlgorithm")
127 .SetGroupName("Lte")
128 .AddConstructor<LteFrHardAlgorithm>()
129 .AddAttribute("UlSubBandOffset",
130 "Uplink Offset in number of Resource Block Groups",
131 UintegerValue(0),
133 MakeUintegerChecker<uint8_t>())
134 .AddAttribute(
135 "UlSubBandwidth",
136 "Uplink Transmission SubBandwidth Configuration in number of Resource Block Groups",
137 UintegerValue(25),
139 MakeUintegerChecker<uint8_t>())
140 .AddAttribute("DlSubBandOffset",
141 "Downlink Offset in number of Resource Block Groups",
142 UintegerValue(0),
144 MakeUintegerChecker<uint8_t>())
145 .AddAttribute("DlSubBandwidth",
146 "Downlink Transmission SubBandwidth Configuration in number of Resource "
147 "Block Groups",
148 UintegerValue(25),
150 MakeUintegerChecker<uint8_t>());
151 return tid;
152}
153
154void
156{
157 NS_LOG_FUNCTION(this << s);
158 m_ffrSapUser = s;
159}
160
163{
164 NS_LOG_FUNCTION(this);
165 return m_ffrSapProvider;
166}
167
168void
170{
171 NS_LOG_FUNCTION(this << s);
172 m_ffrRrcSapUser = s;
173}
174
177{
178 NS_LOG_FUNCTION(this);
179 return m_ffrRrcSapProvider;
180}
181
182void
184{
185 NS_LOG_FUNCTION(this);
187
188 NS_ASSERT_MSG(m_dlBandwidth > 14, "DlBandwidth must be at least 15 to use FFR algorithms");
189 NS_ASSERT_MSG(m_ulBandwidth > 14, "UlBandwidth must be at least 15 to use FFR algorithms");
190
191 if (m_frCellTypeId != 0)
192 {
195 }
196}
197
198void
200{
201 NS_LOG_FUNCTION(this);
202 if (m_frCellTypeId != 0)
203 {
206 }
209 m_needReconfiguration = false;
210}
211
212void
213LteFrHardAlgorithm::SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
214{
215 NS_LOG_FUNCTION(this);
216 for (uint16_t i = 0; i < NUM_DOWNLINK_CONFS; ++i)
217 {
220 {
223 }
224 }
225}
226
227void
228LteFrHardAlgorithm::SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
229{
230 NS_LOG_FUNCTION(this);
231 for (uint16_t i = 0; i < NUM_UPLINK_CONFS; ++i)
232 {
233 if ((g_frHardUplinkDefaultConfiguration[i].m_cellId == cellId) &&
235 {
238 }
239 }
240}
241
242void
244{
245 m_dlRbgMap.clear();
246
247 int rbgSize = GetRbgSize(m_dlBandwidth);
248 m_dlRbgMap.resize(m_dlBandwidth / rbgSize, true);
249
250 NS_ASSERT_MSG(m_dlOffset <= m_dlBandwidth, "DlOffset higher than DlBandwidth");
251 NS_ASSERT_MSG(m_dlSubBand <= m_dlBandwidth, "DlBandwidth higher than DlBandwidth");
253 "(DlOffset+DlSubBand) higher than DlBandwidth");
254
255 for (int i = m_dlOffset / rbgSize; i < (m_dlOffset / rbgSize + m_dlSubBand / rbgSize); i++)
256 {
257 m_dlRbgMap[i] = false;
258 }
259}
260
261void
263{
264 m_ulRbgMap.clear();
265
267 {
268 m_ulRbgMap.resize(m_ulBandwidth, false);
269 return;
270 }
271
272 m_ulRbgMap.resize(m_ulBandwidth, true);
273
274 NS_ASSERT_MSG(m_ulOffset <= m_ulBandwidth, "UlOffset higher than UlBandwidth");
275 NS_ASSERT_MSG(m_ulSubBand <= m_ulBandwidth, "UlBandwidth higher than UlBandwidth");
277 "(UlOffset+UlSubBand) higher than UlBandwidth");
278
279 for (uint8_t i = m_ulOffset; i < (m_ulOffset + m_ulSubBand); i++)
280 {
281 m_ulRbgMap[i] = false;
282 }
283}
284
285std::vector<bool>
287{
288 NS_LOG_FUNCTION(this);
289
291 {
292 Reconfigure();
293 }
294
295 if (m_dlRbgMap.empty())
296 {
298 }
299
300 return m_dlRbgMap;
301}
302
303bool
305{
306 NS_LOG_FUNCTION(this);
307 return !m_dlRbgMap[rbId];
308}
309
310std::vector<bool>
312{
313 NS_LOG_FUNCTION(this);
314
315 if (m_ulRbgMap.empty())
316 {
318 }
319
320 return m_ulRbgMap;
321}
322
323bool
325{
326 NS_LOG_FUNCTION(this);
327
329 {
330 return true;
331 }
332
333 return !m_ulRbgMap[rbId];
334}
335
336void
339{
340 NS_LOG_FUNCTION(this);
341 NS_LOG_WARN("Method should not be called, because it is empty");
342}
343
344void
347{
348 NS_LOG_FUNCTION(this);
349 NS_LOG_WARN("Method should not be called, because it is empty");
350}
351
352void
353LteFrHardAlgorithm::DoReportUlCqiInfo(std::map<uint16_t, std::vector<double>> ulCqiMap)
354{
355 NS_LOG_FUNCTION(this);
356 NS_LOG_WARN("Method should not be called, because it is empty");
357}
358
359uint8_t
361{
362 NS_LOG_FUNCTION(this);
363 return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213
364 // Table 5.1.1.1-2
365}
366
367uint16_t
369{
370 NS_LOG_FUNCTION(this);
371
373 {
374 return m_ulBandwidth;
375 }
376
377 return m_ulSubBand;
378}
379
380void
382{
383 NS_LOG_FUNCTION(this << rnti << (uint16_t)measResults.measId);
384 NS_LOG_WARN("Method should not be called, because it is empty");
385}
386
387void
389{
390 NS_LOG_FUNCTION(this);
391 NS_LOG_WARN("Method should not be called, because it is empty");
392}
393
394} // end of namespace ns3
The abstract base class of a Frequency Reuse algorithm.
uint16_t m_cellId
cell ID
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:40
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Definition: lte-ffr-sap.h:140
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.
uint8_t m_ulSubBand
UL subband.
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.
uint8_t m_dlSubBand
DL subband.
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:451
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Hold an unsigned integer type.
Definition: uinteger.h:45
#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 > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#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:261
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
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:306
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
MeasResults structure.
Definition: lte-rrc-sap.h:717
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:718