37 return static_cast<std::uint64_t
>(
nearest);
39 return static_cast<std::uint64_t
>(std::ceil(value));
61 if (source.chirp_count.has_value() &&
first_index >= *source.chirp_count)
94 if (source.triangle_count.has_value() &&
first_index >= *source.triangle_count)
128 source.carrier_freq =
signal->getCarrier();
129 source.amplitude = std::sqrt(
signal->getPower());
130 if (
const auto*
const fmcw =
signal->getFmcwChirpSignal(); fmcw !=
nullptr)
133 source.is_fmcw =
true;
135 source.chirp_duration = source.fmcw->getChirpDuration();
136 source.chirp_period = source.fmcw->getChirpPeriod();
137 source.chirp_rate = source.fmcw->getChirpRate();
138 source.signed_chirp_rate = source.fmcw->getSignedChirpRate();
139 source.start_freq_off = source.fmcw->getStartFrequencyOffset();
140 source.two_pi_f0 = 2.0 *
PI * source.start_freq_off;
141 source.s_pi_alpha =
PI * source.signed_chirp_rate;
142 source.chirp_count = source.fmcw->getChirpCount();
143 if (source.chirp_count.has_value())
146 std::min(source.segment_end,
147 segment_start +
static_cast<RealType>(*source.chirp_count) * source.chirp_period);
152 if (
const auto*
const triangle =
signal->getFmcwTriangleSignal(); triangle !=
nullptr)
155 source.is_fmcw =
true;
156 source.triangle = triangle;
157 source.chirp_duration = triangle->getChirpDuration();
158 source.chirp_rate = triangle->getChirpRate();
159 source.start_freq_off = triangle->getStartFrequencyOffset();
160 source.triangle_period = triangle->getTrianglePeriod();
161 source.chirp_period = source.triangle_period;
162 source.two_pi_f0 = 2.0 *
PI * source.start_freq_off;
163 source.two_pi_f0_plus_B = 2.0 *
PI * (source.start_freq_off + triangle->getChirpBandwidth());
164 source.pi_alpha =
PI * source.chirp_rate;
165 source.neg_pi_alpha = -source.pi_alpha;
168 source.triangle_count = triangle->getTriangleCount();
174 if (source.triangle_count.has_value())
177 segment_start +
static_cast<RealType>(*source.triangle_count) * source.triangle_period;
185 if (source.triangle_count.has_value())
200 source.segment_start = segment_start;
201 source.segment_end = segment_end;
207 const auto*
const signal =
tx->getSignal();
219 std::max<RealType>(0.0, (source.segment_end - segment_start) / source.triangle_period));
221 "FMCW triangle transmitter '{}' segment [{}, {}] emits {} complete triangles and drops {} s of "
222 "leftover active time.",
233 source.segment_end = segment_end;
Class representing a radar signal with associated properties.
Represents a radar transmitter system.
double RealType
Type for real numbers.
constexpr RealType PI
Mathematical constant π (pi).
Header file for the logging system.
std::uint64_t countFmcwTriangleStarts(const ActiveStreamingSource &source, const RealType active_start, const RealType active_end)
Counts FMCW triangles that start inside the absolute interval.
ActiveStreamingSource makeActiveSource(const radar::Transmitter *const tx, const RealType segment_start, const RealType segment_end)
Builds an active-source cache from a streaming transmitter and segment bounds.
std::uint64_t countFmcwChirpStarts(const ActiveStreamingSource &source, const RealType active_start, const RealType active_end)
Counts FMCW chirps that start inside the absolute interval.
std::optional< RealType > firstFmcwTriangleStart(const ActiveStreamingSource &source, const RealType active_start, const RealType active_end)
Returns the first FMCW triangle start inside the absolute interval, if one exists.
ActiveStreamingSource makeActiveSourceFromWaveform(const fers_signal::RadarSignal *const signal, const RealType segment_start, const RealType segment_end)
Builds an active-source cache directly from a waveform for receiver-local LO references.
std::optional< RealType > firstFmcwChirpStart(const ActiveStreamingSource &source, const RealType active_start, const RealType active_end)
Returns the first FMCW chirp start inside the absolute interval, if one exists.
@ WARNING
Warning level for potentially harmful situations.
Classes for handling radar waveforms and signals.
Defines the global state for the event-driven simulation engine.
Cached description of an active streaming transmitter segment.
RealType triangle_period
Cached full triangle period in seconds.
RealType segment_start
Segment start time in seconds.
const radar::Transmitter * transmitter
Transmitter active during this segment.
RealType chirp_period
Cached FMCW chirp period in seconds.
std::optional< std::size_t > chirp_count
Optional finite chirp count for the segment.
std::optional< std::size_t > triangle_count
Optional finite triangle count for the segment.
RealType segment_end
Segment end time in seconds.