pub struct ClosedLoopSimulator { /* private fields */ }Expand description
Closed-loop simulator combining a PID controller with a plant.
Implementations§
Source§impl ClosedLoopSimulator
impl ClosedLoopSimulator
Sourcepub fn new(controller: PidController, plant: SystemPlant) -> Self
pub fn new(controller: PidController, plant: SystemPlant) -> Self
Create a new closed-loop simulator.
Sourcepub fn simulate(&mut self, setpoint: f64, steps: usize, dt: f64) -> Vec<f64>
pub fn simulate(&mut self, setpoint: f64, steps: usize, dt: f64) -> Vec<f64>
Run the closed-loop simulation for steps time steps of size dt.
Returns the output trace (one value per step).
Sourcepub fn steady_state_error(&self, setpoint: f64) -> f64
pub fn steady_state_error(&self, setpoint: f64) -> f64
Steady-state error: difference between the last recorded output and setpoint.
Auto Trait Implementations§
impl Freeze for ClosedLoopSimulator
impl RefUnwindSafe for ClosedLoopSimulator
impl Send for ClosedLoopSimulator
impl Sync for ClosedLoopSimulator
impl Unpin for ClosedLoopSimulator
impl UnsafeUnpin for ClosedLoopSimulator
impl UnwindSafe for ClosedLoopSimulator
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more