13#include <ns3/double.h>
29 TypeId(
"ns3::CosineAntennaModel")
31 .SetGroupName(
"Antenna")
33 .AddAttribute(
"VerticalBeamwidth",
34 "The 3 dB vertical beamwidth (degrees). A beamwidth of 360 deg "
35 "corresponds to constant gain",
40 .AddAttribute(
"HorizontalBeamwidth",
41 "The 3 dB horizontal beamwidth (degrees). A beamwidth of 360 deg "
42 "corresponds to constant gain",
47 .AddAttribute(
"Orientation",
48 "The angle (degrees) that expresses the orientation of the antenna on "
49 "the x-y plane relative to the x axis",
54 .AddAttribute(
"MaxGain",
55 "The gain (dB) at the antenna boresight (the direction of maximum gain)",
73 if (beamwidthDegrees == 360.0)
79 exponent = -3.0 / (20 * std::log10(std::cos(
DegreesToRadians(beamwidthDegrees / 4.0))));
93 double beamwidthRadians = 4 * std::acos(std::pow(0.5, 1 / (2 * exponent)));
152 double gainDb = 10 * std::log10(gain);
Class holding the azimuth and inclination angles of spherical coordinates.
double GetInclination() const
Getter for inclination angle.
void SetAzimuth(double azimuth)
Setter for azimuth angle.
double GetAzimuth() const
Getter for azimuth angle.
interface for antenna radiation pattern models
double m_maxGain
antenna gain in dB towards the main orientation
void SetHorizontalBeamwidth(double horizontalBeamwidthDegrees)
Set the horizontal 3 dB beamwidth (bilateral) of the cosine antenna model.
double GetHorizontalBeamwidth() const
Get the horizontal 3 dB beamwidth of the cosine antenna model.
double GetGainDb(Angles a) override
this method is expected to be re-implemented by each antenna model
double GetOrientation() const
Get the horizontal orientation of the antenna element.
static double GetBeamwidthFromExponent(double exponent)
Compute the beamwidth of the cosine antenna model from the exponent.
static double GetExponentFromBeamwidth(double beamwidthDegrees)
Compute the exponent of the cosine antenna model from the beamwidth.
static TypeId GetTypeId()
Get the type ID.
double GetVerticalBeamwidth() const
Get the vertical 3 dB beamwidth of the cosine antenna model.
double m_verticalExponent
exponent of the vertical direction
void SetVerticalBeamwidth(double verticalBeamwidthDegrees)
Set the vertical 3 dB beamwidth (bilateral) of the cosine antenna model.
void SetOrientation(double orientationDegrees)
Set the horizontal orientation of the antenna element.
double m_orientationRadians
orientation in radians in the horizontal direction (bearing)
double m_horizontalExponent
exponent of the horizontal direction
This class can be used to hold variables of floating point type such as 'double' or 'float'.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#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 > MakeDoubleChecker()
double DegreesToRadians(double degrees)
converts degrees to radians
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
double RadiansToDegrees(double radians)
converts radians to degrees