24 #include <ns3/double.h>
40 TypeId(
"ns3::CosineAntennaModel")
42 .SetGroupName(
"Antenna")
44 .AddAttribute(
"VerticalBeamwidth",
45 "The 3 dB vertical beamwidth (degrees). A beamwidth of 360 deg "
46 "corresponds to constant gain",
50 MakeDoubleChecker<double>(0, 360))
51 .AddAttribute(
"HorizontalBeamwidth",
52 "The 3 dB horizontal beamwidth (degrees). A beamwidth of 360 deg "
53 "corresponds to constant gain",
57 MakeDoubleChecker<double>(0, 360))
58 .AddAttribute(
"Orientation",
59 "The angle (degrees) that expresses the orientation of the antenna on "
60 "the x-y plane relative to the x axis",
64 MakeDoubleChecker<double>(-360, 360))
65 .AddAttribute(
"MaxGain",
66 "The gain (dB) at the antenna boresight (the direction of maximum gain)",
69 MakeDoubleChecker<double>());
84 if (beamwidthDegrees == 360.0)
90 exponent = -3.0 / (20 * std::log10(std::cos(
DegreesToRadians(beamwidthDegrees / 4.0))));
104 double beamwidthRadians = 4 * std::acos(std::pow(0.5, 1 / (2 * exponent)));
163 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 AttributeAccessor > MakeDoubleAccessor(T1 a1)
double DegreesToRadians(double degrees)
converts degrees to radians
double RadiansToDegrees(double radians)
converts radians to degrees