antenna: Add attribute to choose urban/indoor radiation pattern of 3GPP antenna

This commit is contained in:
Amir Ashtari
2024-11-11 12:47:17 +01:00
committed by Gabriel Ferreira
parent 9c69a42d49
commit bbf4cb80e1
2 changed files with 104 additions and 9 deletions

View File

@@ -9,6 +9,7 @@
#include "antenna-model.h"
#include <ns3/double.h>
#include <ns3/enum.h>
#include <ns3/log.h>
#include <cmath>
@@ -23,20 +24,34 @@ NS_OBJECT_ENSURE_REGISTERED(ThreeGppAntennaModel);
TypeId
ThreeGppAntennaModel::GetTypeId()
{
static TypeId tid = TypeId("ns3::ThreeGppAntennaModel")
.SetParent<AntennaModel>()
.SetGroupName("Antenna")
.AddConstructor<ThreeGppAntennaModel>();
static TypeId tid =
TypeId("ns3::ThreeGppAntennaModel")
.SetParent<AntennaModel>()
.SetGroupName("Antenna")
.AddConstructor<ThreeGppAntennaModel>()
.AddAttribute(
"RadiationPattern",
"Radiation pattern of 3GPP antenna model",
EnumValue<RadiationPattern>(RadiationPattern::OUTDOOR),
MakeEnumAccessor<RadiationPattern>(&ThreeGppAntennaModel::SetRadiationPattern,
&ThreeGppAntennaModel::GetRadiationPattern),
MakeEnumChecker<RadiationPattern>(RadiationPattern::OUTDOOR,
"Outdoor",
RadiationPattern::INDOOR,
"Indoor"));
return tid;
}
ThreeGppAntennaModel::ThreeGppAntennaModel()
: m_verticalBeamwidthDegrees{65},
m_horizontalBeamwidthDegrees{65},
m_aMax{30},
m_slaV{30},
m_geMax{8.0}
{
SetRadiationPattern(RadiationPattern::OUTDOOR);
}
void
ThreeGppAntennaModel::DoInitialize()
{
NS_LOG_FUNCTION(this);
SetRadiationPattern(m_radiationPattern);
}
ThreeGppAntennaModel::~ThreeGppAntennaModel()
@@ -55,6 +70,49 @@ ThreeGppAntennaModel::GetHorizontalBeamwidth() const
return m_horizontalBeamwidthDegrees;
}
void
ThreeGppAntennaModel::SetRadiationPattern(RadiationPattern pattern)
{
m_radiationPattern = pattern;
switch (pattern)
{
case RadiationPattern::OUTDOOR:
SetOutdoorAntennaPattern();
break;
case RadiationPattern::INDOOR:
SetIndoorAntennaPattern();
break;
default:
NS_ABORT_MSG("Unknown radiation pattern");
}
}
ThreeGppAntennaModel::RadiationPattern
ThreeGppAntennaModel::GetRadiationPattern() const
{
return m_radiationPattern;
}
void
ThreeGppAntennaModel::SetOutdoorAntennaPattern()
{
m_verticalBeamwidthDegrees = 65;
m_horizontalBeamwidthDegrees = 65;
m_aMax = 30;
m_slaV = 30;
m_geMax = 8;
}
void
ThreeGppAntennaModel::SetIndoorAntennaPattern()
{
m_verticalBeamwidthDegrees = 90;
m_horizontalBeamwidthDegrees = 90;
m_aMax = 25;
m_slaV = 25;
m_geMax = 5;
}
double
ThreeGppAntennaModel::GetSlaV() const
{

View File

@@ -22,6 +22,15 @@ namespace ns3
class ThreeGppAntennaModel : public AntennaModel
{
public:
/**
* The different antenna radiation patterns defined in ITU-R M.2412.
*/
enum class RadiationPattern
{
OUTDOOR,
INDOOR
};
ThreeGppAntennaModel();
~ThreeGppAntennaModel() override;
@@ -46,6 +55,18 @@ class ThreeGppAntennaModel : public AntennaModel
*/
double GetHorizontalBeamwidth() const;
/**
* Set the antenna radiation pattern
* @param pattern the antenna radiation pattern to used
*/
void SetRadiationPattern(RadiationPattern pattern);
/**
* Get the antenna radiation pattern
* @return the radiation pattern of the antenna
*/
RadiationPattern GetRadiationPattern() const;
/**
* Get the side-lobe attenuation in the vertical direction of the antenna element.
* @return side-lobe attenuation in the vertical direction in dB
@@ -65,6 +86,21 @@ class ThreeGppAntennaModel : public AntennaModel
double GetAntennaElementGain() const;
private:
// Inherited from Object.
// Waits for the attribute values to be set before setting the radiation pattern values
void DoInitialize() override;
/**
* Set the radiation pattern Dense Urban eMBB, Rural eMBB, Urban Macro mMTC, and Urban
* Macro - URLLC, Table 8-6 in Report ITU-R M.2412
*/
void SetOutdoorAntennaPattern();
/**
* Set the radiation pattern for Indoor Hotspot - eMBB, Table 8-7 in Report ITU-R M.2412
*/
void SetIndoorAntennaPattern();
double m_verticalBeamwidthDegrees; //!< beamwidth in the vertical direction \f$(\theta_{3dB})\f$
//!< [deg]
double m_horizontalBeamwidthDegrees; //!< beamwidth in the horizontal direction
@@ -72,6 +108,7 @@ class ThreeGppAntennaModel : public AntennaModel
double m_aMax; //!< maximum attenuation (A_{max}) [dB]
double m_slaV; //!< side-lobe attenuation in the vertical direction (SLA_V) [dB]
double m_geMax; //!< maximum directional gain of the antenna element (G_{E,max}) [dBi]
RadiationPattern m_radiationPattern; //!< current antenna radiation pattern
};
} // namespace ns3