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
must be at least 1 (zero previously reached tuning_math::measure_oscillation’s
internal assert! and panicked mid-run, after the loop had already been switched to
manual and stroked – see docs/internal/v1-checklist.md §2), and mrft_delay_secs against
MRFT_DELAY_SECS_MAX. This is real range validation at the model/construction level,
not just a client-side keystroke filter or a single “not blank” check, so it applies
no matter how the LoopConfig was built (CLI flags, an imported template, or a
future web GUI request).
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 moreSource§impl ComposeSchema for LoopConfig
impl ComposeSchema for LoopConfig
impl Copy for LoopConfig
Source§impl Debug for LoopConfig
impl Debug for LoopConfig
Source§impl<'de> Deserialize<'de> for LoopConfig
impl<'de> Deserialize<'de> for LoopConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for LoopConfig
impl PartialEq for LoopConfig
Source§fn eq(&self, other: &LoopConfig) -> bool
fn eq(&self, other: &LoopConfig) -> bool
self and other values to be equal, and is used by ==.