24 Radar(platform, std::move(name)), _mode(mode), _rng(seed)
30 std::lock_guard lock(_inbox_mutex);
31 _inbox.push_back(std::move(response));
36 std::lock_guard lock(_interference_log_mutex);
37 _pulsed_interference_log.push_back(std::move(response));
42 std::lock_guard lock(_inbox_mutex);
43 std::vector<std::unique_ptr<serial::Response>> drained_responses;
44 drained_responses.swap(_inbox);
45 return drained_responses;
51 std::lock_guard lock(_finalizer_queue_mutex);
52 _finalizer_queue.push(std::move(job));
54 _finalizer_queue_cv.notify_one();
59 std::unique_lock lock(_finalizer_queue_mutex);
60 _finalizer_queue_cv.wait(lock, [
this] {
return !_finalizer_queue.empty(); });
62 job = std::move(_finalizer_queue.front());
63 _finalizer_queue.pop();
83 throw std::runtime_error(
"Noise temperature must be positive");
85 _noise_temperature = temp;
91 _window_length = length;
92 _window_prf = 1 / (std::floor(rate / prf) / rate);
93 _window_skip = std::floor(rate * skip) / rate;
99 const RealType pulses = time * _window_prf;
100 return static_cast<unsigned>(std::ceil(pulses));
105 const RealType stime =
static_cast<RealType>(window) / _window_prf + _window_skip;
109 throw std::logic_error(
"Receiver must be associated with timing source");
116 std::lock_guard lock(_cw_mutex);
117 _cw_iq_data.resize(numSamples);
122 if (index < _cw_iq_data.size())
124 _cw_iq_data[index] += sample;
133 if (_schedule.empty())
137 for (
const auto& period : _schedule)
140 if (time >= period.start && time <= period.end)
145 if (time < period.start)
A class representing a vector in spherical coordinates.
const std::string & getName() const noexcept
Retrieves the name of the object.
Represents a radar system on a platform.
std::shared_ptr< timing::Timing > _timing
Timing source for the radar.
virtual RealType getNoiseTemperature(const math::SVec3 &angle) const noexcept
Gets the noise temperature of the radar.
void addInterferenceToLog(std::unique_ptr< serial::Response > response) noexcept
Adds a pulsed interference response to the receiver's CW-mode log.
void setCwSample(size_t index, ComplexType sample)
Sets a single IQ sample at a specific index for CW simulation.
Receiver(Platform *platform, std::string name, unsigned seed, OperationMode mode) noexcept
Constructs a Receiver object.
std::vector< std::unique_ptr< serial::Response > > drainInbox() noexcept
Moves all responses from the inbox into a RenderingJob.
unsigned getWindowCount() const noexcept
Gets the number of radar windows.
RealType getWindowStart(unsigned window) const
Retrieves the start time of a specific radar window.
std::optional< RealType > getNextWindowTime(RealType time) const
Determines the next valid window start time at or after the given time.
void prepareCwData(size_t numSamples)
Prepares the internal storage for CW IQ data.
void setSchedule(std::vector< SchedulePeriod > schedule)
Sets the active schedule for the receiver.
void enqueueFinalizerJob(core::RenderingJob &&job)
Adds a completed RenderingJob to the finalizer queue.
RealType getNoiseTemperature() const noexcept
Retrieves the noise temperature of the receiver.
bool waitAndDequeueFinalizerJob(core::RenderingJob &job)
Waits for and dequeues a RenderingJob from the finalizer queue.
void setWindowProperties(RealType length, RealType prf, RealType skip) noexcept
Sets the properties for radar windows.
void addResponseToInbox(std::unique_ptr< serial::Response > response) noexcept
Adds a response to the receiver's pulsed-mode inbox.
void setNoiseTemperature(RealType temp)
Sets the noise temperature of the receiver.
double RealType
Type for real numbers.
constexpr RealType EPSILON
Machine epsilon for real numbers.
std::complex< RealType > ComplexType
Type for complex numbers.
@ FATAL
Fatal level for severe error events.
RealType endTime() noexcept
Get the end time for the simulation.
RealType rate() noexcept
Get the rendering sample rate.
RealType startTime() noexcept
Get the start time for the simulation.
unsigned oversampleRatio() noexcept
Get the oversampling ratio.
OperationMode
Defines the operational mode of a radar component.
Defines the Parameters struct and provides methods for managing simulation parameters.
Radar Receiver class for managing signal reception and response handling.
Classes for managing radar signal responses.
A data packet containing all information needed to process one receive window.
RealType duration
The duration of the receive window in seconds.