Skip to main content

BlockSnapshot

Enum BlockSnapshot 

Source
pub enum BlockSnapshot {
Show 13 variants Stateless, Dynamic { x: Vec<f64>, }, DiscreteDynamic { x: Vec<f64>, time_since_sample: f64, last_output: Vec<f64>, }, DiscretePid { int_state: f64, int_prev_e: f64, filt_state: f64, filt_prev_v: f64, time_since_sample: f64, last_output: f64, }, Phase(f64), Pmsm { x: Vec<f64>, }, Bit(bool), FlipFlop { q: bool, prev_clk: f64, }, Counter { count: i64, prev_clk: f64, }, SampledFunction { time_since_sample: f64, last_output: Vec<f64>, }, PyBlock { time_since_sample: f64, next_hit_dt: f64, last_output: Vec<f64>, xc: Vec<f64>, state: Vec<u8>, }, CScript { time_since_sample: f64, next_hit_dt: f64, last_output: Vec<f64>, xc: Vec<f64>, state: Vec<u8>, }, OctBlock { time_since_sample: f64, next_hit_dt: f64, last_output: Vec<f64>, xc: Vec<f64>, state: Vec<u8>, },
}
Expand description

One block’s own persisted state. Variants mirror block_graph::BlockState, minus everything the netlist rebuilds (the compiled state-space, the models, the FFI instances).

Variants§

§

Stateless

§

Dynamic

Pid/StateSpace/TransferFunction.

Fields

§

DiscreteDynamic

DiscreteStateSpace/DiscreteTransferFunction.

Fields

§time_since_sample: f64
§last_output: Vec<f64>
§

DiscretePid

Fields

§int_state: f64
§int_prev_e: f64
§filt_state: f64
§filt_prev_v: f64
§time_since_sample: f64
§last_output: f64
§

Phase(f64)

Vco and PhaseShiftPwm — both a single phase in cycles.

§

Pmsm

Fields

§

Bit(bool)

Hysteresis and SrLatch — a single persisted bit.

§

FlipFlop

Fields

§prev_clk: f64
§

Counter

Fields

§count: i64
§prev_clk: f64
§

SampledFunction

PyFunction/OctFunction — stateless hosts, only the zero-order-hold bookkeeping.

Fields

§time_since_sample: f64
§last_output: Vec<f64>
§

PyBlock

PyBlock — the zero-order-hold bookkeeping, the solver-owned xc, and the block’s own state object as pickle bytes.

Fields

§time_since_sample: f64
§next_hit_dt: f64
§last_output: Vec<f64>
§xc: Vec<f64>
§state: Vec<u8>
§

CScript

CScript — the same bookkeeping and xc as PyBlock, and the opaque C state as the bytes the library’s own cscript_state_write produced (see cscript_ffi’s module doc comment, “The optional checkpoint state contract”). Only ever built for a library that exports that contract; otherwise the run is refused as DaeError::CheckpointUnsupportedBlock.

Appended after PyBlock on purpose: postcard encodes a variant as its index, so adding variants at the end leaves every existing file’s encoding unchanged and FORMAT_VERSION stays at 1.

Fields

§time_since_sample: f64
§next_hit_dt: f64
§last_output: Vec<f64>
§xc: Vec<f64>
§state: Vec<u8>
§

OctBlock

OctBlock — the same bookkeeping and xc, and the instance’s __gs_state.<name> slot as the bytes of an Octave save -binary of it (see octave_ffi::OctaveSession::save_state). Needs no author opt-in.

Fields

§time_since_sample: f64
§next_hit_dt: f64
§last_output: Vec<f64>
§xc: Vec<f64>
§state: Vec<u8>

Trait Implementations§

Source§

impl Clone for BlockSnapshot

Source§

fn clone(&self) -> Self

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 Debug for BlockSnapshot

Source§

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

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

impl<'de> Deserialize<'de> for BlockSnapshot

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 BlockSnapshot

Source§

fn eq(&self, other: &Self) -> 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 BlockSnapshot

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 BlockSnapshot

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.