A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
26namespace ns3
27{
28
29NS_LOG_COMPONENT_DEFINE("LteFfrSimple");
30
31NS_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
56void
58{
59 NS_LOG_FUNCTION(this);
60 delete m_ffrSapProvider;
62}
63
66{
67 static TypeId tid =
68 TypeId("ns3::LteFfrSimple")
70 .AddConstructor<LteFfrSimple>()
71 .AddAttribute("UlSubBandOffset",
72 "Uplink Offset in number of Resource Block Groups",
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",
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
101void
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
115void
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
129void
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
149void
151{
152 NS_LOG_FUNCTION(this);
153}
154
155void
157{
159}
160
161void
163{
164 m_pdschConfigDedicated = pdschConfigDedicated;
165}
166
167void
168LteFfrSimple::SetTpc(uint32_t tpc, uint32_t num, bool accumulatedMode)
169{
170 m_tpc = tpc;
171 m_tpcNum = num;
172 m_accumulatedMode = accumulatedMode;
173}
174
175std::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
194bool
196{
197 NS_LOG_FUNCTION(this);
198 return true;
199}
200
201std::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
219bool
221{
222 NS_LOG_FUNCTION(this);
223 return true;
224}
225
226void
228{
229 NS_LOG_FUNCTION(this);
230}
231
232void
234{
235 NS_LOG_FUNCTION(this);
236}
237
238void
239LteFfrSimple::DoReportUlCqiInfo(std::map<uint16_t, std::vector<double>> ulCqiMap)
240{
241 NS_LOG_FUNCTION(this);
242}
243
244uint8_t
246{
247 NS_LOG_FUNCTION(this);
248
250 {
251 if (m_tpcNum > 0)
252 {
253 m_tpcNum--;
254 return m_tpc;
255 }
256 else
257 {
258 return 1;
259 }
260 }
261 else
262 {
263 return m_tpc;
264 }
265
266 return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213
267 // Table 5.1.1.1-2
268}
269
270uint16_t
272{
273 NS_LOG_FUNCTION(this);
274 return m_ulBandwidth;
275}
276
277void
279{
280 NS_LOG_FUNCTION(this << rnti << (uint16_t)measResults.measId);
281
282 auto it = m_ues.find(rnti);
283
284 if (it == m_ues.end())
285 {
286 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
287 pdschConfigDedicated.pa = LteRrcSap::PdschConfigDedicated::dB0;
288 m_ues.insert(
289 std::pair<uint16_t, LteRrcSap::PdschConfigDedicated>(rnti, pdschConfigDedicated));
290 }
291
293 {
295 }
296}
297
298void
300{
301 NS_LOG_FUNCTION(this);
302
303 for (auto it = m_ues.begin(); it != m_ues.end(); it++)
304 {
305 if (it->second.pa != m_pdschConfigDedicated.pa)
306 {
309 m_ffrRrcSapUser->SetPdschConfigDedicated(it->first, pdschConfigDedicated);
310 }
311 }
312}
313
314void
316{
317 NS_LOG_FUNCTION(this);
318}
319
320} // 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:140
void DoReportDlCqiInfo(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters &params) override
DoReportDlCqiInfo.
LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated
PDSCH config dedicated.
uint8_t DoGetTpc(uint16_t rnti) override
DoGetTpc for UE.
void DoInitialize() override
Initialize() implementation.
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
void DoReportUlCqiInfo(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters &params) override
DoReportUlCqiInfo.
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
bool m_accumulatedMode
whether to use the TPC accumulated mode
void SetTpc(uint32_t tpc, uint32_t num, bool accumulatedMode)
Set transmission power control.
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.
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:451
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Hold an unsigned integer type.
Definition: uinteger.h:45
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
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.
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:306
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
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
@ RSRQ
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:426
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:384
enum ns3::LteRrcSap::ReportConfigEutra::@65 reportInterval
Report interval enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@63 triggerQuantity
Trigger type enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Definition: lte-rrc-sap.h:393
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:365
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t range
Value range used in RSRP/RSRQ threshold.
Definition: lte-rrc-sap.h:368