FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
radar::Receiver Class Referencefinal

Manages radar signal reception and response processing. More...

#include "receiver.h"

+ Inheritance diagram for radar::Receiver:
+ Collaboration diagram for radar::Receiver:

Classes

struct  DechirpReference
 Parsed and resolved dechirp reference details. More...
 
struct  FmcwIfChainRequest
 Receiver-local FMCW IF-chain request parsed from scenario input. More...
 

Public Types

enum class  RecvFlag : std::uint8_t { FLAG_NODIRECT = 1 , FLAG_NOPROPLOSS = 2 }
 Enumeration for receiver configuration flags. More...
 
enum class  DechirpMode : std::uint8_t { None , Physical , Ideal }
 Receiver-side FMCW dechirping mode. More...
 
enum class  DechirpReferenceSource : std::uint8_t { None , Attached , Transmitter , Custom }
 Source used to construct the receiver LO reference. More...
 
using FmcwIfOutputCallback = std::function< void(std::span< const ComplexType >, std::uint64_t)>
 

Public Member Functions

 Receiver (Platform *platform, std::string name, unsigned seed, OperationMode mode, const SimId id=0) noexcept
 Constructs a Receiver object.
 
 ~Receiver () override=default
 
 Receiver (const Receiver &)=delete
 
 Receiver (Receiver &&)=delete
 
Receiveroperator= (const Receiver &)=delete
 
Receiveroperator= (Receiver &&)=delete
 
void addResponseToInbox (std::unique_ptr< serial::Response > response) noexcept
 Adds a response to the receiver's pulsed-mode inbox.
 
void addInterferenceToLog (std::unique_ptr< serial::Response > response) noexcept
 Adds a pulsed interference response to the receiver's streaming-mode log.
 
bool checkFlag (RecvFlag flag) const noexcept
 Checks if a specific flag is set.
 
SimId getId () const noexcept
 Retrieves the unique ID of the receiver.
 
RealType getNoiseTemperature () const noexcept
 Retrieves the noise temperature of the receiver.
 
RealType getWindowLength () const noexcept
 Retrieves the radar window length.
 
RealType getWindowPrf () const noexcept
 Retrieves the pulse repetition frequency (PRF) of the radar window.
 
RealType getWindowSkip () const noexcept
 Retrieves the window skip time.
 
RealType getNoiseTemperature (const math::SVec3 &angle) const noexcept override
 Gets the noise temperature for a specific angle.
 
RealType getWindowStart (unsigned window) const
 Retrieves the start time of a specific radar window.
 
unsigned getWindowCount () const noexcept
 Gets the number of radar windows.
 
std::mt19937 & getRngEngine () noexcept
 Gets the receiver's internal random number generator engine.
 
OperationMode getMode () const noexcept
 Gets the operational mode of the receiver.
 
DechirpMode getDechirpMode () const noexcept
 Gets the configured dechirp mode.
 
bool isDechirpEnabled () const noexcept
 Returns true when the receiver emits dechirped IF data.
 
const DechirpReferencegetDechirpReference () const noexcept
 Gets the configured dechirp reference.
 
const FmcwIfChainRequestgetFmcwIfChainRequest () const noexcept
 Gets the optional receiver-local FMCW IF-chain request.
 
std::optional< RealTypegetIfSampleRate () const noexcept
 Gets the receiver-local FMCW IF sample rate in Hz.
 
std::optional< RealTypegetIfFilterBandwidth () const noexcept
 Gets the receiver-local FMCW IF filter bandwidth in Hz.
 
std::optional< RealTypegetIfFilterTransitionWidth () const noexcept
 Gets the receiver-local FMCW IF filter transition width in Hz.
 
bool hasFmcwIfSampleRate () const noexcept
 Returns true when this receiver requests IF-rate FMCW output.
 
bool hasFmcwIfResamplingSink () const noexcept
 Returns true when this receiver is using the online FMCW IF resampling sink.
 
const std::optional< fers_signal::FmcwIfResamplerPlan > & getFmcwIfResamplerPlan () const noexcept
 Gets the active or most recently used IF resampling plan, if any.
 
const std::vector< core::ActiveStreamingSource > & getDechirpSources () const noexcept
 Gets resolved receive-time LO source segments.
 
bool isActive () const noexcept
 Checks if the receiver is currently active (listening).
 
void setActive (const bool active) noexcept
 Sets the active state of the receiver.
 
void setMode (OperationMode mode) noexcept
 Sets the operational mode of the receiver.
 
void setDechirpMode (DechirpMode mode) noexcept
 Sets the receiver-side dechirp mode.
 
void setDechirpReference (DechirpReference reference)
 Stores the unresolved dechirp reference parsed from scenario input.
 
void setFmcwIfChainRequest (FmcwIfChainRequest request) noexcept
 Stores the receiver-local FMCW IF-chain request.
 
void initializeFmcwIfResampling (fers_signal::FmcwIfResamplerPlan plan)
 Creates the online FMCW IF resampling sink and clears the output buffer.
 
void beginFmcwIfResamplingSegment (RealType segment_start_time)
 Advances the continuous IF resampling timeline to the next active segment start.
 
void consumeFmcwIfBlock (std::span< const ComplexType > block, RealType block_start_time)
 Feeds one completed high-rate dechirped block into the online IF sink.
 
void setFmcwIfOutputCallback (FmcwIfOutputCallback callback)
 Routes emitted IF samples to a live consumer instead of the HDF5 accumulation buffer.
 
void endFmcwIfResamplingSegment ()
 Marks the current scheduled IF segment inactive.
 
void flushFmcwIfResampling ()
 Flushes remaining samples from the online IF sink into the output buffer.
 
void setResolvedDechirpSources (std::vector< core::ActiveStreamingSource > sources)
 Replaces resolved receive-time LO source segments.
 
void clearResolvedDechirpSources () noexcept
 Clears resolved dechirp source segments.
 
std::vector< std::unique_ptr< serial::Response > > drainInbox () noexcept
 Moves all responses from the inbox into a RenderingJob.
 
void enqueueFinalizerJob (core::RenderingJob &&job)
 Adds a completed RenderingJob to the finalizer queue.
 
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 setFlag (RecvFlag flag) noexcept
 Sets a receiver flag.
 
void clearFlag (RecvFlag flag) noexcept
 Clears a receiver flag.
 
void setNoiseTemperature (RealType temp)
 Sets the noise temperature of the receiver.
 
const std::vector< std::unique_ptr< serial::Response > > & getPulsedInterferenceLog () const
 Retrieves the log of pulsed interferences for streaming modes.
 
void prunePulsedInterferenceEndingBefore (RealType cutoff_time) noexcept
 Removes logged pulsed interference responses that ended before a receive time.
 
void setSchedule (std::vector< SchedulePeriod > schedule)
 Sets the active schedule for the receiver.
 
const std::vector< SchedulePeriod > & getSchedule () const noexcept
 Retrieves the list of active reception periods.
 
std::optional< RealTypegetNextWindowTime (RealType time) const
 Determines the next valid window start time at or after the given time.
 
const RadargetAttached () const noexcept
 Retrieves the attached radar object.
 
const antenna::AntennagetAntenna () const noexcept
 Gets the antenna associated with this radar.
 
RealType getGain (const math::SVec3 &angle, const math::SVec3 &refangle, RealType wavelength) const
 Calculates the radar gain based on input angles and wavelength.
 
std::shared_ptr< timing::TiminggetTiming () const
 Retrieves the timing source for the radar.
 
void setTiming (const std::shared_ptr< timing::Timing > &tim)
 Sets the timing source for the radar.
 
void setAntenna (const antenna::Antenna *ant)
 Sets the antenna for the radar.
 
void setAttached (const Radar *obj)
 Attaches another radar object to this radar.
 
math::Vec3 getPosition (const RealType time) const
 Retrieves the position of the object.
 
math::SVec3 getRotation (const RealType time) const
 Retrieves the rotation of the object.
 
PlatformgetPlatform () const noexcept
 Retrieves the associated platform of the object.
 
const std::string & getName () const noexcept
 Retrieves the name of the object.
 
void setName (std::string name) noexcept
 Sets the name of the object.
 

Protected Attributes

std::shared_ptr< timing::Timing_timing
 Timing source for the radar.
 

Detailed Description

Manages radar signal reception and response processing.

Definition at line 46 of file receiver.h.

Member Typedef Documentation

◆ FmcwIfOutputCallback

using radar::Receiver::FmcwIfOutputCallback = std::function<void(std::span<const ComplexType>, std::uint64_t)>

Definition at line 49 of file receiver.h.

Member Enumeration Documentation

◆ DechirpMode

enum class radar::Receiver::DechirpMode : std::uint8_t
strong

Receiver-side FMCW dechirping mode.

Enumerator
None 

Output raw pre-mix streaming IQ.

Physical 

Preserve timing phase-noise decorrelation in the IF output.

Ideal 

Ignore timing phase noise during the dechirp mix.

Definition at line 62 of file receiver.h.

63 {
64 None, ///< Output raw pre-mix streaming IQ.
65 Physical, ///< Preserve timing phase-noise decorrelation in the IF output.
66 Ideal ///< Ignore timing phase noise during the dechirp mix.
67 };
@ 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.

◆ DechirpReferenceSource

Source used to construct the receiver LO reference.

Enumerator
None 

No reference configured.

Attached 

Use the attached transmitter.

Transmitter 

Use a named transmitter.

Custom 

Use a named top-level waveform with the receiver schedule.

Definition at line 70 of file receiver.h.

71 {
72 None, ///< No reference configured.
73 Attached, ///< Use the attached transmitter.
74 Transmitter, ///< Use a named transmitter.
75 Custom ///< Use a named top-level waveform with the receiver schedule.
76 };
@ Transmitter
Use a named transmitter.
@ Attached
Use the attached transmitter.
@ Custom
Use a named top-level waveform with the receiver schedule.

◆ RecvFlag

enum class radar::Receiver::RecvFlag : std::uint8_t
strong

Enumeration for receiver configuration flags.

Enumerator
FLAG_NODIRECT 

Disable direct-path reception.

FLAG_NOPROPLOSS 

Disable propagation-loss scaling.

Definition at line 55 of file receiver.h.

56 {
57 FLAG_NODIRECT = 1, ///< Disable direct-path reception.
58 FLAG_NOPROPLOSS = 2 ///< Disable propagation-loss scaling.
59 };
@ FLAG_NODIRECT
Disable direct-path reception.
@ FLAG_NOPROPLOSS
Disable propagation-loss scaling.

Constructor & Destructor Documentation

◆ Receiver() [1/3]

radar::Receiver::Receiver ( Platform platform,
std::string  name,
unsigned  seed,
OperationMode  mode,
const SimId  id = 0 
)
explicitnoexcept

Constructs a Receiver object.

Parameters
platformThe platform associated with this receiver.
nameThe name of the receiver.
seedThe seed for the receiver's internal random number generator.
modeThe operational mode (PULSED_MODE, CW_MODE, or FMCW_MODE).

Definition at line 109 of file receiver.cpp.

110 :
111 Radar(platform, std::move(name), id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Receiver) : id),
112 _mode(mode), _rng(seed)
113 {
114 }
static SimIdGenerator & instance()
Get the singleton instance of SimIdGenerator.
Definition sim_id.h:48
Radar(Platform *platform, std::string name, const SimId id=0) noexcept
Constructs a Radar object.
Definition radar_obj.h:58
math::Vec3 max

◆ ~Receiver()

radar::Receiver::~Receiver ( )
overridedefault

◆ Receiver() [2/3]

radar::Receiver::Receiver ( const Receiver )
delete

◆ Receiver() [3/3]

radar::Receiver::Receiver ( Receiver &&  )
delete

Member Function Documentation

◆ addInterferenceToLog()

void radar::Receiver::addInterferenceToLog ( std::unique_ptr< serial::Response response)
noexcept

Adds a pulsed interference response to the receiver's streaming-mode log.

Parameters
responseA unique pointer to the response object.

Definition at line 122 of file receiver.cpp.

123 {
124 std::scoped_lock const lock(_interference_log_mutex);
125 _pulsed_interference_log.push_back(std::move(response));
126 }

References max.

◆ addResponseToInbox()

void radar::Receiver::addResponseToInbox ( std::unique_ptr< serial::Response response)
noexcept

Adds a response to the receiver's pulsed-mode inbox.

Parameters
responseA unique pointer to the response object.

Definition at line 116 of file receiver.cpp.

117 {
118 std::scoped_lock const lock(_inbox_mutex);
119 _inbox.push_back(std::move(response));
120 }

References max.

◆ beginFmcwIfResamplingSegment()

void radar::Receiver::beginFmcwIfResamplingSegment ( RealType  segment_start_time)

Advances the continuous IF resampling timeline to the next active segment start.

Definition at line 233 of file receiver.cpp.

234 {
235 if (_fmcw_if_sink == nullptr || !_fmcw_if_plan.has_value())
236 {
237 return;
238 }
239 consumeFmcwIfZerosUntil(ceilSampleIndexAtOrAfter(segment_start_time, _fmcw_if_plan->input_sample_rate_hz));
240 _fmcw_if_segment_active = true;
241 }

References max.

Referenced by consumeFmcwIfBlock().

+ Here is the caller graph for this function:

◆ checkFlag()

bool radar::Receiver::checkFlag ( RecvFlag  flag) const
noexcept

Checks if a specific flag is set.

Parameters
flagThe flag to check.
Returns
True if the flag is set, false otherwise.

Definition at line 137 of file receiver.h.

137{ return (_flags & static_cast<int>(flag)) != 0; }

References max.

◆ clearFlag()

void radar::Receiver::clearFlag ( RecvFlag  flag)
noexcept

Clears a receiver flag.

Parameters
flagThe flag to clear.

Definition at line 350 of file receiver.h.

350{ _flags &= ~static_cast<int>(flag); }

References max.

◆ clearResolvedDechirpSources()

void radar::Receiver::clearResolvedDechirpSources ( )
noexcept

Clears resolved dechirp source segments.

Definition at line 305 of file receiver.h.

305{ _dechirp_sources.clear(); }

◆ consumeFmcwIfBlock()

void radar::Receiver::consumeFmcwIfBlock ( std::span< const ComplexType block,
RealType  block_start_time 
)

Feeds one completed high-rate dechirped block into the online IF sink.

Definition at line 243 of file receiver.cpp.

244 {
245 if (_fmcw_if_sink == nullptr || !_fmcw_if_plan.has_value())
246 {
247 throw std::logic_error("FMCW IF resampling sink has not been initialized.");
248 }
249 const auto input_sample_rate_hz = _fmcw_if_plan->input_sample_rate_hz;
250 if (!_fmcw_if_segment_active)
251 {
253 }
254 const auto block_start_index = ceilSampleIndexAtOrAfter(block_start_time, input_sample_rate_hz);
255 if (block_start_index < _fmcw_if_input_cursor)
256 {
257 throw std::logic_error("FMCW IF resampling input blocks must be supplied in chronological order.");
258 }
259 consumeFmcwIfZerosUntil(block_start_index);
260 _fmcw_if_sink->consume(block);
261 _fmcw_if_input_cursor += block.size();
262 auto emitted = _fmcw_if_sink->takeOutput();
263 appendFmcwIfOutput(std::move(emitted));
264 }
void beginFmcwIfResamplingSegment(RealType segment_start_time)
Advances the continuous IF resampling timeline to the next active segment start.
Definition receiver.cpp:233

