Skip to content

Commit

Permalink
antenna: Add attribute to choose urban/indoor radiation pattern of 3G…
Browse files Browse the repository at this point in the history
…PP antenna
  • Loading branch information
Amir Ashtari authored and Gabrielcarvfer committed Dec 10, 2024
1 parent 9c69a42 commit bbf4cb8
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 9 deletions.
76 changes: 67 additions & 9 deletions src/antenna/model/three-gpp-antenna-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "antenna-model.h"

#include <ns3/double.h>
#include <ns3/enum.h>
#include <ns3/log.h>

#include <cmath>
Expand All @@ -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()
Expand All @@ -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
{
Expand Down
37 changes: 37 additions & 0 deletions src/antenna/model/three-gpp-antenna-model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -65,13 +86,29 @@ 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
//!< \f$(\phi_{3dB})\f$ [deg]
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
Expand Down

0 comments on commit bbf4cb8

Please sign in to comment.