Skip to main content

ControlSpec

Enum ControlSpec 

Source
pub enum ControlSpec {
    Setpoint {
        setpoint: f32,
        hysteresis: f32,
        cooling: bool,
        safe_band: f32,
    },
    Level {
        empty: f32,
        warn_within: u32,
    },
    Surge {
        rising: bool,
        limit: f32,
    },
    Monitor,
}
Expand description

How a profile turns each reading into control output and alerts.

This is the policy half of a profile’s manifest: the tunable rule a community can publish and share, with no code to write. Profile::controller assembles it into a live Controller. In a manifest it is tagged by kind:

{ "kind": "setpoint", "setpoint": 5.0, "hysteresis": 0.5, "cooling": true, "safe_band": 3.0 }

Variants§

§

Setpoint

Hold a reading near setpoint by switching an output on and off.

Fields

§setpoint: f32

The target reading, such as 5 C for a vaccine fridge.

§hysteresis: f32

Half the deadband width around the setpoint, which stops the output chattering at the threshold.

§cooling: bool

Whether the output cools (switches on above the band) or heats (switches on below it). An irrigation valve that adds water is a “heater”.

§safe_band: f32

How far the reading may stray from the setpoint before an Alert::OutOfRange fires.

§

Level

Watch a falling level and warn before it reaches empty.

Fields

§empty: f32

The level treated as empty, such as a dry tank.

§warn_within: u32

Warn once the level is estimated to reach empty within this many more samples.

§

Surge

Warn when a reading changes faster than limit per sample.

Fields

§rising: bool

Watch a rapid rise (true) or a rapid fall (false).

§limit: f32

The largest safe change per sample.

§

Monitor

Report readings only, with no control output and no alerts.

Trait Implementations§

Source§

impl Clone for ControlSpec

Source§

fn clone(&self) -> ControlSpec

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 Copy for ControlSpec

Source§

impl Debug for ControlSpec

Source§

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

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

impl<'de> Deserialize<'de> for ControlSpec

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 ControlSpec

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for ControlSpec

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 ControlSpec

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.