INET Framework for OMNeT++/OMNEST
inet::physicallayer::CosineAntenna::AntennaGain Class Reference

#include <CosineAntenna.h>

Inheritance diagram for inet::physicallayer::CosineAntenna::AntennaGain:
inet::physicallayer::IAntennaGain inet::IPrintableObject inet::IntrusivePtrCounter< IAntennaGain >

Public Member Functions

 AntennaGain (double maxGain, deg beamWidth)
 
virtual double getMinGain () const override
 Returns the minimum possible antenna gain independent of any direction. More...
 
virtual double getMaxGain () const override
 Returns the maximum possible antenna gain independent of any direction. More...
 
virtual deg getBeamWidth () const
 
virtual double computeGain (const Quaternion &direction) const override
 Returns the antenna gain in the provided direction. More...
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const
 Prints this object to the provided output stream. More...
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 
- Public Member Functions inherited from inet::IntrusivePtrCounter< IAntennaGain >
INET_ALWAYS_INLINE IntrusivePtrCounter () noexcept
 
INET_ALWAYS_INLINE IntrusivePtrCounter (IntrusivePtrCounter const &) noexcept
 
INET_ALWAYS_INLINE unsigned int use_count () const noexcept
 
INET_ALWAYS_INLINE IntrusivePtrCounteroperator= (IntrusivePtrCounter const &) noexcept
 
INET_ALWAYS_INLINE IntrusivePtr< IAntennaGainshared_from_this ()
 

Protected Attributes

double maxGain
 
deg beamWidth
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 
- Protected Member Functions inherited from inet::IntrusivePtrCounter< IAntennaGain >
INET_ALWAYS_INLINE ~IntrusivePtrCounter ()=default
 

Constructor & Destructor Documentation

◆ AntennaGain()

inet::physicallayer::CosineAntenna::AntennaGain::AntennaGain ( double  maxGain,
deg  beamWidth 
)
40  :
42 {
43 }

Member Function Documentation

◆ computeGain()

double inet::physicallayer::CosineAntenna::AntennaGain::computeGain ( const Quaternion direction) const
overridevirtual

Returns the antenna gain in the provided direction.

The direction is determined by rotating the X axis using the given quaternion. The direction is to be interpreted in the local coordinate system of the radiation pattern. This way the gain depends only on the antenna radion pattern characteristics, and not on the antenna orientation determined by the antenna's mobility model.

For transmissions, it determines how well the antenna converts input power into radio waves headed in the specified direction. For receptions, it determines how well the antenna converts radio waves arriving from the specified direction.

Implements inet::physicallayer::IAntennaGain.

46 {
47  double exponent = -3.0 / (20 * std::log10(std::cos(math::deg2rad(beamWidth.get()) / 4.0)));
48  double product = math::minnan(1.0, math::maxnan(-1.0, direction.rotate(Coord::X_AXIS) * Coord::X_AXIS));
49  double angle = std::acos(product);
50  return maxGain * std::pow(std::abs(std::cos(angle / 2.0)), exponent);
51 }

◆ getBeamWidth()

virtual deg inet::physicallayer::CosineAntenna::AntennaGain::getBeamWidth ( ) const
inlinevirtual
27 { return beamWidth; }

◆ getMaxGain()

virtual double inet::physicallayer::CosineAntenna::AntennaGain::getMaxGain ( ) const
inlineoverridevirtual

Returns the maximum possible antenna gain independent of any direction.

Implements inet::physicallayer::IAntennaGain.

26 { return maxGain; }

◆ getMinGain()

virtual double inet::physicallayer::CosineAntenna::AntennaGain::getMinGain ( ) const
inlineoverridevirtual

Returns the minimum possible antenna gain independent of any direction.

Implements inet::physicallayer::IAntennaGain.

25 { return 0; }

Member Data Documentation

◆ beamWidth

deg inet::physicallayer::CosineAntenna::AntennaGain::beamWidth
protected

◆ maxGain

double inet::physicallayer::CosineAntenna::AntennaGain::maxGain
protected

The documentation for this class was generated from the following files:
inet::physicallayer::CosineAntenna::AntennaGain::maxGain
double maxGain
Definition: CosineAntenna.h:31
inet::units::cos
Value cos(const value< Value, Unit > &angle)
Definition: Units.h:1524
inet::math::maxnan
const T maxnan(const T &a, const T &b)
This function properly and symmetrically handles NaNs in contrast with std::max and std::fmax.
Definition: INETMath.h:234
inet::Coord::X_AXIS
static const Coord X_AXIS
Definition: Coord.h:29
inet::math::deg2rad
double deg2rad(double deg)
Convert a degree value to radian.
Definition: INETMath.h:183
inet::units::value::get
const value_type & get() const
Definition: Units.h:108
inet::physicallayer::CosineAntenna::AntennaGain::beamWidth
deg beamWidth
Definition: CosineAntenna.h:32
inet::math::minnan
const T minnan(const T &a, const T &b)
This function properly and symmetrically handles NaNs in contrast with std::min and std::fmin.
Definition: INETMath.h:216