A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uniform-planar-array.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 University of Padova, Dep. of Information Engineering, SIGNET lab.
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#ifndef UNIFORM_PLANAR_ARRAY_H
8#define UNIFORM_PLANAR_ARRAY_H
9
10#include "phased-array-model.h"
11
12#include "ns3/object.h"
13
14namespace ns3
15{
16
17/**
18 * @ingroup antenna
19 *
20 * @brief Class implementing Uniform Planar Array (UPA) model.
21 *
22 * @note the current implementation supports the modeling of antenna arrays
23 * composed of a single panel and with single or dual polarization.
24 */
26{
27 public:
28 /**
29 * Constructor
30 */
32
33 /**
34 * Destructor
35 */
36 ~UniformPlanarArray() override;
37
38 /**
39 * @brief Get the type ID.
40 * @return The object TypeId.
41 */
42 static TypeId GetTypeId();
43
44 /**
45 * Returns the horizontal and vertical components of the antenna element field
46 * pattern at the specified direction and for the specified polarization.
47 * @param a the angle indicating the interested direction
48 * @param polIndex the index of the polarization for which will be retrieved the field
49 * pattern
50 * @return a pair in which the first element is the horizontal component
51 * of the field pattern and the second element is the vertical
52 * component of the field pattern
53 */
54 std::pair<double, double> GetElementFieldPattern(Angles a, uint8_t polIndex = 0) const override;
55
56 /**
57 * Returns the location of the antenna element with the specified
58 * index assuming the left bottom corner is (0,0,0), normalized
59 * with respect to the wavelength.
60 * Antenna elements are scanned row by row, left to right and bottom to top.
61 * For example, an antenna with 2 rows and 3 columns will be ordered as follows:
62 * ^ z
63 * | 3 4 5
64 * | 0 1 2
65 * ----------> y
66 * In case of dual-polarized antennas, the antennas of the first and the second polarization
67 * are overlapped in space.
68 *
69 * @param index index of the antenna element
70 * @return the 3D vector that
71 * represents the position of the element
72 */
73 Vector GetElementLocation(uint64_t index) const override;
74
75 /**
76 * Check if an antenna array contains dual-polarized elements
77 *
78 * @return true if antenna has two polarization otherwise false
79 */
80 bool IsDualPol() const override;
81
82 /**
83 * Returns bearing angle of first polarization
84 * @return bearing angle in radians
85 */
86 double GetAlpha() const;
87
88 /**
89 * Returns downtilt angle of first polarization
90 * @return downtilt angle in radians
91 */
92 double GetBeta() const;
93
94 /**
95 * Returns polarization angle of first polarization
96 * @return polarization angle in radians
97 */
98 double GetPolSlant() const override;
99
100 /**
101 * Returns the number of polarizations, 2 in the case that
102 * the antenna is dual-polarized, otherwise 1
103 * @return
104 */
105 uint8_t GetNumPols() const override;
106
107 /**
108 * Returns the number of total antenna elements. Note that if the antenna
109 * is dual-polarized the number of total antenna elements is doubled.
110 * @return the number of antenna elements
111 */
112 size_t GetNumElems() const override;
113
114 /**
115 * Set the number of columns of the phased array
116 * This method resets the stored beamforming vector to a ComplexVector
117 * of the correct size, but zero-filled
118 * @param n the number of columns
119 */
120 void SetNumColumns(uint32_t n) override;
121
122 /**
123 * Get the number of columns of the phased array
124 * @return the number of columns
125 */
126 uint32_t GetNumColumns() const override;
127
128 /**
129 * Set the number of rows of the phased array
130 * This method resets the stored beamforming vector to a ComplexVector
131 * of the correct size, but zero-filled
132 * @param n the number of rows
133 */
134 void SetNumRows(uint32_t n) override;
135
136 /**
137 * Get the number of rows of the phased array
138 * @return the number of rows
139 */
140 uint32_t GetNumRows() const override;
141
142 /**
143 * Set the number of vertical antenna ports
144 * @param nPorts The number of vertical ports to be configured
145 */
146 void SetNumVerticalPorts(uint16_t nPorts) override;
147
148 /**
149 * Set the number of horizontal antenna ports
150 * @param nPorts
151 */
152 void SetNumHorizontalPorts(uint16_t nPorts) override;
153
154 /**
155 * Get the number of vertical antenna ports
156 * @return the number of vertical antenna ports
157 */
158 uint16_t GetNumVerticalPorts() const override;
159
160 /**
161 * Get the number of horizontal antenna ports
162 * @return the number of horizontal antenna ports
163 */
164 uint16_t GetNumHorizontalPorts() const override;
165
166 /**
167 * Get the total number of antenna ports
168 * @return the number of antenna ports
169 */
170 uint16_t GetNumPorts() const override;
171
172 /**
173 * Get the number of vertical elements belonging to each port
174 * @return the number of vertical elements belonging of each port
175 */
176 size_t GetVElemsPerPort() const override;
177
178 /**
179 * Get the number of horizontal elements belonging to each port
180 * @return the number of horizontal elements belonging to each port
181 */
182 size_t GetHElemsPerPort() const override;
183
184 /**
185 * Get the total number of elements belonging to each port
186 * @return the number of elements per port
187 */
188 size_t GetNumElemsPerPort() const override;
189
190 /**
191 * Maps element within a port to an index of element within the antenna array
192 * @param portIndex the port index
193 * @param subElementIndex the element index within the port
194 * @return the element index in the antenna array
195 */
196 uint16_t ArrayIndexFromPortIndex(uint16_t portIndex, uint16_t subElementIndex) const override;
197
198 /**
199 * @brief Set the bearing angle
200 * This method sets the bearing angle and
201 * computes its cosine and sine
202 * @param alpha the bearing angle in radians
203 */
204 void SetAlpha(double alpha);
205
206 /**
207 * @brief Set the downtilt angle
208 * This method sets the downtilt angle and
209 * computes its cosine and sine
210 * @param beta the downtilt angle in radians
211 */
212 void SetBeta(double beta);
213
214 /**
215 * @brief Set the polarization slant angle
216 * This method sets the polarization slant angle and
217 * computes its cosine and sine
218 * @param polSlant the polarization slant angle in radians
219 */
220 void SetPolSlant(double polSlant);
221
222 /**
223 * Set the horizontal spacing for the antenna elements of the phased array
224 * This method resets the stored beamforming vector to a ComplexVector
225 * of the correct size, but zero-filled
226 * @param s the horizontal spacing in multiples of wavelength
227 */
228 void SetAntennaHorizontalSpacing(double s);
229
230 /**
231 * Get the horizontal spacing for the antenna elements of the phased array
232 * @return the horizontal spacing in multiples of wavelength
233 */
234 double GetAntennaHorizontalSpacing() const;
235
236 /**
237 * Set the vertical spacing for the antenna elements of the phased array
238 * This method resets the stored beamforming vector to a ComplexVector
239 * of the correct size, but zero-filled
240 * @param s the vertical spacing in multiples of wavelength
241 */
242 void SetAntennaVerticalSpacing(double s);
243
244 /**
245 * Get the vertical spacing for the antenna elements of the phased array
246 * @return the vertical spacing in multiples of wavelength
247 */
248 double GetAntennaVerticalSpacing() const;
249
250 /**
251 * Set the polarization
252 * @param isDualPol whether to set the antenna array to be dual-polarized,
253 * if true, antenna will be dual-polarized
254 */
255 void SetDualPol(bool isDualPol);
256
257 /**
258 * Returns the index of polarization to which belongs the antenna element with a specific index
259 * @param elemIndex the antenna element index
260 * @return the polarization index
261 */
262 uint8_t GetElemPol(size_t elemIndex) const override;
263
264 private:
265 uint32_t m_numColumns{1}; //!< number of columns
266 uint32_t m_numRows{1}; //!< number of rows
267 double m_disV{0.5}; //!< antenna spacing in the vertical direction in multiples of wave length
268 double m_disH{0.5}; //!< antenna spacing in the horizontal direction in multiples of wave length
269 double m_alpha{0.0}; //!< the bearing angle in radians
270 double m_cosAlpha{1.0}; //!< the cosine of alpha
271 double m_sinAlpha{0.0}; //!< the sine of alpha
272 double m_beta{0.0}; //!< the downtilt angle in radians
273 double m_cosBeta{1.0}; //!< the cosine of Beta
274 double m_sinBeta{0.0}; //!< the sine of Beta
275 double m_polSlant{0.0}; //!< the polarization slant angle in radians
276 bool m_isDualPolarized{false}; //!< if true antenna elements are dual-polarized
277 uint16_t m_numVPorts{1}; //!< Number of vertical ports
278 uint16_t m_numHPorts{1}; //!< Number of horizontal ports
279 std::vector<double> m_cosPolSlant{1.0, 0.0}; //!< the cosine of polarization slant angle
280 std::vector<double> m_sinPolSlant{0.0, -1.0}; //!< the sine polarization slant angle
281};
282
283} /* namespace ns3 */
284
285#endif /* UNIFORM_PLANAR_ARRAY_H */
Class holding the azimuth and inclination angles of spherical coordinates.
Definition angles.h:107
Class implementing the phased array model virtual base class.
a unique identifier for an interface.
Definition type-id.h:49
Class implementing Uniform Planar Array (UPA) model.
double m_disV
antenna spacing in the vertical direction in multiples of wave length
double m_sinAlpha
the sine of alpha
void SetPolSlant(double polSlant)
Set the polarization slant angle This method sets the polarization slant angle and computes its cosin...
uint16_t GetNumPorts() const override
Get the total number of antenna ports.
double m_disH
antenna spacing in the horizontal direction in multiples of wave length
void SetBeta(double beta)
Set the downtilt angle This method sets the downtilt angle and computes its cosine and sine.
bool m_isDualPolarized
if true antenna elements are dual-polarized
uint16_t ArrayIndexFromPortIndex(uint16_t portIndex, uint16_t subElementIndex) const override
Maps element within a port to an index of element within the antenna array.
void SetNumRows(uint32_t n) override
Set the number of rows of the phased array This method resets the stored beamforming vector to a Comp...
bool IsDualPol() const override
Check if an antenna array contains dual-polarized elements.
static TypeId GetTypeId()
Get the type ID.
void SetAlpha(double alpha)
Set the bearing angle This method sets the bearing angle and computes its cosine and sine.
void SetNumColumns(uint32_t n) override
Set the number of columns of the phased array This method resets the stored beamforming vector to a C...
double GetAntennaVerticalSpacing() const
Get the vertical spacing for the antenna elements of the phased array.
uint16_t GetNumVerticalPorts() const override
Get the number of vertical antenna ports.
uint16_t m_numVPorts
Number of vertical ports.
std::pair< double, double > GetElementFieldPattern(Angles a, uint8_t polIndex=0) const override
Returns the horizontal and vertical components of the antenna element field pattern at the specified ...
double m_polSlant
the polarization slant angle in radians
uint8_t GetElemPol(size_t elemIndex) const override
Returns the index of polarization to which belongs the antenna element with a specific index.
uint32_t GetNumRows() const override
Get the number of rows of the phased array.
double GetPolSlant() const override
Returns polarization angle of first polarization.
double m_cosBeta
the cosine of Beta
void SetAntennaVerticalSpacing(double s)
Set the vertical spacing for the antenna elements of the phased array This method resets the stored b...
double GetAntennaHorizontalSpacing() const
Get the horizontal spacing for the antenna elements of the phased array.
~UniformPlanarArray() override
Destructor.
uint32_t m_numRows
number of rows
Vector GetElementLocation(uint64_t index) const override
Returns the location of the antenna element with the specified index assuming the left bottom corner ...
uint32_t m_numColumns
number of columns
double m_alpha
the bearing angle in radians
uint16_t GetNumHorizontalPorts() const override
Get the number of horizontal antenna ports.
uint16_t m_numHPorts
Number of horizontal ports.
void SetDualPol(bool isDualPol)
Set the polarization.
size_t GetHElemsPerPort() const override
Get the number of horizontal elements belonging to each port.
void SetNumVerticalPorts(uint16_t nPorts) override
Set the number of vertical antenna ports.
size_t GetVElemsPerPort() const override
Get the number of vertical elements belonging to each port.
uint32_t GetNumColumns() const override
Get the number of columns of the phased array.
void SetNumHorizontalPorts(uint16_t nPorts) override
Set the number of horizontal antenna ports.
std::vector< double > m_cosPolSlant
the cosine of polarization slant angle
double GetAlpha() const
Returns bearing angle of first polarization.
double GetBeta() const
Returns downtilt angle of first polarization.
double m_sinBeta
the sine of Beta
size_t GetNumElems() const override
Returns the number of total antenna elements.
void SetAntennaHorizontalSpacing(double s)
Set the horizontal spacing for the antenna elements of the phased array This method resets the stored...
double m_beta
the downtilt angle in radians
double m_cosAlpha
the cosine of alpha
size_t GetNumElemsPerPort() const override
Get the total number of elements belonging to each port.
uint8_t GetNumPols() const override
Returns the number of polarizations, 2 in the case that the antenna is dual-polarized,...
std::vector< double > m_sinPolSlant
the sine polarization slant angle
Every class exported by the ns3 library is enclosed in the ns3 namespace.