antenna: allow non-unitary gain for IsotropicAntennaModel

This commit is contained in:
Nicola Baldo
2018-08-13 18:55:01 -07:00
parent 26df85d8bf
commit 64b9588860
2 changed files with 17 additions and 2 deletions

View File

@@ -20,11 +20,13 @@
#include <ns3/log.h>
#include <ns3/double.h>
#include "antenna-model.h"
#include "isotropic-antenna-model.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("IsotropicAntennaModel");
@@ -39,6 +41,11 @@ IsotropicAntennaModel::GetTypeId ()
.SetParent<AntennaModel> ()
.SetGroupName("Antenna")
.AddConstructor<IsotropicAntennaModel> ()
.AddAttribute ("Gain",
"The gain of the antenna in dB",
DoubleValue (0),
MakeDoubleAccessor (&IsotropicAntennaModel::m_gainDb),
MakeDoubleChecker<double> ())
;
return tid;
}
@@ -52,7 +59,7 @@ double
IsotropicAntennaModel::GetGainDb (Angles a)
{
NS_LOG_FUNCTION (this << a);
return 0.0;
return m_gainDb;
}
}

View File

@@ -30,7 +30,7 @@ namespace ns3 {
/**
* \brief Isotropic antenna model
*
* This is the simplest antenna model. The gain of this antenna is unitary (=0dB) in all directions.
* This is the simplest antenna model. The gain of this antenna is the same in all directions.
*/
class IsotropicAntennaModel : public AntennaModel
{
@@ -42,6 +42,14 @@ public:
// inherited from AntennaModel
virtual double GetGainDb (Angles a);
protected:
/**
* gain of the antenna in dB, in all directions
*
*/
double m_gainDb;
};