A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 NS_LOG_COMPONENT_DEFINE ("LteFfrSimple");
27 
28 namespace ns3 {
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),
76  MakeUintegerAccessor (&LteFfrSimple::m_ulOffset),
77  MakeUintegerChecker<uint8_t> ())
78  .AddAttribute ("UlSubBandwidth",
79  "Uplink Transmission SubBandwidth Configuration in number of Resource Block Groups",
80  UintegerValue (25),
81  MakeUintegerAccessor (&LteFfrSimple::m_ulSubBand),
82  MakeUintegerChecker<uint8_t> ())
83  .AddAttribute ("DlSubBandOffset",
84  "Downlink Offset in number of Resource Block Groups",
85  UintegerValue (0),
86  MakeUintegerAccessor (&LteFfrSimple::m_dlOffset),
87  MakeUintegerChecker<uint8_t> ())
88  .AddAttribute ("DlSubBandwidth",
89  "Downlink Transmission SubBandwidth Configuration in number of Resource Block Groups",
90  UintegerValue (12),
91  MakeUintegerAccessor (&LteFfrSimple::m_dlSubBand),
92  MakeUintegerChecker<uint8_t> ())
93  .AddTraceSource ("ChangePdschConfigDedicated",
94  "trace fired upon change of PdschConfigDedicated",
96  ;
97  return tid;
98 }
99 
100 
101 void
103 {
104  NS_LOG_FUNCTION (this << s);
105  m_ffrSapUser = s;
106 }
107 
108 
111 {
112  NS_LOG_FUNCTION (this);
113  return m_ffrSapProvider;
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION (this << s);
120  m_ffrRrcSapUser = s;
121 }
122 
123 
126 {
127  NS_LOG_FUNCTION (this);
128  return m_ffrRrcSapProvider;
129 }
130 
131 
132 void
134 {
135  NS_LOG_FUNCTION (this);
137 
138  NS_LOG_LOGIC (this << " requesting Event A4 measurements"
139  << " (threshold = 0" << ")");
140  LteRrcSap::ReportConfigEutra reportConfig;
143  reportConfig.threshold1.range = 0;
147 
149 }
150 
151 void
153 {
154  NS_LOG_FUNCTION (this);
155 }
156 
157 void
159 {
161 }
162 
163 void
165 {
166  m_pdschConfigDedicated = pdschConfigDedicated;
167 }
168 
169 void
170 LteFfrSimple::SetTpc (uint32_t tpc, uint32_t num, bool acculumatedMode)
171 {
172  m_tpc = tpc;
173  m_tpcNum = num;
174  m_acculumatedMode = acculumatedMode;
175 }
176 
177 std::vector <bool>
179 {
180  NS_LOG_FUNCTION (this);
181 
182  if (m_dlRbgMap.empty ())
183  {
184  int rbgSize = GetRbgSize (m_dlBandwidth);
185  m_dlRbgMap.resize (m_dlBandwidth / rbgSize, true);
186 
187  for (uint8_t i = m_dlOffset; i < (m_dlOffset + m_dlSubBand); i++)
188  {
189  m_dlRbgMap[i] = false;
190 
191  }
192  }
193 
194  return m_dlRbgMap;
195 }
196 
197 bool
199 {
200  NS_LOG_FUNCTION (this);
201  return true;
202 }
203 
204 std::vector <bool>
206 {
207  NS_LOG_FUNCTION (this);
208 
209  if (m_ulRbgMap.empty ())
210  {
211  m_ulRbgMap.resize (m_ulBandwidth, true);
212 
213  for (uint8_t i = m_ulOffset; i < (m_ulOffset + m_ulSubBand); i++)
214  {
215  m_ulRbgMap[i] = false;
216  }
217  }
218 
219  return m_ulRbgMap;
220 }
221 
222 bool
224 {
225  NS_LOG_FUNCTION (this);
226  return true;
227 }
228 
229 void
231 {
232  NS_LOG_FUNCTION (this);
233 }
234 
235 void
237 {
238  NS_LOG_FUNCTION (this);
239 }
240 
241 void
242 LteFfrSimple::DoReportUlCqiInfo (std::map <uint16_t, std::vector <double> > ulCqiMap)
243 {
244  NS_LOG_FUNCTION (this);
245 }
246 
247 uint8_t
248 LteFfrSimple::DoGetTpc (uint16_t rnti)
249 {
250  NS_LOG_FUNCTION (this);
251 
252  if (m_acculumatedMode)
253  {
254  if (m_tpcNum > 0)
255  {
256  m_tpcNum--;
257  return m_tpc;
258  }
259  else
260  {
261  return 1;
262  }
263  }
264  else
265  {
266  return m_tpc;
267  }
268 
269  return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213 Table 5.1.1.1-2
270 }
271 
272 uint8_t
274 {
275  NS_LOG_FUNCTION (this);
276  return m_ulBandwidth;
277 }
278 
279 void
281  LteRrcSap::MeasResults measResults)
282 {
283  NS_LOG_FUNCTION (this << rnti << (uint16_t) measResults.measId);
284 
285  std::map<uint16_t, LteRrcSap::PdschConfigDedicated>::iterator it;
286 
287  it = m_ues.find (rnti);
288 
289  if (it == m_ues.end ())
290  {
291  LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
292  pdschConfigDedicated.pa = LteRrcSap::PdschConfigDedicated::dB0;
293  m_ues.insert (std::pair<uint16_t, LteRrcSap::PdschConfigDedicated> (rnti,
294  pdschConfigDedicated));
295  }
296 
298  {
300  }
301 }
302 
303 void
305 {
306  NS_LOG_FUNCTION (this);
307 
308  std::map<uint16_t, LteRrcSap::PdschConfigDedicated>::iterator it;
309  for (it = m_ues.begin (); it != m_ues.end (); it++)
310  {
311  if (it->second.pa != m_pdschConfigDedicated.pa)
312  {
315  m_ffrRrcSapUser->SetPdschConfigDedicated (it->first, pdschConfigDedicated );
316  }
317  }
318 }
319 
320 void
322 {
323  NS_LOG_FUNCTION (this);
324 }
325 
326 } // end of namespace ns3
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:315
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
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 the class in the ns-3 factory.
Definition: object-base.h:38
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
DoReportUlCqiInfo.
LteFfrSapProvider * m_ffrSapProvider
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:170
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
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...
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:46
Ptr< SampleEmitter > s
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:233
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:331
virtual void Reconfigure()
Automatic FR reconfiguration.
The abstract base class of a Frequency Reuse algorithm.
std::vector< bool > m_ulRbgMap
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
enum ns3::LteRrcSap::ReportConfigEutra::@73 eventId
Choice of E-UTRA event triggered reporting criteria.
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.
enum ns3::LteRrcSap::ReportConfigEutra::@77 reportInterval
Indicates the interval between periodical reports.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
LteFfrSimple()
Creates a trivial ffr algorithm instance.
enum ns3::LteRrcSap::ReportConfigEutra::@75 triggerQuantity
The quantities used to evaluate the triggering condition for the event, see 3GPP TS 36...
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
TracedCallback< uint16_t, uint8_t > m_changePdschConfigDedicatedTrace
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:363
void UpdatePdschConfigDedicated()
enum ns3::LteRrcSap::ThresholdEutra::@71 choice
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
a unique identifier for an interface.
Definition: type-id.h:49
virtual void DoInitialize()
This method is called only once by Object::Initialize.
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
bool m_changePdschConfigDedicated
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: object.cc:342
virtual ~LteFfrSimple()