A Discrete-Event Network Simulator
API
component-carrier.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Danilo Abrignani
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: Danilo Abrignani <danilo.abrignani@unibo.it>
18  */
19 
20 #include "component-carrier.h"
21 
22 #include <ns3/abort.h>
23 #include <ns3/boolean.h>
24 #include <ns3/log.h>
25 #include <ns3/uinteger.h>
26 
27 namespace ns3
28 {
29 
30 NS_LOG_COMPONENT_DEFINE("ComponentCarrier");
31 
32 NS_OBJECT_ENSURE_REGISTERED(ComponentCarrier);
33 
34 TypeId
36 {
37  static TypeId tid =
38  TypeId("ns3::ComponentCarrier")
39  .SetParent<Object>()
40  .AddConstructor<ComponentCarrier>()
41  .AddAttribute(
42  "UlBandwidth",
43  "Uplink Transmission Bandwidth Configuration in number of Resource Blocks",
44  UintegerValue(25),
47  MakeUintegerChecker<uint8_t>())
48  .AddAttribute(
49  "DlBandwidth",
50  "Downlink Transmission Bandwidth Configuration in number of Resource Blocks",
51  UintegerValue(25),
54  MakeUintegerChecker<uint8_t>())
55  .AddAttribute("DlEarfcn",
56  "Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
57  "as per 3GPP 36.101 Section 5.7.3.",
58  UintegerValue(100),
61  MakeUintegerChecker<uint32_t>(0, 262143))
62  .AddAttribute("UlEarfcn",
63  "Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
64  "as per 3GPP 36.101 Section 5.7.3.",
65  UintegerValue(18100),
68  MakeUintegerChecker<uint32_t>(18000, 262143))
69  .AddAttribute(
70  "CsgId",
71  "The Closed Subscriber Group (CSG) identity that this eNodeB belongs to",
72  UintegerValue(0),
74  MakeUintegerChecker<uint32_t>())
75  .AddAttribute(
76  "CsgIndication",
77  "If true, only UEs which are members of the CSG (i.e. same CSG ID) "
78  "can gain access to the eNodeB, therefore enforcing closed access mode. "
79  "Otherwise, the eNodeB operates as a non-CSG cell and implements open access mode.",
80  BooleanValue(false),
84  .AddAttribute(
85  "PrimaryCarrier",
86  "If true, this Carrier Component will be the Primary Carrier Component (PCC) "
87  "Only one PCC per eNodeB is (currently) allowed",
88  BooleanValue(false),
91  return tid;
92 }
93 
95  : Object()
96 {
97  NS_LOG_FUNCTION(this);
98 }
99 
101 {
102  NS_LOG_FUNCTION(this);
103 }
104 
105 void
107 {
108  NS_LOG_FUNCTION(this);
110 }
111 
112 uint16_t
114 {
115  return m_ulBandwidth;
116 }
117 
118 void
120 {
121  NS_LOG_FUNCTION(this << bw);
122  switch (bw)
123  {
124  case 6:
125  case 15:
126  case 25:
127  case 50:
128  case 75:
129  case 100:
130  m_ulBandwidth = bw;
131  break;
132 
133  default:
134  NS_FATAL_ERROR("Invalid bandwidth value " << bw);
135  break;
136  }
137 }
138 
139 uint16_t
141 {
142  return m_dlBandwidth;
143 }
144 
145 void
147 {
148  NS_LOG_FUNCTION(this << bw);
149  switch (bw)
150  {
151  case 6:
152  case 15:
153  case 25:
154  case 50:
155  case 75:
156  case 100:
157  m_dlBandwidth = bw;
158  break;
159 
160  default:
161  NS_FATAL_ERROR("Invalid bandwidth value " << bw);
162  break;
163  }
164 }
165 
166 uint32_t
168 {
169  return m_dlEarfcn;
170 }
171 
172 void
174 {
175  NS_LOG_FUNCTION(this << earfcn);
176  m_dlEarfcn = earfcn;
177 }
178 
179 uint32_t
181 {
182  return m_ulEarfcn;
183 }
184 
185 void
187 {
188  NS_LOG_FUNCTION(this << earfcn);
189  m_ulEarfcn = earfcn;
190 }
191 
192 uint32_t
194 {
195  return m_csgId;
196 }
197 
198 void
200 {
201  NS_LOG_FUNCTION(this << csgId);
202  m_csgId = csgId;
203 }
204 
205 bool
207 {
208  return m_csgIndication;
209 }
210 
211 void
213 {
214  NS_LOG_FUNCTION(this << csgIndication);
215  m_csgIndication = csgIndication;
216 }
217 
218 bool
220 {
221  return m_primaryCarrier;
222 }
223 
224 void
225 ComponentCarrier::SetAsPrimary(bool primaryCarrier)
226 {
227  NS_LOG_FUNCTION(this << primaryCarrier);
228  m_primaryCarrier = primaryCarrier;
229 }
230 
231 //====================================================
232 
234 
235 TypeId
237 {
238  static TypeId tid = TypeId("ns3::ComponentCarrierBaseStation")
240  .AddConstructor<ComponentCarrierBaseStation>();
241  return tid;
242 }
243 
245  : ComponentCarrier()
246 {
247  NS_LOG_FUNCTION(this);
248 }
249 
251 {
252  NS_LOG_FUNCTION(this);
253 }
254 
255 uint16_t
257 {
258  return m_cellId;
259 }
260 
261 void
263 {
264  NS_LOG_FUNCTION(this << cellId);
265  m_cellId = cellId;
266 }
267 
268 } // namespace ns3
Defines a Base station, that is a ComponentCarrier but with a cell Id.
~ComponentCarrierBaseStation() override
~ComponentCarrierBaseStation
uint16_t GetCellId() const
Get cell identifier.
static TypeId GetTypeId()
Get the type ID.
void SetCellId(uint16_t cellId)
Set physical cell identifier.
uint16_t m_cellId
Cell identifier.
ComponentCarrier Object, it defines a single Carrier This is the parent class for both ComponentCarri...
void SetCsgIndication(bool csgIndication)
Enable or disable the CSG indication flag.
void SetDlEarfcn(uint32_t earfcn)
uint32_t GetDlEarfcn() const
uint16_t GetUlBandwidth() const
bool GetCsgIndication() const
Returns the CSG indication flag of the eNodeB.
uint16_t GetDlBandwidth() const
bool m_csgIndication
CSG indication.
void SetUlEarfcn(uint32_t earfcn)
uint32_t GetCsgId() const
Returns the CSG ID of the eNodeB.
void SetAsPrimary(bool primaryCarrier)
Set as primary carrier.
static TypeId GetTypeId()
Get the type ID.
uint16_t m_dlBandwidth
downlink bandwidth in RBs *‍/
void DoDispose() override
Destructor implementation.
void SetCsgId(uint32_t csgId)
Associate the eNodeB device with a particular CSG.
uint32_t m_ulEarfcn
uplink carrier frequency *‍/
uint32_t GetUlEarfcn() const
virtual void SetUlBandwidth(uint16_t bw)
bool m_primaryCarrier
whether the carrier is primary
bool IsPrimary() const
Checks if the carrier is the primary carrier.
uint16_t m_ulBandwidth
uplink bandwidth in RBs *‍/
uint32_t m_dlEarfcn
downlink carrier frequency *‍/
virtual void SetDlBandwidth(uint16_t bw)
A base class which provides memory management and object aggregation.
Definition: object.h:89
virtual void DoDispose()
Destructor implementation.
Definition: object.cc:352
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46