pub struct LoopConfig {
pub process_type: ProcessType,
pub controller_type: ControllerType,
pub relay_amp_percent: f32,
pub num_cycles_skip: u32,
pub num_cycles_count: u32,
pub noise_protection_secs: u32,
pub mrft_delay_secs: u32,
}Fields§
§process_type: ProcessType§controller_type: ControllerType§relay_amp_percent: f32Relay amplitude as a percentage of the MV range. Not enforced by the type itself –
call LoopConfig::validate on a LoopConfig built from external input (CLI flags,
an imported template) before using it, to catch an out-of-range value before it
reaches a live loop.
num_cycles_skip: u32§num_cycles_count: u32§noise_protection_secs: u32§mrft_delay_secs: u32Pre/post-test recording padding, in seconds. PV is still read and recorded during this period; no switch evaluation happens.
Implementations§
Source§impl LoopConfig
impl LoopConfig
Sourcepub const RELAY_AMP_PERCENT_MIN: f32 = 0.1
pub const RELAY_AMP_PERCENT_MIN: f32 = 0.1
Minimum allowed relay_amp_percent. A relay step smaller than this is not a
meaningfully-sized perturbation to reliably induce a detectable oscillation, and is
far more likely to be a data-entry slip (a misplaced decimal point) than a genuine
choice.
Sourcepub const RELAY_AMP_PERCENT_MAX: f32 = 50.0
pub const RELAY_AMP_PERCENT_MAX: f32 = 50.0
Maximum allowed relay_amp_percent. Half of the entire MV span in a single relay step
is already an unusually aggressive, disruptive perturbation to a live process –
legitimate tunes use single-digit to low-double-digit percentages. A value above this
is far more likely to be a mistake than a deliberate choice; this is exactly the
failure mode this bound closes off, where an unvalidated field let a stray four-digit
debug shortcut reach a live control loop as a “relay amplitude”.
Sourcepub const MRFT_DELAY_SECS_MAX: u32 = 3600
pub const MRFT_DELAY_SECS_MAX: u32 = 3600
Maximum allowed mrft_delay_secs. Chosen to match the built-in whole-run timeout
(one hour): genuine pre/post-test recording padding is realistically a few minutes
at most, so anything larger is far more likely a units mistake (e.g. milliseconds
typed as seconds) than a deliberate choice.
Sourcepub fn with_process_type(self, process_type: ProcessType) -> LoopConfig
pub fn with_process_type(self, process_type: ProcessType) -> LoopConfig
Applies process_type’s default skip/test/noise-protection values, keeping the
existing controller_type, relay_amp_percent, and mrft_delay_secs. Downgrades
controller_type from PID to PI if the new process type doesn’t allow PID.
Sourcepub fn validate(&self) -> Result<(), LoopConfigError>
pub fn validate(&self) -> Result<(), LoopConfigError>
Validates fields whose legality can’t be expressed in the type system alone: relay
amplitude against [RELAY_AMP_PERCENT_MIN, RELAY_AMP_PERCENT_MAX], num_cycles_count
of at least 1, and mrft_delay_secs against MRFT_DELAY_SECS_MAX. This model-level
validation applies regardless of how the LoopConfig was built (CLI flags, an
imported template, or an HTTP request), not just to client-side form input.
Trait Implementations§
Source§impl Clone for LoopConfig
impl Clone for LoopConfig
Source§fn clone(&self) -> LoopConfig
fn clone(&self) -> LoopConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more