A Discrete-Event Network Simulator
API
lte-fr-hard-algorithm.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Piotr Gawlowicz
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
19  *
20  */
21 
22 #include "lte-fr-hard-algorithm.h"
23 #include <ns3/log.h>
24 
25 namespace ns3 {
26 
27 NS_LOG_COMPONENT_DEFINE ("LteFrHardAlgorithm");
28 
29 NS_OBJECT_ENSURE_REGISTERED (LteFrHardAlgorithm);
30 
33 {
34  uint8_t m_cellId;
35  uint8_t m_dlBandwidth;
36  uint8_t m_dlOffset;
37  uint8_t m_dlSubBand;
39  { 1, 15, 0, 4},
40  { 2, 15, 4, 4},
41  { 3, 15, 8, 6},
42  { 1, 25, 0, 8},
43  { 2, 25, 8, 8},
44  { 3, 25, 16, 9},
45  { 1, 50, 0, 16},
46  { 2, 50, 16, 16},
47  { 3, 50, 32, 18},
48  { 1, 75, 0, 24},
49  { 2, 75, 24, 24},
50  { 3, 75, 48, 27},
51  { 1, 100, 0, 32},
52  { 2, 100, 32, 32},
53  { 3, 100, 64, 36}
54 };
55 
58 {
59  uint8_t m_cellId;
60  uint8_t m_ulBandwidth;
61  uint8_t m_ulOffset;
62  uint8_t m_ulSubBand;
64  { 1, 15, 0, 5},
65  { 2, 15, 5, 5},
66  { 3, 15, 10, 5},
67  { 1, 25, 0, 8},
68  { 2, 25, 8, 8},
69  { 3, 25, 16, 9},
70  { 1, 50, 0, 16},
71  { 2, 50, 16, 16},
72  { 3, 50, 32, 18},
73  { 1, 75, 0, 24},
74  { 2, 75, 24, 24},
75  { 3, 75, 48, 27},
76  { 1, 100, 0, 32},
77  { 2, 100, 32, 32},
78  { 3, 100, 64, 36}
79 };
80 
85 
87  : m_ffrSapUser (0),
88  m_ffrRrcSapUser (0),
89  m_dlOffset (0),
90  m_dlSubBand (0),
91  m_ulOffset (0),
92  m_ulSubBand (0)
93 {
94  NS_LOG_FUNCTION (this);
97 }
98 
99 
101 {
102  NS_LOG_FUNCTION (this);
103 }
104 
105 
106 void
108 {
109  NS_LOG_FUNCTION (this);
110  delete m_ffrSapProvider;
111  delete m_ffrRrcSapProvider;
112 }
113 
114 
115 TypeId
117 {
118  static TypeId tid = TypeId ("ns3::LteFrHardAlgorithm")
120  .SetGroupName("Lte")
121  .AddConstructor<LteFrHardAlgorithm> ()
122  .AddAttribute ("UlSubBandOffset",
123  "Uplink Offset in number of Resource Block Groups",
124  UintegerValue (0),
126  MakeUintegerChecker<uint8_t> ())
127  .AddAttribute ("UlSubBandwidth",
128  "Uplink Transmission SubBandwidth Configuration in number of Resource Block Groups",
129  UintegerValue (25),
131  MakeUintegerChecker<uint8_t> ())
132  .AddAttribute ("DlSubBandOffset",
133  "Downlink Offset in number of Resource Block Groups",
134  UintegerValue (0),
136  MakeUintegerChecker<uint8_t> ())
137  .AddAttribute ("DlSubBandwidth",
138  "Downlink Transmission SubBandwidth Configuration in number of Resource Block Groups",
139  UintegerValue (25),
141  MakeUintegerChecker<uint8_t> ())
142  ;
143  return tid;
144 }
145 
146 
147 void
149 {
150  NS_LOG_FUNCTION (this << s);
151  m_ffrSapUser = s;
152 }
153 
154 
157 {
158  NS_LOG_FUNCTION (this);
159  return m_ffrSapProvider;
160 }
161 
162 void
164 {
165  NS_LOG_FUNCTION (this << s);
166  m_ffrRrcSapUser = s;
167 }
168 
169 
172 {
173  NS_LOG_FUNCTION (this);
174  return m_ffrRrcSapProvider;
175 }
176 
177 
178 void
180 {
181  NS_LOG_FUNCTION (this);
183 
184  NS_ASSERT_MSG (m_dlBandwidth > 14,"DlBandwidth must be at least 15 to use FFR algorithms");
185  NS_ASSERT_MSG (m_ulBandwidth > 14,"UlBandwidth must be at least 15 to use FFR algorithms");
186 
187  if (m_frCellTypeId != 0)
188  {
191  }
192 
193 }
194 
195 void
197 {
198  NS_LOG_FUNCTION (this);
199  if (m_frCellTypeId != 0)
200  {
203  }
206  m_needReconfiguration = false;
207 }
208 
209 void
210 LteFrHardAlgorithm::SetDownlinkConfiguration (uint16_t cellId, uint8_t bandwidth)
211 {
212  NS_LOG_FUNCTION (this);
213  for (uint16_t i = 0; i < NUM_DOWNLINK_CONFS; ++i)
214  {
217  {
220  }
221  }
222 }
223 
224 void
225 LteFrHardAlgorithm::SetUplinkConfiguration (uint16_t cellId, uint8_t bandwidth)
226 {
227  NS_LOG_FUNCTION (this);
228  for (uint16_t i = 0; i < NUM_UPLINK_CONFS; ++i)
229  {
232  {
235  }
236  }
237 }
238 
239 void
241 {
242  m_dlRbgMap.clear ();
243 
244  int rbgSize = GetRbgSize (m_dlBandwidth);
245  m_dlRbgMap.resize (m_dlBandwidth / rbgSize, true);
246 
247  NS_ASSERT_MSG (m_dlOffset <= m_dlBandwidth,"DlOffset higher than DlBandwidth");
248  NS_ASSERT_MSG (m_dlSubBand <= m_dlBandwidth,"DlBandwidth higher than DlBandwidth");
250  "(DlOffset+DlSubBand) higher than DlBandwidth");
251 
252  for (uint8_t i = m_dlOffset / rbgSize; i < (m_dlOffset / rbgSize + m_dlSubBand / rbgSize); i++)
253  {
254  m_dlRbgMap[i] = false;
255 
256  }
257 }
258 
259 void
261 {
262  m_ulRbgMap.clear ();
263 
264  if (!m_enabledInUplink)
265  {
266  m_ulRbgMap.resize (m_ulBandwidth, false);
267  return;
268  }
269 
270  m_ulRbgMap.resize (m_ulBandwidth, true);
271 
272  NS_ASSERT_MSG (m_ulOffset <= m_ulBandwidth,"UlOffset higher than UlBandwidth");
273  NS_ASSERT_MSG (m_ulSubBand <= m_ulBandwidth,"UlBandwidth higher than UlBandwidth");
275  "(UlOffset+UlSubBand) higher than UlBandwidth");
276 
277  for (uint8_t i = m_ulOffset; i < (m_ulOffset + m_ulSubBand); i++)
278  {
279  m_ulRbgMap[i] = false;
280  }
281 }
282 
283 std::vector <bool>
285 {
286  NS_LOG_FUNCTION (this);
287 
289  {
290  Reconfigure ();
291  }
292 
293  if (m_dlRbgMap.empty ())
294  {
296  }
297 
298  return m_dlRbgMap;
299 }
300 
301 bool
303 {
304  NS_LOG_FUNCTION (this);
305  return !m_dlRbgMap[rbId];
306 }
307 
308 std::vector <bool>
310 {
311  NS_LOG_FUNCTION (this);
312 
313  if (m_ulRbgMap.empty ())
314  {
316  }
317 
318  return m_ulRbgMap;
319 }
320 
321 bool
323 {
324  NS_LOG_FUNCTION (this);
325 
326  if (!m_enabledInUplink)
327  {
328  return true;
329  }
330 
331  return !m_ulRbgMap[rbId];
332 }
333 
334 void
336 {
337  NS_LOG_FUNCTION (this);
338  NS_LOG_WARN ("Method should not be called, because it is empty");
339 }
340 
341 void
343 {
344  NS_LOG_FUNCTION (this);
345  NS_LOG_WARN ("Method should not be called, because it is empty");
346 }
347 
348 void
349 LteFrHardAlgorithm::DoReportUlCqiInfo (std::map <uint16_t, std::vector <double> > ulCqiMap)
350 {
351  NS_LOG_FUNCTION (this);
352  NS_LOG_WARN ("Method should not be called, because it is empty");
353 }
354 
355 uint8_t
357 {
358  NS_LOG_FUNCTION (this);
359  return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213 Table 5.1.1.1-2
360 }
361 
362 uint16_t
364 {
365  NS_LOG_FUNCTION (this);
366 
367  if (!m_enabledInUplink)
368  {
369  return m_ulBandwidth;
370  }
371 
372  return m_ulSubBand;
373 }
374 
375 void
377  LteRrcSap::MeasResults measResults)
378 {
379  NS_LOG_FUNCTION (this << rnti << (uint16_t) measResults.measId);
380  NS_LOG_WARN ("Method should not be called, because it is empty");
381 }
382 
383 void
385 {
386  NS_LOG_FUNCTION (this);
387  NS_LOG_WARN ("Method should not be called, because it is empty");
388 }
389 
390 } // end of namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::LteFrHardAlgorithm::m_dlSubBand
uint8_t m_dlSubBand
DL subband.
Definition: lte-fr-hard-algorithm.h:119
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::LteFfrAlgorithm::m_cellId
uint16_t m_cellId
cell ID
Definition: lte-ffr-algorithm.h:245
ns3::LteFfrSapUser
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Definition: lte-ffr-sap.h:139
ns3::LteFrHardAlgorithm
Hard Frequency Reuse algorithm implementation which uses only 1 sub-band.
Definition: lte-fr-hard-algorithm.h:37
ns3::LteFrHardAlgorithm::DoReportDlCqiInfo
virtual void DoReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
DoReportDlCqiInfo.
Definition: lte-fr-hard-algorithm.cc:335
ns3::NUM_UPLINK_CONFS
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
ns3::LteFrHardAlgorithm::DoGetAvailableUlRbg
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
Definition: lte-fr-hard-algorithm.cc:309
ns3::FfMacSchedSapProvider::SchedDlCqiInfoReqParameters
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Definition: ff-mac-sched-sap.h:125
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LteFrHardAlgorithm::m_ulSubBand
uint8_t m_ulSubBand
UL subband.
Definition: lte-fr-hard-algorithm.h:122
ns3::FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
Definition: ff-mac-sched-sap.h:186
ns3::LteFrHardAlgorithm::DoIsDlRbgAvailableForUe
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
Definition: lte-fr-hard-algorithm.cc:302
ns3::LteFrHardAlgorithm::m_ffrSapProvider
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
Definition: lte-fr-hard-algorithm.h:112
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
ns3::LteFrHardAlgorithm::DoGetTpc
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
Definition: lte-fr-hard-algorithm.cc:356
ns3::LteFrHardAlgorithm::DoReportUeMeas
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
Definition: lte-fr-hard-algorithm.cc:376
ns3::LteFrHardAlgorithm::m_ffrRrcSapUser
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
Definition: lte-fr-hard-algorithm.h:115
ns3::LteFrHardAlgorithm::SetLteFfrRrcSapUser
virtual void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s)
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
Definition: lte-fr-hard-algorithm.cc:163
ns3::LteFrHardAlgorithm::DoGetAvailableDlRbg
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
Definition: lte-fr-hard-algorithm.cc:284
ns3::LteFrHardAlgorithm::m_dlOffset
uint8_t m_dlOffset
DL offset.
Definition: lte-fr-hard-algorithm.h:118
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::LteFrHardAlgorithm::GetLteFfrSapProvider
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
Definition: lte-fr-hard-algorithm.cc:156
ns3::LteFfrAlgorithm::m_needReconfiguration
bool m_needReconfiguration
If true FR algorithm will be reconfigured.
Definition: lte-ffr-algorithm.h:254
ns3::LteFrHardAlgorithm::DoRecvLoadInformation
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
Definition: lte-fr-hard-algorithm.cc:384
ns3::LteFfrAlgorithm::m_ulBandwidth
uint8_t m_ulBandwidth
uplink bandwidth in RBs
Definition: lte-ffr-algorithm.h:248
ns3::LteFrHardAlgorithm::GetLteFfrRrcSapProvider
virtual LteFfrRrcSapProvider * GetLteFfrRrcSapProvider()
Export the "provider" part of the LteFfrRrcSap interface.
Definition: lte-fr-hard-algorithm.cc:171
ns3::LteFrHardAlgorithm::DoIsUlRbgAvailableForUe
virtual bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
Definition: lte-fr-hard-algorithm.cc:322
ns3::LteFrHardAlgorithm::InitializeUplinkRbgMaps
void InitializeUplinkRbgMaps()
Initialize uplink rbg maps.
Definition: lte-fr-hard-algorithm.cc:260
ns3::LteFrHardAlgorithm::DoGetMinContinuousUlBandwidth
virtual uint16_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
Definition: lte-fr-hard-algorithm.cc:363
ns3::LteFrHardAlgorithm::SetDownlinkConfiguration
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set downlink configuration.
Definition: lte-fr-hard-algorithm.cc:210
ns3::LteFfrRrcSapUser
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Definition: lte-ffr-rrc-sap.h:89
ns3::LteFrHardAlgorithm::m_ulRbgMap
std::vector< bool > m_ulRbgMap
UL RBG Map.
Definition: lte-fr-hard-algorithm.h:125
ns3::NUM_DOWNLINK_CONFS
const uint16_t NUM_DOWNLINK_CONFS(sizeof(g_ffrEnhancedDownlinkDefaultConfiguration)/sizeof(FfrEnhancedDownlinkDefaultConfiguration))
ns3::LteFfrAlgorithm::m_frCellTypeId
uint8_t m_frCellTypeId
FFR cell type ID for automatic configuration.
Definition: lte-ffr-algorithm.h:250
ns3::LteFfrSapProvider
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Definition: lte-ffr-sap.h:40
ns3::LteFrHardAlgorithm::DoInitialize
virtual void DoInitialize()
Initialize() implementation.
Definition: lte-fr-hard-algorithm.cc:179
ns3::LteFrHardAlgorithm::DoReportUlCqiInfo
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
DoReportUlCqiInfo.
Definition: lte-fr-hard-algorithm.cc:342
ns3::LteFfrAlgorithm::m_dlBandwidth
uint8_t m_dlBandwidth
downlink bandwidth in RBs
Definition: lte-ffr-algorithm.h:247
ns3::LteFrHardAlgorithm::m_ulOffset
uint8_t m_ulOffset
UL offset.
Definition: lte-fr-hard-algorithm.h:121
ns3::LteFrHardAlgorithm::SetLteFfrSapUser
virtual void SetLteFfrSapUser(LteFfrSapUser *s)
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
Definition: lte-fr-hard-algorithm.cc:148
ns3::LteFrHardAlgorithm::SetUplinkConfiguration
void SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set uplink configuration.
Definition: lte-fr-hard-algorithm.cc:225
NS_ASSERT_MSG
#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:88
ns3::Object::DoInitialize
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
lte-fr-hard-algorithm.h
ns3::g_frHardDownlinkDefaultConfiguration
static const struct ns3::FrHardDownlinkDefaultConfiguration g_frHardDownlinkDefaultConfiguration[]
the hard downlink default configuration
ns3::LteFrHardAlgorithm::LteFrHardAlgorithm
LteFrHardAlgorithm()
Creates a trivial ffr algorithm instance.
Definition: lte-fr-hard-algorithm.cc:86
ns3::g_frHardUplinkDefaultConfiguration
static const struct ns3::FrHardUplinkDefaultConfiguration g_frHardUplinkDefaultConfiguration[]
the hard uplink default configuration
ns3::LteFrHardAlgorithm::Reconfigure
virtual void Reconfigure()
Automatic FR reconfiguration.
Definition: lte-fr-hard-algorithm.cc:196
ns3::LteRrcSap::MeasResults
MeasResults structure.
Definition: lte-rrc-sap.h:679
ns3::EpcX2Sap::LoadInformationParams
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:304
ns3::LteFrHardAlgorithm::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition: lte-fr-hard-algorithm.cc:107
ns3::LteFrHardAlgorithm::MemberLteFfrRrcSapProvider< LteFrHardAlgorithm >
friend class MemberLteFfrRrcSapProvider< LteFrHardAlgorithm >
let the forwarder class access the protected and private members
Definition: lte-fr-hard-algorithm.h:62
ns3::LteFfrAlgorithm::GetRbgSize
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
Definition: lte-ffr-algorithm.cc:154
ns3::LteRrcSap::MeasResults::measId
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:680
ns3::LteFfrAlgorithm
The abstract base class of a Frequency Reuse algorithm.
Definition: lte-ffr-algorithm.h:58
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::LteFrHardAlgorithm::~LteFrHardAlgorithm
virtual ~LteFrHardAlgorithm()
Definition: lte-fr-hard-algorithm.cc:100
ns3::LteFrHardAlgorithm::m_ffrSapUser
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
Definition: lte-fr-hard-algorithm.h:111
ns3::LteFfrAlgorithm::m_enabledInUplink
bool m_enabledInUplink
If true FR algorithm will also work in Uplink.
Definition: lte-ffr-algorithm.h:252
ns3::LteFrHardAlgorithm::InitializeDownlinkRbgMaps
void InitializeDownlinkRbgMaps()
Initialize downlink rbg maps.
Definition: lte-fr-hard-algorithm.cc:240
ns3::MakeUintegerAccessor
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:45
ns3::LteFrHardAlgorithm::MemberLteFfrSapProvider< LteFrHardAlgorithm >
friend class MemberLteFfrSapProvider< LteFrHardAlgorithm >
let the forwarder class access the protected and private members
Definition: lte-fr-hard-algorithm.h:60
ns3::LteFfrRrcSapProvider
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
Definition: lte-ffr-rrc-sap.h:39
ns3::LteFrHardAlgorithm::m_ffrRrcSapProvider
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
Definition: lte-fr-hard-algorithm.h:116
ns3::LteFrHardAlgorithm::m_dlRbgMap
std::vector< bool > m_dlRbgMap
DL RBG Map.
Definition: lte-fr-hard-algorithm.h:124
ns3::LteFrHardAlgorithm::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: lte-fr-hard-algorithm.cc:116