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.
DiscreteDynamic
DiscreteStateSpace/DiscreteTransferFunction.
DiscretePid
Fields
Phase(f64)
Vco and PhaseShiftPwm — both a single phase in cycles.
Pmsm
Bit(bool)
Hysteresis and SrLatch — a single persisted bit.
FlipFlop
Counter
SampledFunction
PyFunction/OctFunction — stateless hosts, only the zero-order-hold bookkeeping.
PyBlock
PyBlock — the zero-order-hold bookkeeping, the solver-owned xc, and the block’s own
state object as pickle bytes.
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.
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.