pub struct DiscretePid {
pub kp: f64,
pub ki: f64,
pub kd: f64,
pub n: f64,
pub period: f64,
pub method: DiscreteIntegrationMethod,
}Expand description
A discrete PID’s own configuration — kp/ki/kd the usual gains, n the derivative
filter coefficient (this codebase’s own existing name for the concept the source manual
calls Kf — same idea, kept consistent with the continuous crate::Pid’s own field name
rather than importing a second spelling for it), period the sample period T baked in at
construction (from the declaring block’s own SampleTimeSpec::Periodic, not a separate
netlist field — the discretized recursion’s own coefficients need the same period the
block is scheduled at, so there is exactly one place to declare it).
Fields§
§kp: f64§ki: f64§kd: f64§n: f64§period: f64§method: DiscreteIntegrationMethodImplementations§
Source§impl DiscretePid
impl DiscretePid
Sourcepub fn step(&self, state: &mut DiscretePidState, e: f64) -> f64
pub fn step(&self, state: &mut DiscretePidState, e: f64) -> f64
One step: given this step’s own error e, advances state in place and returns the
unsaturated controller output u[k] = Kp*e[k] + Ki*int_output[k] + Kd*v[k] — the
caller (dae-runtime) applies anti-windup clamping on top of this, the same
tentative-step/reject logic the continuous Pid’s own arm already uses (this method
itself has no notion of saturation limits at all).