A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
cc-helper.h
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#ifndef CC_HELPER_H
21#define CC_HELPER_H
22
23#include <ns3/component-carrier.h>
24#include <ns3/config.h>
25#include <ns3/names.h>
26#include <ns3/net-device-container.h>
27#include <ns3/net-device.h>
28#include <ns3/node-container.h>
29#include <ns3/node.h>
30#include <ns3/simulator.h>
31
32#include <map>
33
34namespace ns3
35{
36
37/**
38 * \ingroup lte
39 *
40 * Creation and configuration of Component Carrier entities. One CcHelper instance is
41 * typically enough for an LTE simulation. To create it:
42 *
43 * Ptr<CcHelper> ccHelper = CreateObject<CcHelper> ();
44 *
45 * The general responsibility of the helper is to create various Component Carrier objects
46 * and arrange them together to set the eNodeB. The overall
47 * arrangement would look like the following:
48 * - Ul Bandwidths
49 * - Dl Bandwidths
50 * - Ul Earfcn
51 * - Dl Earfcn
52 *
53 *
54 * This helper it is also used within the LteHelper in order to maintain backwards compatibility
55 * with previous user simulation script.
56 */
57class CcHelper : public Object
58{
59 public:
60 CcHelper();
61 ~CcHelper() override;
62
63 /**
64 * Register this type.
65 * \return The object TypeId.
66 */
67 static TypeId GetTypeId();
68 void DoDispose() override;
69
70 /**
71 * Create single CC.
72 *
73 * \param ulBandwidth the UL bandwidth
74 * \param dlBandwidth the DL bandwidth
75 * \param ulEarfcn the UL EARFCN
76 * \param dlEarfcn the DL EARFCN
77 * \param isPrimary true if primary
78 * \returns the component carrier
79 */
80 ComponentCarrier DoCreateSingleCc(uint16_t ulBandwidth,
81 uint16_t dlBandwidth,
82 uint32_t ulEarfcn,
83 uint32_t dlEarfcn,
84 bool isPrimary);
85
86 /**
87 * Set an attribute for the Component Carrier to be created.
88 *
89 * \param n the name of the attribute.
90 * \param v the value of the attribute
91 */
92 void SetCcAttribute(std::string n, const AttributeValue& v);
93
94 /**
95 * EquallySpacedCcs() create a valid std::map< uint8_t, Ptr<ComponentCarrier> >
96 * The Primary Component Carrier it is at the position 0 in the map
97 * The number of Component Carrier created depend on m_noOfCcs
98 * Currently it is limited to maximum 2 ComponentCarrier
99 * Since, only a LteEnbPhy object is available just symmetric Carrier Aggregation scheme
100 * are allowed, i.e. 2 Uplink Component Carrier and 2 Downlink Component Carrier
101 * Using this method, each CC will have the same characteristics (bandwidth)
102 * while they are spaced by exactly the bandwidth. Hence, using this method,
103 * you will create a intra-channel Carrier Aggregation scheme.
104 *
105 * \returns std::map< uint8_t, Ptr<ComponentCarrier> >
106 */
107
108 std::map<uint8_t, ComponentCarrier> EquallySpacedCcs();
109
110 /**
111 * Set number of CCs.
112 *
113 * \param nCc the number of CCs
114 */
115 void SetNumberOfComponentCarriers(uint16_t nCc);
116 /**
117 * Set UL EARFCN.
118 *
119 * \param ulEarfcn the UL EARFCN
120 */
121 void SetUlEarfcn(uint32_t ulEarfcn);
122 /**
123 * Set DL EARFCN.
124 *
125 * \param dlEarfcn the DL EARFCN
126 */
127 void SetDlEarfcn(uint32_t dlEarfcn);
128 /**
129 * Set DL bandwidth.
130 *
131 * \param dlBandwidth the DL bandwidth
132 */
133 void SetDlBandwidth(uint16_t dlBandwidth);
134 /**
135 * Set UL bandwidth.
136 *
137 * \param ulBandwidth the UL bandwidth
138 */
139 void SetUlBandwidth(uint16_t ulBandwidth);
140 /**
141 * Get number of component carriers.
142 *
143 * \returns the number of component carriers
144 */
145 uint16_t GetNumberOfComponentCarriers() const;
146 /**
147 * Get UL EARFCN.
148 *
149 * \returns the UL EARFCN
150 */
151 uint32_t GetUlEarfcn() const;
152 /**
153 * Get DL EARFCN.
154 *
155 * \returns the DL EARFCN
156 */
157 uint32_t GetDlEarfcn() const;
158 /**
159 * Get DL bandwidth.
160 *
161 * \returns the DL bandwidth
162 */
163 uint16_t GetDlBandwidth() const;
164 /**
165 * Get UL bandwidth.
166 *
167 * \returns the UL bandwidth
168 */
169 uint16_t GetUlBandwidth() const;
170
171 protected:
172 // inherited from Object
173 void DoInitialize() override;
174
175 private:
176 /**
177 * Create a single component carrier.
178 *
179 * \param ulBandwidth uplink bandwidth for the current CC
180 * \param dlBandwidth downlink bandwidth for the current CC
181 * \param ulEarfcn uplink EARFCN - not control on the validity at this point
182 * \param dlEarfcn downlink EARFCN - not control on the validity at this point
183 * \param isPrimary identify if this is the Primary Component Carrier (PCC) - only one
184 * PCC is allowed
185 * \return the component carrier
186 */
187 ComponentCarrier CreateSingleCc(uint16_t ulBandwidth,
188 uint16_t dlBandwidth,
189 uint32_t ulEarfcn,
190 uint32_t dlEarfcn,
191 bool isPrimary) const;
192
193 /// Factory for each Carrier Component.
195
196 uint32_t m_ulEarfcn; ///< Uplink EARFCN
197 uint32_t m_dlEarfcn; ///< Downlink EARFCN
198 uint16_t m_dlBandwidth; ///< Downlink Bandwidth
199 uint16_t m_ulBandwidth; ///< Uplink Bandwidth
200 uint16_t m_numberOfComponentCarriers; ///< Number of component carriers
201
202}; // end of `class LteHelper`
203
204} // namespace ns3
205
206#endif // LTE_HELPER_H
Hold a value for an Attribute.
Definition: attribute.h:70
Creation and configuration of Component Carrier entities.
Definition: cc-helper.h:58
uint32_t GetUlEarfcn() const
Get UL EARFCN.
Definition: cc-helper.cc:147
ObjectFactory m_ccFactory
Factory for each Carrier Component.
Definition: cc-helper.h:194
void SetNumberOfComponentCarriers(uint16_t nCc)
Set number of CCs.
Definition: cc-helper.cc:111
ComponentCarrier DoCreateSingleCc(uint16_t ulBandwidth, uint16_t dlBandwidth, uint32_t ulEarfcn, uint32_t dlEarfcn, bool isPrimary)
Create single CC.
Definition: cc-helper.cc:171
void SetDlEarfcn(uint32_t dlEarfcn)
Set DL EARFCN.
Definition: cc-helper.cc:123
void DoDispose() override
Destructor implementation.
Definition: cc-helper.cc:97
uint16_t GetDlBandwidth() const
Get DL bandwidth.
Definition: cc-helper.cc:159
uint32_t GetDlEarfcn() const
Get DL EARFCN.
Definition: cc-helper.cc:153
void SetUlBandwidth(uint16_t ulBandwidth)
Set UL bandwidth.
Definition: cc-helper.cc:135
~CcHelper() override
Definition: cc-helper.cc:91
void SetDlBandwidth(uint16_t dlBandwidth)
Set DL bandwidth.
Definition: cc-helper.cc:129
uint16_t m_numberOfComponentCarriers
Number of component carriers.
Definition: cc-helper.h:200
uint16_t GetUlBandwidth() const
Get UL bandwidth.
Definition: cc-helper.cc:165
uint16_t m_ulBandwidth
Uplink Bandwidth.
Definition: cc-helper.h:199
uint16_t m_dlBandwidth
Downlink Bandwidth.
Definition: cc-helper.h:198
static TypeId GetTypeId()
Register this type.
Definition: cc-helper.cc:55
std::map< uint8_t, ComponentCarrier > EquallySpacedCcs()
EquallySpacedCcs() create a valid std::map< uint8_t, Ptr<ComponentCarrier> > The Primary Component Ca...
Definition: cc-helper.cc:181
void SetUlEarfcn(uint32_t ulEarfcn)
Set UL EARFCN.
Definition: cc-helper.cc:117
uint16_t GetNumberOfComponentCarriers() const
Get number of component carriers.
Definition: cc-helper.cc:141
void DoInitialize() override
Initialize() implementation.
Definition: cc-helper.cc:49
uint32_t m_ulEarfcn
Uplink EARFCN.
Definition: cc-helper.h:196
uint32_t m_dlEarfcn
Downlink EARFCN.
Definition: cc-helper.h:197
void SetCcAttribute(std::string n, const AttributeValue &v)
Set an attribute for the Component Carrier to be created.
Definition: cc-helper.cc:104
ComponentCarrier CreateSingleCc(uint16_t ulBandwidth, uint16_t dlBandwidth, uint32_t ulEarfcn, uint32_t dlEarfcn, bool isPrimary) const
Create a single component carrier.
Definition: cc-helper.cc:230
ComponentCarrier Object, it defines a single Carrier This is the parent class for both ComponentCarri...
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.