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.
 
bool isSteppedFrequency () const noexcept
 Returns true when this signal is a stepped-frequency CW waveform.
 
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.
 
const class SteppedFrequencySignalgetSteppedFrequencySignal () const noexcept
 Gets the stepped-frequency implementation, if this signal owns one.
 
const class FileSignalgetFileSignal () const noexcept
 Gets the file-backed signal 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 161 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 266 of file radar_signal.cpp.

267 :
268 _name(std::move(name)), _id(id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Waveform) : id),
269 _power(power), _carrierfreq(carrierfreq), _length(length), _signal(std::move(signal))
270 {
271 if (!_signal)
272 {
273 throw std::runtime_error("Signal is empty");
274 }
275 }
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 211 of file radar_signal.h.

211{ 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 197 of file radar_signal.h.

197{ return _filename; }

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

+ Here is the caller graph for this function:

◆ getFileSignal()

const FileSignal * fers_signal::RadarSignal::getFileSignal ( ) const
noexcept

Gets the file-backed signal implementation, if this signal owns one.

Definition at line 342 of file radar_signal.cpp.

343 {
344 return dynamic_cast<const FileSignal*>(_signal.get());
345 }

Referenced by isCw(), and 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 327 of file radar_signal.cpp.

328 {
329 return dynamic_cast<const FmcwChirpSignal*>(_signal.get());
330 }

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

333 {
334 return dynamic_cast<const FmcwTriangleSignal*>(_signal.get());
335 }

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

225{ 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 242 of file radar_signal.h.

242{ 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 218 of file radar_signal.h.

218{ 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 204 of file radar_signal.h.

204{ 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 232 of file radar_signal.h.

232{ 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 235 of file radar_signal.h.

235{ 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 248 of file radar_signal.h.

248{ return _signal.get(); }

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

+ Here is the caller graph for this function:

◆ getSteppedFrequencySignal()

const SteppedFrequencySignal * fers_signal::RadarSignal::getSteppedFrequencySignal ( ) const
noexcept

Gets the stepped-frequency implementation, if this signal owns one.

Definition at line 337 of file radar_signal.cpp.

338 {
339 return dynamic_cast<const SteppedFrequencySignal*>(_signal.get());
340 }

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

301 {
302 if (dynamic_cast<const CwSignal*>(_signal.get()) != nullptr)
303 {
304 return true;
305 }
306 const auto* file = getFileSignal();
307 return file != nullptr && file->getKind() == FileWaveformKind::Cw;
308 }
const class FileSignal * getFileSignal() const noexcept
Gets the file-backed signal implementation, if this signal owns one.

References fers_signal::Cw, and getFileSignal().

+ Here is the call graph for this function:

◆ isFmcwChirp()

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

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

Definition at line 310 of file radar_signal.cpp.

311 {
312 return dynamic_cast<const FmcwChirpSignal*>(_signal.get()) != nullptr;
313 }

◆ isFmcwFamily()

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

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

Definition at line 320 of file radar_signal.cpp.

320{ 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 315 of file radar_signal.cpp.

316 {
317 return dynamic_cast<const FmcwTriangleSignal*>(_signal.get()) != nullptr;
318 }

◆ isSteppedFrequency()

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

Returns true when this signal is a stepped-frequency CW waveform.

Definition at line 322 of file radar_signal.cpp.

323 {
324 return dynamic_cast<const SteppedFrequencySignal*>(_signal.get()) != nullptr;
325 }

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

279 {
280 auto data = _signal->render(points, size, fracWinDelay);
281 const RealType scale = std::sqrt(_power);
282
283 std::ranges::for_each(data, [scale](auto& value) { value *= scale; });
284
285 return data;
286 }
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 288 of file radar_signal.cpp.

291 {
292 auto data = _signal->renderSlice(points, outputStartTime, outputSampleRate, sampleCount, fracWinDelay);
293 const RealType scale = std::sqrt(_power);
294
295 std::ranges::for_each(data, [scale](auto& value) { value *= scale; });
296
297 return data;
298 }

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

191{ _filename = filename; }

References max.


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