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_acculumatedMode (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_acculumatedMode = 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_acculumatedMode)
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 uint8_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
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:132
#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:44
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
DoReportUlCqiInfo.
LteFfrSapProvider * m_ffrSapProvider
enum ns3::LteRrcSap::ReportConfigEutra::@73 triggerQuantity
The quantities used to evaluate the triggering condition for the event, see 3GPP TS 36...
void SetTpc(uint32_t tpc, uint32_t num, bool acculumatedMode)
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Definition: lte-rrc-sap.h:339
Specifies criteria for triggering of an E-UTRA measurement reporting event.
Definition: lte-rrc-sap.h:321
uint8_t m_ulBandwidth
uplink bandwidth in RBs
std::map< uint16_t, LteRrcSap::PdschConfigDedicated > m_ues
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
enum ns3::LteRrcSap::ReportConfigEutra::@71 eventId
Choice of E-UTRA event triggered reporting criteria.
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
enum ns3::LteRrcSap::ThresholdEutra::@69 choice
std::vector< bool > m_dlRbgMap
LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated
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
Template for the implementation of the LteFfrSapProvider as a member of an owner class of type C to w...
Definition: lte-ffr-sap.h:146
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
static TypeId GetTypeId()
void ChangePdschConfigDedicated(bool change)
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
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...
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:252
virtual void DoDispose()
Destructor implementation.
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
enum ns3::LteRrcSap::ReportConfigEutra::@75 reportInterval
Indicates the interval between periodical reports.
uint8_t range
Value range used in RSRP/RSRQ threshold.
Definition: lte-rrc-sap.h:317
virtual uint8_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
LteFfrSapUser * m_ffrSapUser
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
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:300
void SetPdschConfigDedicated(LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
LteFfrRrcSapProvider * m_ffrRrcSapProvider
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:315
TracedCallback< uint16_t, uint8_t > m_changePdschConfigDedicatedTrace
void UpdatePdschConfigDedicated()
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:904
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:331
bool m_changePdschConfigDedicated
virtual ~LteFfrSimple()
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:363