pub struct DiscretePidState {
pub int_state: f64,
pub int_prev_e: f64,
pub filt_state: f64,
pub filt_prev_v: f64,
}Expand description
DiscretePid’s own persisted state — two small scalars per branch that needs memory (the
proportional action is stateless). int_prev_e is only ever read/written when method is
ForwardEuler/Trapezoidal (both need a remembered previous error); BackwardEuler never
touches it, but it’s still always present in this struct rather than modeled as an
Option/per-method enum, since a fixed-shape state is simpler for dae-runtime to hold
regardless of which method a given instance happens to use.
Fields§
§int_state: f64The integral action’s own accumulated value (Ki-scaled contribution to u is
ki * int_state after each step’s own update — see DiscretePid::step).
int_prev_e: f64The integral action’s own remembered previous error — only meaningful for
ForwardEuler/Trapezoidal.
filt_state: f64The derivative filter’s own accumulated value.
filt_prev_v: f64The derivative filter’s own remembered previous input (v[k-1]) — always meaningful,
since the filter is always Forward Euler.