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