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
26namespace ns3 {
27
28NS_LOG_COMPONENT_DEFINE ("LteFfrSimple");
29
30NS_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
58void
60{
61 NS_LOG_FUNCTION (this);
62 delete m_ffrSapProvider;
64}
65
66
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
102void
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
117void
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
133void
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
152void
154{
155 NS_LOG_FUNCTION (this);
156}
157
158void
160{
162}
163
164void
166{
167 m_pdschConfigDedicated = pdschConfigDedicated;
168}
169
170void
171LteFfrSimple::SetTpc (uint32_t tpc, uint32_t num, bool acculumatedMode)
172{
173 m_tpc = tpc;
174 m_tpcNum = num;
175 m_accumulatedMode = acculumatedMode;
176}
177
178std::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
198bool
200{
201 NS_LOG_FUNCTION (this);
202 return true;
203}
204
205std::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
223bool
225{
226 NS_LOG_FUNCTION (this);
227 return true;
228}
229
230void
232{
233 NS_LOG_FUNCTION (this);
234}
235
236void
238{
239 NS_LOG_FUNCTION (this);
240}
241
242void
243LteFfrSimple::DoReportUlCqiInfo (std::map <uint16_t, std::vector <double> > ulCqiMap)
244{
245 NS_LOG_FUNCTION (this);
246}
247
248uint8_t
250{
251 NS_LOG_FUNCTION (this);
252
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
273uint16_t
275{
276 NS_LOG_FUNCTION (this);
277 return m_ulBandwidth;
278}
279
280void
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
304void
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
321void
323{
324 NS_LOG_FUNCTION (this);
325}
326
327} // 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:40
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Definition: lte-ffr-sap.h:139
virtual void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s)
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated
PDSCH config dedicated.
void SetTpc(uint32_t tpc, uint32_t num, bool acculumatedMode)
Set transmission power control.
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
void ChangePdschConfigDedicated(bool change)
Callback function that is used to be connected to trace ChangePdschConfigDedicated.
virtual void DoDispose()
Destructor implementation.
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
uint8_t m_measId
measure ID
virtual LteFfrRrcSapProvider * GetLteFfrRrcSapProvider()
Export the "provider" part of the LteFfrRrcSap interface.
virtual uint16_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
void SetPdschConfigDedicated(LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
Set PDSCH config dedicated function.
virtual void DoReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params)
DoReportDlCqiInfo.
virtual bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
uint32_t m_tpc
transmission power control to be used
uint8_t m_dlSubBand
DL subband.
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
virtual void SetLteFfrSapUser(LteFfrSapUser *s)
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
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
std::map< uint16_t, LteRrcSap::PdschConfigDedicated > m_ues
UEs.
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.
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
bool m_accumulatedMode
whether to use the TPC accumulated mode
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
std::vector< bool > m_ulRbgMap
UL RBG map.
virtual void DoInitialize()
Initialize() implementation.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params)
DoReportUlCqiInfo.
LteFfrSimple()
Creates a trivial ffr algorithm instance.
uint8_t m_ulSubBand
UL subband.
static TypeId GetTypeId()
Get the type ID.
bool m_changePdschConfigDedicated
PDSCH config dedicate changed?
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
virtual ~LteFfrSimple()
virtual void Reconfigure()
Automatic FR reconfiguration.
TracedCallback< uint16_t, uint8_t > m_changePdschConfigDedicatedTrace
PDSCH config dedicated change trace callback.
uint8_t m_ulOffset
UL offset.
void UpdatePdschConfigDedicated()
Update PDSCH config dedicated function.
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Hold an unsigned integer type.
Definition: uinteger.h:44
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:45
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#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:45
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.
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:304
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:679
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:680
PdschConfigDedicated structure.
Definition: lte-rrc-sap.h:155
Specifies criteria for triggering of an E-UTRA measurement reporting event.
Definition: lte-rrc-sap.h:362
@ RSRQ
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:407
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:381
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:373
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:355
uint8_t range
Value range used in RSRP/RSRQ threshold.
Definition: lte-rrc-sap.h:357
enum ns3::LteRrcSap::ThresholdEutra::@63 choice
Threshold enumeration.