23 #include "ns3/double.h" 24 #include "ns3/uinteger.h" 25 #include "ns3/boolean.h" 47 static TypeId tid =
TypeId (
"ns3::ThreeGppAntennaArrayModel")
49 .AddConstructor<ThreeGppAntennaArrayModel> ()
50 .AddAttribute (
"AntennaHorizontalSpacing",
51 "Horizontal spacing between antenna elements, in multiples of wave length",
54 MakeDoubleChecker<double> ())
55 .AddAttribute (
"AntennaVerticalSpacing",
56 "Vertical spacing between antenna elements, in multiples of wave length",
59 MakeDoubleChecker<double> ())
60 .AddAttribute (
"NumColumns",
61 "Horizontal size of the array",
64 MakeUintegerChecker<uint32_t> ())
65 .AddAttribute (
"NumRows",
66 "Vertical size of the array",
69 MakeUintegerChecker<uint32_t> ())
70 .AddAttribute (
"BearingAngle",
71 "The bearing angle in radians",
74 MakeDoubleChecker<double> (-M_PI, M_PI))
75 .AddAttribute (
"DowntiltAngle",
76 "The downtilt angle in radians",
79 MakeDoubleChecker<double> (0, M_PI))
80 .AddAttribute (
"ElementGain",
81 "Directional gain of an antenna element in dBi",
84 MakeDoubleChecker<double> (0, 8))
85 .AddAttribute (
"IsotropicElements",
86 "If true, use an isotropic radiation pattern (for testing purposes)",
123 std::pair<double, double>
129 a.
phi = fmod (a.
phi + M_PI, 2 * M_PI);
136 NS_ASSERT_MSG (a.
phi >= -M_PI && a.
phi <= M_PI,
"The horizontal angle should be between -M_PI and M_PI");
145 double aPrime = pow (10, aPrimeDb / 10);
156 double fieldThetaPrime = std::sqrt (aPrime);
160 double fieldTheta = cos (psi) * fieldThetaPrime;
161 double fieldPhi = sin (psi) * fieldThetaPrime;
162 NS_LOG_DEBUG (a.
phi/M_PI*180 <<
" " << a.
theta/M_PI*180 <<
" " << fieldTheta*fieldTheta + fieldPhi*fieldPhi);
164 return std::make_pair (fieldPhi, fieldTheta);
176 double thetaDeg = thetaRadian * 180 / M_PI;
177 double phiDeg = phiRadian * 180 / M_PI;
178 NS_ASSERT_MSG (thetaDeg >= 0 && thetaDeg <= 180,
"the vertical angle should be the range of [0,180]");
179 NS_ASSERT_MSG (phiDeg >= -180 && phiDeg <= 180,
"the horizontal angle should be the range of [-180,180]");
186 double A_v = -1 *
std::min (SLA,12 * pow ((thetaDeg - 90) / 65,2));
187 double A_h = -1 *
std::min (A_M,12 * pow (phiDeg / 65,2));
virtual uint64_t GetNumberOfElements(void) const
Returns the number of antenna elements.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
std::vector< std::complex< double > > ComplexVector
type definition for complex vectors
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
double m_disH
antenna spacing in the horizontal direction in multiples of wave length
bool m_isOmniTx
true if the antenna is configured for omni transmissions
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
double theta
the inclination angle in radians
ThreeGppAntennaArrayModel(void)
Constructor.
virtual Vector GetElementLocation(uint64_t index) const
Returns the location of the antenna element with the specified index assuming the left bottom corner ...
uint32_t m_numRows
number of rows
uint32_t m_numColumns
number of columns
double m_disV
antenna spacing in the vertical direction in multiples of wave length
Hold an unsigned integer type.
virtual ~ThreeGppAntennaArrayModel(void)
Destructor.
double m_alpha
the bearing angle in radians
void SetBeamformingVector(const ComplexVector &beamformingVector)
Sets the beamforming vector to be used.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_gE
directional gain of a single antenna element (dBi)
ComplexVector m_beamformingVector
the beamforming vector in use
const ComplexVector & GetBeamformingVector(void) const
Returns the beamforming vector that is currently being used.
static TypeId GetTypeId(void)
#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 AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
double m_beta
the downtilt angle in radians
bool IsOmniTx(void) const
Returns true if the antenna is configured for omnidirectional transmissions.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
double phi
the azimuth angle in radians
double GetRadiationPattern(double vAngleRadian, double hAngleRadian) const
Returns the radiation power pattern of a single antenna element in dB, generated according to Table 7...
bool m_isIsotropic
if true, antenna elements are isotropic
void ChangeToOmniTx(void)
Change the antenna model to omnidirectional (ignoring the beams)
struct holding the azimuth and inclination angles of spherical coordinates.
A base class which provides memory management and object aggregation.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::pair< double, double > GetElementFieldPattern(Angles a) const
Returns the horizontal and vertical components of the antenna element field pattern at the specified ...