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 polarization angle of first polarization
84 * \return polarization angle in radians
85 */
86 double GetPolSlant() const override;
87
88 /**
89 * Returns the number of polarizations, 2 in the case that
90 * the antenna is dual-polarized, otherwise 1
91 * \return
92 */
93 uint8_t GetNumPols() const override;
94
95 /**
96 * Returns the number of total antenna elements. Note that if the antenna
97 * is dual-polarized the number of total antenna elements is doubled.
98 * \return the number of antenna elements
99 */
100 size_t GetNumElems() const override;
101
102 /**
103 * Set the number of columns of the phased array
104 * This method resets the stored beamforming vector to a ComplexVector
105 * of the correct size, but zero-filled
106 * \param n the number of columns
107 */
108 void SetNumColumns(uint32_t n) override;
109
110 /**
111 * Get the number of columns of the phased array
112 * \return the number of columns
113 */
114 uint32_t GetNumColumns() const override;
115
116 /**
117 * Set the number of rows of the phased array
118 * This method resets the stored beamforming vector to a ComplexVector
119 * of the correct size, but zero-filled
120 * \param n the number of rows
121 */
122 void SetNumRows(uint32_t n) override;
123
124 /**
125 * Get the number of rows of the phased array
126 * \return the number of rows
127 */
128 uint32_t GetNumRows() const override;
129
130 /**
131 * Set the number of vertical antenna ports
132 * \param nPorts The number of vertical ports to be configured
133 */
134 void SetNumVerticalPorts(uint16_t nPorts) override;
135
136 /**
137 * Set the number of horizontal antenna ports
138 * \param nPorts
139 */
140 void SetNumHorizontalPorts(uint16_t nPorts) override;
141
142 /**
143 * Get the number of vertical antenna ports
144 * \return the number of vertical antenna ports
145 */
146 uint16_t GetNumVerticalPorts() const override;
147
148 /**
149 * Get the number of horizontal antenna ports
150 * \return the number of horizontal antenna ports
151 */
152 uint16_t GetNumHorizontalPorts() const override;
153
154 /**
155 * Get the total number of antenna ports
156 * \return the number of antenna ports
157 */
158 uint16_t GetNumPorts() const override;
159
160 /**
161 * Get the number of vertical elements belonging to each port
162 * \return the number of vertical elements belonging of each port
163 */
164 size_t GetVElemsPerPort() const override;
165
166 /**
167 * Get the number of horizontal elements belonging to each port
168 * \return the number of horizontal elements belonging to each port
169 */
170 size_t GetHElemsPerPort() const override;
171
172 /**
173 * Get the total number of elements belonging to each port
174 * \return the number of elements per port
175 */
176 size_t GetNumElemsPerPort() const override;
177
178 /**
179 * Maps element within a port to an index of element within the antenna array
180 * \param portIndex the port index
181 * \param subElementIndex the element index within the port
182 * \return the element index in the antenna array
183 */
184 uint16_t ArrayIndexFromPortIndex(uint16_t portIndex, uint16_t subElementIndex) const override;
185
186 /**
187 * \brief Set the bearing angle
188 * This method sets the bearing angle and
189 * computes its cosine and sine
190 * \param alpha the bearing angle in radians
191 */
192 void SetAlpha(double alpha);
193
194 /**
195 * \brief Set the downtilt angle
196 * This method sets the downtilt angle and
197 * computes its cosine and sine
198 * \param beta the downtilt angle in radians
199 */
200 void SetBeta(double beta);
201
202 /**
203 * \brief Set the polarization slant angle
204 * This method sets the polarization slant angle and
205 * computes its cosine and sine
206 * \param polSlant the polarization slant angle in radians
207 */
208 void SetPolSlant(double polSlant);
209
210 /**
211 * Set the horizontal spacing for the antenna elements of the phased array
212 * This method resets the stored beamforming vector to a ComplexVector
213 * of the correct size, but zero-filled
214 * \param s the horizontal spacing in multiples of wavelength
215 */
216 void SetAntennaHorizontalSpacing(double s);
217
218 /**
219 * Get the horizontal spacing for the antenna elements of the phased array
220 * \return the horizontal spacing in multiples of wavelength
221 */
222 double GetAntennaHorizontalSpacing() const;
223
224 /**
225 * Set the vertical spacing for the antenna elements of the phased array
226 * This method resets the stored beamforming vector to a ComplexVector
227 * of the correct size, but zero-filled
228 * \param s the vertical spacing in multiples of wavelength
229 */
230 void SetAntennaVerticalSpacing(double s);
231
232 /**
233 * Get the vertical spacing for the antenna elements of the phased array
234 * \return the vertical spacing in multiples of wavelength
235 */
236 double GetAntennaVerticalSpacing() const;
237
238 /**
239 * Set the polarization
240 * \param isDualPol whether to set the antenna array to be dual-polarized,
241 * if true, antenna will be dual-polarized
242 */
243 void SetDualPol(bool isDualPol);
244
245 /**
246 * Returns the index of polarization to which belongs the antenna element with a specific index
247 * \param elemIndex the antenna element index
248 * \return the polarization index
249 */
250 uint8_t GetElemPol(size_t elemIndex) const override;
251
252 private:
253 uint32_t m_numColumns{1}; //!< number of columns
254 uint32_t m_numRows{1}; //!< number of rows
255 double m_disV{0.5}; //!< antenna spacing in the vertical direction in multiples of wave length
256 double m_disH{0.5}; //!< antenna spacing in the horizontal direction in multiples of wave length
257 double m_alpha{0.0}; //!< the bearing angle in radians
258 double m_cosAlpha{1.0}; //!< the cosine of alpha
259 double m_sinAlpha{0.0}; //!< the sine of alpha
260 double m_beta{0.0}; //!< the downtilt angle in radians
261 double m_cosBeta{1.0}; //!< the cosine of Beta
262 double m_sinBeta{0.0}; //!< the sine of Beta
263 double m_polSlant{0.0}; //!< the polarization slant angle in radians
264 bool m_isDualPolarized{false}; //!< if true antenna elements are dual-polarized
265 uint16_t m_numVPorts{1}; //!< Number of vertical ports
266 uint16_t m_numHPorts{1}; //!< Number of horizontal ports
267 std::vector<double> m_cosPolSlant{1.0, 0.0}; //!< the cosine of polarization slant angle
268 std::vector<double> m_sinPolSlant{0.0, -1.0}; //!< the sine polarization slant angle
269};
270
271} /* namespace ns3 */
272
273#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:48
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.