FERS 1.0.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 { ENU , UTM , ECEF }
 Defines the coordinate systems supported for scenario definition. 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.
 
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 the KML generator.
 
double originLatitude () noexcept
 
double originLongitude () noexcept
 
double originAltitude () noexcept
 
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 the scenario.
 
CoordinateFrame coordinateFrame () noexcept
 
int utmZone () noexcept
 
bool utmNorthHemisphere () noexcept
 
 NLOHMANN_JSON_SERIALIZE_ENUM (CoordinateFrame, {{CoordinateFrame::ENU, "ENU"}, {CoordinateFrame::UTM, "UTM"}, {CoordinateFrame::ECEF, "ECEF"}}) void to_json(nlohmann
 
void from_json (const nlohmann::json &j, Parameters &p)
 

Variables

Parameters params
 

Enumeration Type Documentation

◆ CoordinateFrame

enum class params::CoordinateFrame
strong

Defines the coordinate systems supported for scenario definition.

Enumerator
ENU 

East-North-Up local tangent plane (default)

UTM 

Universal Transverse Mercator.

ECEF 

Earth-Centered, Earth-Fixed.

Definition at line 28 of file parameters.h.

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

Function Documentation

◆ adcBits()

unsigned params::adcBits ( )
noexcept

Get the ADC quantization bits.

Returns
Number of ADC quantization bits.

Definition at line 121 of file parameters.h.

121{ return params.adc_bits; }

Referenced by 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 85 of file parameters.h.

85{ return params.boltzmann_k; }

Referenced by processing::applyThermalNoise().

+ 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 79 of file parameters.h.

79{ return params.c; }

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

+ Here is the caller graph for this function:

◆ coordinateFrame()

CoordinateFrame params::coordinateFrame ( )
noexcept

Definition at line 272 of file parameters.h.

272{ return params.coordinate_frame; }

Referenced by serial::KmlGenerator::generateKml().

+ Here is the caller graph for this function:

◆ endTime()

RealType params::endTime ( )
noexcept

Get the end time for the simulation.

Returns
End time for the simulation.

Definition at line 97 of file parameters.h.

97{ return params.end; }

Referenced by fers_signal::from_json(), radar::Receiver::getWindowCount(), serial::json_to_world(), radar::processRawSchedule(), core::runEventDrivenSim(), core::World::scheduleInitialEvents(), and setTime().

+ Here is the caller graph for this function:

◆ from_json()

void params::from_json ( const nlohmann::json &  j,
Parameters p 
)

Definition at line 516 of file json_serializer.cpp.

517 {
518 p.start = j.at("starttime").get<RealType>();
519 p.end = j.at("endtime").get<RealType>();
520 p.rate = j.at("rate").get<RealType>();
521 p.c = j.value("c", Parameters::DEFAULT_C);
522 p.sim_sampling_rate = j.value("simSamplingRate", 1000.0);
523 p.adc_bits = j.value("adc_bits", 0);
524 p.oversample_ratio = j.value("oversample", 1);
525 p.random_seed = j.value<std::optional<unsigned>>("randomseed", std::nullopt);
526
527 const auto& origin = j.at("origin");
528 p.origin_latitude = origin.at("latitude").get<double>();
529 p.origin_longitude = origin.at("longitude").get<double>();
530 p.origin_altitude = origin.at("altitude").get<double>();
531
532 const auto& cs = j.at("coordinatesystem");
533 p.coordinate_frame = cs.at("frame").get<CoordinateFrame>();
534 if (p.coordinate_frame == CoordinateFrame::UTM)
535 {
536 p.utm_zone = cs.at("zone").get<int>();
537 p.utm_north_hemisphere = cs.at("hemisphere").get<std::string>() == "N";
538 }
539 }
double RealType
Type for real numbers.
Definition config.h:27
CoordinateFrame
Defines the coordinate systems supported for scenario definition.
Definition parameters.h:29
RealType rate
Rendering sample rate.
Definition parameters.h:57
double origin_longitude
Geodetic origin longitude.
Definition parameters.h:52
RealType start
Start time for the simulation.
Definition parameters.h:45
double origin_altitude
Geodetic origin altitude (in meters)
Definition parameters.h:53
CoordinateFrame coordinate_frame
Scenario coordinate frame.
Definition parameters.h:54
RealType end
End time for the simulation.
Definition parameters.h:46
int utm_zone
UTM zone (1-60), if applicable.
Definition parameters.h:55
unsigned oversample_ratio
Oversampling ratio.
Definition parameters.h:63
std::optional< unsigned > random_seed
Random seed for simulation.
Definition parameters.h:58
RealType sim_sampling_rate
Temporal sampling rate (Hz) that determines time-step resolution for radar pulse simulation.
Definition parameters.h:47
RealType c
Speed of light (modifiable)
Definition parameters.h:43
unsigned adc_bits
ADC quantization bits.
Definition parameters.h:59
bool utm_north_hemisphere
UTM hemisphere, if applicable.
Definition parameters.h:56
double origin_latitude
Geodetic origin latitude.
Definition parameters.h:51

References params::Parameters::adc_bits, params::Parameters::c, params::Parameters::coordinate_frame, params::Parameters::DEFAULT_C, params::Parameters::end, params::Parameters::origin_altitude, params::Parameters::origin_latitude, params::Parameters::origin_longitude, params::Parameters::oversample_ratio, params::Parameters::random_seed, params::Parameters::rate, params::Parameters::sim_sampling_rate, params::Parameters::start, UTM, params::Parameters::utm_north_hemisphere, and params::Parameters::utm_zone.

◆ NLOHMANN_JSON_SERIALIZE_ENUM()

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

Definition at line 485 of file json_serializer.cpp.

486 {{CoordinateFrame::ENU, "ENU"},
487 {CoordinateFrame::UTM, "UTM"},
488 {CoordinateFrame::ECEF, "ECEF"}})
489
490 void to_json(nlohmann::json& j, const Parameters& p)
491 {
492 j = nlohmann::json{{"starttime", p.start},
493 {"endtime", p.end},
494 {"rate", p.rate},
495 {"c", p.c},
496 {"simSamplingRate", p.sim_sampling_rate},
497 {"adc_bits", p.adc_bits},
498 {"oversample", p.oversample_ratio}};
499
500 if (p.random_seed.has_value())
501 {
502 j["randomseed"] = p.random_seed.value();
503 }
504
505 j["origin"] = {
506 {"latitude", p.origin_latitude}, {"longitude", p.origin_longitude}, {"altitude", p.origin_altitude}};
507
508 j["coordinatesystem"] = {{"frame", p.coordinate_frame}};
509 if (p.coordinate_frame == CoordinateFrame::UTM)
510 {
511 j["coordinatesystem"]["zone"] = p.utm_zone;
512 j["coordinatesystem"]["hemisphere"] = p.utm_north_hemisphere ? "N" : "S";
513 }
514 }
void to_json(nlohmann::json &j, const Vec3 &v)