References beginFmcwIfResamplingSegment(), and max.

+ Here is the call graph for this function:

◆ drainInbox()

std::vector< std::unique_ptr< serial::Response > > radar::Receiver::drainInbox ( )
noexcept

Moves all responses from the inbox into a RenderingJob.

Returns
A vector of unique pointers to the responses.

Definition at line 135 of file receiver.cpp.

136 {
137 std::scoped_lock const lock(_inbox_mutex);
138 std::vector<std::unique_ptr<serial::Response>> drained_responses;
139 drained_responses.swap(_inbox);
140 return drained_responses;
141 }

References max.

◆ endFmcwIfResamplingSegment()

void radar::Receiver::endFmcwIfResamplingSegment ( )

Marks the current scheduled IF segment inactive.

Definition at line 306 of file receiver.cpp.

307 {
308 if (_fmcw_if_sink == nullptr)
309 {
310 return;
311 }
312 _fmcw_if_segment_active = false;
313 }

Referenced by flushFmcwIfResampling().

+ Here is the caller graph for this function:

◆ enqueueFinalizerJob()

void radar::Receiver::enqueueFinalizerJob ( core::RenderingJob &&  job)

Adds a completed RenderingJob to the finalizer queue.

Parameters
jobThe RenderingJob to enqueue.

Definition at line 143 of file receiver.cpp.

144 {
145 {
146 std::scoped_lock const lock(_finalizer_queue_mutex);
147 _finalizer_queue.push(std::move(job));
148 }
149 _finalizer_queue_cv.notify_one();
150 }

References max.

◆ flushFmcwIfResampling()

void radar::Receiver::flushFmcwIfResampling ( )

Flushes remaining samples from the online IF sink into the output buffer.

Definition at line 315 of file receiver.cpp.

316 {
317 if (_fmcw_if_sink == nullptr)
318 {
319 return;
320 }
322 if (_fmcw_if_plan.has_value())
323 {
324 const RealType flush_until_time = params::endTime() + _fmcw_if_plan->group_delay_seconds +
325 1.0 / _fmcw_if_plan->actual_output_sample_rate_hz;
326 consumeFmcwIfZerosUntil(ceilSampleIndexAtOrAfter(flush_until_time, _fmcw_if_plan->input_sample_rate_hz));
327 auto emitted = _fmcw_if_sink->finish();
328 appendFmcwIfOutput(std::move(emitted));
329 }
330 _fmcw_if_sink.reset();
331 }
void endFmcwIfResamplingSegment()
Marks the current scheduled IF segment inactive.
Definition receiver.cpp:306
double RealType
Type for real numbers.
Definition config.h:27
RealType endTime() noexcept
Get the end time for the simulation.
Definition parameters.h:109

References endFmcwIfResamplingSegment(), params::endTime(), and max.

+ Here is the call graph for this function:

◆ getAntenna()

const antenna::Antenna * radar::Radar::getAntenna ( ) const
noexceptinherited

Gets the antenna associated with this radar.

Returns
Pointer to the associated antenna.

Definition at line 93 of file radar_obj.h.

93{ return _antenna; }

Referenced by radar::to_json().

+ Here is the caller graph for this function:

◆ getAttached()

const Radar * radar::Radar::getAttached ( ) const
noexceptinherited

Retrieves the attached radar object.

Returns
Pointer to the attached radar object.

Definition at line 79 of file radar_obj.h.

79{ return _attached; }

◆ getDechirpMode()

DechirpMode radar::Receiver::getDechirpMode ( ) const
noexcept

Gets the configured dechirp mode.

Definition at line 212 of file receiver.h.

212{ return _dechirp_mode; }

◆ getDechirpReference()

const DechirpReference & radar::Receiver::getDechirpReference ( ) const
noexcept

Gets the configured dechirp reference.

Definition at line 218 of file receiver.h.

218{ return _dechirp_reference; }

◆ getDechirpSources()

const std::vector< core::ActiveStreamingSource > & radar::Receiver::getDechirpSources ( ) const
noexcept

Gets resolved receive-time LO source segments.

Definition at line 251 of file receiver.h.

252 {
253 return _dechirp_sources;
254 }

◆ getFmcwIfChainRequest()

const FmcwIfChainRequest & radar::Receiver::getFmcwIfChainRequest ( ) const
noexcept

Gets the optional receiver-local FMCW IF-chain request.

Definition at line 221 of file receiver.h.

221{ return _fmcw_if_chain; }

◆ getFmcwIfResamplerPlan()

const std::optional< fers_signal::FmcwIfResamplerPlan > & radar::Receiver::getFmcwIfResamplerPlan ( ) const
noexcept

Gets the active or most recently used IF resampling plan, if any.

Definition at line 245 of file receiver.h.

246 {
247 return _fmcw_if_plan;
248 }

◆ getGain()

RealType radar::Radar::getGain ( const math::SVec3 angle,
const math::SVec3 refangle,
RealType  wavelength 
) const
inherited

Calculates the radar gain based on input angles and wavelength.

Parameters
angleThe radar's pointing angle.
refangleThe reference angle for comparison.
wavelengthThe wavelength of the radar signal.
Returns
The calculated radar gain.

Definition at line 26 of file radar_obj.cpp.

27 {
28 return _antenna->getGain(angle, refangle, wavelength);
29 }
virtual RealType getGain(const math::SVec3 &angle, const math::SVec3 &refangle, RealType wavelength) const =0
Computes the gain of the antenna based on the input angle and reference angle.

References antenna::Antenna::getGain(), and max.

+ Here is the call graph for this function:

◆ getId()

SimId radar::Receiver::getId ( ) const
noexcept

Retrieves the unique ID of the receiver.

Returns
The receiver SimId.

Definition at line 144 of file receiver.h.

144{ return Radar::getId(); }
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Definition radar_obj.h:86

References radar::Radar::getId().

+ Here is the call graph for this function:

◆ getIfFilterBandwidth()

std::optional< RealType > radar::Receiver::getIfFilterBandwidth ( ) const
noexcept

Gets the receiver-local FMCW IF filter bandwidth in Hz.

Definition at line 227 of file receiver.h.

228 {
229 return _fmcw_if_chain.filter_bandwidth_hz;
230 }
std::optional< RealType > filter_bandwidth_hz
One-sided IF passband edge in hertz.
Definition receiver.h:93

References radar::Receiver::FmcwIfChainRequest::filter_bandwidth_hz.

◆ getIfFilterTransitionWidth()

std::optional< RealType > radar::Receiver::getIfFilterTransitionWidth ( ) const
noexcept

Gets the receiver-local FMCW IF filter transition width in Hz.

Definition at line 233 of file receiver.h.

234 {
235 return _fmcw_if_chain.filter_transition_width_hz;
236 }
std::optional< RealType > filter_transition_width_hz
Optional IF filter transition width in hertz.
Definition receiver.h:94

References radar::Receiver::FmcwIfChainRequest::filter_transition_width_hz.

◆ getIfSampleRate()

std::optional< RealType > radar::Receiver::getIfSampleRate ( ) const
noexcept

Gets the receiver-local FMCW IF sample rate in Hz.

Definition at line 224 of file receiver.h.

224{ return _fmcw_if_chain.sample_rate_hz; }
std::optional< RealType > sample_rate_hz
Requested IF ADC sample rate in hertz.
Definition receiver.h:92

References radar::Receiver::FmcwIfChainRequest::sample_rate_hz.

◆ getMode()

OperationMode radar::Receiver::getMode ( ) const
noexcept

Gets the operational mode of the receiver.

Returns
The operational mode (PULSED_MODE, CW_MODE, or FMCW_MODE).

Definition at line 209 of file receiver.h.

209{ return _mode; }

◆ getName()

const std::string & radar::Object::getName ( ) const
noexceptinherited

Retrieves the name of the object.

Returns
A const reference to the string representing the object's name.

Definition at line 79 of file object.h.

79{ return _name; }

Referenced by setNoiseTemperature(), radar::to_json(), and radar::to_json().

+ Here is the caller graph for this function:

◆ getNextWindowTime()

std::optional< RealType > radar::Receiver::getNextWindowTime ( RealType  time) const

Determines the next valid window start time at or after the given time.

Parameters
timeThe proposed window start time.
Returns
The actual start time, or nullopt if no valid time exists in the schedule.

Definition at line 384 of file receiver.cpp.

385 {
386 // If no schedule is defined, assume always on.
387 if (_schedule.empty())
388 {
389 return time;
390 }
391 for (const auto& period : _schedule)
392 {
393 // If time is within this period, it's valid.
394 if (time >= period.start && time <= period.end)
395 {
396 return time;
397 }
398 // If time is before this period, skip to the start of this period.
399 if (time < period.start)
400 {
401 return period.start;
402 }
403 // If time is after this period, continue to next period.
404 }
405 // Time is after the last scheduled period.
406 return std::nullopt;
407 }

References max.

◆ getNoiseTemperature() [1/2]

RealType radar::Receiver::getNoiseTemperature ( ) const
noexcept

Retrieves the noise temperature of the receiver.

Returns
The noise temperature.

Definition at line 151 of file receiver.h.

151{ return _noise_temperature; }

◆ getNoiseTemperature() [2/2]

RealType radar::Receiver::getNoiseTemperature ( const math::SVec3 angle) const
overridevirtualnoexcept

Gets the noise temperature for a specific angle.

Parameters
angleThe angle in spherical coordinates (SVec3).
Returns
The noise temperature at the given angle.

Reimplemented from radar::Radar.

Definition at line 164 of file receiver.cpp.

165 {
166 return _noise_temperature + Radar::getNoiseTemperature(angle);
167 }
virtual RealType getNoiseTemperature(const math::SVec3 &angle) const noexcept
Gets the noise temperature of the radar.
Definition radar_obj.cpp:31

References radar::Radar::getNoiseTemperature(), and max.

+ Here is the call graph for this function:

◆ getPlatform()

Platform * radar::Object::getPlatform ( ) const
noexceptinherited

Retrieves the associated platform of the object.

Returns
A pointer to the Platform object associated with this object.

Definition at line 65 of file object.h.

65{ return _platform; }

◆ getPosition()

math::Vec3 radar::Object::getPosition ( const RealType  time) const
inherited

Retrieves the position of the object.

Parameters
timeThe time at which to get the position of the object.
Returns
A math::Vec3 representing the position of the object.

Definition at line 50 of file object.h.

50{ return _platform->getPosition(time); }
math::Vec3 getPosition(const RealType time) const
Gets the position of the platform at a specific time.
Definition platform.h:75

References radar::Platform::getPosition().

+ Here is the call graph for this function:

◆ getPulsedInterferenceLog()

const std::vector< std::unique_ptr< serial::Response > > & radar::Receiver::getPulsedInterferenceLog ( ) const

Retrieves the log of pulsed interferences for streaming modes.

Returns
A const reference to the vector of interference responses.

Definition at line 364 of file receiver.h.

365 {
366 return _pulsed_interference_log;
367 }

◆ getRngEngine()

std::mt19937 & radar::Receiver::getRngEngine ( )
noexcept

Gets the receiver's internal random number generator engine.

Returns
A mutable reference to the RNG engine.

Definition at line 202 of file receiver.h.

202{ return _rng; }

◆ getRotation()

math::SVec3 radar::Object::getRotation ( const RealType  time) const
inherited

Retrieves the rotation of the object.

Parameters
timeThe time at which to get the rotation of the object.
Returns
A math::SVec3 representing the rotation of the object.

Definition at line 58 of file object.h.

58{ return _platform->getRotation(time); }
math::SVec3 getRotation(const RealType time) const
Gets the rotation of the platform at a specific time.
Definition platform.h:83

References radar::Platform::getRotation().

Referenced by radar::FileTarget::getRcs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSchedule()

const std::vector< SchedulePeriod > & radar::Receiver::getSchedule ( ) const
noexcept

Retrieves the list of active reception periods.

Returns
A const reference to the schedule vector.

Definition at line 382 of file receiver.h.

382{ return _schedule; }

◆ getTiming()

std::shared_ptr< timing::Timing > radar::Radar::getTiming ( ) const
inherited

Retrieves the timing source for the radar.

Returns
Shared pointer to the timing source.

Definition at line 66 of file radar_obj.cpp.

67 {
68 if (!_timing)
69 {
70 LOG(Level::FATAL, "Radar::GetTiming called before timing set");
71 throw std::runtime_error("Radar::GetTiming called before timing set");
72 }
73 return _timing;
74 }
std::shared_ptr< timing::Timing > _timing
Timing source for the radar.
Definition radar_obj.h:144
#define LOG(level,...)
Definition logging.h:19

References radar::Radar::_timing, and LOG.

Referenced by radar::to_json().

+ Here is the caller graph for this function:

◆ getWindowCount()

unsigned radar::Receiver::getWindowCount ( ) const
noexcept

Gets the number of radar windows.

Returns
The total number of radar windows.

Definition at line 364 of file receiver.cpp.

365 {
366 const RealType time = params::endTime() - params::startTime();
367 const RealType pulses = time * _window_prf;
368 return static_cast<unsigned>(std::ceil(pulses));
369 }
RealType startTime() noexcept
Get the start time for the simulation.
Definition parameters.h:103

References params::endTime(), max, and params::startTime().

+ Here is the call graph for this function:

◆ getWindowLength()

RealType radar::Receiver::getWindowLength ( ) const
noexcept

Retrieves the radar window length.

Returns
The radar window length.

Definition at line 158 of file receiver.h.

158{ return _window_length; }

◆ getWindowPrf()

RealType radar::Receiver::getWindowPrf ( ) const
noexcept

Retrieves the pulse repetition frequency (PRF) of the radar window.

Returns
The PRF of the radar window.

Definition at line 165 of file receiver.h.

165{ return _window_prf; }

◆ getWindowSkip()

RealType radar::Receiver::getWindowSkip ( ) const
noexcept

Retrieves the window skip time.

Returns
The window skip time.

Definition at line 172 of file receiver.h.

172{ return _window_skip; }

◆ getWindowStart()

RealType radar::Receiver::getWindowStart ( unsigned  window) const

Retrieves the start time of a specific radar window.

Parameters
windowThe index of the window.
Returns
The start time of the specified window.
Exceptions
std::logic_errorIf the receiver is not associated with a timing source.

Definition at line 371 of file receiver.cpp.

372 {
373 const RealType stime = static_cast<RealType>(window) / _window_prf + _window_skip;
374 if (!_timing)
375 {
376 LOG(logging::Level::FATAL, "Receiver must be associated with timing source");
377 throw std::logic_error("Receiver must be associated with timing source");
378 }
379 return stime;
380 }
@ FATAL
Fatal level for severe error events.

References radar::Radar::_timing, logging::FATAL, LOG, and max.

◆ hasFmcwIfResamplingSink()

bool radar::Receiver::hasFmcwIfResamplingSink ( ) const
noexcept

Returns true when this receiver is using the online FMCW IF resampling sink.

Definition at line 242 of file receiver.h.

242{ return _fmcw_if_sink != nullptr; }

◆ hasFmcwIfSampleRate()

bool radar::Receiver::hasFmcwIfSampleRate ( ) const
noexcept

Returns true when this receiver requests IF-rate FMCW output.

Definition at line 239 of file receiver.h.

239{ return _fmcw_if_chain.sample_rate_hz.has_value(); }

References radar::Receiver::FmcwIfChainRequest::sample_rate_hz.

◆ initializeFmcwIfResampling()

void radar::Receiver::initializeFmcwIfResampling ( fers_signal::FmcwIfResamplerPlan  plan)

Creates the online FMCW IF resampling sink and clears the output buffer.

Definition at line 223 of file receiver.cpp.

224 {
225 _fmcw_if_plan = std::move(plan);
226 _fmcw_if_samples_to_discard = _fmcw_if_plan->warmup_discard_samples;
227 _fmcw_if_sink = std::make_unique<fers_signal::FmcwIfResamplingSink>(*_fmcw_if_plan);
228 _fmcw_if_input_cursor = 0;
229 _fmcw_if_output_cursor = 0;
230 _fmcw_if_segment_active = false;
231 }

◆ isActive()

bool radar::Receiver::isActive ( ) const
noexcept

Checks if the receiver is currently active (listening).

Returns
True if active, false otherwise.

Definition at line 260 of file receiver.h.

260{ return _is_active; }

◆ isDechirpEnabled()

bool radar::Receiver::isDechirpEnabled ( ) const
noexcept

Returns true when the receiver emits dechirped IF data.

Definition at line 215 of file receiver.h.

215{ return _dechirp_mode != DechirpMode::None; }

References None.

◆ operator=() [1/2]

Receiver & radar::Receiver::operator= ( const Receiver )
delete

◆ operator=() [2/2]

Receiver & radar::Receiver::operator= ( Receiver &&  )
delete

◆ prunePulsedInterferenceEndingBefore()

void radar::Receiver::prunePulsedInterferenceEndingBefore ( RealType  cutoff_time)
noexcept

Removes logged pulsed interference responses that ended before a receive time.

Definition at line 128 of file receiver.cpp.

129 {
130 std::scoped_lock const lock(_interference_log_mutex);
131 std::erase_if(_pulsed_interference_log,
132 [cutoff_time](const auto& response) { return response && response->endTime() <= cutoff_time; });
133 }

References max.

◆ setActive()

void radar::Receiver::setActive ( const bool  active)
noexcept

Sets the active state of the receiver.

Parameters
activeThe new active state.

Definition at line 266 of file receiver.h.

266{ _is_active = active; }

References max.

◆ setAntenna()

void radar::Radar::setAntenna ( const antenna::Antenna ant)
inherited

Sets the antenna for the radar.

Parameters
antPointer to the antenna to set.

Definition at line 46 of file radar_obj.cpp.

47 {
48 if (ant == nullptr)
49 {
50 LOG(Level::FATAL, "Transmitter's antenna set to null");
51 throw std::logic_error("Transmitter's antenna set to null");
52 }
53 _antenna = ant;
54 }

References LOG, and max.

◆ setAttached()

void radar::Radar::setAttached ( const Radar obj)
inherited

Attaches another radar object to this radar.

Parameters
objPointer to the radar object to attach.
Exceptions
std::runtime_errorIf another object is already attached.

Definition at line 56 of file radar_obj.cpp.

57 {
58 if (_attached != nullptr)
59 {
60 LOG(Level::FATAL, "Attempted to attach second object to transmitter");
61 throw std::runtime_error("Attempted to attach second object to transmitter");
62 }
63 _attached = obj;
64 }

References LOG, and max.

◆ setDechirpMode()

void radar::Receiver::setDechirpMode ( DechirpMode  mode)
noexcept

Sets the receiver-side dechirp mode.

Definition at line 189 of file receiver.cpp.

190 {
191 _dechirp_mode = mode;
192 if (_dechirp_mode == DechirpMode::None)
193 {
194 _dechirp_reference = {};
195 _dechirp_sources.clear();
196 _fmcw_if_chain = {};
197 _fmcw_if_plan.reset();
198 _fmcw_if_sink.reset();
199 _fmcw_if_samples_to_discard = 0;
200 _fmcw_if_input_cursor = 0;
201 _fmcw_if_output_cursor = 0;
202 _fmcw_if_segment_active = false;
203 }
204 }

◆ setDechirpReference()

void radar::Receiver::setDechirpReference ( DechirpReference  reference)

Stores the unresolved dechirp reference parsed from scenario input.

Definition at line 206 of file receiver.cpp.

207 {
208 _dechirp_reference = std::move(reference);
209 _dechirp_sources.clear();
210 }

References max.

◆ setFlag()

void radar::Receiver::setFlag ( RecvFlag  flag)
noexcept

Sets a receiver flag.

Parameters
flagThe flag to set.

Definition at line 343 of file receiver.h.

343{ _flags |= static_cast<int>(flag); }

References max.

◆ setFmcwIfChainRequest()

void radar::Receiver::setFmcwIfChainRequest ( FmcwIfChainRequest  request)
noexcept

Stores the receiver-local FMCW IF-chain request.

Definition at line 212 of file receiver.cpp.

213 {
214 _fmcw_if_chain = request;
215 _fmcw_if_plan.reset();
216 _fmcw_if_sink.reset();
217 _fmcw_if_samples_to_discard = 0;
218 _fmcw_if_input_cursor = 0;
219 _fmcw_if_output_cursor = 0;
220 _fmcw_if_segment_active = false;
221 }

References max.

◆ setFmcwIfOutputCallback()

void radar::Receiver::setFmcwIfOutputCallback ( FmcwIfOutputCallback  callback)

Routes emitted IF samples to a live consumer instead of the HDF5 accumulation buffer.

Definition at line 266 of file receiver.cpp.

267 {
268 _fmcw_if_output_callback = std::move(callback);
269 }

References max.

◆ setMode()

void radar::Receiver::setMode ( OperationMode  mode)
noexcept

Sets the operational mode of the receiver.

Parameters
modeThe operational mode (PULSED_MODE, CW_MODE, or FMCW_MODE).

Definition at line 179 of file receiver.cpp.

180 {
181 _mode = mode;
182 if (_mode != OperationMode::FMCW_MODE)
183 {
185 _fmcw_if_chain = {};
186 }
187 }
void setDechirpMode(DechirpMode mode) noexcept
Sets the receiver-side dechirp mode.
Definition receiver.cpp:189
@ FMCW_MODE
The component operates in an FMCW streaming mode.

References radar::FMCW_MODE.

◆ setName()

void radar::Object::setName ( std::string  name)
noexceptinherited

Sets the name of the object.

Parameters
nameThe new name for the object.

Definition at line 86 of file object.h.

86{ _name = std::move(name); }

◆ setNoiseTemperature()

void radar::Receiver::setNoiseTemperature ( RealType  temp)

Sets the noise temperature of the receiver.

Parameters
tempThe new noise temperature.
Exceptions
std::runtime_errorIf the noise temperature is negative.

Definition at line 169 of file receiver.cpp.

170 {
171 if (temp < -EPSILON)
172 {
173 LOG(logging::Level::FATAL, "Noise temperature for receiver {} is negative", getName());
174 throw std::runtime_error("Noise temperature must be positive");
175 }
176 _noise_temperature = temp;
177 }
const std::string & getName() const noexcept
Retrieves the name of the object.
Definition object.h:79
constexpr RealType EPSILON
Machine epsilon for real numbers.
Definition config.h:51

References EPSILON, logging::FATAL, radar::Object::getName(), LOG, and max.

+ Here is the call graph for this function:

◆ setResolvedDechirpSources()

void radar::Receiver::setResolvedDechirpSources ( std::vector< core::ActiveStreamingSource sources)

Replaces resolved receive-time LO source segments.

Definition at line 351 of file receiver.cpp.

352 {
353 _dechirp_sources = std::move(sources);
354 }

References max.

◆ setSchedule()

void radar::Receiver::setSchedule ( std::vector< SchedulePeriod schedule)

Sets the active schedule for the receiver.

Parameters
scheduleA vector of active periods.

Definition at line 382 of file receiver.cpp.

382{ _schedule = std::move(schedule); }

References max.

◆ setTiming()

void radar::Radar::setTiming ( const std::shared_ptr< timing::Timing > &  tim)
inherited

Sets the timing source for the radar.

Parameters
timShared pointer to the timing source to set.

Definition at line 36 of file radar_obj.cpp.

37 {
38 if (!tim)
39 {
40 LOG(Level::FATAL, "Radar timing source must not be null");
41 throw std::runtime_error("Radar timing source must not be null");
42 }
43 _timing = tim;
44 }

References radar::Radar::_timing, LOG, and max.

◆ setWindowProperties()

void radar::Receiver::setWindowProperties ( RealType  length,
RealType  prf,
RealType  skip 
)
noexcept

Sets the properties for radar windows.

Parameters
lengthThe length of the radar window.
prfThe pulse repetition frequency.
skipThe skip time between windows.

Definition at line 356 of file receiver.cpp.

357 {
358 const auto rate = params::rate() * params::oversampleRatio();
359 _window_length = length;
360 _window_prf = 1 / (std::floor(rate / prf) / rate);
361 _window_skip = std::floor(rate * skip) / rate;
362 }
RealType rate() noexcept
Get the rendering sample rate.
Definition parameters.h:121
unsigned oversampleRatio() noexcept
Get the oversampling ratio.
Definition parameters.h:151

References max, params::oversampleRatio(), and params::rate().

+ Here is the call graph for this function:

◆ waitAndDequeueFinalizerJob()

bool radar::Receiver::waitAndDequeueFinalizerJob ( core::RenderingJob job)

Waits for and dequeues a RenderingJob from the finalizer queue.

This is a blocking call, intended for use by the dedicated finalizer thread.

Parameters
jobA reference to a RenderingJob to be filled.
Returns
false if a shutdown signal is received, true otherwise.

Definition at line 152 of file receiver.cpp.

153 {
154 std::unique_lock lock(_finalizer_queue_mutex);
155 _finalizer_queue_cv.wait(lock, [this] { return !_finalizer_queue.empty(); });
156
157 job = std::move(_finalizer_queue.front());
158 _finalizer_queue.pop();
159
160 const bool is_shutdown_job = job.duration < 0.0;
161 return !is_shutdown_job;
162 }

References max.

Member Data Documentation

◆ _timing

std::shared_ptr<timing::Timing> radar::Radar::_timing
protectedinherited

Timing source for the radar.

Definition at line 144 of file radar_obj.h.

Referenced by radar::Radar::getTiming(), getWindowStart(), and radar::Radar::setTiming().


The documentation for this class was generated from the following files: