FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
radar Namespace Reference

Classes

class  FileTarget
 File-based radar target. More...
 
class  IsoTarget
 Isotropic radar target. More...
 
class  Object
 Represents a physical object in the radar system. More...
 
class  Platform
 Represents a simulation platform with motion and rotation paths. More...
 
class  Radar
 Represents a radar system on a platform. More...
 
class  RcsChiSquare
 Chi-square distributed RCS model. More...
 
class  RcsConst
 Constant RCS model. More...
 
class  RcsModel
 Base class for RCS fluctuation models. More...
 
class  Receiver
 Manages radar signal reception and response processing. More...
 
struct  SchedulePeriod
 Represents a time period during which the transmitter is active. More...
 
class  Target
 Base class for radar targets. More...
 
class  Transmitter
 Represents a radar transmitter system. More...
 

Enumerations

enum class  OperationMode { PULSED_MODE , CW_MODE }
 Defines the operational mode of a radar component. More...
 

Functions

std::vector< SchedulePeriodprocessRawSchedule (std::vector< SchedulePeriod > periods, const std::string &ownerName, bool isPulsed, RealType pri)
 Processes a raw list of schedule periods.
 
std::unique_ptr< TargetcreateIsoTarget (Platform *platform, std::string name, RealType rcs, unsigned seed, const SimId id=0)
 Creates an isotropic target.
 
std::unique_ptr< TargetcreateFileTarget (Platform *platform, std::string name, const std::string &filename, unsigned seed, const SimId id=0)
 Creates a file-based target.
 
void to_json (nlohmann::json &j, const SchedulePeriod &p)
 
void from_json (const nlohmann::json &j, SchedulePeriod &p)
 
void to_json (nlohmann::json &j, const Transmitter &t)
 
void to_json (nlohmann::json &j, const Receiver &r)
 
void to_json (nlohmann::json &j, const Target &t)
 
void to_json (nlohmann::json &j, const Platform &p)
 

Enumeration Type Documentation

◆ OperationMode

enum class radar::OperationMode
strong

Defines the operational mode of a radar component.

Enumerator
PULSED_MODE 

The component operates in a pulsed mode.

CW_MODE 

The component operates in a continuous-wave mode.

Definition at line 36 of file radar_obj.h.

37 {
38 PULSED_MODE, ///< The component operates in a pulsed mode.
39 CW_MODE ///< The component operates in a continuous-wave mode.
40 };
@ PULSED_MODE
The component operates in a pulsed mode.
@ CW_MODE
The component operates in a continuous-wave mode.

Function Documentation

◆ createFileTarget()

std::unique_ptr< Target > radar::createFileTarget ( Platform platform,
std::string  name,
const std::string &  filename,
unsigned  seed,
const SimId  id = 0 
)

Creates a file-based 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.
Returns
A unique pointer to the newly created FileTarget.

Definition at line 297 of file target.h.

299 {
300 return std::make_unique<FileTarget>(platform, std::move(name), filename, seed, id);
301 }

Referenced by serial::xml_parser_utils::createDefaultAssetLoaders(), and serial::update_target_from_json().

+ Here is the caller graph for this function:

◆ createIsoTarget()

std::unique_ptr< Target > radar::createIsoTarget ( Platform platform,
std::string  name,
RealType  rcs,
unsigned  seed,
const SimId  id = 0 
)

Creates an isotropic target.

Parameters
platformPointer to the platform associated with the target.
nameThe name of the target.
rcsThe constant RCS value for the target.
seedThe seed for the target's internal random number generator.
Returns
A unique pointer to the newly created IsoTarget.

Definition at line 282 of file target.h.

284 {
285 return std::make_unique<IsoTarget>(platform, std::move(name), rcs, seed, id);
286 }

Referenced by serial::xml_parser_utils::parseTarget(), and serial::update_target_from_json().

+ Here is the caller graph for this function:

◆ from_json()

void radar::from_json ( const nlohmann::json &  j,
SchedulePeriod p 
)

Definition at line 452 of file json_serializer.cpp.

453 {
454 j.at("start").get_to(p.start);
455 j.at("end").get_to(p.end);
456 }

References radar::SchedulePeriod::end, and radar::SchedulePeriod::start.

◆ processRawSchedule()

std::vector< SchedulePeriod > radar::processRawSchedule ( std::vector< SchedulePeriod periods,
const std::string &  ownerName,
bool  isPulsed,
RealType  pri 
)

Processes a raw list of schedule periods.

This function performs the following operations:

  1. Filters invalid periods (start >= end).
  2. Filters periods completely outside simulation bounds.
  3. Sorts periods by start time.
  4. Merges overlapping or adjacent periods.
  5. Checks against PRI constraints (if pulsed).
Parameters
periodsThe raw vector of periods.
ownerNameThe name of the object owning this schedule (for logging).
isPulsedWhether the object is operating in pulsed mode.
priThe Pulse Repetition Interval (only used if isPulsed is true).
Returns
A sorted, merged, and validated vector of periods.

Definition at line 17 of file schedule_period.cpp.

19 {
20 if (periods.empty())
21 {
22 return {};
23 }
24
25 std::vector<SchedulePeriod> valid_periods;
26 valid_periods.reserve(periods.size());
27
28 const RealType sim_start = params::startTime();
29 const RealType sim_end = params::endTime();
30
31 // 1. Filter invalid and out-of-bounds periods
32 for (const auto& p : periods)
33 {
34 if (p.start >= p.end)
35 {
37 "Object '{}' has a schedule period with start ({}) >= end ({}). Ignoring period.", ownerName,
38 p.start, p.end);
39 continue;
40 }
41
42 if (p.end <= sim_start || p.start >= sim_end)
43 {
45 "Object '{}' has a schedule period [{}, {}] completely outside simulation time. Ignoring.",
46 ownerName, p.start, p.end);
47 continue;
48 }
49 valid_periods.push_back(p);
50 }
51
52 if (valid_periods.empty())
53 {
54 return {};
55 }
56
57 // 2. Sort by start time
58 std::ranges::sort(valid_periods, [](const auto& a, const auto& b) { return a.start < b.start; });
59
60 // 3. Merge overlapping intervals
61 std::vector<SchedulePeriod> merged;
62 merged.reserve(valid_periods.size());
63 merged.push_back(valid_periods.front());
64
65 for (size_t i = 1; i < valid_periods.size(); ++i)
66 {
67 if (valid_periods[i].start <= merged.back().end)
68 {
69 // Overlap or adjacency: extend the previous period
70 merged.back().end = std::max(merged.back().end, valid_periods[i].end);
71 }
72 else
73 {
74 merged.push_back(valid_periods[i]);
75 }
76 }
77
78 // 4. Check PRI constraints
79 if (isPulsed)
80 {
81 for (const auto& period : merged)
82 {
83 if (period.end - period.start < pri)
84 {
85 LOG(logging::Level::WARNING, "Object '{}' has a schedule period [{}, {}] shorter than PRI ({}s).",
86 ownerName, period.start, period.end, pri);
87 }
88 }
89 }
90
91 return merged;
92 }
double RealType
Type for real numbers.
Definition config.h:27
#define LOG(level,...)
Definition logging.h:19
@ WARNING
Warning level for potentially harmful situations.
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 params::endTime(), LOG, params::startTime(), and logging::WARNING.

Referenced by serial::xml_parser_utils::parseSchedule(), serial::update_monostatic_from_json(), serial::update_receiver_from_json(), and serial::update_transmitter_from_json().

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

◆ to_json() [1/5]

void radar::to_json ( nlohmann::json &  j,
const Platform p 
)

Definition at line 539 of file json_serializer.cpp.

540 {
541 j = {{"id", sim_id_to_json(p.getId())}, {"name", p.getName()}, {"motionpath", *p.getMotionPath()}};
542
544 {
545 j["fixedrotation"] = *p.getRotationPath();
546 }
547 else
548 {
549 j["rotationpath"] = *p.getRotationPath();
550 }
551 }
InterpType getType() const noexcept
Gets the interpolation type of the path.
SimId getId() const noexcept
Gets the unique ID of the platform.
Definition platform.h:97
math::Path * getMotionPath() const noexcept
Gets the motion path of the platform.
Definition platform.h:60
const std::string & getName() const noexcept
Gets the name of the platform.
Definition platform.h:90
math::RotationPath * getRotationPath() const noexcept
Gets the rotation path of the platform.
Definition platform.h:67

References radar::Platform::getId(), radar::Platform::getMotionPath(), radar::Platform::getName(), radar::Platform::getRotationPath(), math::RotationPath::getType(), and math::RotationPath::INTERP_CONSTANT.

+ Here is the call graph for this function:

◆ to_json() [2/5]

void radar::to_json ( nlohmann::json &  j,
const Receiver r 
)

Definition at line 480 of file json_serializer.cpp.

481 {
482 j = nlohmann::json{{"id", sim_id_to_json(r.getId())},
483 {"name", r.getName()},
484 {"noise_temp", r.getNoiseTemperature()},
485 {"antenna", sim_id_to_json((r.getAntenna() != nullptr) ? r.getAntenna()->getId() : 0)},
486 {"timing", sim_id_to_json(r.getTiming() ? r.getTiming()->getId() : 0)},
487 {"nodirect", r.checkFlag(Receiver::RecvFlag::FLAG_NODIRECT)},
488 {"nopropagationloss", r.checkFlag(Receiver::RecvFlag::FLAG_NOPROPLOSS)}};
489
490 if (r.getMode() == OperationMode::PULSED_MODE)
491 {
492 j["pulsed_mode"] = {
493 {"prf", r.getWindowPrf()}, {"window_skip", r.getWindowSkip()}, {"window_length", r.getWindowLength()}};
494 }
495 else
496 {
497 j["cw_mode"] = nlohmann::json::object();
498 }
499 if (!r.getSchedule().empty())
500 {
501 j["schedule"] = r.getSchedule();
502 }
503 }
SimId getId() const noexcept
Retrieves the unique ID of the antenna.
const std::string & getName() const noexcept
Retrieves the name of the object.
Definition object.h:79
const antenna::Antenna * getAntenna() const noexcept
Gets the antenna associated with this radar.
Definition radar_obj.h:90
std::shared_ptr< timing::Timing > getTiming() const
Retrieves the timing source for the radar.
Definition radar_obj.cpp:66
bool checkFlag(RecvFlag flag) const noexcept
Checks if a specific flag is set.
Definition receiver.h:88
const std::vector< SchedulePeriod > & getSchedule() const noexcept
Retrieves the list of active reception periods.
Definition receiver.h:277
SimId getId() const noexcept
Retrieves the unique ID of the receiver.
Definition receiver.h:95
RealType getNoiseTemperature() const noexcept
Retrieves the noise temperature of the receiver.
Definition receiver.h:102
OperationMode getMode() const noexcept
Gets the operational mode of the receiver.
Definition receiver.h:160
RealType getWindowPrf() const noexcept
Retrieves the pulse repetition frequency (PRF) of the radar window.
Definition receiver.h:116
RealType getWindowSkip() const noexcept
Retrieves the window skip time.
Definition receiver.h:123
RealType getWindowLength() const noexcept
Retrieves the radar window length.
Definition receiver.h:109

References radar::Receiver::checkFlag(), radar::Receiver::FLAG_NODIRECT, radar::Receiver::FLAG_NOPROPLOSS, radar::Radar::getAntenna(), antenna::Antenna::getId(), radar::Receiver::getId(), radar::Receiver::getMode(), radar::Object::getName(), radar::Receiver::getNoiseTemperature(), radar::Receiver::getSchedule(), radar::Radar::getTiming(), radar::Receiver::getWindowLength(), radar::Receiver::getWindowPrf(), radar::Receiver::getWindowSkip(), and PULSED_MODE.

+ Here is the call graph for this function:

◆ to_json() [3/5]

void radar::to_json ( nlohmann::json &  j,
const SchedulePeriod p 
)

