FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
antenna::H5Antenna Class Referencefinal

Represents an antenna whose gain pattern is loaded from a HDF5 file. More...

#include "antenna_factory.h"

+ Inheritance diagram for antenna::H5Antenna:
+ Collaboration diagram for antenna::H5Antenna:

Public Member Functions

 H5Antenna (const std::string_view name, const std::string &filename)
 Constructs a H5Antenna with the specified name and gain pattern file.
 
 ~H5Antenna () override=default
 
 H5Antenna (const H5Antenna &)=delete
 
H5Antennaoperator= (const H5Antenna &)=delete
 
 H5Antenna (H5Antenna &&)=delete
 
H5Antennaoperator= (H5Antenna &&)=delete
 
RealType getGain (const math::SVec3 &angle, const math::SVec3 &refangle, RealType) const override
 Computes the gain of the antenna based on the input angle and reference angle.
 
const std::string & getFilename () const noexcept
 Gets the filename of the antenna description.
 
const std::vector< std::vector< RealType > > & getPattern () const noexcept
 Gets the gain pattern object.
 
RealType getEfficiencyFactor () const noexcept
 Retrieves the efficiency factor of the antenna.
 
std::string getName () const noexcept
 Retrieves the name of the antenna.
 
virtual RealType getNoiseTemperature (const math::SVec3 &) const noexcept
 Computes the noise temperature of the antenna based on the angle.
 
void setEfficiencyFactor (RealType loss) noexcept
 Sets the efficiency factor of the antenna.
 

Static Protected Member Functions

static RealType getAngle (const math::SVec3 &angle, const math::SVec3 &refangle) noexcept
 Computes the angle between the input and reference angles.
 

Detailed Description

Represents an antenna whose gain pattern is loaded from a HDF5 file.

This class models an antenna with a gain pattern defined in an HDF5 file. The gain pattern is stored in a Pattern object, which is used to compute the antenna's gain based on the input angle and reference angle.

Definition at line 436 of file antenna_factory.h.

Constructor & Destructor Documentation

◆ H5Antenna() [1/3]

antenna::H5Antenna::H5Antenna ( const std::string_view  name,
const std::string &  filename 
)

Constructs a H5Antenna with the specified name and gain pattern file.

Parameters
nameThe name of the antenna.
filenameThe path to the file containing the antenna's gain pattern.

Definition at line 445 of file antenna_factory.h.

445 :
446 Antenna(name.data()), _pattern(serial::readPattern(filename, "antenna")), _filename(filename)
447 {
448 }
Antenna(std::string name) noexcept
Constructs an Antenna object with the given name.
std::vector< std::vector< RealType > > readPattern(const std::string &name, const std::string &datasetName)
Reads a 2D pattern dataset from an HDF5 file.

◆ ~H5Antenna()

antenna::H5Antenna::~H5Antenna ( )
overridedefault

◆ H5Antenna() [2/3]

antenna::H5Antenna::H5Antenna ( const H5Antenna )
delete

◆ H5Antenna() [3/3]

antenna::H5Antenna::H5Antenna ( H5Antenna &&  )
delete

Member Function Documentation

◆ getAngle()

RealType antenna::Antenna::getAngle ( const math::SVec3 angle,
const math::SVec3 refangle 
)
staticprotectednoexceptinherited

Computes the angle between the input and reference angles.

Parameters
angleThe input angle.
refangleThe reference angle.
Returns
The computed angle.

Definition at line 93 of file antenna_factory.cpp.

94 {
95 SVec3 normangle(angle);
96 normangle.length = 1;
97 return std::acos(dotProduct(Vec3(normangle), Vec3(refangle)));
98 }
A class representing a vector in spherical coordinates.
A class representing a vector in rectangular coordinates.
RealType dotProduct(const Vec3 &a, const Vec3 &b) noexcept
Computes the dot product of two Vec3 vectors.

References math::SVec3::length.

◆ getEfficiencyFactor()

RealType antenna::Antenna::getEfficiencyFactor ( ) const
noexceptinherited

Retrieves the efficiency factor of the antenna.

Returns
The efficiency factor of the antenna.

Definition at line 73 of file antenna_factory.h.

73{ return _loss_factor; }

Referenced by antenna::Isotropic::getGain(), antenna::XmlAntenna::getGain(), getGain(), and antenna::to_json().

+ Here is the caller graph for this function:

◆ getFilename()

const std::string & antenna::H5Antenna::getFilename ( ) const
noexcept

Gets the filename of the antenna description.

Definition at line 471 of file antenna_factory.h.

471{ return _filename; }

◆ getGain()

RealType antenna::H5Antenna::getGain ( const math::SVec3 angle,
const math::SVec3 refangle,
RealType   
) const
overridevirtual

Computes the gain of the antenna based on the input angle and reference angle.

Parameters
angleThe angle at which the gain is to be computed.
refangleThe reference angle.
Returns
The gain of the antenna at the specified angle.

Implements antenna::Antenna.

Definition at line 163 of file antenna_factory.cpp.

164 {
165 constexpr RealType two_pi = 2.0 * PI;
166
167 const SVec3& pattern_angle = angle - refangle;
168
169 const double ex1 = (pattern_angle.azimuth + PI) / two_pi;
170 const double ey1 = (pattern_angle.elevation + PI) / two_pi;
171
172 const auto calc_grid_point = [](const double value, const unsigned size)
173 {
174 const double x1 = std::floor(value * (size - 1)) / (size - 1);
175 const double x2 = std::min(x1 + 1.0 / size, 1.0);
176 return std::pair{x1, x2};
177 };
178
179 unsigned size_azi = _pattern.size();
180 unsigned size_elev = _pattern[0].size();
181
182 LOG(logging::Level::TRACE, "Size of pattern: {} x {}", size_azi, size_elev);
183
184 const auto [x1, x2] = calc_grid_point(ex1, size_azi);
185 const auto [y1, y2] = calc_grid_point(ey1, size_elev);
186
187 const double t = (ex1 - x1) / (x2 - x1);
188 const double u = (ey1 - y1) / (y2 - y1);
189
190 const auto calc_array_index = [](const double value, const unsigned size)
191 { return std::min(static_cast<unsigned>(std::floor(value * size)), size - 1); };
192
193 const unsigned arr_x = calc_array_index(x1, size_azi);
194 const unsigned arr_y = calc_array_index(y1, size_elev);
195
196 const RealType interp = (1.0 - t) * (1.0 - u) * _pattern[arr_x][arr_y] +
197 t * (1.0 - u) * _pattern[(arr_x + 1) % size_azi][arr_y] +
198 t * u * _pattern[(arr_x + 1) % size_azi][(arr_y + 1) % size_elev] +
199 (1.0 - t) * u * _pattern[arr_x][(arr_y + 1) % size_elev];
200
201 return interp * getEfficiencyFactor();
202 }
RealType getEfficiencyFactor() const noexcept
Retrieves the efficiency factor of the antenna.
RealType elevation
The elevation angle of the vector.
RealType azimuth
The azimuth angle of the vector.
double RealType
Type for real numbers.
Definition config.h:27
constexpr RealType PI
Mathematical constant π (pi).
Definition config.h:43
#define LOG(level,...)
Definition logging.h:19
@ TRACE
Trace level for detailed debugging information.

References math::SVec3::azimuth, math::SVec3::elevation, antenna::Antenna::getEfficiencyFactor(), LOG, PI, and logging::TRACE.

+ Here is the call graph for this function:

◆ getName()

std::string antenna::Antenna::getName ( ) const
noexceptinherited

Retrieves the name of the antenna.

Returns
The name of the antenna.

Definition at line 80 of file antenna_factory.h.

80{ return _name; }

Referenced by antenna::to_json(), radar::to_json(), and radar::to_json().

+ Here is the caller graph for this function:

◆ getNoiseTemperature()

virtual RealType antenna::Antenna::getNoiseTemperature ( const math::SVec3 ) const
virtualnoexceptinherited

Computes the noise temperature of the antenna based on the angle.

Parameters
angleThe angle at which the noise temperature is to be computed.
Returns
The noise temperature of the antenna.

Definition at line 89 of file antenna_factory.h.

89{ return 0; }

◆ getPattern()

const std::vector< std::vector< RealType > > & antenna::H5Antenna::getPattern ( ) const
noexcept

Gets the gain pattern object.

Definition at line 474 of file antenna_factory.h.

474{ return _pattern; }

◆ operator=() [1/2]

H5Antenna & antenna::H5Antenna::operator= ( const H5Antenna )
delete

◆ operator=() [2/2]

H5Antenna & antenna::H5Antenna::operator= ( H5Antenna &&  )
delete

◆ setEfficiencyFactor()

void antenna::Antenna::setEfficiencyFactor ( RealType  loss)
noexceptinherited

Sets the efficiency factor of the antenna.

Parameters
lossThe new efficiency factor.

Definition at line 84 of file antenna_factory.cpp.

85 {
86 if (loss > 1)
87 {
88 LOG(Level::INFO, "Using greater than unity antenna efficiency.");
89 }
90 _loss_factor = loss;
91 }

References LOG.


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