FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
radar_obj.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2006-2008 Marc Brooker and Michael Inggs
4// Copyright (c) 2008-present FERS Contributors (see AUTHORS.md).
5//
6// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
7
8/**
9 * @file radar_obj.h
10 * @brief Defines the Radar class and associated functionality.
11 */
12
13#pragma once
14
15#include "core/sim_id.h"
16#include "object.h"
17
18namespace timing
19{
20 class Timing;
21}
22
23namespace antenna
24{
25 class Antenna;
26}
27
28namespace radar
29{
30 class Platform;
31
32 /**
33 * @enum OperationMode
34 * @brief Defines the operational mode of a radar component.
35 */
36 enum class OperationMode
37 {
38 PULSED_MODE, ///< The component operates in a pulsed mode.
39 CW_MODE ///< The component operates in a continuous-wave mode.
40 };
41
42 /**
43 * @class Radar
44 * @brief Represents a radar system on a platform.
45 */
46 class Radar : public Object
47 {
48 public:
49 /**
50 * @brief Constructs a Radar object.
51 *
52 * @param platform Pointer to the platform on which the radar is mounted.
53 * @param name Name of the radar object.
54 */
55 Radar(Platform* platform, std::string name, const SimId id = 0) noexcept :
56 Object(platform, std::move(name), ObjectType::Unknown,
57 id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Unknown) : id)
58 {
59 }
60
61 ~Radar() override = default;
62
63 Radar(const Radar&) = delete;
64
65 Radar& operator=(const Radar&) = delete;
66
67 Radar(Radar&&) = delete;
68
69 Radar& operator=(Radar&&) = delete;
70
71 /**
72 * @brief Retrieves the attached radar object.
73 *
74 * @return Pointer to the attached radar object.
75 */
76 [[nodiscard]] const Radar* getAttached() const noexcept { return _attached; }
77
78 /**
79 * @brief Retrieves the unique ID of the radar object.
80 *
81 * @return The radar SimId.
82 */
83 [[nodiscard]] SimId getId() const noexcept { return Object::getId(); }
84
85 /**
86 * @brief Gets the antenna associated with this radar.
87 *
88 * @return Pointer to the associated antenna.
89 */
90 [[nodiscard]] const antenna::Antenna* getAntenna() const noexcept { return _antenna; }
91
92 /**
93 * @brief Calculates the radar gain based on input angles and wavelength.
94 *
95 * @param angle The radar's pointing angle.
96 * @param refangle The reference angle for comparison.
97 * @param wavelength The wavelength of the radar signal.
98 * @return The calculated radar gain.
99 */
100 [[nodiscard]] RealType getGain(const math::SVec3& angle, const math::SVec3& refangle,
101 RealType wavelength) const;
102
103 /**
104 * @brief Gets the noise temperature of the radar.
105 *
106 * @param angle The angle at which the noise temperature is calculated.
107 * @return The calculated noise temperature.
108 */
109 [[nodiscard]] virtual RealType getNoiseTemperature(const math::SVec3& angle) const noexcept;
110
111 /**
112 * @brief Retrieves the timing source for the radar.
113 *
114 * @return Shared pointer to the timing source.
115 */
116 [[nodiscard]] std::shared_ptr<timing::Timing> getTiming() const;
117
118 /**
119 * @brief Sets the timing source for the radar.
120 *
121 * @param tim Shared pointer to the timing source to set.
122 */
123 void setTiming(const std::shared_ptr<timing::Timing>& tim);
124
125 /**
126 * @brief Sets the antenna for the radar.
127 *
128 * @param ant Pointer to the antenna to set.
129 */
130 void setAntenna(const antenna::Antenna* ant);
131
132 /**
133 * @brief Attaches another radar object to this radar.
134 *
135 * @param obj Pointer to the radar object to attach.
136 * @throws std::runtime_error If another object is already attached.
137 */
138 void setAttached(const Radar* obj);
139
140 protected:
141 std::shared_ptr<timing::Timing> _timing; ///< Timing source for the radar.
142
143 private:
144 const antenna::Antenna* _antenna{nullptr}; ///< Antenna object associated with the radar.
145 const Radar* _attached{nullptr}; ///< Attached radar object.
146 };
147}
Thread-safe Meyers singleton for generating unique object IDs.
Definition sim_id.h:42
Abstract base class representing an antenna.
A class representing a vector in spherical coordinates.
Represents a physical object in the radar system.
Definition object.h:25
SimId getId() const noexcept
Retrieves the unique ID of the object.
Definition object.h:72
Represents a simulation platform with motion and rotation paths.
Definition platform.h:32
Represents a radar system on a platform.
Definition radar_obj.h:47
std::shared_ptr< timing::Timing > _timing
Timing source for the radar.
Definition radar_obj.h:141
const Radar * getAttached() const noexcept
Retrieves the attached radar object.
Definition radar_obj.h:76
~Radar() override=default
void setAntenna(const antenna::Antenna *ant)
Sets the antenna for the radar.
Definition radar_obj.cpp:46
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
Radar(const Radar &)=delete
void setAttached(const Radar *obj)
Attaches another radar object to this radar.
Definition radar_obj.cpp:56
Radar & operator=(const Radar &)=delete
Radar & operator=(Radar &&)=delete
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Definition radar_obj.h:83
Radar(Radar &&)=delete
RealType getGain(const math::SVec3 &angle, const math::SVec3 &refangle, RealType wavelength) const
Calculates the radar gain based on input angles and wavelength.
Definition radar_obj.cpp:26
virtual RealType getNoiseTemperature(const math::SVec3 &angle) const noexcept
Gets the noise temperature of the radar.
Definition radar_obj.cpp:31
Radar(Platform *platform, std::string name, const SimId id=0) noexcept
Constructs a Radar object.
Definition radar_obj.h:55
void setTiming(const std::shared_ptr< timing::Timing > &tim)
Sets the timing source for the radar.
Definition radar_obj.cpp:36
double RealType
Type for real numbers.
Definition config.h:27
OperationMode
Defines the operational mode of a radar component.
Definition radar_obj.h:37
@ PULSED_MODE
The component operates in a pulsed mode.
@ CW_MODE
The component operates in a continuous-wave mode.
Base class for all physical objects in the radar system.
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
ObjectType
Categorizes objects for ID generation.
Definition sim_id.h:25