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

#include <CosineAntenna.h>

Inheritance diagram for inet::physicallayer::CosineAntenna:
inet::physicallayer::AntennaBase inet::physicallayer::IAntenna inet::physicallayer::IPrintableObject

Public Member Functions

 CosineAntenna ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual double getMaxGain () const override
 Returns the maximum possible antenna gain independent of any direction. More...
 
virtual double computeGain (const EulerAngles direction) const override
 Returns the antenna gain in the provided direction. More...
 
- Public Member Functions inherited from inet::physicallayer::AntennaBase
 AntennaBase ()
 
virtual IMobilitygetMobility () const override
 Returns the mobility of this antenna that describes its position and orientation over time. More...
 
virtual int getNumAntennas () const override
 Returns the number of antennas in the array. More...
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Protected Member Functions

virtual void initialize (int stage) override
 

Protected Attributes

double maxGain
 
degree beamWidth
 
- Protected Attributes inherited from inet::physicallayer::AntennaBase
IMobilitymobility
 
int numAntennas
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 

Constructor & Destructor Documentation

inet::physicallayer::CosineAntenna::CosineAntenna ( )
26  :
27  AntennaBase(),
28  maxGain(NaN),
29  beamWidth(NaN)
30 {
31 }
AntennaBase()
Definition: AntennaBase.cc:25
degree beamWidth
Definition: CosineAntenna.h:31
double maxGain
Definition: CosineAntenna.h:30
#define NaN
Definition: INETMath.h:103

Member Function Documentation

double inet::physicallayer::CosineAntenna::computeGain ( const EulerAngles  direction) const
overridevirtual

Returns the antenna gain in the provided direction.

The direction is relative to the antenna geometry, so the result depends only on the antenna characteristics. 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 the specified direction.

Implements inet::physicallayer::IAntenna.

52 {
53  double exponent = -3.0 / (20 * std::log10(std::cos(math::deg2rad(beamWidth.get()) / 4.0)));
54  return maxGain * std::pow(std::cos(direction.alpha / 2.0), exponent);
55 }
degree beamWidth
Definition: CosineAntenna.h:31
Value cos(const value< Value, Unit > &angle)
Definition: Units.h:1201
const value_type & get() const
Definition: Units.h:89
double maxGain
Definition: CosineAntenna.h:30
double deg2rad(double deg)
Convert a degree value to radian.
Definition: INETMath.h:186
virtual double inet::physicallayer::CosineAntenna::getMaxGain ( ) const
inlineoverridevirtual

Returns the maximum possible antenna gain independent of any direction.

Implements inet::physicallayer::IAntenna.

40 { return maxGain; }
double maxGain
Definition: CosineAntenna.h:30
void inet::physicallayer::CosineAntenna::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::physicallayer::AntennaBase.

34 {
36  if (stage == INITSTAGE_LOCAL) {
37  maxGain = math::dB2fraction(par("maxGain"));
38  beamWidth = degree(par("beamWidth"));
39  }
40 }
degree beamWidth
Definition: CosineAntenna.h:31
scale< rad, 180000000, 3141593 > degree
Definition: Units.h:974
double maxGain
Definition: CosineAntenna.h:30
double dB2fraction(double dB)
Converts a dB value to fraction.
Definition: INETMath.h:166
Local initializations.
Definition: InitStages.h:35
virtual void initialize(int stage) override
Definition: AntennaBase.cc:31
std::ostream & inet::physicallayer::CosineAntenna::printToStream ( std::ostream &  stream,
int  level 
) const
overridevirtual

Prints this object to the provided output stream.

Function calls to operator<< with pointers or references either const or not are all forwarded to this function.

Reimplemented from inet::physicallayer::AntennaBase.

43 {
44  stream << "CosineAntenna";
45  if (level <= PRINT_LEVEL_DETAIL)
46  stream << ", maxGain = " << maxGain
47  << ", beamWidth = " << beamWidth;
48  return AntennaBase::printToStream(stream, level);
49 }
degree beamWidth
Definition: CosineAntenna.h:31
double maxGain
Definition: CosineAntenna.h:30
virtual std::ostream & printToStream(std::ostream &stream, int level) const override
Prints this object to the provided output stream.
Definition: AntennaBase.cc:39

Member Data Documentation

degree inet::physicallayer::CosineAntenna::beamWidth
protected
double inet::physicallayer::CosineAntenna::maxGain
protected

The documentation for this class was generated from the following files: