5G-LENA nr-v4.0
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-component-carrier.cc
1// Copyright (c) 2015 Danilo Abrignani
2//
3// SPDX-License-Identifier: GPL-2.0-only
4//
5// Author: Danilo Abrignani <danilo.abrignani@unibo.it>
6
7#include "nr-component-carrier.h"
8
9#include "ns3/abort.h"
10#include "ns3/boolean.h"
11#include "ns3/log.h"
12#include "ns3/uinteger.h"
13
14namespace ns3
15{
16
17NS_LOG_COMPONENT_DEFINE("NrComponentCarrier");
18
19NS_OBJECT_ENSURE_REGISTERED(NrComponentCarrier);
20
21TypeId
23{
24 static TypeId tid =
25 TypeId("ns3::NrComponentCarrier")
26 .SetParent<Object>()
27 .AddConstructor<NrComponentCarrier>()
28 .AddAttribute(
29 "UlBandwidth",
30 "Uplink Transmission Bandwidth Configuration in number of Resource Blocks",
31 UintegerValue(25),
32 MakeUintegerAccessor(&NrComponentCarrier::SetUlBandwidth,
34 MakeUintegerChecker<uint8_t>())
35 .AddAttribute(
36 "DlBandwidth",
37 "Downlink Transmission Bandwidth Configuration in number of Resource Blocks",
38 UintegerValue(25),
39 MakeUintegerAccessor(&NrComponentCarrier::SetDlBandwidth,
41 MakeUintegerChecker<uint8_t>())
42 .AddAttribute("DlEarfcn",
43 "Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
44 "as per 3GPP 36.101 Section 5.7.3.",
45 UintegerValue(100),
46 MakeUintegerAccessor(&NrComponentCarrier::SetDlEarfcn,
48 MakeUintegerChecker<uint32_t>(0, 262143))
49 .AddAttribute("UlEarfcn",
50 "Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
51 "as per 3GPP 36.101 Section 5.7.3.",
52 UintegerValue(18100),
53 MakeUintegerAccessor(&NrComponentCarrier::SetUlEarfcn,
55 MakeUintegerChecker<uint32_t>(18000, 262143))
56 .AddAttribute(
57 "CsgId",
58 "The Closed Subscriber Group (CSG) identity that this eNodeB belongs to",
59 UintegerValue(0),
61 MakeUintegerChecker<uint32_t>())
62 .AddAttribute(
63 "CsgIndication",
64 "If true, only UEs which are members of the CSG (i.e. same CSG ID) "
65 "can gain access to the eNodeB, therefore enforcing closed access mode. "
66 "Otherwise, the eNodeB operates as a non-CSG cell and implements open access mode.",
67 BooleanValue(false),
68 MakeBooleanAccessor(&NrComponentCarrier::SetCsgIndication,
70 MakeBooleanChecker())
71 .AddAttribute(
72 "PrimaryCarrier",
73 "If true, this Carrier Component will be the Primary Carrier Component (PCC) "
74 "Only one PCC per eNodeB is (currently) allowed",
75 BooleanValue(false),
76 MakeBooleanAccessor(&NrComponentCarrier::SetAsPrimary,
78 MakeBooleanChecker());
79 return tid;
80}
81
82NrComponentCarrier::NrComponentCarrier()
83 : Object()
84{
85 NS_LOG_FUNCTION(this);
86}
87
88NrComponentCarrier::~NrComponentCarrier()
89{
90 NS_LOG_FUNCTION(this);
91}
92
93void
94NrComponentCarrier::DoDispose()
95{
96 NS_LOG_FUNCTION(this);
97 Object::DoDispose();
98}
99
100uint16_t
105
106void
108{
109 NS_LOG_FUNCTION(this << bw);
110 switch (bw)
111 {
112 case 6:
113 case 15:
114 case 25:
115 case 50:
116 case 75:
117 case 100:
118 m_ulBandwidth = bw;
119 break;
120
121 default:
122 NS_FATAL_ERROR("Invalid bandwidth value " << bw);
123 break;
124 }
125}
126
127uint16_t
132
133void
135{
136 NS_LOG_FUNCTION(this << bw);
137 switch (bw)
138 {
139 case 6:
140 case 15:
141 case 25:
142 case 50:
143 case 75:
144 case 100:
145 m_dlBandwidth = bw;
146 break;
147
148 default:
149 NS_FATAL_ERROR("Invalid bandwidth value " << bw);
150 break;
151 }
152}
153
154uint32_t
156{
157 return m_dlEarfcn;
158}
159
160void
162{
163 NS_LOG_FUNCTION(this << earfcn);
164 m_dlEarfcn = earfcn;
165}
166
167uint32_t
169{
170 return m_ulEarfcn;
171}
172
173void
175{
176 NS_LOG_FUNCTION(this << earfcn);
177 m_ulEarfcn = earfcn;
178}
179
180uint32_t
182{
183 return m_csgId;
184}
185
186void
188{
189 NS_LOG_FUNCTION(this << csgId);
190 m_csgId = csgId;
191}
192
193bool
198
199void
201{
202 NS_LOG_FUNCTION(this << csgIndication);
203 m_csgIndication = csgIndication;
204}
205
206bool
211
212void
214{
215 NS_LOG_FUNCTION(this << primaryCarrier);
216 m_primaryCarrier = primaryCarrier;
217}
218
219} // namespace ns3
void SetAsPrimary(bool primaryCarrier)
Set as primary carrier.
bool m_csgIndication
CSG indication.
virtual void SetDlBandwidth(uint16_t bw)
uint32_t m_dlEarfcn
downlink carrier frequency *‍/
bool m_primaryCarrier
whether the carrier is primary
uint16_t m_dlBandwidth
downlink bandwidth in RBs *‍/
bool GetCsgIndication() const
Returns the CSG indication flag of the eNodeB.
void SetDlEarfcn(uint32_t earfcn)
uint32_t GetCsgId() const
Returns the CSG ID of the eNodeB.
uint32_t m_ulEarfcn
uplink carrier frequency *‍/
virtual void SetUlBandwidth(uint16_t bw)
bool IsPrimary() const
Checks if the carrier is the primary carrier.
void SetUlEarfcn(uint32_t earfcn)
void SetCsgIndication(bool csgIndication)
Enable or disable the CSG indication flag.
uint16_t m_ulBandwidth
uplink bandwidth in RBs *‍/
void SetCsgId(uint32_t csgId)
Associate the eNodeB device with a particular CSG.
static TypeId GetTypeId()
Get the type ID.