1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2011 CTTC 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation; 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * 18 * Author: Nicola Baldo <nbaldo@cttc.es> 19 */ 20 21 #ifndef COSINE_ANTENNA_MODEL_H 22 #define COSINE_ANTENNA_MODEL_H 23 24 25 #include <ns3/object.h> 26 #include <ns3/antenna-model.h> 27 28 namespace ns3 { 29 30 /** 31 * 32 * \brief Cosine Antenna Model 33 * 34 * This class implements the cosine model, similarly to what is described in: 35 * Cosine Antenna Element, Mathworks, Phased Array System Toolbox (Sep. 2020) 36 * Available online: https://www.mathworks.com/help/phased/ug/cosine-antenna-element.html 37 * 38 * The power pattern of the element is equal to: 39 // P(az,el) = cos(az/2)^2m * cos(pi/2 - incl/2)^2n, 40 // where az is the azimuth angle, and incl is the inclination angle. 41 * 42 * Differently from the source, the response is defined for azimuth and elevation angles 43 * between –180 and 180 degrees and is always positive. 44 * There is no response at the backside of a cosine antenna. 45 * The cosine response pattern achieves a maximum value of 1 (0 dB) at 0 degrees azimuth 46 * and 90 degrees inclination. 47 * An extra settable gain is added to the original model, to improve its generality. 48 */ 49 class CosineAntennaModel : public AntennaModel 50 { 51 public: 52 // inherited from Object 53 static TypeId GetTypeId (); 54 55 // inherited from AntennaModel 56 virtual double GetGainDb (Angles a); 57 58 /** 59 * Get the vertical 3 dB beamwidth of the cosine antenna model. 60 * \return the vertical beamwidth in degrees 61 */ 62 double GetVerticalBeamwidth (void) const; 63 64 /** 65 * Get the horizontal 3 dB beamwidth of the cosine antenna model. 66 * \return the horizontal beamwidth in degrees 67 */ 68 double GetHorizontalBeamwidth (void) const; 69 70 /** 71 * Get the horizontal orientation of the antenna element. 72 * \return the horizontal orientation in degrees 73 */ 74 double GetOrientation (void) const; 75 76 private: 77 78 /** 79 * Set the vertical 3 dB beamwidth (bilateral) of the cosine antenna model. 80 * \param verticalBeamwidthDegrees the vertical beamwidth in degrees 81 */ 82 void SetVerticalBeamwidth (double verticalBeamwidthDegrees); 83 84 /** 85 * Set the horizontal 3 dB beamwidth (bilateral) of the cosine antenna model. 86 * \param horizontalBeamwidthDegrees the horizontal beamwidth in degrees 87 */ 88 void SetHorizontalBeamwidth (double horizontalBeamwidthDegrees); 89 90 /** 91 * Set the horizontal orientation of the antenna element. 92 * \param orientationDegrees the horizontal orientation in degrees 93 */ 94 void SetOrientation (double orientationDegrees); 95 96 /** 97 * Compute the exponent of the cosine antenna model from the beamwidth 98 * \param beamwidthRadians the beamwidth in degrees 99 * \return the exponent 100 */ 101 static double GetExponentFromBeamwidth (double beamwidthDegrees); 102 103 /** 104 * Compute the beamwidth of the cosine antenna model from the exponent 105 * \param exponent the exponent 106 * \return beamwidth in degrees 107 */ 108 static double GetBeamwidthFromExponent (double exponent); 109 110 double m_verticalExponent; //!< exponent of the vertical direction 111 double m_horizontalExponent; //!< exponent of the horizontal direction 112 double m_orientationRadians; //!< orientation in radians in the horizontal direction (bearing) 113 double m_maxGain; //!< antenna gain in dB towards the main orientation 114 }; 115 116 117 118 } // namespace ns3 119 120 121 #endif // COSINE_ANTENNA_MODEL_H 122