A Discrete-Event Network Simulator
API
three-gpp-antenna-model.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 University of Padova, Dep. of Information Engineering, SIGNET lab.
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 
19 
20 #include <ns3/log.h>
21 #include <ns3/double.h>
22 #include <cmath>
23 #include "antenna-model.h"
25 
26 
27 namespace ns3 {
28 
29 NS_LOG_COMPONENT_DEFINE ("ThreeGppAntennaModel");
30 
31 NS_OBJECT_ENSURE_REGISTERED (ThreeGppAntennaModel);
32 
33 
34 TypeId
36 {
37  static TypeId tid = TypeId ("ns3::ThreeGppAntennaModel")
39  .SetGroupName ("Antenna")
40  .AddConstructor<ThreeGppAntennaModel> ()
41  ;
42  return tid;
43 }
44 
46  : m_verticalBeamwidthDegrees {65},
47  m_horizontalBeamwidthDegrees {65},
48  m_aMax {30},
49  m_slaV {30},
50  m_geMax {8.0}
51 {}
52 
53 
55 {}
56 
57 
58 double
60 {
62 }
63 
64 
65 double
67 {
69 }
70 
71 
72 double
74 {
75  return m_slaV;
76 }
77 
78 
79 double
81 {
82  return m_aMax;
83 }
84 
85 
86 double
88 {
89  return m_geMax;
90 }
91 
92 
93 double
95 {
96  NS_LOG_FUNCTION (this << a);
97 
98  double phiDeg = RadiansToDegrees (a.GetAzimuth ());
99  double thetaDeg = RadiansToDegrees (a.GetInclination ());
100 
101  NS_ASSERT_MSG (-180.0 <= phiDeg && phiDeg <= 180.0, "Out of boundaries: phiDeg=" << phiDeg);
102  NS_ASSERT_MSG (0.0 <= thetaDeg && thetaDeg <= 180.0, "Out of boundaries: thetaDeg=" << thetaDeg);
103 
104  // compute the radiation power pattern using equations in table 7.3-1 in
105  // 3GPP TR 38.901
106  double vertGain = -std::min (m_slaV, 12 * pow ((thetaDeg - 90) / m_verticalBeamwidthDegrees, 2)); // vertical cut of the radiation power pattern (dB)
107  double horizGain = -std::min (m_aMax, 12 * pow (phiDeg / m_horizontalBeamwidthDegrees, 2)); // horizontal cut of the radiation power pattern (dB)
108 
109  double gainDb = m_geMax - std::min (m_aMax, -(vertGain + horizGain)); // 3D radiation power pattern (dB)
110 
111  NS_LOG_DEBUG ("gain=" << gainDb << " dB");
112  return gainDb;
113 
114 }
115 
116 
117 }
118 
#define min(a, b)
Definition: 80211b.c:42
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:119
double GetInclination(void) const
Getter for inclination angle.
Definition: angles.cc:231
double GetAzimuth(void) const
Getter for azimuth angle.
Definition: angles.cc:224
interface for antenna radiation pattern models
Definition: antenna-model.h:56
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]
virtual double GetGainDb(Angles a) override
this method is expected to be re-implemented by each antenna model
virtual ~ThreeGppAntennaModel(void) override
double m_aMax
maximum attenuation (A_{max}) [dB]
double GetMaxAttenuation() const
Get the naximum 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:922
#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:88
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#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:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RadiansToDegrees(double radians)
converts radians to degrees
Definition: angles.cc:47