pub fn calculate_all(
peaks: &[f32],
troughs: &[f32],
switch_times: &[DateTime<Utc>],
mv_sign_init: i8,
direction: ControllerDirection,
config: LoopConfig,
pv_range: PvRange,
template: &DcsTemplate,
compat: TuningMathCompat,
) -> [(TuningResult, PidParameters); 3]Expand description
The top-level entry point: computes the PID parameters for all three response levels from
a completed MRFT run, in one call. Composes measure_oscillation (once) with
calculate_tuning_result and calculate_pid_parameters (once per ResponseLevel).
Pure port of MRFTcompletionActions’s call into TuningConstantsCalc +
CalculatePIDparameters.
Returns both the intermediate TuningResult (Kp/Ti/Td, DCS-unit-independent) and the
final PidParameters (in the template’s own units) for each response level, since
callers that persist a run (e.g. bhtune-cli’s tune command, via
bhtune_db::TuneResultRow::from_calculated) need both — the schema records the
control-theory result alongside the exact values it derived for the connected DCS.