A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
8
9#include "antenna-model.h"
10
11#include "ns3/double.h"
12#include "ns3/enum.h"
13#include "ns3/log.h"
14
15#include <cmath>
16
17namespace ns3
18{
19
20NS_LOG_COMPONENT_DEFINE("ThreeGppAntennaModel");
21
22NS_OBJECT_ENSURE_REGISTERED(ThreeGppAntennaModel);
23
24TypeId
26{
27 static TypeId tid =
28 TypeId("ns3::ThreeGppAntennaModel")
30 .SetGroupName("Antenna")
31 .AddConstructor<ThreeGppAntennaModel>()
32 .AddAttribute(
33 "RadiationPattern",
34 "Radiation pattern of 3GPP antenna model",
39 "Outdoor",
41 "Indoor"));
42 return tid;
43}
44
49
50void
56
60
61double
66
67double
72
73void
75{
76 m_radiationPattern = pattern;
77 switch (pattern)
78 {
81 break;
84 break;
85 default:
86 NS_ABORT_MSG("Unknown radiation pattern");
87 }
88}
89
95
96void
105
106void
115
116double
118{
119 return m_slaV;
120}
121
122double
127
128double
133
134double
136{
137 NS_LOG_FUNCTION(this << a);
138
139 double phiDeg = RadiansToDegrees(a.GetAzimuth());
140 double thetaDeg = RadiansToDegrees(a.GetInclination());
141
142 NS_ASSERT_MSG(-180.0 <= phiDeg && phiDeg <= 180.0, "Out of boundaries: phiDeg=" << phiDeg);
143 NS_ASSERT_MSG(0.0 <= thetaDeg && thetaDeg <= 180.0, "Out of boundaries: thetaDeg=" << thetaDeg);
144
145 // compute the radiation power pattern using equations in table 7.3-1 in
146 // 3GPP TR 38.901
147 double vertGain = -std::min(m_slaV,
148 12 * pow((thetaDeg - 90) / m_verticalBeamwidthDegrees,
149 2)); // vertical cut of the radiation power pattern (dB)
150 double horizGain = -std::min(m_aMax,
151 12 * pow(phiDeg / m_horizontalBeamwidthDegrees,
152 2)); // horizontal cut of the radiation power pattern (dB)
153
154 double gainDb =
155 m_geMax - std::min(m_aMax, -(vertGain + horizGain)); // 3D radiation power pattern (dB)
156
157 NS_LOG_DEBUG("gain=" << gainDb << " dB");
158 return gainDb;
159}
160
161} // namespace ns3
Class holding the azimuth and inclination angles of spherical coordinates.
Definition angles.h:107
double GetInclination() const
Getter for inclination angle.
Definition angles.cc:236
double GetAzimuth() const
Getter for azimuth angle.
Definition angles.cc:230
interface for antenna radiation pattern models
Hold variables of type enum.
Definition enum.h:52
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.
RadiationPattern
The different antenna radiation patterns defined in ITU-R M.2412.
static TypeId GetTypeId()
Get the type ID.
RadiationPattern m_radiationPattern
current antenna radiation pattern
double m_horizontalBeamwidthDegrees
beamwidth in the horizontal direction [deg]
double GetVerticalBeamwidth() const
Get the vertical beamwidth of the antenna element.
void SetIndoorAntennaPattern()
Set the radiation pattern for Indoor Hotspot - eMBB, Table 8-7 in Report ITU-R M.2412.
double GetHorizontalBeamwidth() const
Get the horizontal beamwidth of the antenna element.
void SetRadiationPattern(RadiationPattern pattern)
Set the antenna radiation pattern.
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
void SetOutdoorAntennaPattern()
Set the radiation pattern Dense Urban – eMBB, Rural – eMBB, Urban Macro – mMTC, and Urban Macro - URL...
RadiationPattern GetRadiationPattern() const
Get the antenna radiation pattern.
double m_aMax
maximum attenuation (A_{max}) [dB]
void DoInitialize() override
Initialize() implementation.
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:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#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:75
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition enum.h:221
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#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:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition enum.h:179
double RadiansToDegrees(double radians)
converts radians to degrees
Definition angles.cc:34