FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
radar::FileTarget Class Referencefinal

File-based radar target. More...

#include "target.h"

+ Inheritance diagram for radar::FileTarget:
+ Collaboration diagram for radar::FileTarget:

Public Member Functions

 FileTarget (Platform *platform, std::string name, const std::string &filename, unsigned seed)
 Constructs a file-based radar target.
 
RealType getRcs (math::SVec3 &inAngle, math::SVec3 &outAngle, RealType time) const override
 Gets the RCS value from file-based data for a specific bistatic geometry and time.
 
const std::string & getFilename () const noexcept
 Gets the filename associated with this target's RCS data.
 
std::mt19937 & getRngEngine () noexcept
 Gets the target's internal random number generator engine.
 
void setFluctuationModel (std::unique_ptr< RcsModel > in)
 Sets the RCS fluctuation model.
 
const RcsModelgetFluctuationModel () const
 Gets the RCS fluctuation model.
 
math::Vec3 getPosition (const RealType time) const
 Retrieves the position of the object.
 
math::SVec3 getRotation (const RealType time) const
 Retrieves the rotation of the object.
 
PlatformgetPlatform () const noexcept
 Retrieves the associated platform of the object.
 
const std::string & getName () const noexcept
 Retrieves the name of the object.
 

Protected Attributes

std::unique_ptr< RcsModel_model {nullptr}
 The RCS fluctuation model for the target.
 
std::mt19937 _rng
 Per-object random number generator for statistical independence.
 

Detailed Description

File-based radar target.

Definition at line 209 of file target.h.

Constructor & Destructor Documentation

◆ FileTarget()

radar::FileTarget::FileTarget ( Platform platform,
std::string  name,
const std::string &  filename,
unsigned  seed 
)

Constructs a file-based radar target.

Parameters
platformPointer to the platform associated with the target.
nameThe name of the target.
filenameThe name of the file containing RCS data.
seedThe seed for the target's internal random number generator.
Exceptions
std::runtime_errorIf the file cannot be loaded or parsed.

Definition at line 59 of file target.cpp.

59 :
60 Target(platform, std::move(name), seed), _azi_samples(std::make_unique_for_overwrite<interp::InterpSet>()),
61 _elev_samples(std::make_unique_for_overwrite<interp::InterpSet>()), _filename(filename)
62 {
63 XmlDocument doc;
64 if (!doc.loadFile(filename))
65 {
66 throw std::runtime_error("Could not load target description from " + filename);
67 }
68
69 const XmlElement root(doc.getRootElement());
70
71 loadTargetGainAxis(_elev_samples.get(), root.childElement("elevation", 0));
72 loadTargetGainAxis(_azi_samples.get(), root.childElement("azimuth", 0));
73 }
Class for managing XML documents.
XmlElement getRootElement() const
Get the root element of the document.
bool loadFile(std::string_view filename)
Load an XML file into the document.
Class representing a node in an XML document.
Target(Platform *platform, std::string name, const unsigned seed)
Constructs a radar target.
Definition target.h:126

References XmlElement::childElement(), XmlDocument::getRootElement(), and XmlDocument::loadFile().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFilename()

const std::string & radar::FileTarget::getFilename ( ) const
noexcept

Gets the filename associated with this target's RCS data.

Returns
The source filename.

Definition at line 248 of file target.h.

248{ return _filename; }

◆ getFluctuationModel()

const RcsModel * radar::Target::getFluctuationModel ( ) const
inherited

Gets the RCS fluctuation model.

Returns
A const pointer to the RcsModel.

Definition at line 159 of file target.h.

159{ return _model.get(); }
std::unique_ptr< RcsModel > _model
The RCS fluctuation model for the target.
Definition target.h:162

References radar::Target::_model.

Referenced by radar::to_json().

+ Here is the caller graph for this function:

◆ getName()

const std::string & radar::Object::getName ( ) const
noexceptinherited

Retrieves the name of the object.

Returns
A const reference to the string representing the object's name.

Definition at line 68 of file object.h.

68{ return _name; }

Referenced by simulation::calculatePreviewLinks(), simulation::calculateResponse(), processing::finalizeCwReceiver(), serial::Response::getTransmitterName(), processing::runPulsedFinalizer(), radar::Receiver::setNoiseTemperature(), radar::to_json(), radar::to_json(), and radar::to_json().

+ Here is the caller graph for this function:

◆ getPlatform()

Platform * radar::Object::getPlatform ( ) const
noexceptinherited

Retrieves the associated platform of the object.

Returns
A pointer to the Platform object associated with this object.

Definition at line 61 of file object.h.

61{ return _platform; }

Referenced by simulation::calculateDirectPathContribution(), simulation::calculateReflectedPathContribution(), and simulation::calculateResponse().

+ Here is the caller graph for this function:

◆ getPosition()

math::Vec3 radar::Object::getPosition ( const RealType  time) const
inherited

Retrieves the position of the object.

Parameters
timeThe time at which to get the position of the object.
Returns
A math::Vec3 representing the position of the object.

Definition at line 46 of file object.h.

46{ return _platform->getPosition(time); }
math::Vec3 getPosition(const RealType time) const
Gets the position of the platform at a specific time.
Definition platform.h:74

References radar::Platform::getPosition().

Referenced by simulation::calculatePreviewLinks(), simulation::solveRe(), and simulation::solveReDirect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRcs()

RealType radar::FileTarget::getRcs ( math::SVec3 inAngle,
math::SVec3 outAngle,
RealType  time 
) const
overridevirtual

Gets the RCS value from file-based data for a specific bistatic geometry and time.

Parameters
inAngleThe incoming angle of the radar wave in the global frame.
outAngleThe outgoing angle of the reflected radar wave in the global frame.
timeThe simulation time at which the interaction occurs.
Returns
The Radar Cross Section (RCS) value in meters squared (m²).
Exceptions
std::runtime_errorIf RCS data cannot be retrieved.

This function calculates the target's aspect-dependent RCS. The key steps are:

  1. Calculate the bistatic angle bisector in the global simulation coordinate system.
  2. Retrieve the target's own orientation (rotation) at the specified 'time'.
  3. Transform the global bistatic angle into the target's local, body-fixed frame by subtracting the target's rotation. This is critical, as RCS patterns are defined relative to the target itself.
  4. Use this local aspect angle to look up the azimuthal and elevation RCS values from the loaded data.

NOTE: This function returns the raw RCS value (σ), which is linearly proportional to scattered power. The calling physics engine is responsible for converting this to a signal amplitude by taking the square root.

Implements radar::Target.

Definition at line 75 of file target.cpp.

76 {
77 // TODO: the handling of arbitrary rcs models needs to be validated and expanded to cover edge cases.
78 // 1. Calculate the bistatic angle bisector in the GLOBAL frame.
79 const SVec3 global_bisector_angle = inAngle + outAngle;
80
81 // 2. Get the target's own rotation at the current time.
82 const SVec3 target_rotation = getRotation(time);
83
84 // 3. Transform the global angle into the target's LOCAL frame for lookup.
85 const SVec3 local_aspect_angle = global_bisector_angle - target_rotation;
86
87 // 4. Use the local aspect angle (bisector is halved) to look up RCS.
88 const auto azi_value = _azi_samples->getValueAt(local_aspect_angle.azimuth / 2.0);
89
90 if (const auto elev_value = _elev_samples->getValueAt(local_aspect_angle.elevation / 2.0);
91 azi_value && elev_value)
92 {
93 // Return the raw RCS value (proportional to power), not its square root.
94 const RealType rcs = *azi_value * *elev_value;
95 return _model ? rcs * _model->sampleModel() : rcs;
96 }
97
98 LOG(logging::Level::FATAL, "Could not get RCS value for target");
99 throw std::runtime_error("Could not get RCS value for target");
100 }
A class representing a vector in spherical coordinates.
RealType elevation
The elevation angle of the vector.
RealType azimuth
The azimuth angle of the vector.
math::SVec3 getRotation(const RealType time) const
Retrieves the rotation of the object.
Definition object.h:54
double RealType
Type for real numbers.
Definition config.h:27
#define LOG(level,...)
Definition logging.h:19
@ FATAL
Fatal level for severe error events.

References radar::Target::_model, math::SVec3::azimuth, math::SVec3::elevation, logging::FATAL, radar::Object::getRotation(), and LOG.

+ Here is the call graph for this function:

◆ getRngEngine()

std::mt19937 & radar::Target::getRngEngine ( )
noexceptinherited

Gets the target's internal random number generator engine.

Returns
A mutable reference to the RNG engine.

Definition at line 145 of file target.h.

145{ return _rng; }
std::mt19937 _rng
Per-object random number generator for statistical independence.
Definition target.h:163

References radar::Target::_rng.

◆ getRotation()

math::SVec3 radar::Object::getRotation ( const RealType  time) const
inherited

Retrieves the rotation of the object.

Parameters
timeThe time at which to get the rotation of the object.
Returns
A math::SVec3 representing the rotation of the object.

Definition at line 54 of file object.h.

54{ return _platform->getRotation(time); }
math::SVec3 getRotation(const RealType time) const
Gets the rotation of the platform at a specific time.
Definition platform.h:82

References radar::Platform::getRotation().

Referenced by getRcs(), and processing::runPulsedFinalizer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFluctuationModel()

void radar::Target::setFluctuationModel ( std::unique_ptr< RcsModel in)
inherited

Sets the RCS fluctuation model.

Assigns a new RCS fluctuation model to the target.

Parameters
inUnique pointer to the new RCS fluctuation model.

Definition at line 153 of file target.h.

153{ _model = std::move(in); }

References radar::Target::_model.

Member Data Documentation

◆ _model

std::unique_ptr<RcsModel> radar::Target::_model {nullptr}
protectedinherited

The RCS fluctuation model for the target.

Definition at line 162 of file target.h.

162{nullptr}; ///< The RCS fluctuation model for the target.

Referenced by radar::Target::getFluctuationModel(), getRcs(), and radar::Target::setFluctuationModel().

◆ _rng

std::mt19937 radar::Target::_rng
protectedinherited

Per-object random number generator for statistical independence.

Definition at line 163 of file target.h.

Referenced by radar::Target::getRngEngine().


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