9#include "ns3/boolean.h"
10#include "ns3/double.h"
12#include "ns3/uinteger.h"
34 TypeId(
"ns3::UniformPlanarArray")
36 .AddConstructor<UniformPlanarArray>()
37 .SetGroupName(
"Antenna")
39 "AntennaHorizontalSpacing",
40 "Horizontal spacing between antenna elements, in multiples of wave length",
45 .AddAttribute(
"AntennaVerticalSpacing",
46 "Vertical spacing between antenna elements, in multiples of wave length",
51 .AddAttribute(
"NumColumns",
52 "Horizontal size of the array",
57 .AddAttribute(
"NumRows",
58 "Vertical size of the array",
65 "The bearing angle in radians",
71 "The downtilt angle in radians",
75 .AddAttribute(
"PolSlantAngle",
76 "The polarization slant angle in radians",
81 .AddAttribute(
"NumVerticalPorts",
82 "Vertical number of ports",
87 .AddAttribute(
"NumHorizontalPorts",
88 "Horizontal number of ports",
93 .AddAttribute(
"IsDualPolarized",
94 "If true, dual polarized antenna",
198std::pair<double, double>
208 double cosIncl = cos(inclination);
209 double sinIncl = sin(inclination);
210 double cosAzim = cos(azimuth -
m_alpha);
211 double sinAzim = sin(azimuth -
m_alpha);
216 Angles aPrime(phiPrime, thetaPrime);
224 double fieldThetaPrime =
226 double fieldPhiPrime =
231 double psi = std::arg(std::complex<double>(
m_cosBeta * sinIncl -
m_sinBeta * cosIncl * cosAzim,
237 double fieldTheta = cos(psi) * fieldThetaPrime - sin(psi) * fieldPhiPrime;
238 double fieldPhi = sin(psi) * fieldThetaPrime + cos(psi) * fieldPhiPrime;
241 << fieldTheta * fieldTheta + fieldPhi * fieldPhi);
243 return std::make_pair(fieldPhi, fieldTheta);
250 uint64_t tmpIndex = index;
293 "The number of vertical ports must divide number of rows");
302 "The number of horizontal ports must divide number of columns");
352 auto firstPolPortIdx = portIndex;
353 auto polarizationOffset = 0;
355 if (firstPolPortIdx >= arraySize)
357 firstPolPortIdx = portIndex - arraySize;
365 return (vElemIdx *
GetNumColumns() + hElemIdx + polarizationOffset);
Class holding the azimuth and inclination angles of spherical coordinates.
double GetInclination() const
Getter for inclination angle.
double GetAzimuth() const
Getter for azimuth angle.
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Class implementing the phased array model virtual base class.
Ptr< AntennaModel > m_antennaElement
the model of the antenna element in use
bool m_isBfVectorValid
ensures the validity of the beamforming vector
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RadiansToDegrees(double radians)
converts radians to degrees