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 "radar_obj.h"
18#include "schedule_period.h"
19
20namespace fers_signal
21{
22 class RadarSignal;
23}
24
25namespace radar
26{
27 /**
28 * @class Transmitter
29 * @brief Represents a radar transmitter system.
30 */
31 class Transmitter final : public Radar
32 {
33 public:
34 /**
35 * @brief Constructor for the Transmitter class.
36 *
37 * @param platform Pointer to the platform object.
38 * @param name Name of the transmitter.
39 * @param mode The operational mode (PULSED_MODE or CW_MODE).
40 */
41 Transmitter(Platform* platform, std::string name, const OperationMode mode) noexcept :
42 Radar(platform, std::move(name)), _mode(mode)
43 {
44 }
45
46 ~Transmitter() override = default;
47
48 Transmitter(const Transmitter&) = delete;
49
51
53
55
56 /**
57 * @brief Retrieves the pulse repetition frequency (PRF).
58 *
59 * @return The current PRF of the transmitter.
60 */
61 [[nodiscard]] RealType getPrf() const noexcept { return _prf; }
62
63 /**
64 * @brief Retrieves the radar signal currently being transmitted.
65 *
66 * @return Pointer to the RadarSignal object being transmitted.
67 */
68 [[nodiscard]] fers_signal::RadarSignal* getSignal() const noexcept { return _signal; }
69
70 /**
71 * @brief Gets the operational mode of the transmitter.
72 *
73 * @return The operational mode (PULSED_MODE or CW_MODE).
74 */
75 [[nodiscard]] OperationMode getMode() const noexcept { return _mode; }
76
77 /**
78 * @brief Sets the radar signal wave to be transmitted.
79 *
80 * @param pulse Pointer to the RadarSignal object representing the wave.
81 */
82 void setWave(fers_signal::RadarSignal* pulse) noexcept { _signal = pulse; }
83
84 /**
85 * @brief Sets the radar signal wave to be transmitted.
86 *
87 * @param signal Pointer to the RadarSignal object to be transmitted.
88 */
89 void setSignal(fers_signal::RadarSignal* signal) noexcept { _signal = signal; }
90
91 /**
92 * @brief Sets the pulse repetition frequency (PRF) of the transmitter.
93 *
94 * @param mprf Desired PRF to be set.
95 */
96 void setPrf(RealType mprf) noexcept;
97
98 /**
99 * @brief Sets the active schedule for the transmitter.
100 *
101 * The provided schedule should be pre-validated and sorted.
102 * @param schedule A vector of active periods.
103 */
104 void setSchedule(std::vector<SchedulePeriod> schedule);
105
106 /**
107 * @brief Retrieves the list of active transmission periods.
108 * @return A const reference to the schedule vector.
109 */
110 [[nodiscard]] const std::vector<SchedulePeriod>& getSchedule() const noexcept { return _schedule; }
111
112 /**
113 * @brief Determines the valid simulation time for a pulse at or after the given time.
114 *
115 * If the requested time falls within an active period, it is returned.
116 * If it falls in a gap between periods, the start of the next period is returned.
117 * If it falls after all periods, std::nullopt is returned.
118 * If no schedule is defined, the transmitter is considered "always on".
119 *
120 * @param time The proposed pulse time.
121 * @return The actual pulse time, or nullopt if no valid time exists.
122 */
123 [[nodiscard]] std::optional<RealType> getNextPulseTime(RealType time) const;
124
125 private:
126 fers_signal::RadarSignal* _signal = nullptr; ///< Pointer to the radar signal being transmitted.
127
128 RealType _prf = {}; ///< The pulse repetition frequency (PRF) of the transmitter.
129
130 OperationMode _mode; ///< The operational mode of the transmitter.
131 std::vector<SchedulePeriod> _schedule; ///< The schedule of active periods.
132 };
133}
Class representing a radar signal with associated properties.
Represents a simulation platform with motion and rotation paths.
Definition platform.h:31
Represents a radar system on a platform.
Definition radar_obj.h:46
Represents a radar transmitter system.
Definition transmitter.h:32
void setWave(fers_signal::RadarSignal *pulse) noexcept
Sets the radar signal wave to be transmitted.
Definition transmitter.h:82
Transmitter & operator=(const Transmitter &)=delete
RealType getPrf() const noexcept
Retrieves the pulse repetition frequency (PRF).
Definition transmitter.h:61
Transmitter(Platform *platform, std::string name, const OperationMode mode) noexcept
Constructor for the Transmitter class.
Definition transmitter.h:41
fers_signal::RadarSignal * getSignal() const noexcept
Retrieves the radar signal currently being transmitted.
Definition transmitter.h:68
~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:75
void setSignal(fers_signal::RadarSignal *signal) noexcept
Sets the radar signal wave to be transmitted.
Definition transmitter.h:89
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:36
Defines the Radar class and associated functionality.