FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
fers_signal::RadarSignal Class Reference

Class representing a radar signal with associated properties. More...

#include "radar_signal.h"

Public Member Functions

 RadarSignal (std::string name, RealType power, RealType carrierfreq, RealType length, std::unique_ptr< Signal > signal, const SimId id=0)
 Constructs a RadarSignal object.
 
 ~RadarSignal ()=default
 
 RadarSignal (const RadarSignal &) noexcept=delete
 
RadarSignaloperator= (const RadarSignal &) noexcept=delete
 
 RadarSignal (RadarSignal &&) noexcept=delete
 
RadarSignaloperator= (RadarSignal &&) noexcept=delete
 
void setFilename (const std::string &filename) noexcept
 Sets the filename associated with this signal.
 
const std::optional< std::string > & getFilename () const noexcept
 Gets the filename associated with this signal.
 
RealType getPower () const noexcept
 Gets the power of the radar signal.
 
RealType getCarrier () const noexcept
 Gets the carrier frequency of the radar signal.
 
const std::string & getName () const noexcept
 Gets the name of the radar signal.
 
SimId getId () const noexcept
 Gets the unique ID of the radar signal.
 
RealType getRate () const noexcept
 Gets the sample rate of the radar signal.
 
unsigned getSampleCount () const noexcept
 Gets the number of native samples in the underlying signal.
 
RealType getLength () const noexcept
 Gets the length of the radar signal.
 
const SignalgetSignal () const noexcept
 Gets the underlying signal object.
 
bool isCw () const noexcept
 Returns true when this signal is a continuous-wave signal.
 
bool isFmcwChirp () const noexcept
 Returns true when this signal is an FMCW linear chirp signal.
 
bool isFmcwTriangle () const noexcept
 Returns true when this signal is an FMCW triangular modulation signal.
 
bool isFmcwFamily () const noexcept
 Returns true when this signal belongs to the FMCW waveform family.
 
const class FmcwChirpSignalgetFmcwChirpSignal () const noexcept
 Gets the FMCW chirp implementation, if this signal owns one.
 
const class FmcwTriangleSignalgetFmcwTriangleSignal () const noexcept
 Gets the FMCW triangle implementation, if this signal owns one.
 
std::vector< ComplexTyperender (const std::vector< interp::InterpPoint > &points, unsigned &size, RealType fracWinDelay) const
 Renders the radar signal.
 
std::vector< ComplexTyperenderSlice (const std::vector< interp::InterpPoint > &points, RealType outputStartTime, RealType outputSampleRate, std::size_t sampleCount, RealType fracWinDelay) const
 Renders a bounded absolute-time slice on the requested output grid.
 

Detailed Description

Class representing a radar signal with associated properties.

Definition at line 149 of file radar_signal.h.

Constructor & Destructor Documentation

◆ RadarSignal() [1/3]

fers_signal::RadarSignal::RadarSignal ( std::string  name,
RealType  power,
RealType  carrierfreq,
RealType  length,
std::unique_ptr< Signal signal,
const SimId  id = 0 
)

Constructs a RadarSignal object.

Parameters
nameThe name of the radar signal.
powerThe power of the radar signal.
carrierfreqThe carrier frequency of the radar signal.
lengthThe length of the radar signal.
signalA unique pointer to the Signal object containing the waveform data.
Exceptions
std::runtime_errorif the signal is null.

Definition at line 174 of file radar_signal.cpp.

175 :
176 _name(std::move(name)), _id(id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Waveform) : id),
177 _power(power), _carrierfreq(carrierfreq), _length(length), _signal(std::move(signal))
178 {
179 if (!_signal)
180 {
181 throw std::runtime_error("Signal is empty");
182 }
183 }
static SimIdGenerator & instance()
Get the singleton instance of SimIdGenerator.
Definition sim_id.h:48
math::Vec3 max

◆ ~RadarSignal()

fers_signal::RadarSignal::~RadarSignal ( )
default

◆ RadarSignal() [2/3]

fers_signal::RadarSignal::RadarSignal ( const RadarSignal )
deletenoexcept

◆ RadarSignal() [3/3]

fers_signal::RadarSignal::RadarSignal ( RadarSignal &&  )
deletenoexcept

Member Function Documentation

◆ getCarrier()

RealType fers_signal::RadarSignal::getCarrier ( ) const
noexcept

Gets the carrier frequency of the radar signal.

Returns
The carrier frequency of the radar signal.

Definition at line 199 of file radar_signal.h.

199{ return _carrierfreq; }

Referenced by serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ getFilename()

const std::optional< std::string > & fers_signal::RadarSignal::getFilename ( ) const
noexcept

Gets the filename associated with this signal.

Returns
The source filename, if one was set.

Definition at line 185 of file radar_signal.h.

185{ return _filename; }

Referenced by serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ getFmcwChirpSignal()

const FmcwChirpSignal * fers_signal::RadarSignal::getFmcwChirpSignal ( ) const
noexcept

Gets the FMCW chirp implementation, if this signal owns one.

Definition at line 222 of file radar_signal.cpp.

223 {
224 return dynamic_cast<const FmcwChirpSignal*>(_signal.get());
225 }

Referenced by radar::Transmitter::getFmcwSignal(), and serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ getFmcwTriangleSignal()

const FmcwTriangleSignal * fers_signal::RadarSignal::getFmcwTriangleSignal ( ) const
noexcept

Gets the FMCW triangle implementation, if this signal owns one.

Definition at line 227 of file radar_signal.cpp.

228 {
229 return dynamic_cast<const FmcwTriangleSignal*>(_signal.get());
230 }

Referenced by serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ getId()

SimId fers_signal::RadarSignal::getId ( ) const
noexcept

Gets the unique ID of the radar signal.

Returns
The radar signal SimId.

Definition at line 213 of file radar_signal.h.

213{ return _id; }

Referenced by core::World::resolveReceiverDechirpReferences(), and radar::to_json().

+ Here is the caller graph for this function:

◆ getLength()

RealType fers_signal::RadarSignal::getLength ( ) const
noexcept

Gets the length of the radar signal.

Returns
The length of the radar signal.

Definition at line 230 of file radar_signal.h.

230{ return _length; }

◆ getName()

const std::string & fers_signal::RadarSignal::getName ( ) const
noexcept

Gets the name of the radar signal.

Returns
The name of the radar signal.

Definition at line 206 of file radar_signal.h.

206{ return _name; }

Referenced by core::World::resolveReceiverDechirpReferences(), and serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ getPower()

RealType fers_signal::RadarSignal::getPower ( ) const
noexcept

Gets the power of the radar signal.

Returns
The power of the radar signal.

Definition at line 192 of file radar_signal.h.

192{ return _power; }

Referenced by serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ getRate()

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

Gets the sample rate of the radar signal.

Returns
The sample rate of the radar signal.

Definition at line 220 of file radar_signal.h.

220{ return _signal->getRate(); }

Referenced by serial::Response::renderBinary(), and serial::Response::sampleRate().

+ Here is the caller graph for this function:

◆ getSampleCount()

unsigned fers_signal::RadarSignal::getSampleCount ( ) const
noexcept

Gets the number of native samples in the underlying signal.

Definition at line 223 of file radar_signal.h.

223{ return _signal->getSampleCount(); }

Referenced by serial::Response::sampleCount().

+ Here is the caller graph for this function:

◆ getSignal()

const Signal * fers_signal::RadarSignal::getSignal ( ) const
noexcept

Gets the underlying signal object.

Returns
A const pointer to the Signal object.

Definition at line 236 of file radar_signal.h.

236{ return _signal.get(); }

Referenced by serial::xml_serializer_utils::serializeWaveform().

+ Here is the caller graph for this function:

◆ isCw()

bool fers_signal::RadarSignal::isCw ( ) const
noexcept

Returns true when this signal is a continuous-wave signal.

Definition at line 208 of file radar_signal.cpp.

208{ return dynamic_cast<const CwSignal*>(_signal.get()) != nullptr; }

◆ isFmcwChirp()

bool fers_signal::RadarSignal::isFmcwChirp ( ) const
noexcept

Returns true when this signal is an FMCW linear chirp signal.

Definition at line 210 of file radar_signal.cpp.

211 {
212 return dynamic_cast<const FmcwChirpSignal*>(_signal.get()) != nullptr;
213 }

◆ isFmcwFamily()

bool fers_signal::RadarSignal::isFmcwFamily ( ) const
noexcept

Returns true when this signal belongs to the FMCW waveform family.

Definition at line 220 of file radar_signal.cpp.

220{ return _signal->isFmcwFamily(); }

Referenced by core::World::resolveReceiverDechirpReferences().

+ Here is the caller graph for this function:

◆ isFmcwTriangle()

bool fers_signal::RadarSignal::isFmcwTriangle ( ) const
noexcept

Returns true when this signal is an FMCW triangular modulation signal.

Definition at line 215 of file radar_signal.cpp.

216 {
217 return dynamic_cast<const FmcwTriangleSignal*>(_signal.get()) != nullptr;
218 }

◆ operator=() [1/2]

RadarSignal & fers_signal::RadarSignal::operator= ( const RadarSignal )
deletenoexcept

◆ operator=() [2/2]

RadarSignal & fers_signal::RadarSignal::operator= ( RadarSignal &&  )
deletenoexcept

◆ render()

std::vector< ComplexType > fers_signal::RadarSignal::render ( const std::vector< interp::InterpPoint > &  points,
unsigned size,
RealType  fracWinDelay 
) const

Renders the radar signal.

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

Definition at line 185 of file radar_signal.cpp.

187 {
188 auto data = _signal->render(points, size, fracWinDelay);
189 const RealType scale = std::sqrt(_power);
190
191 std::ranges::for_each(data, [scale](auto& value) { value *= scale; });
192
193 return data;
194 }
double RealType
Type for real numbers.
Definition config.h:27

References max.

Referenced by serial::Response::renderBinary().

+ Here is the caller graph for this function:

◆ renderSlice()

std::vector< ComplexType > fers_signal::RadarSignal::renderSlice ( const std::vector< interp::InterpPoint > &  points,
RealType  outputStartTime,
RealType  outputSampleRate,
std::size_t  sampleCount,
RealType  fracWinDelay 
) const

Renders a bounded absolute-time slice on the requested output grid.

Definition at line 196 of file radar_signal.cpp.

199 {
200 auto data = _signal->renderSlice(points, outputStartTime, outputSampleRate, sampleCount, fracWinDelay);
201 const RealType scale = std::sqrt(_power);
202
203 std::ranges::for_each(data, [scale](auto& value) { value *= scale; });
204
205 return data;
206 }

References max.

Referenced by serial::Response::renderSlice().

+ Here is the caller graph for this function:

◆ setFilename()

void fers_signal::RadarSignal::setFilename ( const std::string &  filename)
noexcept

Sets the filename associated with this signal.

Parameters
filenameThe source filename.

Definition at line 179 of file radar_signal.h.

179{ _filename = filename; }

References max.


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