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)
 Creates an isotropic target.
 
std::unique_ptr< TargetcreateFileTarget (Platform *platform, std::string name, const std::string &filename, unsigned seed)
 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 35 of file radar_obj.h.

36 {
37 PULSED_MODE, ///< The component operates in a pulsed mode.
38 CW_MODE ///< The component operates in a continuous-wave mode.
39 };
@ 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 
)

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 279 of file target.h.

281 {
282 return std::make_unique<FileTarget>(platform, std::move(name), filename, seed);
283 }

Referenced by serial::json_to_world().

+ Here is the caller graph for this function:

◆ createIsoTarget()

std::unique_ptr< Target > radar::createIsoTarget ( Platform platform,
std::string  name,
RealType  rcs,
unsigned  seed 
)

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 265 of file target.h.

266 {
267 return std::make_unique<IsoTarget>(platform, std::move(name), rcs, seed);
268 }

Referenced by serial::json_to_world().

+ Here is the caller graph for this function:

◆ from_json()

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

Definition at line 383 of file json_serializer.cpp.

384 {
385 j.at("start").get_to(p.start);
386 j.at("end").get_to(p.end);
387 }

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::sort(valid_periods.begin(), valid_periods.end(),
59 [](const auto& a, const auto& b) { return a.start < b.start; });
60
61 // 3. Merge overlapping intervals
62 std::vector<SchedulePeriod> merged;
63 merged.reserve(valid_periods.size());
64 merged.push_back(valid_periods.front());
65
66 for (size_t i = 1; i < valid_periods.size(); ++i)
67 {
68 if (valid_periods[i].start <= merged.back().end)
69 {
70 // Overlap or adjacency: extend the previous period
71 merged.back().end = std::max(merged.back().end, valid_periods[i].end);
72 }
73 else
74 {
75 merged.push_back(valid_periods[i]);
76 }
77 }
78
79 // 4. Check PRI constraints
80 if (isPulsed)
81 {
82 for (const auto& period : merged)
83 {
84 if (period.end - period.start < pri)
85 {
86 LOG(logging::Level::WARNING, "Object '{}' has a schedule period [{}, {}] shorter than PRI ({}s).",
87 ownerName, period.start, period.end, pri);
88 }
89 }
90 }
91
92 return merged;
93 }
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:97
RealType startTime() noexcept
Get the start time for the simulation.
Definition parameters.h:91

References params::endTime(), LOG, params::startTime(), and logging::WARNING.

Referenced by serial::json_to_world().

+ 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 467 of file json_serializer.cpp.

468 {
469 j = {{"name", p.getName()}, {"motionpath", *p.getMotionPath()}};
470
472 {
473 j["fixedrotation"] = *p.getRotationPath();
474 }
475 else
476 {
477 j["rotationpath"] = *p.getRotationPath();
478 }
479 }
InterpType getType() const noexcept
Gets the interpolation type of the path.
math::Path * getMotionPath() const noexcept
Gets the motion path of the platform.
Definition platform.h:59
const std::string & getName() const noexcept
Gets the name of the platform.
Definition platform.h:89
math::RotationPath * getRotationPath() const noexcept
Gets the rotation path of the platform.
Definition platform.h:66

References 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 410 of file json_serializer.cpp.

