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/simulator.h>
25 #include <ns3/log.h>
26 #include <ns3/abort.h>
27 #include <ns3/lte-enb-phy.h>
28 #include <ns3/pointer.h>
29 
30 namespace ns3 {
31 
32 NS_LOG_COMPONENT_DEFINE ("ComponentCarrier");
33 
34 NS_OBJECT_ENSURE_REGISTERED ( ComponentCarrier);
35 
37 {
38  static TypeId
39  tid =
40  TypeId ("ns3::ComponentCarrier")
41  .SetParent<Object> ()
42  .AddConstructor<ComponentCarrier> ()
43  .AddAttribute ("UlBandwidth",
44  "Uplink Transmission Bandwidth Configuration in number of Resource Blocks",
45  UintegerValue (25),
48  MakeUintegerChecker<uint8_t> ())
49  .AddAttribute ("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),
60  MakeUintegerChecker<uint32_t> (0, 262143))
61  .AddAttribute ("UlEarfcn",
62  "Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
63  "as per 3GPP 36.101 Section 5.7.3. ",
64  UintegerValue (18100),
66  MakeUintegerChecker<uint32_t> (18000, 262143))
67  .AddAttribute ("CsgId",
68  "The Closed Subscriber Group (CSG) identity that this eNodeB belongs to",
69  UintegerValue (0),
72  MakeUintegerChecker<uint32_t> ())
73  .AddAttribute ("CsgIndication",
74  "If true, only UEs which are members of the CSG (i.e. same CSG ID) "
75  "can gain access to the eNodeB, therefore enforcing closed access mode. "
76  "Otherwise, the eNodeB operates as a non-CSG cell and implements open access mode.",
77  BooleanValue (false),
81  .AddAttribute ("PrimaryCarrier",
82  "If true, this Carrier Component will be the Primary Carrier Component (PCC) "
83  "Only one PCC per eNodeB is (currently) allowed",
84  BooleanValue (false),
88  ;
89  return tid;
90 }
92  : m_isConstructed (false)
93 {
94  NS_LOG_FUNCTION (this);
95 }
96 
98 {
99  NS_LOG_FUNCTION (this);
100 }
101 
102 void
104 {
105  NS_LOG_FUNCTION (this);
107 }
108 
109 uint8_t
111 {
112  return m_ulBandwidth;
113 }
114 
115 void
117 {
118  NS_LOG_FUNCTION (this << uint16_t (bw));
119  switch (bw)
120  {
121  case 6:
122  case 15:
123  case 25:
124  case 50:
125  case 75:
126  case 100:
127  m_ulBandwidth = bw;
128  break;
129 
130  default:
131  NS_FATAL_ERROR ("Invalid bandwidth value " << (uint16_t) bw);
132  break;
133  }
134 }
135 
136 uint8_t
138 {
139  return m_dlBandwidth;
140 }
141 
142 void
144 {
145  NS_LOG_FUNCTION (this << uint16_t (bw));
146  switch (bw)
147  {
148  case 6:
149  case 15:
150  case 25:
151  case 50:
152  case 75:
153  case 100:
154  m_dlBandwidth = bw;
155  break;
156 
157  default:
158  NS_FATAL_ERROR ("Invalid bandwidth value " << (uint16_t) bw);
159  break;
160  }
161 }
162 
163 uint32_t
165 {
166  return m_dlEarfcn;
167 }
168 
169 void
171 {
172  NS_LOG_FUNCTION (this << earfcn);
173  m_dlEarfcn = earfcn;
174 }
175 
176 uint32_t
178 {
179  return m_ulEarfcn;
180 }
181 
182 void
184 {
185  NS_LOG_FUNCTION (this << earfcn);
186  m_ulEarfcn = earfcn;
187 }
188 
189 uint32_t
191 {
192  return m_csgId;
193 }
194 
195 void
197 {
198  NS_LOG_FUNCTION (this << csgId);
199  m_csgId = csgId;
200 }
201 
202 bool
204 {
205  return m_csgIndication;
206 }
207 
208 void
210 {
211  NS_LOG_FUNCTION (this << csgIndication);
212  m_csgIndication = csgIndication;
213 }
214 
215 bool
217 {
218  return m_primaryCarrier;
219 }
220 
221 void
222 ComponentCarrier::SetAsPrimary (bool primaryCarrier)
223 {
224  NS_LOG_FUNCTION (this << primaryCarrier);
225  m_primaryCarrier = primaryCarrier;
226 }
227 
228 void
230 {
231  NS_LOG_FUNCTION (this);
232  m_isConstructed = true;
233 }
234 
235 } // namespace ns3
236 
237 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
Definition: boolean.h:36
void SetAsPrimary(bool primaryCarrier)
Set as primary carrier.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
uint32_t GetCsgId() const
Returns the CSG ID of the eNodeB.
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:84
uint8_t GetDlBandwidth() const
uint32_t GetUlEarfcn() const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:204
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
bool m_primaryCarrier
whether the carrier is primary
void SetCsgId(uint32_t csgId)
Associate the eNodeB device with a particular CSG.
uint8_t GetUlBandwidth() const
void SetCsgIndication(bool csgIndication)
Enable or disable the CSG indication flag.
bool m_isConstructed
whether the instance is constructed
Hold an unsigned integer type.
Definition: uinteger.h:44
virtual ~ComponentCarrier(void)
void SetDlEarfcn(uint32_t earfcn)
virtual void DoDispose(void)
Destructor implementation.
uint32_t m_dlEarfcn
downlink carrier frequency
void SetUlEarfcn(uint32_t earfcn)
bool IsPrimary() const
Checks if the carrier is the primary carrier.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
uint8_t m_dlBandwidth
downlink bandwidth in RBs
virtual void SetDlBandwidth(uint8_t bw)
uint16_t m_csgId
CSG ID.
virtual void SetUlBandwidth(uint8_t bw)
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoInitialize(void)
Initialize() implementation.
bool GetCsgIndication() const
Returns the CSG indication flag of the eNodeB.
bool m_csgIndication
CSG indication.
A base class which provides memory management and object aggregation.
Definition: object.h:87
uint8_t m_ulBandwidth
uplink bandwidth in RBs
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
a unique identifier for an interface.
Definition: type-id.h:58
uint32_t m_ulEarfcn
uplink carrier frequency
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
uint32_t GetDlEarfcn() const