FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
params Namespace Reference

Classes

class  Parameters
 Struct to hold simulation parameters. More...
 

Enumerations

enum class  CoordinateFrame : std::uint8_t { ENU , UTM , ECEF }
 Defines the coordinate systems supported for KML/geospatial export. More...
 
enum class  RotationAngleUnit : std::uint8_t { Degrees , Radians }
 Defines the units used at external rotation-path boundaries. More...
 

Functions

RealType c () noexcept
 Get the speed of light.
 
RealType boltzmannK () noexcept
 Get the Boltzmann constant.
 
RealType startTime () noexcept
 Get the start time for the simulation.
 
RealType endTime () noexcept
 Get the end time for the simulation.
 
RealType simSamplingRate () noexcept
 Get the simulation sampling rate.
 
RealType rate () noexcept
 Get the rendering sample rate.
 
unsigned randomSeed () noexcept
 Get the random seed.
 
unsigned adcBits () noexcept
 Get the ADC quantization bits.
 
unsigned renderFilterLength () noexcept
 Get the render filter length.
 
unsigned renderThreads () noexcept
 Get the number of worker threads.
 
unsigned oversampleRatio () noexcept
 Get the oversampling ratio.
 
constexpr unsigned maxSupportedOversampleRatio () noexcept
 Gets the maximum supported oversampling ratio.
 
void validateOversampleRatio (const unsigned ratio)
 Validates that an oversampling ratio is supported.
 
void setC (RealType cValue) noexcept
 Set the speed of light.
 
void setTime (const RealType startTime, const RealType endTime) noexcept
 Set the start and end times for the simulation.
 
void setSimSamplingRate (const RealType rate) noexcept
 Set the simulation sampling rate.
 
void setRate (RealType rateValue)
 Set the rendering sample rate.
 
void setRandomSeed (const unsigned seed) noexcept
 Set the random seed.
 
void setAdcBits (const unsigned bits) noexcept
 Set the ADC quantization bits.
 
void setOversampleRatio (unsigned ratio)
 Set the oversampling ratio.
 
void setOrigin (const double lat, const double lon, const double alt) noexcept
 Set the geodetic origin for ENU KML/geospatial export.
 
double originLatitude () noexcept
 Gets the KML/geospatial export origin latitude.
 
double originLongitude () noexcept
 Gets the KML/geospatial export origin longitude.
 
double originAltitude () noexcept
 Gets the KML/geospatial export origin altitude.
 
std::expected< void, std::string > setThreads (const unsigned threads) noexcept
 Set the number of worker threads.
 
void setCoordinateSystem (const CoordinateFrame frame, const int zone, const bool north) noexcept
 Set the coordinate system for KML/geospatial export.
 
CoordinateFrame coordinateFrame () noexcept
 Gets the KML/geospatial export coordinate frame.
 
RotationAngleUnit rotationAngleUnit () noexcept
 Gets the external rotation angle unit.
 
int utmZone () noexcept
 Gets the configured KML UTM zone.
 
bool utmNorthHemisphere () noexcept
 Gets the configured KML UTM hemisphere.
 
void setRotationAngleUnit (const RotationAngleUnit unit) noexcept
 Sets the external rotation angle unit.
 
constexpr std::string_view rotationAngleUnitToken (const RotationAngleUnit unit) noexcept
 Converts a rotation angle unit to its XML token.
 
std::optional< RotationAngleUnitrotationAngleUnitFromToken (const std::string_view token) noexcept
 Parses a rotation angle unit from an XML token.
 
 NLOHMANN_JSON_SERIALIZE_ENUM (CoordinateFrame, {{CoordinateFrame::ENU, "ENU"}, {CoordinateFrame::UTM, "UTM"}, {CoordinateFrame::ECEF, "ECEF"}}) NLOHMANN_JSON_SERIALIZE_ENUM(RotationAngleUnit
 

Variables

Parameters params
 Global simulation parameter state.
 

Enumeration Type Documentation

◆ CoordinateFrame

enum class params::CoordinateFrame : std::uint8_t
strong

Defines the coordinate systems supported for KML/geospatial export.

Enumerator
ENU 

East-North-Up local tangent plane (default)

UTM 

Universal Transverse Mercator.

ECEF 

Earth-Centered, Earth-Fixed.

Definition at line 30 of file parameters.h.

31 {
32 ENU, ///< East-North-Up local tangent plane (default)
33 UTM, ///< Universal Transverse Mercator
34 ECEF ///< Earth-Centered, Earth-Fixed
35 };
@ UTM
Universal Transverse Mercator.
@ ENU
East-North-Up local tangent plane (default)
@ ECEF
Earth-Centered, Earth-Fixed.

◆ RotationAngleUnit

enum class params::RotationAngleUnit : std::uint8_t
strong

Defines the units used at external rotation-path boundaries.

Enumerator
Degrees 

Compass azimuth and elevation expressed in degrees.

Radians 

Compass azimuth and elevation expressed in radians.

Definition at line 41 of file parameters.h.

42 {
43 Degrees, ///< Compass azimuth and elevation expressed in degrees
44 Radians ///< Compass azimuth and elevation expressed in radians
45 };

Function Documentation

◆ adcBits()

unsigned params::adcBits ( )
noexcept

Get the ADC quantization bits.

Returns
Number of ADC quantization bits.

Definition at line 133 of file parameters.h.

133{ return params.adc_bits; }

Referenced by processing::buildReceiverStreamDescriptor(), and processing::quantizeAndScaleWindow().

+ Here is the caller graph for this function:

◆ boltzmannK()

RealType params::boltzmannK ( )
noexcept

Get the Boltzmann constant.

Returns
The Boltzmann constant.

Definition at line 97 of file parameters.h.

97{ return params.boltzmann_k; }

Referenced by processing::applyThermalNoise(), and processing::applyThermalNoiseAtSampleRate().

+ Here is the caller graph for this function:

◆ c()

RealType params::c ( )
noexcept

Get the speed of light.

Returns
The speed of light in meters per second.

Definition at line 91 of file parameters.h.

91{ return params.c; }

Referenced by simulation::calculateStreamingDirectPathContribution(), simulation::calculateStreamingReflectedPathContribution(), fers_get_antenna_pattern(), simulation::solveRe(), and simulation::solveReDirect().

+ Here is the caller graph for this function:

◆ coordinateFrame()

CoordinateFrame params::coordinateFrame ( )
noexcept

Gets the KML/geospatial export coordinate frame.

Returns
The KML/geospatial export coordinate frame.

Definition at line 321 of file parameters.h.

321{ return params.coordinate_frame; }

◆ endTime()

◆ maxSupportedOversampleRatio()

constexpr unsigned params::maxSupportedOversampleRatio ( )
constexprnoexcept

Gets the maximum supported oversampling ratio.

Returns
The maximum supported oversampling ratio.

Definition at line 157 of file parameters.h.

157{ return 8u; }

Referenced by validateOversampleRatio().

+ Here is the caller graph for this function:

◆ NLOHMANN_JSON_SERIALIZE_ENUM()

params::NLOHMANN_JSON_SERIALIZE_ENUM ( CoordinateFrame  ,
{{CoordinateFrame::ENU, "ENU"}, {CoordinateFrame::UTM, "UTM"}, {CoordinateFrame::ECEF, "ECEF"}}   
)

References ECEF, ENU, and UTM.

◆ originAltitude()

double params::originAltitude ( )
noexcept

Gets the KML/geospatial export origin altitude.

Returns
The KML origin altitude in meters.

Definition at line 285 of file parameters.h.

285{ return params.origin_altitude; }

◆ originLatitude()

double params::originLatitude ( )
noexcept

Gets the KML/geospatial export origin latitude.

Returns
The KML origin latitude in degrees.

Definition at line 273 of file parameters.h.

273{ return params.origin_latitude; }

◆ originLongitude()

double params::originLongitude ( )
noexcept

Gets the KML/geospatial export origin longitude.

Returns
The KML origin longitude in degrees.

Definition at line 279 of file parameters.h.

279{ return params.origin_longitude; }

◆ oversampleRatio()

unsigned params::oversampleRatio ( )
noexcept

◆ randomSeed()

unsigned params::randomSeed ( )
noexcept

Get the random seed.

Returns
The current random seed value.

Definition at line 127 of file parameters.h.

127{ return params.random_seed.value_or(0); }

◆ rate()

◆ renderFilterLength()

unsigned params::renderFilterLength ( )
noexcept

Get the render filter length.

Returns
The length of the render filter.

Definition at line 139 of file parameters.h.

139{ return params.filter_length; }

Referenced by fers_signal::downsample(), fers_signal::DownsamplingSink::DownsamplingSink(), fers_signal::Signal::renderSlice(), and fers_signal::upsample().

+ Here is the caller graph for this function:

◆ renderThreads()

unsigned params::renderThreads ( )
noexcept

Get the number of worker threads.

Returns
The number of worker threads.

Definition at line 145 of file parameters.h.

145{ return params.render_threads; }

◆ rotationAngleUnit()

RotationAngleUnit params::rotationAngleUnit ( )
noexcept

Gets the external rotation angle unit.

Returns
The active rotation angle unit.

Definition at line 327 of file parameters.h.

327{ return params.rotation_angle_unit; }

Referenced by math::from_json(), serial::xml_serializer_utils::serializeRotation(), math::to_json(), and serial::update_platform_paths_from_json().

+ Here is the caller graph for this function:

◆ rotationAngleUnitFromToken()

std::optional< RotationAngleUnit > params::rotationAngleUnitFromToken ( const std::string_view  token)
noexcept

Parses a rotation angle unit from an XML token.

Parameters
tokenThe token to parse.
Returns
The parsed unit, or std::nullopt if the token is unknown.

Definition at line 362 of file parameters.h.

363 {
364 if (token == "deg")
365 {
366 return RotationAngleUnit::Degrees;
367 }
368 if (token == "rad")
369 {
370 return RotationAngleUnit::Radians;
371 }
372 return std::nullopt;
373 }
math::Vec3 max

References Degrees, max, and Radians.

Referenced by serial::xml_parser_utils::parseRotationAngleUnit().

+ Here is the caller graph for this function:

◆ rotationAngleUnitToken()

constexpr std::string_view params::rotationAngleUnitToken ( const RotationAngleUnit  unit)
constexprnoexcept

Converts a rotation angle unit to its XML token.

Parameters
unitThe rotation angle unit.
Returns
The corresponding token string.

Definition at line 352 of file parameters.h.

353 {
354 return unit == RotationAngleUnit::Radians ? "rad" : "deg";
355 }

References Radians.

Referenced by serial::kml_generator_utils::generateDirectionalAntennaKml(), and serial::xml_serializer_utils::serializeParameters().

+ Here is the caller graph for this function:

◆ setAdcBits()

void params::setAdcBits ( const unsigned  bits)
noexcept

Set the ADC quantization bits.

Parameters
bitsThe new ADC quantization bits.

Definition at line 237 of file parameters.h.

238 {
239 params.adc_bits = bits;
240 LOG(logging::Level::DEBUG, "ADC quantization bits set to: {}", bits);
241 }
#define LOG(level,...)
Definition logging.h:19
@ DEBUG
Debug level for general debugging information.

References logging::DEBUG, LOG, and max.

◆ setC()

void params::setC ( RealType  cValue)
noexcept

Set the speed of light.

Parameters
cValueThe new speed of light.

Definition at line 181 of file parameters.h.

182 {
183 params.c = cValue;
184 LOG(logging::Level::INFO, "Propagation speed (c) set to: {:.5f}", cValue);
185 }
@ INFO
Info level for informational messages.

References logging::INFO, LOG, and max.

◆ setCoordinateSystem()

void params::setCoordinateSystem ( const CoordinateFrame  frame,
const int  zone,
const bool  north 
)
noexcept

Set the coordinate system for KML/geospatial export.

Parameters
frameThe KML coordinate frame (ENU, UTM, ECEF).
zoneThe KML UTM zone, if applicable.
northThe KML UTM hemisphere (true for North), if applicable.

Definition at line 310 of file parameters.h.

311 {
312 params.coordinate_frame = frame;
313 params.utm_zone = zone;
314 params.utm_north_hemisphere = north;
315 }

References max.

◆ setOrigin()

void params::setOrigin ( const double  lat,
const double  lon,
const double  alt 
)
noexcept

Set the geodetic origin for ENU KML/geospatial export.

Parameters
latThe latitude of the KML origin.
lonThe longitude of the KML origin.
altThe altitude of the KML origin (MSL).

Definition at line 261 of file parameters.h.

262 {
263 params.origin_latitude = lat;
264 params.origin_longitude = lon;
265 params.origin_altitude = alt;
266 LOG(logging::Level::INFO, "KML origin set to lat: {}, lon: {}, alt: {}", lat, lon, alt);
267 }

References logging::INFO, LOG, and max.

◆ setOversampleRatio()

void params::setOversampleRatio ( unsigned  ratio)

Set the oversampling ratio.

Parameters
ratioThe new oversampling ratio.
Exceptions
std::runtime_errorif the ratio is zero.

Definition at line 248 of file parameters.h.

249 {
251 params.oversample_ratio = ratio;
252 LOG(logging::Level::DEBUG, "Oversampling enabled with ratio: {}", ratio);
253 }
void validateOversampleRatio(const unsigned ratio)
Validates that an oversampling ratio is supported.
Definition parameters.h:164

References logging::DEBUG, LOG, and validateOversampleRatio().

+ Here is the call graph for this function:

◆ setRandomSeed()

void params::setRandomSeed ( const unsigned  seed)
noexcept

Set the random seed.

Parameters
seedThe new random seed value.

Definition at line 227 of file parameters.h.

228 {
229 params.random_seed = seed;
230 LOG(logging::Level::DEBUG, "Random seed set to: {}", seed);
231 }

References logging::DEBUG, LOG, and max.

◆ setRate()

void params::setRate ( RealType  rateValue)

Set the rendering sample rate.

Parameters
rateValueThe new sample rate for rendering.

Definition at line 213 of file parameters.h.

214 {
215 if (rateValue <= 0)
216 {
217 throw std::runtime_error("Sampling rate must be > 0");
218 }
219 params.rate = rateValue;
220 LOG(logging::Level::DEBUG, "Sample rate set to: {:.5f}", rateValue);
221 }

References logging::DEBUG, LOG, and max.

◆ setRotationAngleUnit()

void params::setRotationAngleUnit ( const RotationAngleUnit  unit)
noexcept

Sets the external rotation angle unit.

Parameters
unitThe rotation angle unit to store.

Definition at line 345 of file parameters.h.

345{ params.rotation_angle_unit = unit; }

◆ setSimSamplingRate()

void params::setSimSamplingRate ( const RealType  rate)
noexcept

Set the simulation sampling rate.

Parameters
rateThe new simulation sampling rate.

Definition at line 203 of file parameters.h.

204 {
205 params.sim_sampling_rate = rate;
206 LOG(logging::Level::DEBUG, "Simulation sampling rate set to: {:.5f} Hz", rate);
207 }
RealType rate() noexcept
Get the rendering sample rate.
Definition parameters.h:121

References logging::DEBUG, LOG, and rate().

+ Here is the call graph for this function:

◆ setThreads()

std::expected< void, std::string > params::setThreads ( const unsigned  threads)
noexcept

Set the number of worker threads.

Parameters
threadsThe number of worker threads.
Returns
A std::expected<void, std::string> indicating success or an error message if the number of threads is invalid.

Definition at line 293 of file parameters.h.

294 {
295 if (threads == 0)
296 {
297 return std::unexpected("Thread count must be >= 1");
298 }
299 params.render_threads = threads;
300 LOG(logging::Level::INFO, "Number of worker threads set to: {}", threads);
301 return {};
302 }

References logging::INFO, LOG, and max.

Referenced by fers_set_thread_count().

+ Here is the caller graph for this function:

◆ setTime()

void params::setTime ( const RealType  startTime,
const RealType  endTime 
)
noexcept

Set the start and end times for the simulation.

Parameters
startTimeStart time for the simulation.
endTimeEnd time for the simulation.

Definition at line 192 of file parameters.h.

193 {
194 params.start = startTime;
195 params.end = endTime;
196 LOG(logging::Level::INFO, "Simulation time set from {:.5f} to {:.5f} seconds", startTime, endTime);
197 }
RealType endTime() noexcept
Get the end time for the simulation.
Definition parameters.h:109
RealType startTime() noexcept
Get the start time for the simulation.
Definition parameters.h:103

References endTime(), logging::INFO, LOG, and startTime().

+ Here is the call graph for this function:

◆ simSamplingRate()

RealType params::simSamplingRate ( )
noexcept

Get the simulation sampling rate.

Returns
The simulation sampling rate.

Definition at line 115 of file parameters.h.

115{ return params.sim_sampling_rate; }

Referenced by simulation::calculateResponse().

+ Here is the caller graph for this function:

◆ startTime()

◆ utmNorthHemisphere()

bool params::utmNorthHemisphere ( )
noexcept

Gets the configured KML UTM hemisphere.

Returns
true for northern hemisphere, false for southern hemisphere.

Definition at line 339 of file parameters.h.

339{ return params.utm_north_hemisphere; }

◆ utmZone()

int params::utmZone ( )
noexcept

Gets the configured KML UTM zone.

Returns
The KML UTM zone, or zero when UTM KML export is not configured.

Definition at line 333 of file parameters.h.

333{ return params.utm_zone; }

◆ validateOversampleRatio()

void params::validateOversampleRatio ( const unsigned  ratio)

Validates that an oversampling ratio is supported.

Parameters
ratioThe oversampling ratio to validate.
Exceptions
std::runtime_errorif the ratio is outside the supported range.

Definition at line 164 of file parameters.h.

165 {
166 if (ratio == 0)
167 {
168 throw std::runtime_error("Oversample ratio must be >= 1");
169 }
170 if (ratio > maxSupportedOversampleRatio())
171 {
172 throw std::runtime_error("Oversampling ratios > 8 are not supported with the current fixed filter length "
173 "of 33. Signal attenuation will occur.");
174 }
175 }

References maxSupportedOversampleRatio().

Referenced by serial::xml_parser_utils::parseOptionalNumericParameters(), and setOversampleRatio().

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

Variable Documentation

◆ params