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, const SimId id=0)
 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.
 
SimId getId () const noexcept
 Retrieves the unique ID 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.
 
void setName (std::string name) noexcept
 Sets the name 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 521 of file antenna_factory.h.

Constructor & Destructor Documentation

◆ H5Antenna() [1/3]

antenna::H5Antenna::H5Antenna ( const std::string_view  name,
const std::string &  filename,
const SimId  id = 0 
)

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 530 of file antenna_factory.h.

530 :
531 Antenna(name.data(), id), _pattern(serial::readPattern(filename, "antenna")), _filename(filename)
532 {
533 }
Antenna(std::string name, const SimId id=0) 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 325 of file antenna_factory.cpp.

326 {
327 SVec3 normangle(angle);
328 normangle.length = 1;
329 return std::acos(dotProduct(Vec3(normangle), Vec3(refangle)));
330 }
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 79 of file antenna_factory.h.

79{ 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 556 of file antenna_factory.h.

556{ 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 416 of file antenna_factory.cpp.

417 {
418 constexpr RealType two_pi = 2.0 * PI;
419
420 const SVec3& pattern_angle = angle - refangle;
421
422 const double ex1 = (pattern_angle.azimuth + PI) / two_pi;
423 const double ey1 = (pattern_angle.elevation + PI) / two_pi;
424
425 const auto calc_grid_point = [](const double value, const std::size_t size)
426 {
427 const double grid_size = static_cast<double>(size - 1);
428 const double x1 = std::floor(value * grid_size) / grid_size;
429 const double x2 = std::min(x1 + 1.0 / static_cast<double>(size), 1.0);
430 return std::pair{x1, x2};
431 };
432
433 const std::size_t size_azi = _pattern.size();
434 const std::size_t size_elev = _pattern[0].size();
435
436 LOG(logging::Level::TRACE, "Size of pattern: {} x {}", size_azi, size_elev);
437
438 const auto [x1, x2] = calc_grid_point(ex1, size_azi);
439 const auto [y1, y2] = calc_grid_point(ey1, size_elev);
440
441 const double t = (ex1 - x1) / (x2 - x1);
442 const double u = (ey1 - y1) / (y2 - y1);
443
444 const auto calc_array_index = [](const double value, const std::size_t size)
445 { return std::min(static_cast<std::size_t>(std::floor(value * static_cast<double>(size))), size - 1); };
446
447 const std::size_t arr_x = calc_array_index(x1, size_azi);
448 const std::size_t arr_y = calc_array_index(y1, size_elev);
449
450 const RealType interp = (1.0 - t) * (1.0 - u) * _pattern[arr_x][arr_y] +
451 t * (1.0 - u) * _pattern[(arr_x + 1) % size_azi][arr_y] +
452 t * u * _pattern[(arr_x + 1) % size_azi][(arr_y + 1) % size_elev] +
453 (1.0 - t) * u * _pattern[arr_x][(arr_y + 1) % size_elev];
454
455 return interp * getEfficiencyFactor();
456 }
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:

◆ getId()

SimId antenna::Antenna::getId ( ) const
noexceptinherited

Retrieves the unique ID of the antenna.

Returns
The antenna SimId.

Definition at line 93 of file antenna_factory.h.

93{ return _id; }

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

+ Here is the caller 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 86 of file antenna_factory.h.

86{ return _name; }

Referenced by serial::kml_generator_utils::findGaussian3DbDropAngle(), serial::kml_generator_utils::findParabolic3DbDropAngle(), serial::kml_generator_utils::findSquareHorn3DbDropAngle(), serial::kml_generator_utils::generateAntennaKml(), serial::xml_serializer_utils::serializeMonostatic(), serial::xml_serializer_utils::serializeReceiver(), serial::xml_serializer_utils::serializeTransmitter(), and antenna::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 102 of file antenna_factory.h.

102{ return 0; }

◆ getPattern()

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

Gets the gain pattern object.

Definition at line 559 of file antenna_factory.h.

559{ 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 316 of file antenna_factory.cpp.

317 {
318 if (loss > 1)
319 {
320 LOG(Level::INFO, "Using greater than unity antenna efficiency.");
321 }
322 _loss_factor = loss;
323 }

References LOG.

Referenced by serial::update_antenna_from_json().

+ Here is the caller graph for this function:

◆ setName()

void antenna::Antenna::setName ( std::string  name)
noexceptinherited

Sets the name of the antenna.

Parameters
nameThe new name of the antenna.

Definition at line 116 of file antenna_factory.h.

116{ _name = std::move(name); }

Referenced by serial::update_antenna_from_json().

+ Here is the caller graph for this function:

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