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