FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
transmitter.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 transmitter.h
10 * @brief Header file for the Transmitter class in the radar namespace.
11 */
12
13#pragma once
14
15#include <optional>
16
17#include "core/sim_id.h"
18#include "radar_obj.h"
19#include "schedule_period.h"
20
21namespace fers_signal
22{
23 class RadarSignal;
24}
25
26namespace radar
27{
28 /**
29 * @class Transmitter
30 * @brief Represents a radar transmitter system.
31 */
32 class Transmitter final : public Radar
33 {
34 public:
35 /**
36 * @brief Constructor for the Transmitter class.
37 *
38 * @param platform Pointer to the platform object.
39 * @param name Name of the transmitter.
40 * @param mode The operational mode (PULSED_MODE or CW_MODE).
41 */
42 Transmitter(Platform* platform, std::string name, const OperationMode mode, const SimId id = 0) noexcept :
43 Radar(platform, std::move(name),
44 id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Transmitter) : id),
45 _mode(mode)
46 {
47 }
48
49 ~Transmitter() override = default;
50
51 Transmitter(const Transmitter&) = delete;
52
54
56
58
59 /**
60 * @brief Retrieves the pulse repetition frequency (PRF).
61 *
62 * @return The current PRF of the transmitter.
63 */
64 [[nodiscard]] RealType getPrf() const noexcept { return _prf; }
65
66 /**
67 * @brief Retrieves the radar signal currently being transmitted.
68 *
69 * @return Pointer to the RadarSignal object being transmitted.
70 */
71 [[nodiscard]] fers_signal::RadarSignal* getSignal() const noexcept { return _signal; }
72
73 /**
74 * @brief Retrieves the unique ID of the transmitter.
75 *
76 * @return The transmitter SimId.
77 */
78 [[nodiscard]] SimId getId() const noexcept { return Radar::getId(); }
79
80 /**
81 * @brief Gets the operational mode of the transmitter.
82 *
83 * @return The operational mode (PULSED_MODE or CW_MODE).
84 */
85 [[nodiscard]] OperationMode getMode() const noexcept { return _mode; }
86
87 /**
88 * @brief Sets the operational mode of the transmitter.
89 *
90 * @param mode The operational mode (PULSED_MODE or CW_MODE).
91 */
92 void setMode(OperationMode mode) noexcept { _mode = mode; }
93
94 /**
95 * @brief Sets the radar signal wave to be transmitted.
96 *
97 * @param pulse Pointer to the RadarSignal object representing the wave.
98 */
99 void setWave(fers_signal::RadarSignal* pulse) noexcept { _signal = pulse; }
100
101 /**
102 * @brief Sets the radar signal wave to be transmitted.
103 *
104 * @param signal Pointer to the RadarSignal object to be transmitted.
105 */
106 void setSignal(fers_signal::RadarSignal* signal) noexcept { _signal = signal; }
107
108 /**
109 * @brief Sets the pulse repetition frequency (PRF) of the transmitter.
110 *
111 * @param mprf Desired PRF to be set.
112 */
113 void setPrf(RealType mprf) noexcept;
114
115 /**
116 * @brief Sets the active schedule for the transmitter.
117 *
118 * The provided schedule should be pre-validated and sorted.
119 * @param schedule A vector of active periods.
120 */
121 void setSchedule(std::vector<SchedulePeriod> schedule);
122
123 /**
124 * @brief Retrieves the list of active transmission periods.
125 * @return A const reference to the schedule vector.
126 */
127 [[nodiscard]] const std::vector<SchedulePeriod>& getSchedule() const noexcept { return _schedule; }
128
129 /**
130 * @brief Determines the valid simulation time for a pulse at or after the given time.
131 *
132 * If the requested time falls within an active period, it is returned.
133 * If it falls in a gap between periods, the start of the next period is returned.
134 * If it falls after all periods, std::nullopt is returned.
135 * If no schedule is defined, the transmitter is considered "always on".
136 *
137 * @param time The proposed pulse time.
138 * @return The actual pulse time, or nullopt if no valid time exists.
139 */
140 [[nodiscard]] std::optional<RealType> getNextPulseTime(RealType time) const;
141
142 private:
143 fers_signal::RadarSignal* _signal = nullptr; ///< Pointer to the radar signal being transmitted.
144
145 RealType _prf = {}; ///< The pulse repetition frequency (PRF) of the transmitter.
146
147 OperationMode _mode; ///< The operational mode of the transmitter.
148 std::vector<SchedulePeriod> _schedule; ///< The schedule of active periods.
149 };
150}
Thread-safe Meyers singleton for generating unique object IDs.
Definition sim_id.h:42
Class representing a radar signal with associated properties.
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
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Definition radar_obj.h:83
Represents a radar transmitter system.
Definition transmitter.h:33
void setWave(fers_signal::RadarSignal *pulse) noexcept
Sets the radar signal wave to be transmitted.
Definition transmitter.h:99
Transmitter & operator=(const Transmitter &)=delete
void setMode(OperationMode mode) noexcept
Sets the operational mode of the transmitter.
Definition transmitter.h:92
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
~Transmitter() override=default
Transmitter(const Transmitter &)=delete
std::optional< RealType > getNextPulseTime(RealType time) const
Determines the valid simulation time for a pulse at or after the given time.
Transmitter & operator=(Transmitter &&)=delete
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
Transmitter(Platform *platform, std::string name, const OperationMode mode, const SimId id=0) noexcept
Constructor for the Transmitter class.
Definition transmitter.h:42
void setSignal(fers_signal::RadarSignal *signal) noexcept
Sets the radar signal wave to be transmitted.
void setSchedule(std::vector< SchedulePeriod > schedule)
Sets the active schedule for the transmitter.
Transmitter(Transmitter &&)=delete
void setPrf(RealType mprf) noexcept
Sets the pulse repetition frequency (PRF) of the transmitter.
double RealType
Type for real numbers.
Definition config.h:27
OperationMode
Defines the operational mode of a radar component.
Definition radar_obj.h:37
Defines the Radar class and associated functionality.
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
ObjectType
Categorizes objects for ID generation.
Definition sim_id.h:25