Skip to main content

LoopConfig

Struct LoopConfig 

Source
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: f32

Relay 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: u32

Pre/post-test recording padding, in seconds. PV is still read and recorded during this period; no switch evaluation happens.

Implementations§

Source§

impl LoopConfig

Source

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.

Source

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”.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> LoopConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for LoopConfig

Source§

fn compose(generics: Vec<RefOr<Schema>>) -> RefOr<Schema>

Source§

impl Copy for LoopConfig

Source§

impl Debug for LoopConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for LoopConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for LoopConfig

Source§

fn eq(&self, other: &LoopConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for LoopConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for LoopConfig

Source§

impl ToSchema for LoopConfig

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference [utoipa::openapi::schema::Schema]s for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.