A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-ffr-algorithm.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-algorithm.h"
11
12#include "ns3/boolean.h"
13#include "ns3/uinteger.h"
14#include <ns3/log.h>
15
16namespace ns3
17{
18
19NS_LOG_COMPONENT_DEFINE("LteFfrAlgorithm");
20
21/// Type 0 RBG allocation
22static const int Type0AllocationRbg[4] = {
23 10, // RBG size 1
24 26, // RBG size 2
25 63, // RBG size 3
26 110, // RBG size 4
27}; // see table 7.1.6.1-1 of 3GPP TS 36.213
28
29NS_OBJECT_ENSURE_REGISTERED(LteFfrAlgorithm);
30
32 : m_needReconfiguration(true)
33{
34}
35
39
42{
43 static TypeId tid =
44 TypeId("ns3::LteFfrAlgorithm")
46 .SetGroupName("Lte")
47 .AddAttribute("FrCellTypeId",
48 "Downlink FR cell type ID for automatic configuration,"
49 "default value is 0 and it means that user needs to configure FR "
50 "algorithm manually,"
51 "if it is set to 1,2 or 3 FR algorithm will be configured automatically",
56 .AddAttribute("EnabledInUplink",
57 "If FR algorithm will also work in Uplink, default value true",
58 BooleanValue(true),
61 return tid;
62}
63
64void
69
70uint16_t
76
77void
79{
80 NS_LOG_FUNCTION(this << bw);
81 switch (bw)
82 {
83 case 6:
84 case 15:
85 case 25:
86 case 50:
87 case 75:
88 case 100:
89 m_ulBandwidth = bw;
90 break;
91
92 default:
93 NS_FATAL_ERROR("invalid bandwidth value " << bw);
94 break;
95 }
96}
97
98uint16_t
100{
101 NS_LOG_FUNCTION(this);
102 return m_dlBandwidth;
103}
104
105void
107{
108 NS_LOG_FUNCTION(this << bw);
109 switch (bw)
110 {
111 case 6:
112 case 15:
113 case 25:
114 case 50:
115 case 75:
116 case 100:
117 m_dlBandwidth = bw;
118 break;
119
120 default:
121 NS_FATAL_ERROR("invalid bandwidth value " << bw);
122 break;
123 }
124}
125
126void
128{
129 NS_LOG_FUNCTION(this << uint16_t(cellTypeId));
130 m_frCellTypeId = cellTypeId;
132}
133
134uint8_t
136{
137 NS_LOG_FUNCTION(this);
138 return m_frCellTypeId;
139}
140
141int
143{
144 for (int i = 0; i < 4; i++)
145 {
146 if (dlbandwidth < Type0AllocationRbg[i])
147 {
148 return i + 1;
149 }
150 }
151
152 return -1;
153}
154
155void
157{
158 NS_LOG_FUNCTION(this);
159 m_cellId = cellId;
160}
161
162void
163LteFfrAlgorithm::DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
164{
165 NS_LOG_FUNCTION(this);
166 SetDlBandwidth(dlBandwidth);
167 SetUlBandwidth(ulBandwidth);
168}
169
170} // end of namespace ns3
static TypeId GetTypeId()
Get the type ID.
bool m_needReconfiguration
If true FR algorithm will be reconfigured.
void SetFrCellTypeId(uint8_t cellTypeId)
uint8_t GetFrCellTypeId() const
uint8_t m_frCellTypeId
FFR cell type ID for automatic configuration.
void DoDispose() override
Destructor implementation.
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
bool m_enabledInUplink
If true FR algorithm will also work in Uplink.
virtual void DoSetCellId(uint16_t cellId)
SetCellId.
uint8_t m_dlBandwidth
downlink bandwidth in RBs
uint16_t GetUlBandwidth() const
void SetDlBandwidth(uint16_t bw)
uint8_t m_ulBandwidth
uplink bandwidth in RBs
virtual void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Implementation of LteFfrRrcSapProvider::SetBandwidth.
void SetUlBandwidth(uint16_t bw)
uint16_t GetDlBandwidth() const
A base class which provides memory management and object aggregation.
Definition object.h:78
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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
static const int Type0AllocationRbg[4]
Type 0 RBG allocation.