pub struct VirtualPid { /* private fields */ }Expand description
A standalone position-form PID controller, for closed-loop validation and demos (e.g.
“do the constants a completed MRFT run just calculated actually control this process
well?”). Deliberately not wired into SimulatorDriver/Driver at all: the
Driver trait models open-loop tag I/O, and during an actual MRFT relay test the engine
itself (bhtune_core::mrft::MrftEngine) drives the MV – nothing needs to close the loop
automatically for that. This exists for whatever, later, wants to run this process in
automatic mode instead (e.g. simulating a completed tune’s results before trusting them
against a real DCS).
Implementations§
Source§impl VirtualPid
impl VirtualPid
pub fn new(config: VirtualPidConfig) -> VirtualPid
Sourcepub fn step(&mut self, setpoint: f32, pv: f32, dt: f32) -> f32
pub fn step(&mut self, setpoint: f32, pv: f32, dt: f32) -> f32
Computes one control step given setpoint/pv and the elapsed time dt (seconds)
since the previous call, returning the clamped controller output.
Derivative acts on pv, not on the error, so a setpoint change alone never spikes the
output – mirrors Model/ProcessModelOPC.py’s own
D = -Kc*tauD*(pv[i]-pv[i-1])/dt (mathematically equivalent to derivative-on-error
only while the setpoint itself is unchanging). The very first call has no previous
pv to compare against, so derivative action is skipped for that call only.
Trait Implementations§
Source§impl Clone for VirtualPid
impl Clone for VirtualPid
Source§fn clone(&self) -> VirtualPid
fn clone(&self) -> VirtualPid
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VirtualPid
Source§impl Debug for VirtualPid
impl Debug for VirtualPid
Source§impl PartialEq for VirtualPid
impl PartialEq for VirtualPid
Source§fn eq(&self, other: &VirtualPid) -> bool
fn eq(&self, other: &VirtualPid) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for VirtualPid
Auto Trait Implementations§
impl Freeze for VirtualPid
impl RefUnwindSafe for VirtualPid
impl Send for VirtualPid
impl Sync for VirtualPid
impl Unpin for VirtualPid
impl UnsafeUnpin for VirtualPid
impl UnwindSafe for VirtualPid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].