411 {
412 j = nlohmann::json{{"name", r.getName()},
413 {"noise_temp", r.getNoiseTemperature()},
414 {"antenna", r.getAntenna() ? r.getAntenna()->getName() : ""},
415 {"timing", r.getTiming() ? r.getTiming()->getName() : ""},
416 {"nodirect", r.checkFlag(Receiver::RecvFlag::FLAG_NODIRECT)},
417 {"nopropagationloss", r.checkFlag(Receiver::RecvFlag::FLAG_NOPROPLOSS)}};
418
419 if (r.getMode() == OperationMode::PULSED_MODE)
420 {
421 j["pulsed_mode"] = {
422 {"prf", r.getWindowPrf()}, {"window_skip", r.getWindowSkip()}, {"window_length", r.getWindowLength()}};
423 }
424 else
425 {
426 j["cw_mode"] = nlohmann::json::object();
427 }
428 if (!r.getSchedule().empty())
429 {
430 j["schedule"] = r.getSchedule();
431 }
432 }
std::string getName() const noexcept
Retrieves the name of the antenna.
const std::string & getName() const noexcept
Retrieves the name of the object.
Definition object.h:68
const antenna::Antenna * getAntenna() const noexcept
Gets the antenna associated with this radar.
Definition radar_obj.h:78
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:86
const std::vector< SchedulePeriod > & getSchedule() const noexcept
Retrieves the list of active reception periods.
Definition receiver.h:255
RealType getNoiseTemperature() const noexcept
Retrieves the noise temperature of the receiver.
Definition receiver.h:93
OperationMode getMode() const noexcept
Gets the operational mode of the receiver.
Definition receiver.h:151
RealType getWindowPrf() const noexcept
Retrieves the pulse repetition frequency (PRF) of the radar window.
Definition receiver.h:107
RealType getWindowSkip() const noexcept
Retrieves the window skip time.
Definition receiver.h:114
RealType getWindowLength() const noexcept
Retrieves the radar window length.
Definition receiver.h:100

References radar::Receiver::checkFlag(), radar::Receiver::FLAG_NODIRECT, radar::Receiver::FLAG_NOPROPLOSS, radar::Radar::getAntenna(), radar::Receiver::getMode(), antenna::Antenna::getName(), 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 381 of file json_serializer.cpp.

381{ j = {{"start", p.start}, {"end", p.end}}; }

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 434 of file json_serializer.cpp.

435 {
436 j["name"] = t.getName();
437 nlohmann::json rcs_json;
438 if (const auto* iso = dynamic_cast<const IsoTarget*>(&t))
439 {
440 rcs_json["type"] = "isotropic";
441 rcs_json["value"] = iso->getConstRcs();
442 }
443 else if (const auto* file = dynamic_cast<const FileTarget*>(&t))
444 {
445 rcs_json["type"] = "file";
446 rcs_json["filename"] = file->getFilename();
447 }
448 j["rcs"] = rcs_json;
449
450 // Serialize the fluctuation model if it exists.
451 if (const auto* model_base = t.getFluctuationModel())
452 {
453 nlohmann::json model_json;
454 if (const auto* chi_model = dynamic_cast<const RcsChiSquare*>(model_base))
455 {
456 model_json["type"] = "chisquare";
457 model_json["k"] = chi_model->getK();
458 }
459 else // Default to constant if it's not a recognized type (e.g., RcsConst)
460 {
461 model_json["type"] = "constant";
462 }
463 j["model"] = model_json;
464 }
465 }
Isotropic radar target.
Definition target.h:172
const RcsModel * getFluctuationModel() const
Gets the RCS fluctuation model.
Definition target.h:159

References radar::Target::getFluctuationModel(), 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 389 of file json_serializer.cpp.

390 {
391 j = nlohmann::json{{"name", t.getName()},
392 {"waveform", t.getSignal() ? t.getSignal()->getName() : ""},
393 {"antenna", t.getAntenna() ? t.getAntenna()->getName() : ""},
394 {"timing", t.getTiming() ? t.getTiming()->getName() : ""}};
395
396 if (t.getMode() == OperationMode::PULSED_MODE)
397 {
398 j["pulsed_mode"] = {{"prf", t.getPrf()}};
399 }
400 else
401 {
402 j["cw_mode"] = nlohmann::json::object();
403 }
404 if (!t.getSchedule().empty())
405 {
406 j["schedule"] = t.getSchedule();
407 }
408 }
const std::string & getName() const noexcept
Gets the name of the radar signal.
RealType getPrf() const noexcept
Retrieves the pulse repetition frequency (PRF).
Definition transmitter.h:61
fers_signal::RadarSignal * getSignal() const noexcept
Retrieves the radar signal currently being transmitted.
Definition transmitter.h:68
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:75

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

+ Here is the call graph for this function: