#include <InterpolatingAntenna.h>
|
virtual void | initialize (int stage) override |
|
virtual void | parseMap (std::map< double, double > &gainMap, const char *text) |
|
virtual double | computeGain (const std::map< double, double > &gainMap, double angle) const |
|
inet::physicallayer::InterpolatingAntenna::InterpolatingAntenna |
( |
| ) |
|
AntennaBase()
Definition: AntennaBase.cc:25
double maxGain
Definition: InterpolatingAntenna.h:31
double minGain
Definition: InterpolatingAntenna.h:30
#define NaN
Definition: INETMath.h:103
double inet::physicallayer::InterpolatingAntenna::computeGain |
( |
const std::map< double, double > & |
gainMap, |
|
|
double |
angle |
|
) |
| const |
|
protectedvirtual |
Referenced by computeGain().
81 angle = fmod(angle, 2 *
M_PI);
82 if (angle < 0.0) angle += 2 *
M_PI;
84 std::map<double, double>::const_iterator lowerBound = gainMap.lower_bound(angle);
85 std::map<double, double>::const_iterator upperBound = gainMap.upper_bound(angle);
86 if (lowerBound->first != angle)
88 if (upperBound == gainMap.end())
90 if (upperBound == lowerBound)
91 return lowerBound->second;
93 double lowerAngle = lowerBound->first;
94 double upperAngle = upperBound->first;
95 double lowerGain = lowerBound->second;
96 double upperGain = upperBound->second;
97 double alpha = (angle - lowerAngle) / (upperAngle - lowerAngle);
98 return (1 - alpha) * lowerGain + alpha * upperGain;
const value< double, units::unit > alpha(7.2973525376e-3)
double inet::physicallayer::InterpolatingAntenna::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.
std::map< double, double > bankGainMap
Definition: InterpolatingAntenna.h:34
std::map< double, double > elevationGainMap
Definition: InterpolatingAntenna.h:32
virtual double computeGain(const std::map< double, double > &gainMap, double angle) const
Definition: InterpolatingAntenna.cc:79
std::map< double, double > headingGainMap
Definition: InterpolatingAntenna.h:33
virtual double inet::physicallayer::InterpolatingAntenna::getMaxGain |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the maximum possible antenna gain independent of any direction.
Implements inet::physicallayer::IAntenna.
double maxGain
Definition: InterpolatingAntenna.h:31
virtual double inet::physicallayer::InterpolatingAntenna::getMinGain |
( |
| ) |
const |
|
inlinevirtual |
double minGain
Definition: InterpolatingAntenna.h:30
void inet::physicallayer::InterpolatingAntenna::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::physicallayer::AntennaBase.
std::map< double, double > bankGainMap
Definition: InterpolatingAntenna.h:34
std::map< double, double > elevationGainMap
Definition: InterpolatingAntenna.h:32
std::map< double, double > headingGainMap
Definition: InterpolatingAntenna.h:33
Local initializations.
Definition: InitStages.h:35
virtual void parseMap(std::map< double, double > &gainMap, const char *text)
Definition: InterpolatingAntenna.cc:51
virtual void initialize(int stage) override
Definition: AntennaBase.cc:31
void inet::physicallayer::InterpolatingAntenna::parseMap |
( |
std::map< double, double > & |
gainMap, |
|
|
const char * |
text |
|
) |
| |
|
protectedvirtual |
Referenced by initialize().
53 cStringTokenizer tokenizer(text);
54 const char *firstAngle = tokenizer.nextToken();
56 throw cRuntimeError(
"Insufficient number of values");
57 if (strcmp(firstAngle,
"0"))
58 throw cRuntimeError(
"The first angle must be 0");
59 const char *firstGain = tokenizer.nextToken();
61 throw cRuntimeError(
"Insufficient number of values");
64 while (tokenizer.hasMoreTokens()) {
65 const char *angleString = tokenizer.nextToken();
66 const char *gainString = tokenizer.nextToken();
67 if (!angleString || !gainString)
68 throw cRuntimeError(
"Insufficient number of values");
69 double angle = atof(angleString) *
M_PI / 180;
75 gainMap.insert(std::pair<double, double>(angle, gain));
double maxGain
Definition: InterpolatingAntenna.h:31
double dB2fraction(double dB)
Converts a dB value to fraction.
Definition: INETMath.h:166
double minGain
Definition: InterpolatingAntenna.h:30
std::ostream & inet::physicallayer::InterpolatingAntenna::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.
45 stream <<
"InterpolatingAntenna";
47 stream <<
", maxGain = " <<
maxGain;
double maxGain
Definition: InterpolatingAntenna.h:31
virtual std::ostream & printToStream(std::ostream &stream, int level) const override
Prints this object to the provided output stream.
Definition: AntennaBase.cc:39
Definition: IPrintableObject.h:36
std::map<double, double> inet::physicallayer::InterpolatingAntenna::bankGainMap |
|
protected |
std::map<double, double> inet::physicallayer::InterpolatingAntenna::elevationGainMap |
|
protected |
std::map<double, double> inet::physicallayer::InterpolatingAntenna::headingGainMap |
|
protected |
double inet::physicallayer::InterpolatingAntenna::maxGain |
|
protected |
double inet::physicallayer::InterpolatingAntenna::minGain |
|
protected |
The documentation for this class was generated from the following files: