Decides when a fixed-rate sensor should take its next sample.
FhSim has no discrete event scheduler, so a sensor that samples at a fixed rate has to schedule itself from the accepted simulation time. The idiom is the one used by Signal/Samplifier in fhsim_base: hold the time of the next sample, and advance it by one period whenever it is reached.
The integrator step is not synchronised with the sample period, so more than one sample can fall inside a single accepted step. Due therefore advances by exactly one period per call and is meant to be used in a loop:
while (m_clock.Due(T))
TakeOneSample(T, X);
A sample fired later than kLatenessFraction of a period after it was due means the integrator step is too coarse for the sample rate, which otherwise shows up only as a quietly aliased signal. The clock says so once, naming the StepMax the user would need, and then stays quiet.
- Note
- This is a helper, not a SimObject, so it has no
@group block and appears in no model list.