References ECEF, ENU, and UTM.

◆ originAltitude()

double params::originAltitude ( )
noexcept

Definition at line 240 of file parameters.h.

240{ return params.origin_altitude; }

Referenced by serial::KmlGenerator::generateKml().

+ Here is the caller graph for this function:

◆ originLatitude()

double params::originLatitude ( )
noexcept

Definition at line 236 of file parameters.h.

236{ return params.origin_latitude; }

Referenced by serial::KmlGenerator::generateKml().

+ Here is the caller graph for this function:

◆ originLongitude()

double params::originLongitude ( )
noexcept

Definition at line 238 of file parameters.h.

238{ return params.origin_longitude; }

Referenced by serial::KmlGenerator::generateKml().

+ Here is the caller graph for this function:

◆ oversampleRatio()

unsigned params::oversampleRatio ( )
noexcept

Get the oversampling ratio.

Returns
The oversampling ratio.

Definition at line 139 of file parameters.h.

139{ return params.oversample_ratio; }

Referenced by processing::applyThermalNoise(), fers_signal::downsample(), processing::finalizeCwReceiver(), serial::json_to_world(), fers_signal::Signal::load(), processing::renderWindow(), core::runEventDrivenSim(), processing::runPulsedFinalizer(), radar::Transmitter::setPrf(), radar::Receiver::setWindowProperties(), and fers_signal::upsample().

+ Here is the caller graph for this function:

◆ randomSeed()

unsigned params::randomSeed ( )
noexcept

Get the random seed.

Returns
The current random seed value.

Definition at line 115 of file parameters.h.

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

◆ rate()

RealType params::rate ( )
noexcept

Get the rendering sample rate.

Returns
The rendering sample rate.

Definition at line 109 of file parameters.h.

109{ return params.rate; }

Referenced by serial::addChunkToFile(), processing::applyThermalNoise(), processing::finalizeCwReceiver(), noise::ClockModelGenerator::getSample(), serial::json_to_world(), processing::renderWindow(), core::runEventDrivenSim(), processing::runPulsedFinalizer(), radar::Transmitter::setPrf(), setSimSamplingRate(), and radar::Receiver::setWindowProperties().

+ Here is the caller graph for this function:

◆ renderFilterLength()

unsigned params::renderFilterLength ( )
noexcept

Get the render filter length.

Returns
The length of the render filter.

Definition at line 127 of file parameters.h.

127{ return params.filter_length; }

Referenced by fers_signal::Signal::render().

+ 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 133 of file parameters.h.

133{ return params.render_threads; }

Referenced by fers_run_simulation().

+ 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 201 of file parameters.h.

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

References logging::DEBUG, and LOG.

◆ setC()

void params::setC ( RealType  cValue)
noexcept

Set the speed of light.

Parameters
cValueThe new speed of light.

Definition at line 145 of file parameters.h.

146 {
147 params.c = cValue;
148 LOG(logging::Level::INFO, "Propagation speed (c) set to: {:.5f}", cValue);
149 }
@ INFO
Info level for informational messages.

References logging::INFO, and LOG.

◆ setCoordinateSystem()

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

Set the coordinate system for the scenario.

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

Definition at line 265 of file parameters.h.

266 {
267 params.coordinate_frame = frame;
268 params.utm_zone = zone;
269 params.utm_north_hemisphere = north;
270 }

◆ setOrigin()

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

Set the geodetic origin for the KML generator.

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

Definition at line 228 of file parameters.h.

229 {
230 params.origin_latitude = lat;
231 params.origin_longitude = lon;
232 params.origin_altitude = alt;
233 LOG(logging::Level::INFO, "Origin set to lat: {}, lon: {}, alt: {}", lat, lon, alt);
234 }

References logging::INFO, and LOG.

◆ 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 212 of file parameters.h.

213 {
214 if (ratio == 0)
215 {
216 throw std::runtime_error("Oversample ratio must be >= 1");
217 }
218 params.oversample_ratio = ratio;
219 LOG(logging::Level::DEBUG, "Oversampling enabled with ratio: {}", ratio);
220 }

References logging::DEBUG, and LOG.

◆ setRandomSeed()

void params::setRandomSeed ( const unsigned  seed)
noexcept

Set the random seed.

Parameters
seedThe new random seed value.

Definition at line 191 of file parameters.h.

192 {
193 params.random_seed = seed;
194 LOG(logging::Level::DEBUG, "Random seed set to: {}", seed);
195 }

References logging::DEBUG, and LOG.

◆ setRate()

void params::setRate ( RealType  rateValue)

Set the rendering sample rate.

Parameters
rateValueThe new sample rate for rendering.

Definition at line 177 of file parameters.h.

178 {
179 if (rateValue <= 0)
180 {
181 throw std::runtime_error("Sampling rate must be > 0");
182 }
183 params.rate = rateValue;
184 LOG(logging::Level::DEBUG, "Sample rate set to: {:.5f}", rateValue);
185 }

References logging::DEBUG, and LOG.

◆ setSimSamplingRate()

void params::setSimSamplingRate ( const RealType  rate)
noexcept

Set the simulation sampling rate.

Parameters
rateThe new simulation sampling rate.

Definition at line 167 of file parameters.h.

168 {
169 params.sim_sampling_rate = rate;
170 LOG(logging::Level::DEBUG, "Simulation sampling rate set to: {:.5f} Hz", rate);
171 }
RealType rate() noexcept
Get the rendering sample rate.
Definition parameters.h:109

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 248 of file parameters.h.

249 {
250 if (threads == 0)
251 {
252 return std::unexpected("Thread count must be >= 1");
253 }
254 params.render_threads = threads;
255 LOG(logging::Level::INFO, "Number of worker threads set to: {}", threads);
256 return {};
257 }

References logging::INFO, and LOG.

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 156 of file parameters.h.

157 {
158 params.start = startTime;
159 params.end = endTime;
160 LOG(logging::Level::INFO, "Simulation time set from {:.5f} to {:.5f} seconds", startTime, endTime);
161 }
RealType endTime() noexcept
Get the end time for the simulation.
Definition parameters.h:97
RealType startTime() noexcept
Get the start time for the simulation.
Definition parameters.h:91

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 103 of file parameters.h.

103{ return params.sim_sampling_rate; }

Referenced by simulation::calculateResponse().

+ Here is the caller graph for this function:

◆ startTime()

RealType params::startTime ( )
noexcept

Get the start time for the simulation.

Returns
Start time for the simulation.

Definition at line 91 of file parameters.h.

91{ return params.start; }

Referenced by processing::finalizeCwReceiver(), fers_signal::from_json(), radar::Receiver::getWindowCount(), serial::json_to_world(), radar::processRawSchedule(), core::runEventDrivenSim(), core::World::scheduleInitialEvents(), and setTime().

+ Here is the caller graph for this function:

◆ utmNorthHemisphere()

bool params::utmNorthHemisphere ( )
noexcept

Definition at line 276 of file parameters.h.

276{ return params.utm_north_hemisphere; }

Referenced by serial::KmlGenerator::generateKml().

+ Here is the caller graph for this function:

◆ utmZone()

int params::utmZone ( )
noexcept

Definition at line 274 of file parameters.h.

274{ return params.utm_zone; }

Referenced by serial::KmlGenerator::generateKml().

+ Here is the caller graph for this function:

Variable Documentation

◆ params