A Discrete-Event Network Simulator
API
lte-ffr-simple.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-ffr-simple.h"
23 #include <ns3/log.h>
24 #include "ns3/lte-rrc-sap.h"
25 
26 namespace ns3 {
27 
28 NS_LOG_COMPONENT_DEFINE ("LteFfrSimple");
29 
30 NS_OBJECT_ENSURE_REGISTERED (LteFfrSimple);
31 
32 
34  : m_ffrSapUser (0),
35  m_ffrRrcSapUser (0),
36  m_dlOffset (0),
37  m_dlSubBand (0),
38  m_ulOffset (0),
39  m_ulSubBand (0),
40  m_measId (0),
41  m_changePdschConfigDedicated (false),
42  m_tpc (1),
43  m_tpcNum (0),
44  m_accumulatedMode (false)
45 {
46  NS_LOG_FUNCTION (this);
49 }
50 
51 
53 {
54  NS_LOG_FUNCTION (this);
55 }
56 
57 
58 void
60 {
61  NS_LOG_FUNCTION (this);
62  delete m_ffrSapProvider;
63  delete m_ffrRrcSapProvider;
64 }
65 
66 
67 TypeId
69 {
70  static TypeId tid = TypeId ("ns3::LteFfrSimple")
72  .AddConstructor<LteFfrSimple> ()
73  .AddAttribute ("UlSubBandOffset",
74  "Uplink Offset in number of Resource Block Groups",
75  UintegerValue (0),
77  MakeUintegerChecker<uint8_t> ())
78  .AddAttribute ("UlSubBandwidth",
79  "Uplink Transmission SubBandwidth Configuration in number of Resource Block Groups",
80  UintegerValue (25),
82  MakeUintegerChecker<uint8_t> ())
83  .AddAttribute ("DlSubBandOffset",
84  "Downlink Offset in number of Resource Block Groups",
85  UintegerValue (0),
87  MakeUintegerChecker<uint8_t> ())
88  .AddAttribute ("DlSubBandwidth",
89  "Downlink Transmission SubBandwidth Configuration in number of Resource Block Groups",
90  UintegerValue (12),
92  MakeUintegerChecker<uint8_t> ())
93  .AddTraceSource ("ChangePdschConfigDedicated",
94  "trace fired upon change of PdschConfigDedicated",
96  "ns3::LteFfrSimple::PdschTracedCallback")
97  ;
98  return tid;
99 }
100 
101 
102 void
104 {
105  NS_LOG_FUNCTION (this << s);
106  m_ffrSapUser = s;
107 }
108 
109 
112 {
113  NS_LOG_FUNCTION (this);
114  return m_ffrSapProvider;
115 }
116 
117 void
119 {
120  NS_LOG_FUNCTION (this << s);
121  m_ffrRrcSapUser = s;
122 }
123 
124 
127 {
128  NS_LOG_FUNCTION (this);
129  return m_ffrRrcSapProvider;
130 }
131 
132 
133 void
135 {
136  NS_LOG_FUNCTION (this);
138 
139  NS_LOG_LOGIC (this << " requesting Event A4 measurements"
140  << " (threshold = 0" << ")");
141  LteRrcSap::ReportConfigEutra reportConfig;
144  reportConfig.threshold1.range = 0;
148 
150 }
151 
152 void
154 {
155  NS_LOG_FUNCTION (this);
156 }
157 
158 void
160 {
162 }
163 
164 void
166 {
167  m_pdschConfigDedicated = pdschConfigDedicated;
168 }
169 
170 void
171 LteFfrSimple::SetTpc (uint32_t tpc, uint32_t num, bool acculumatedMode)
172 {
173  m_tpc = tpc;
174  m_tpcNum = num;
175  m_accumulatedMode = acculumatedMode;
176 }
177 
178 std::vector <bool>
180 {
181  NS_LOG_FUNCTION (this);
182 
183  if (m_dlRbgMap.empty ())
184  {
185  int rbgSize = GetRbgSize (m_dlBandwidth);
186  m_dlRbgMap.resize (m_dlBandwidth / rbgSize, true);
187 
188  for (uint8_t i = m_dlOffset; i < (m_dlOffset + m_dlSubBand); i++)
189  {
190  m_dlRbgMap[i] = false;
191 
192  }
193  }
194 
195  return m_dlRbgMap;
196 }
197 
198 bool
200 {
201  NS_LOG_FUNCTION (this);
202  return true;
203 }
204 
205 std::vector <bool>
207 {
208  NS_LOG_FUNCTION (this);
209 
210  if (m_ulRbgMap.empty ())
211  {
212  m_ulRbgMap.resize (m_ulBandwidth, true);
213 
214  for (uint8_t i = m_ulOffset; i < (m_ulOffset + m_ulSubBand); i++)
215  {
216  m_ulRbgMap[i] = false;
217  }
218  }
219 
220  return m_ulRbgMap;
221 }
222 
223 bool
225 {
226  NS_LOG_FUNCTION (this);
227  return true;
228 }
229 
230 void
232 {
233  NS_LOG_FUNCTION (this);
234 }
235 
236 void
238 {
239  NS_LOG_FUNCTION (this);
240 }
241 
242 void
243 LteFfrSimple::DoReportUlCqiInfo (std::map <uint16_t, std::vector <double> > ulCqiMap)
244 {
245  NS_LOG_FUNCTION (this);
246 }
247 
248 uint8_t
249 LteFfrSimple::DoGetTpc (uint16_t rnti)
250 {
251  NS_LOG_FUNCTION (this);
252 
253  if (m_accumulatedMode)
254  {
255  if (m_tpcNum > 0)
256  {
257  m_tpcNum--;
258  return m_tpc;
259  }
260  else
261  {
262  return 1;
263  }
264  }
265  else
266  {
267  return m_tpc;
268  }
269 
270  return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213 Table 5.1.1.1-2
271 }
272 
273 uint16_t
275 {
276  NS_LOG_FUNCTION (this);
277  return m_ulBandwidth;
278 }
279 
280 void
282  LteRrcSap::MeasResults measResults)
283 {
284  NS_LOG_FUNCTION (this << rnti << (uint16_t) measResults.measId);
285 
286  std::map<uint16_t, LteRrcSap::PdschConfigDedicated>::iterator it;
287 
288  it = m_ues.find (rnti);
289 
290  if (it == m_ues.end ())
291  {
292  LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
293  pdschConfigDedicated.pa = LteRrcSap::PdschConfigDedicated::dB0;
294  m_ues.insert (std::pair<uint16_t, LteRrcSap::PdschConfigDedicated> (rnti,
295  pdschConfigDedicated));
296  }
297 
299  {
301  }
302 }
303 
304 void
306 {
307  NS_LOG_FUNCTION (this);
308 
309  std::map<uint16_t, LteRrcSap::PdschConfigDedicated>::iterator it;
310  for (it = m_ues.begin (); it != m_ues.end (); it++)
311  {
312  if (it->second.pa != m_pdschConfigDedicated.pa)
313  {
316  m_ffrRrcSapUser->SetPdschConfigDedicated (it->first, pdschConfigDedicated );
317  }
318  }
319 }
320 
321 void
323 {
324  NS_LOG_FUNCTION (this);
325 }
326 
327 } // end of namespace ns3
enum ns3::LteRrcSap::ThresholdEutra::@63 choice
Threshold enumeration.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
Template for the implementation of the LteFfrRrcSapProvider as a member of an owner class of type C t...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Definition: lte-ffr-sap.h:138
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
DoReportUlCqiInfo.
uint8_t m_ulOffset
UL offset.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void SetTpc(uint32_t tpc, uint32_t num, bool acculumatedMode)
Set transmission power control.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Definition: lte-rrc-sap.h:381
Specifies criteria for triggering of an E-UTRA measurement reporting event.
Definition: lte-rrc-sap.h:361
uint8_t m_ulBandwidth
uplink bandwidth in RBs
std::map< uint16_t, LteRrcSap::PdschConfigDedicated > m_ues
UEs.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
uint8_t m_dlOffset
DL offset.
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
enum ns3::LteRrcSap::ReportConfigEutra::@66 triggerQuantity
Trigger type enumeration.
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:407
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
std::vector< bool > m_dlRbgMap
DL RBG map.
LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated
PDSCH config dedicated.
virtual uint8_t AddUeMeasReportConfigForFfr(LteRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity...
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual void SetPdschConfigDedicated(uint16_t rnti, LteRrcSap::PdschConfigDedicated pdschConfigDedicated)=0
Instruct the eNodeB RRC entity to perform RrcConnectionReconfiguration to inform UE about new PdschCo...
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
Template for the implementation of the LteFfrSapProvider as a member of an owner class of type C to w...
Definition: lte-ffr-sap.h:152
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
static TypeId GetTypeId()
Get the type ID.
MeasResults structure.
Definition: lte-rrc-sap.h:678
void ChangePdschConfigDedicated(bool change)
Callback function that is used to be connected to trace ChangePdschConfigDedicated.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Definition: lte-ffr-sap.h:39
Hold an unsigned integer type.
Definition: uinteger.h:44
bool m_accumulatedMode
whether to use the TPC accumulated mode
uint8_t m_dlBandwidth
downlink bandwidth in RBs
virtual void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s)
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
enum ns3::LteRrcSap::ReportConfigEutra::@68 reportInterval
Report interval enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@65 eventId
Event enumeration.
virtual bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
uint32_t m_tpcNum
number of TPC configurations
virtual void DoDispose()
Destructor implementation.
virtual uint16_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Reconfigure()
Automatic FR reconfiguration.
The abstract base class of a Frequency Reuse algorithm.
std::vector< bool > m_ulRbgMap
UL RBG map.
uint8_t m_ulSubBand
UL subband.
uint8_t range
Value range used in RSRP/RSRQ threshold.
Definition: lte-rrc-sap.h:357
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
uint8_t m_dlSubBand
DL subband.
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:680
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
uint8_t m_measId
measure ID
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
LteFfrSimple()
Creates a trivial ffr algorithm instance.
virtual void SetLteFfrSapUser(LteFfrSapUser *s)
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
virtual LteFfrRrcSapProvider * GetLteFfrRrcSapProvider()
Export the "provider" part of the LteFfrRrcSap interface.
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
virtual void DoReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
DoReportDlCqiInfo.
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:303
void SetPdschConfigDedicated(LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
Set PDSCH config dedicated function.
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:373
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:355
TracedCallback< uint16_t, uint8_t > m_changePdschConfigDedicatedTrace
PDSCH config dedicated change trace callback.
void UpdatePdschConfigDedicated()
Update PDSCH config dedicated function.
PdschConfigDedicated structure.
Definition: lte-rrc-sap.h:154
uint32_t m_tpc
transmission power control to be used
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
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
a unique identifier for an interface.
Definition: type-id.h:58
virtual void DoInitialize()
Initialize() implementation.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
bool m_changePdschConfigDedicated
PDSCH config dedicate changed?
virtual ~LteFfrSimple()