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 36 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 58 of file radar_signal.cpp.

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

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 70 of file radar_signal.h.

70{ 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 64 of file radar_signal.cpp.

65 {
66 clear();
67 const unsigned ratio = params::oversampleRatio();
68 _data.resize(samples * ratio);
69 _size = samples * ratio;
70 _rate = sampleRate * ratio;
71
72 if (ratio == 1)
73 {
74 std::ranges::copy(inData, _data.begin());
75 }
76 else
77 {
78 upsample(inData, samples, _data);
79 }
80 }
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:151

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 82 of file radar_signal.cpp.

84 {
85 auto out = std::vector<ComplexType>(_size);
86 size = _size;
87
88 const RealType timestep = 1.0 / _rate;
89 const int filt_length = static_cast<int>(params::renderFilterLength());
91
92 auto iter = points.begin();
93 auto next = points.size() > 1 ? std::next(iter) : iter;
94 const RealType idelay = std::round(_rate * iter->delay);
95 RealType sample_time = iter->time;
96
97 for (int i = 0; i < static_cast<int>(_size); ++i)
98 {
99 if (sample_time > next->time && next != iter)
100 {
101 iter = next;
102 if (std::next(next) != points.end())
103 {
104 ++next;
105 }
106 }
107
108 auto [amplitude, phase, fdelay, i_sample_unwrap] =
109 calculateWeightsAndDelays(iter, next, sample_time, idelay, fracWinDelay);
110 const auto& filt = interp.getFilter(fdelay);
111 ComplexType accum = performConvolution(i, filt.data(), filt_length, amplitude, i_sample_unwrap);
112 out[static_cast<std::size_t>(i)] = std::exp(ComplexType(0.0, 1.0) * phase) * accum;
113
114 sample_time += timestep;
115 }
116
117 return out;
118 }
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:139

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: