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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
7 *
8 */
9
10#include "lte-ffr-simple.h"
11
12#include "ns3/lte-rrc-sap.h"
13#include <ns3/log.h>
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("LteFfrSimple");
19
20NS_OBJECT_ENSURE_REGISTERED(LteFfrSimple);
21
23 : m_ffrSapUser(nullptr),
24 m_ffrRrcSapUser(nullptr),
25 m_dlOffset(0),
26 m_dlSubBand(0),
27 m_ulOffset(0),
28 m_ulSubBand(0),
29 m_measId(0),
30 m_changePdschConfigDedicated(false),
31 m_tpc(1),
32 m_tpcNum(0),
33 m_accumulatedMode(false)
34{
35 NS_LOG_FUNCTION(this);
38}
39
44
45void
52
55{
56 static TypeId tid =
57 TypeId("ns3::LteFfrSimple")
59 .AddConstructor<LteFfrSimple>()
60 .AddAttribute("UlSubBandOffset",
61 "Uplink Offset in number of Resource Block Groups",
65 .AddAttribute(
66 "UlSubBandwidth",
67 "Uplink Transmission SubBandwidth Configuration in number of Resource Block Groups",
68 UintegerValue(25),
71 .AddAttribute("DlSubBandOffset",
72 "Downlink Offset in number of Resource Block Groups",
76 .AddAttribute("DlSubBandwidth",
77 "Downlink Transmission SubBandwidth Configuration in number of Resource "
78 "Block Groups",
79 UintegerValue(12),
82 .AddTraceSource(
83 "ChangePdschConfigDedicated",
84 "trace fired upon change of PdschConfigDedicated",
86 "ns3::LteFfrSimple::PdschTracedCallback");
87 return tid;
88}
89
90void
96
103
104void
110
117
118void
120{
121 NS_LOG_FUNCTION(this);
123
124 NS_LOG_LOGIC(this << " requesting Event A4 measurements"
125 << " (threshold = 0"
126 << ")");
127 LteRrcSap::ReportConfigEutra reportConfig;
130 reportConfig.threshold1.range = 0;
134
136}
137
138void
143
144void
149
150void
152{
153 m_pdschConfigDedicated = pdschConfigDedicated;
154}
155
156void
157LteFfrSimple::SetTpc(uint32_t tpc, uint32_t num, bool accumulatedMode)
158{
159 m_tpc = tpc;
160 m_tpcNum = num;
161 m_accumulatedMode = accumulatedMode;
162}
163
164std::vector<bool>
166{
167 NS_LOG_FUNCTION(this);
168
169 if (m_dlRbgMap.empty())
170 {
171 int rbgSize = GetRbgSize(m_dlBandwidth);
172 m_dlRbgMap.resize(m_dlBandwidth / rbgSize, true);
173
174 for (uint8_t i = m_dlOffset; i < (m_dlOffset + m_dlSubBand); i++)
175 {
176 m_dlRbgMap[i] = false;
177 }
178 }
179
180 return m_dlRbgMap;
181}
182
183bool
185{
186 NS_LOG_FUNCTION(this);
187 return true;
188}
189
190std::vector<bool>
192{
193 NS_LOG_FUNCTION(this);
194
195 if (m_ulRbgMap.empty())
196 {
197 m_ulRbgMap.resize(m_ulBandwidth, true);
198
199 for (uint8_t i = m_ulOffset; i < (m_ulOffset + m_ulSubBand); i++)
200 {
201 m_ulRbgMap[i] = false;
202 }
203 }
204
205 return m_ulRbgMap;
206}
207
208bool
210{
211 NS_LOG_FUNCTION(this);
212 return true;
213}
214
215void
220
221void
226
227void
228LteFfrSimple::DoReportUlCqiInfo(std::map<uint16_t, std::vector<double>> ulCqiMap)
229{
230 NS_LOG_FUNCTION(this);
231}
232
233uint8_t
235{
236 NS_LOG_FUNCTION(this);
237
239 {
240 if (m_tpcNum > 0)
241 {
242 m_tpcNum--;
243 return m_tpc;
244 }
245 else
246 {
247 return 1;
248 }
249 }
250 else
251 {
252 return m_tpc;
253 }
254
255 return 1; // 1 is mapped to 0 for Accumulated mode, and to -1 in Absolute mode TS36.213
256 // Table 5.1.1.1-2
257}
258
259uint16_t
265
266void
268{
269 NS_LOG_FUNCTION(this << rnti << (uint16_t)measResults.measId);
270
271 auto it = m_ues.find(rnti);
272
273 if (it == m_ues.end())
274 {
275 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
276 pdschConfigDedicated.pa = LteRrcSap::PdschConfigDedicated::dB0;
277 m_ues.insert(
278 std::pair<uint16_t, LteRrcSap::PdschConfigDedicated>(rnti, pdschConfigDedicated));
279 }
280
282 {
284 }
285}
286
287void
289{
290 NS_LOG_FUNCTION(this);
291
292 for (auto it = m_ues.begin(); it != m_ues.end(); it++)
293 {
294 if (it->second.pa != m_pdschConfigDedicated.pa)
295 {
298 m_ffrRrcSapUser->SetPdschConfigDedicated(it->first, pdschConfigDedicated);
299 }
300 }
301}
302
303void
308
309} // 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:29
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
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:440
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#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:35
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.
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Parameters of the LOAD INFORMATION message.
Definition epc-x2-sap.h:295
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
MeasResults structure.
uint8_t measId
measure ID
PdschConfigDedicated structure.
Specifies criteria for triggering of an E-UTRA measurement reporting event.
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
@ RSRQ
Reference Signal Received Quality.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
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.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t range
Value range used in RSRP/RSRQ threshold.