FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
fers_signal::Signal Class Reference

Class for handling radar waveform signal data. More...

#include "radar_signal.h"

+ Inheritance diagram for fers_signal::Signal:

Public Member Functions

virtual ~Signal ()=default
 
 Signal ()=default
 
 Signal (const Signal &)=delete
 
Signaloperator= (const Signal &)=delete
 
 Signal (Signal &&)=default
 
Signaloperator= (Signal &&)=default
 
void clear () noexcept
 Clears the internal signal data.
 
void load (std::span< const ComplexType > inData, unsigned samples, RealType sampleRate)
 Loads complex radar waveform data.
 
RealType getRate () const noexcept
 Gets the sample rate of the signal.
 
virtual std::vector< ComplexTyperender (const std::vector< interp::InterpPoint > &points, unsigned &size, double fracWinDelay) const
 Renders the signal data based on interpolation points.
 

Detailed Description

Class for handling radar waveform signal data.

Definition at line 35 of file radar_signal.h.

Constructor & Destructor Documentation

◆ ~Signal()

virtual fers_signal::Signal::~Signal ( )
virtualdefault

◆ Signal() [1/3]

fers_signal::Signal::Signal ( )
default

◆ Signal() [2/3]

fers_signal::Signal::Signal ( const Signal )
delete

◆ Signal() [3/3]

fers_signal::Signal::Signal ( Signal &&  )
default

Member Function Documentation

◆ clear()

void fers_signal::Signal::clear ( )
noexcept

Clears the internal signal data.

Definition at line 57 of file radar_signal.cpp.

58 {
59 _size = 0;
60 _rate = 0;
61 }

Referenced by load().

+ Here is the caller graph for this function:

◆ getRate()

RealType fers_signal::Signal::getRate ( ) const
noexcept

Gets the sample rate of the signal.

Returns
The sample rate of the signal.

Definition at line 69 of file radar_signal.h.

69{ return _rate; }

◆ load()

void fers_signal::Signal::load ( std::span< const ComplexType inData,
unsigned  samples,
RealType  sampleRate 
)

Loads complex radar waveform data.

Parameters
inDataThe input span of complex signal data.
samplesThe number of samples in the input data.
sampleRateThe sample rate of the input data.

Definition at line 63 of file radar_signal.cpp.

64 {
65 clear();
66 const unsigned ratio = params::oversampleRatio();
67 _data.resize(samples * ratio);
68 _size = samples * ratio;
69 _rate = sampleRate * ratio;
70
71 if (ratio == 1)
72 {
73 std::ranges::copy(inData, _data.begin());
74 }
75 else
76 {
77 upsample(inData, samples, _data);
78 }
79 }
void clear() noexcept
Clears the internal signal data.
void upsample(const std::span< const ComplexType > in, const unsigned size, std::span< ComplexType > out)
Upsamples a signal by a given ratio.
unsigned oversampleRatio() noexcept
Get the oversampling ratio.
Definition parameters.h:139

References clear(), params::oversampleRatio(), and fers_signal::upsample().

+ Here is the call graph for this function:

◆ operator=() [1/2]

Signal & fers_signal::Signal::operator= ( const Signal )
delete

◆ operator=() [2/2]

Signal & fers_signal::Signal::operator= ( Signal &&  )
default

◆ render()

std::vector< ComplexType > fers_signal::Signal::render ( const std::vector< interp::InterpPoint > &  points,
unsigned &  size,
double  fracWinDelay 
) const
virtual

Renders the signal data based on interpolation points.

Parameters
pointsA vector of interpolation points used to render the signal.
sizeReference to store the size of the rendered data.
fracWinDelayFractional window delay to apply during rendering.
Returns
A vector of rendered complex signal data.

Reimplemented in fers_signal::CwSignal.

Definition at line 81 of file radar_signal.cpp.

83 {
84 auto out = std::vector<ComplexType>(_size);
85 size = _size;
86
87 const RealType timestep = 1.0 / _rate;
88 const int filt_length = static_cast<int>(params::renderFilterLength());
90
91 auto iter = points.begin();
92 auto next = points.size() > 1 ? std::next(iter) : iter;
93 const RealType idelay = std::round(_rate * iter->delay);
94 RealType sample_time = iter->time;
95
96 for (int i = 0; i < static_cast<int>(_size); ++i)
97 {
98 if (sample_time > next->time && next != iter)
99 {
100 iter = next;
101 if (std::next(next) != points.end())
102 {
103 ++next;
104 }
105 }
106
107 auto [amplitude, phase, fdelay, i_sample_unwrap] =
108 calculateWeightsAndDelays(iter, next, sample_time, idelay, fracWinDelay);
109 const auto& filt = interp.getFilter(fdelay);
110 ComplexType accum = performConvolution(i, filt.data(), filt_length, amplitude, i_sample_unwrap);
111 out[i] = std::exp(ComplexType(0.0, 1.0) * phase) * accum;
112
113 sample_time += timestep;
114 }
115
116 return out;
117 }
static InterpFilter & getInstance() noexcept
Retrieves the singleton instance of the InterpFilter class.
double RealType
Type for real numbers.
Definition config.h:27
std::complex< RealType > ComplexType
Type for complex numbers.
Definition config.h:35
unsigned renderFilterLength() noexcept
Get the render filter length.
Definition parameters.h:127

References interp::InterpFilter::getInstance(), and params::renderFilterLength().

+ Here is the call graph for this function:

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