Skip to main content

Module range

Module range 

Source
Expand description

Validated PV/MV range types – the boundary a live OPC DA read or a CLI flag override must pass through before an untrusted number is treated as a range with a known, trustworthy shape (finite bounds, correctly ordered, non-zero span). See AGENTS.md’s “Live-plant safety hardening” section for the review finding this closes (--cycles-count 0 panicking mid-run was the same finding’s other symptom: no externally supplied number reached the engine validated).

PvRange and MvRange both still expose plain public fields and can be constructed directly with a struct literal – deliberately, since that’s how already-trusted values (test fixtures, values reloaded from bhtune-db that were already validated once before being stored) are constructed elsewhere in the codebase. PvRange::new/MvRange::new are the validating constructors: the ones any caller reading a number from a live driver or an external CLI flag/config value must go through.

Structs§

MvRange
MV range floor/ceiling (MvMSL/MvMSH in the legacy app) – the bounds crate::mrft::clamp_relay_amplitude clamps the relay step within, and the range an initial MV reading must fall inside before a test can safely begin stroking it.
PvRange
PV scale range, read once before the test starts (PvSH/PvSL in the legacy app’s ReadInitialOPCvalues) – distinct from MvRange, used only to express the oscillation amplitude as a percentage in core-tuning-math::measure_oscillation.

Enums§

RangeError
Why PvRange::new/MvRange::new rejected a range.