A Discrete-Event Network Simulator
API
three-gpp-antenna-model.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 University of Padova, Dep. of Information Engineering, SIGNET lab.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17 
19 
20 #include "antenna-model.h"
21 
22 #include <ns3/double.h>
23 #include <ns3/log.h>
24 
25 #include <cmath>
26 
27 namespace ns3
28 {
29 
30 NS_LOG_COMPONENT_DEFINE("ThreeGppAntennaModel");
31 
32 NS_OBJECT_ENSURE_REGISTERED(ThreeGppAntennaModel);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId("ns3::ThreeGppAntennaModel")
39  .SetGroupName("Antenna")
40  .AddConstructor<ThreeGppAntennaModel>();
41  return tid;
42 }
43 
45  : m_verticalBeamwidthDegrees{65},
46  m_horizontalBeamwidthDegrees{65},
47  m_aMax{30},
48  m_slaV{30},
49  m_geMax{8.0}
50 {
51 }
52 
54 {
55 }
56 
57 double
59 {
61 }
62 
63 double
65 {
67 }
68 
69 double
71 {
72  return m_slaV;
73 }
74 
75 double
77 {
78  return m_aMax;
79 }
80 
81 double
83 {
84  return m_geMax;
85 }
86 
87 double
89 {
90  NS_LOG_FUNCTION(this << a);
91 
92  double phiDeg = RadiansToDegrees(a.GetAzimuth());
93  double thetaDeg = RadiansToDegrees(a.GetInclination());
94 
95  NS_ASSERT_MSG(-180.0 <= phiDeg && phiDeg <= 180.0, "Out of boundaries: phiDeg=" << phiDeg);
96  NS_ASSERT_MSG(0.0 <= thetaDeg && thetaDeg <= 180.0, "Out of boundaries: thetaDeg=" << thetaDeg);
97 
98  // compute the radiation power pattern using equations in table 7.3-1 in
99  // 3GPP TR 38.901
100  double vertGain = -std::min(m_slaV,
101  12 * pow((thetaDeg - 90) / m_verticalBeamwidthDegrees,
102  2)); // vertical cut of the radiation power pattern (dB)
103  double horizGain = -std::min(m_aMax,
104  12 * pow(phiDeg / m_horizontalBeamwidthDegrees,
105  2)); // horizontal cut of the radiation power pattern (dB)
106 
107  double gainDb =
108  m_geMax - std::min(m_aMax, -(vertGain + horizGain)); // 3D radiation power pattern (dB)
109 
110  NS_LOG_DEBUG("gain=" << gainDb << " dB");
111  return gainDb;
112 }
113 
114 } // namespace ns3
#define min(a, b)
Definition: 80211b.c:41
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
double GetInclination() const
Getter for inclination angle.
Definition: angles.cc:246
double GetAzimuth() const
Getter for azimuth angle.
Definition: angles.cc:240
interface for antenna radiation pattern models
Definition: antenna-model.h:55
Antenna model based on a parabolic approximation of the main lobe radiation pattern.
double m_geMax
maximum directional gain of the antenna element (G_{E,max}) [dBi]
double GetAntennaElementGain() const
Get the maximum directional gain of the antenna element.
static TypeId GetTypeId()
Get the type ID.
double m_horizontalBeamwidthDegrees
beamwidth in the horizontal direction [deg]
double GetVerticalBeamwidth() const
Get the vertical beamwidth of the antenna element.
double GetHorizontalBeamwidth() const
Get the horizontal beamwidth of the antenna element.
double m_verticalBeamwidthDegrees
beamwidth in the vertical direction [deg]
double GetGainDb(Angles a) override
this method is expected to be re-implemented by each antenna model
double m_aMax
maximum attenuation (A_{max}) [dB]
double GetMaxAttenuation() const
Get the maximum attenuation of the antenna element.
double GetSlaV() const
Get the side-lobe attenuation in the vertical direction of the antenna element.
double m_slaV
side-lobe attenuation in the vertical direction (SLA_V) [dB]
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#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.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RadiansToDegrees(double radians)
converts radians to degrees
Definition: angles.cc:45