15#include <condition_variable>
247 return _fmcw_if_plan;
253 return _dechirp_sources;
366 return _pulsed_interference_log;
394 void appendFmcwIfOutput(std::vector<ComplexType> emitted);
397 void advanceFmcwIfOutputZeros(std::size_t sample_count);
403 bool _is_active =
false;
408 std::vector<SchedulePeriod> _schedule;
414 std::vector<std::unique_ptr<serial::Response>>
416 std::mutex _inbox_mutex;
417 std::queue<core::RenderingJob> _finalizer_queue;
418 std::mutex _finalizer_queue_mutex;
419 std::condition_variable _finalizer_queue_cv;
422 std::vector<std::unique_ptr<serial::Response>>
423 _pulsed_interference_log;
424 std::mutex _interference_log_mutex;
426 DechirpReference _dechirp_reference{};
427 std::vector<core::ActiveStreamingSource> _dechirp_sources;
428 FmcwIfChainRequest _fmcw_if_chain{};
429 std::optional<fers_signal::FmcwIfResamplerPlan> _fmcw_if_plan;
430 std::unique_ptr<fers_signal::FmcwIfResamplingSink> _fmcw_if_sink;
432 std::uint64_t _fmcw_if_samples_to_discard = 0;
433 std::size_t _fmcw_if_input_cursor = 0;
434 std::size_t _fmcw_if_output_cursor = 0;
435 bool _fmcw_if_segment_active =
false;
A class representing a vector in spherical coordinates.
Represents a radar system on a platform.
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Manages radar signal reception and response processing.
void addInterferenceToLog(std::unique_ptr< serial::Response > response) noexcept
Adds a pulsed interference response to the receiver's streaming-mode log.
std::mt19937 & getRngEngine() noexcept
Gets the receiver's internal random number generator engine.
void clearResolvedDechirpSources() noexcept
Clears resolved dechirp source segments.
std::optional< RealType > getIfSampleRate() const noexcept
Gets the receiver-local FMCW IF sample rate in Hz.
void setMode(OperationMode mode) noexcept
Sets the operational mode of the receiver.
bool hasFmcwIfResamplingSink() const noexcept
Returns true when this receiver is using the online FMCW IF resampling sink.
void setActive(const bool active) noexcept
Sets the active state of the receiver.
void prunePulsedInterferenceEndingBefore(RealType cutoff_time) noexcept
Removes logged pulsed interference responses that ended before a receive time.
bool checkFlag(RecvFlag flag) const noexcept
Checks if a specific flag is set.
std::optional< RealType > getIfFilterTransitionWidth() const noexcept
Gets the receiver-local FMCW IF filter transition width in Hz.
std::vector< std::unique_ptr< serial::Response > > drainInbox() noexcept
Moves all responses from the inbox into a RenderingJob.
void setFlag(RecvFlag flag) noexcept
Sets a receiver flag.
const FmcwIfChainRequest & getFmcwIfChainRequest() const noexcept
Gets the optional receiver-local FMCW IF-chain request.
void initializeFmcwIfResampling(fers_signal::FmcwIfResamplerPlan plan)
Creates the online FMCW IF resampling sink and clears the output buffer.
const std::vector< SchedulePeriod > & getSchedule() const noexcept
Retrieves the list of active reception periods.
std::optional< RealType > getIfFilterBandwidth() const noexcept
Gets the receiver-local FMCW IF filter bandwidth in Hz.
bool isActive() const noexcept
Checks if the receiver is currently active (listening).
DechirpReferenceSource
Source used to construct the receiver LO reference.
@ Transmitter
Use a named transmitter.
@ Attached
Use the attached transmitter.
@ None
No reference configured.
@ Custom
Use a named top-level waveform with the receiver schedule.
unsigned getWindowCount() const noexcept
Gets the number of radar windows.
void setDechirpReference(DechirpReference reference)
Stores the unresolved dechirp reference parsed from scenario input.
bool isDechirpEnabled() const noexcept
Returns true when the receiver emits dechirped IF data.
const std::vector< core::ActiveStreamingSource > & getDechirpSources() const noexcept
Gets resolved receive-time LO source segments.
void setResolvedDechirpSources(std::vector< core::ActiveStreamingSource > sources)
Replaces resolved receive-time LO source segments.
void consumeFmcwIfBlock(std::span< const ComplexType > block, RealType block_start_time)
Feeds one completed high-rate dechirped block into the online IF sink.
RealType getWindowStart(unsigned window) const
Retrieves the start time of a specific radar window.
std::function< void(std::span< const ComplexType >, std::uint64_t)> FmcwIfOutputCallback
void clearFlag(RecvFlag flag) noexcept
Clears a receiver flag.
void beginFmcwIfResamplingSegment(RealType segment_start_time)
Advances the continuous IF resampling timeline to the next active segment start.
std::optional< RealType > getNextWindowTime(RealType time) const
Determines the next valid window start time at or after the given time.
void setDechirpMode(DechirpMode mode) noexcept
Sets the receiver-side dechirp mode.
bool hasFmcwIfSampleRate() const noexcept
Returns true when this receiver requests IF-rate FMCW output.
const DechirpReference & getDechirpReference() const noexcept
Gets the configured dechirp reference.
const std::optional< fers_signal::FmcwIfResamplerPlan > & getFmcwIfResamplerPlan() const noexcept
Gets the active or most recently used IF resampling plan, if any.
const std::vector< std::unique_ptr< serial::Response > > & getPulsedInterferenceLog() const
Retrieves the log of pulsed interferences for streaming modes.
void endFmcwIfResamplingSegment()
Marks the current scheduled IF segment inactive.
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.
SimId getId() const noexcept
Retrieves the unique ID of the receiver.
RealType getNoiseTemperature() const noexcept
Retrieves the noise temperature of the receiver.
OperationMode getMode() const noexcept
Gets the operational mode of the receiver.
RealType getWindowPrf() const noexcept
Retrieves the pulse repetition frequency (PRF) of the radar window.
bool waitAndDequeueFinalizerJob(core::RenderingJob &job)
Waits for and dequeues a RenderingJob from the finalizer queue.
RealType getWindowSkip() const noexcept
Retrieves the window skip time.
void setWindowProperties(RealType length, RealType prf, RealType skip) noexcept
Sets the properties for radar windows.
void setFmcwIfOutputCallback(FmcwIfOutputCallback callback)
Routes emitted IF samples to a live consumer instead of the HDF5 accumulation buffer.
void addResponseToInbox(std::unique_ptr< serial::Response > response) noexcept
Adds a response to the receiver's pulsed-mode inbox.
DechirpMode
Receiver-side FMCW dechirping mode.
@ Ideal
Ignore timing phase noise during the dechirp mix.
@ None
Output raw pre-mix streaming IQ.
@ Physical
Preserve timing phase-noise decorrelation in the IF output.
RecvFlag
Enumeration for receiver configuration flags.
@ FLAG_NODIRECT
Disable direct-path reception.
@ FLAG_NOPROPLOSS
Disable propagation-loss scaling.
DechirpMode getDechirpMode() const noexcept
Gets the configured dechirp mode.
void setFmcwIfChainRequest(FmcwIfChainRequest request) noexcept
Stores the receiver-local FMCW IF-chain request.
void setNoiseTemperature(RealType temp)
Sets the noise temperature of the receiver.
void flushFmcwIfResampling()
Flushes remaining samples from the online IF sink into the output buffer.
RealType getWindowLength() const noexcept
Retrieves the radar window length.
double RealType
Type for real numbers.
Internal FMCW IF rational resampler planning and streaming sink.
std::string_view dechirpReferenceSourceToken(const Receiver::DechirpReferenceSource source) noexcept
Converts a dechirp reference source to its scenario token.
OperationMode
Defines the operational mode of a radar component.
Receiver::DechirpReferenceSource parseDechirpReferenceSourceToken(const std::string_view token)
Parses a dechirp reference source scenario token.
std::string_view dechirpModeToken(const Receiver::DechirpMode mode) noexcept
Converts a dechirp mode to its scenario token.
Receiver::DechirpMode parseDechirpModeToken(const std::string_view token)
Parses a dechirp mode scenario token.
Defines the Radar class and associated functionality.
Defines the data packet for asynchronous receiver finalization.
Classes for managing radar signal responses.
uint64_t SimId
64-bit Unique Simulation ID.
Defines the global state for the event-driven simulation engine.
Parsed and resolved dechirp reference details.
std::string name
Parsed transmitter or waveform name when applicable.
DechirpReferenceSource source
Reference source type.
std::string transmitter_name
Resolved transmitter name for attached/transmitter references.
SimId transmitter_id
Resolved transmitter ID for attached/transmitter references.
SimId waveform_id
Resolved waveform ID for custom references.
std::string waveform_name
Resolved waveform name for custom references.
Receiver-local FMCW IF-chain request parsed from scenario input.
std::optional< RealType > sample_rate_hz
Requested IF ADC sample rate in hertz.
std::optional< RealType > filter_transition_width_hz
Optional IF filter transition width in hertz.
std::optional< RealType > filter_bandwidth_hz
One-sided IF passband edge in hertz.