20#include <ns3/boolean.h>
21#include <ns3/double.h>
23#include <ns3/uinteger.h>
45 TypeId(
"ns3::UniformPlanarArray")
47 .AddConstructor<UniformPlanarArray>()
48 .SetGroupName(
"Antenna")
50 "AntennaHorizontalSpacing",
51 "Horizontal spacing between antenna elements, in multiples of wave length",
55 MakeDoubleChecker<double>(0.0))
56 .AddAttribute(
"AntennaVerticalSpacing",
57 "Vertical spacing between antenna elements, in multiples of wave length",
61 MakeDoubleChecker<double>(0.0))
62 .AddAttribute(
"NumColumns",
63 "Horizontal size of the array",
67 MakeUintegerChecker<uint32_t>(1))
68 .AddAttribute(
"NumRows",
69 "Vertical size of the array",
73 MakeUintegerChecker<uint32_t>(1))
74 .AddAttribute(
"BearingAngle",
75 "The bearing angle in radians",
78 MakeDoubleChecker<double>(-M_PI, M_PI))
79 .AddAttribute(
"DowntiltAngle",
80 "The downtilt angle in radians",
83 MakeDoubleChecker<double>(-M_PI, M_PI))
84 .AddAttribute(
"PolSlantAngle",
85 "The polarization slant angle in radians",
89 MakeDoubleChecker<double>(-M_PI, M_PI))
90 .AddAttribute(
"NumVerticalPorts",
91 "Vertical number of ports",
95 MakeUintegerChecker<uint32_t>())
96 .AddAttribute(
"NumHorizontalPorts",
97 "Horizontal number of ports",
101 MakeUintegerChecker<uint32_t>())
102 .AddAttribute(
"IsDualPolarized",
103 "If true, dual polarized antenna",
207std::pair<double, double>
217 double cosIncl = cos(inclination);
218 double sinIncl = sin(inclination);
219 double cosAzim = cos(azimuth -
m_alpha);
220 double sinAzim = sin(azimuth -
m_alpha);
225 Angles aPrime(phiPrime, thetaPrime);
233 double fieldThetaPrime =
235 double fieldPhiPrime =
240 double psi = std::arg(std::complex<double>(
m_cosBeta * sinIncl -
m_sinBeta * cosIncl * cosAzim,
246 double fieldTheta = cos(psi) * fieldThetaPrime - sin(psi) * fieldPhiPrime;
247 double fieldPhi = sin(psi) * fieldThetaPrime + cos(psi) * fieldPhiPrime;
250 << fieldTheta * fieldTheta + fieldPhi * fieldPhi);
252 return std::make_pair(fieldPhi, fieldTheta);
259 uint64_t tmpIndex = index;
302 "The number of vertical ports must divide number of rows");
311 "The number of horizontal ports must divide number of columns");
361 auto firstPolPortIdx = portIndex;
362 auto polarizationOffset = 0;
364 if (firstPolPortIdx >= arraySize)
366 firstPolPortIdx = portIndex - arraySize;
374 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.
virtual double GetGainDb(Angles a)=0
this method is expected to be re-implemented by each antenna model
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...
#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.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
double RadiansToDegrees(double radians)
converts radians to degrees