A Discrete-Event Network Simulator
API
component-carrier.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015 Danilo Abrignani
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: Danilo Abrignani <danilo.abrignani@unibo.it>
19  */
20 
21 #include "component-carrier.h"
22 #include <ns3/uinteger.h>
23 #include <ns3/boolean.h>
24 #include <ns3/log.h>
25 #include <ns3/abort.h>
26 
27 namespace ns3 {
28 
29 NS_LOG_COMPONENT_DEFINE ("ComponentCarrier");
30 
31 NS_OBJECT_ENSURE_REGISTERED ( ComponentCarrier);
32 
34 {
35  static TypeId
36  tid =
37  TypeId ("ns3::ComponentCarrier")
38  .SetParent<Object> ()
39  .AddConstructor<ComponentCarrier> ()
40  .AddAttribute ("UlBandwidth",
41  "Uplink Transmission Bandwidth Configuration in number of Resource Blocks",
42  UintegerValue (25),
45  MakeUintegerChecker<uint8_t> ())
46  .AddAttribute ("DlBandwidth",
47  "Downlink Transmission Bandwidth Configuration in number of Resource Blocks",
48  UintegerValue (25),
51  MakeUintegerChecker<uint8_t> ())
52  .AddAttribute ("DlEarfcn",
53  "Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
54  "as per 3GPP 36.101 Section 5.7.3. ",
55  UintegerValue (100),
58  MakeUintegerChecker<uint32_t> (0, 262143))
59  .AddAttribute ("UlEarfcn",
60  "Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
61  "as per 3GPP 36.101 Section 5.7.3. ",
62  UintegerValue (18100),
65  MakeUintegerChecker<uint32_t> (18000, 262143))
66  .AddAttribute ("CsgId",
67  "The Closed Subscriber Group (CSG) identity that this eNodeB belongs to",
68  UintegerValue (0),
71  MakeUintegerChecker<uint32_t> ())
72  .AddAttribute ("CsgIndication",
73  "If true, only UEs which are members of the CSG (i.e. same CSG ID) "
74  "can gain access to the eNodeB, therefore enforcing closed access mode. "
75  "Otherwise, the eNodeB operates as a non-CSG cell and implements open access mode.",
76  BooleanValue (false),
80  .AddAttribute ("PrimaryCarrier",
81  "If true, this Carrier Component will be the Primary Carrier Component (PCC) "
82  "Only one PCC per eNodeB is (currently) allowed",
83  BooleanValue (false),
87  ;
88  return tid;
89 }
91 {
92  NS_LOG_FUNCTION (this);
93 }
94 
96 {
97  NS_LOG_FUNCTION (this);
98 }
99 
100 void
102 {
103  NS_LOG_FUNCTION (this);
105 }
106 
107 uint16_t
109 {
110  return m_ulBandwidth;
111 }
112 
113 void
115 {
116  NS_LOG_FUNCTION (this << bw);
117  switch (bw)
118  {
119  case 6:
120  case 15:
121  case 25:
122  case 50:
123  case 75:
124  case 100:
125  m_ulBandwidth = bw;
126  break;
127 
128  default:
129  NS_FATAL_ERROR ("Invalid bandwidth value " << bw);
130  break;
131  }
132 }
133 
134 uint16_t
136 {
137  return m_dlBandwidth;
138 }
139 
140 void
142 {
143  NS_LOG_FUNCTION (this << bw);
144  switch (bw)
145  {
146  case 6:
147  case 15:
148  case 25:
149  case 50:
150  case 75:
151  case 100:
152  m_dlBandwidth = bw;
153  break;
154 
155  default:
156  NS_FATAL_ERROR ("Invalid bandwidth value " << bw);
157  break;
158  }
159 }
160 
161 uint32_t
163 {
164  return m_dlEarfcn;
165 }
166 
167 void
169 {
170  NS_LOG_FUNCTION (this << earfcn);
171  m_dlEarfcn = earfcn;
172 }
173 
174 uint32_t
176 {
177  return m_ulEarfcn;
178 }
179 
180 void
182 {
183  NS_LOG_FUNCTION (this << earfcn);
184  m_ulEarfcn = earfcn;
185 }
186 
187 uint32_t
189 {
190  return m_csgId;
191 }
192 
193 void
195 {
196  NS_LOG_FUNCTION (this << csgId);
197  m_csgId = csgId;
198 }
199 
200 bool
202 {
203  return m_csgIndication;
204 }
205 
206 void
208 {
209  NS_LOG_FUNCTION (this << csgIndication);
210  m_csgIndication = csgIndication;
211 }
212 
213 bool
215 {
216  return m_primaryCarrier;
217 }
218 
219 void
220 ComponentCarrier::SetAsPrimary (bool primaryCarrier)
221 {
222  NS_LOG_FUNCTION (this << primaryCarrier);
223  m_primaryCarrier = primaryCarrier;
224 }
225 
226 //====================================================
227 
229 
231 {
232  static TypeId
233  tid =
234  TypeId ("ns3::ComponentCarrierBaseStation")
236  .AddConstructor<ComponentCarrierBaseStation> ()
237  ;
238  return tid;
239 }
240 
242 {
243  NS_LOG_FUNCTION (this);
244 }
245 
247 {
248  NS_LOG_FUNCTION (this);
249 }
250 
251 uint16_t
253 {
254  return m_cellId;
255 }
256 
257 void
259 {
260  NS_LOG_FUNCTION (this << cellId);
261  m_cellId = cellId;
262 }
263 
264 } // namespace ns3
265 
266 
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Defines a Base station, that is a ComponentCarrier but with a cell Id.
uint16_t GetCellId()
Get cell identifier.
virtual ~ComponentCarrierBaseStation(void) override
~ComponentCarrierBaseStation
void SetCellId(uint16_t cellId)
Set physical cell identifier.
uint16_t m_cellId
Cell identifier.
static TypeId GetTypeId(void)
Get the type ID.
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)
virtual ~ComponentCarrier(void)
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.
static TypeId GetTypeId(void)
Get the type ID.
void SetUlEarfcn(uint32_t earfcn)
uint32_t GetCsgId() const
Returns the CSG ID of the eNodeB.
void SetAsPrimary(bool primaryCarrier)
Set as primary carrier.
virtual void DoDispose(void)
Destructor implementation.
uint16_t m_dlBandwidth
downlink bandwidth in RBs *‍/
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:88
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
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 AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#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
Every class exported by the ns3 library is enclosed in the ns3 namespace.