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