Definition at line 447 of file json_serializer.cpp.

448 {
449 j = {{"start", p.start}, {"end", p.end}};
450 } // NOLINT(*-use-internal-linkage)

References radar::SchedulePeriod::end, and radar::SchedulePeriod::start.

◆ to_json() [4/5]

void radar::to_json ( nlohmann::json &  j,
const Target t 
)

Definition at line 505 of file json_serializer.cpp.

506 {
507 j["id"] = sim_id_to_json(t.getId());
508 j["name"] = t.getName();
509 nlohmann::json rcs_json;
510 if (const auto* iso = dynamic_cast<const IsoTarget*>(&t))
511 {
512 rcs_json["type"] = "isotropic";
513 rcs_json["value"] = iso->getConstRcs();
514 }
515 else if (const auto* file = dynamic_cast<const FileTarget*>(&t))
516 {
517 rcs_json["type"] = "file";
518 rcs_json["filename"] = file->getFilename();
519 }
520 j["rcs"] = rcs_json;
521
522 // Serialize the fluctuation model if it exists.
523 if (const auto* model_base = t.getFluctuationModel())
524 {
525 nlohmann::json model_json;
526 if (const auto* chi_model = dynamic_cast<const RcsChiSquare*>(model_base))
527 {
528 model_json["type"] = "chisquare";
529 model_json["k"] = chi_model->getK();
530 }
531 else // Default to constant if it's not a recognized type (e.g., RcsConst)
532 {
533 model_json["type"] = "constant";
534 }
535 j["model"] = model_json;
536 }
537 }
Isotropic radar target.
Definition target.h:188
SimId getId() const noexcept
Gets the unique ID of the target.
Definition target.h:153
const RcsModel * getFluctuationModel() const
Gets the RCS fluctuation model.
Definition target.h:167

References radar::Target::getFluctuationModel(), radar::Target::getId(), and radar::Object::getName().

+ Here is the call graph for this function:

◆ to_json() [5/5]

void radar::to_json ( nlohmann::json &  j,
const Transmitter t 
)

Definition at line 458 of file json_serializer.cpp.

459 {
460 j = nlohmann::json{{"id", sim_id_to_json(t.getId())},
461 {"name", t.getName()},
462 {"waveform", sim_id_to_json((t.getSignal() != nullptr) ? t.getSignal()->getId() : 0)},
463 {"antenna", sim_id_to_json((t.getAntenna() != nullptr) ? t.getAntenna()->getId() : 0)},
464 {"timing", sim_id_to_json(t.getTiming() ? t.getTiming()->getId() : 0)}};
465
466 if (t.getMode() == OperationMode::PULSED_MODE)
467 {
468 j["pulsed_mode"] = {{"prf", t.getPrf()}};
469 }
470 else
471 {
472 j["cw_mode"] = nlohmann::json::object();
473 }
474 if (!t.getSchedule().empty())
475 {
476 j["schedule"] = t.getSchedule();
477 }
478 }
SimId getId() const noexcept
Gets the unique ID of the radar signal.
SimId getId() const noexcept
Retrieves the unique ID of the transmitter.
Definition transmitter.h:78
RealType getPrf() const noexcept
Retrieves the pulse repetition frequency (PRF).
Definition transmitter.h:64
fers_signal::RadarSignal * getSignal() const noexcept
Retrieves the radar signal currently being transmitted.
Definition transmitter.h:71
const std::vector< SchedulePeriod > & getSchedule() const noexcept
Retrieves the list of active transmission periods.
OperationMode getMode() const noexcept
Gets the operational mode of the transmitter.
Definition transmitter.h:85

References radar::Radar::getAntenna(), antenna::Antenna::getId(), radar::Transmitter::getId(), fers_signal::RadarSignal::getId(), radar::Transmitter::getMode(), radar::Object::getName(), radar::Transmitter::getPrf(), radar::Transmitter::getSchedule(), radar::Transmitter::getSignal(), radar::Radar::getTiming(), and PULSED_MODE.

+ Here is the call graph for this function: