pub struct PyControlSystem {
pub order: usize,
pub a_matrix: Vec<f64>,
pub b_matrix: Vec<f64>,
pub c_matrix: Vec<f64>,
pub d_matrix: Vec<f64>,
pub num_inputs: usize,
pub num_outputs: usize,
pub state: Vec<f64>,
}Expand description
A simple state-space system: dx/dt = A x + B u, y = C x + D u.
Fields§
§order: usizeSystem order (n).
a_matrix: Vec<f64>State matrix A (n×n, row-major flat).
b_matrix: Vec<f64>Input matrix B (n×m, row-major flat).
c_matrix: Vec<f64>Output matrix C (p×n, row-major flat).
d_matrix: Vec<f64>Feedthrough matrix D (p×m, row-major flat).
num_inputs: usizeNumber of inputs (m).
num_outputs: usizeNumber of outputs (p).
state: Vec<f64>Current state vector (n values).
Implementations§
Source§impl PyControlSystem
impl PyControlSystem
Sourcepub fn first_order_lag(tau: f64) -> Self
pub fn first_order_lag(tau: f64) -> Self
Create a first-order lag system: dx/dt = -x/tau + u/tau.
Sourcepub fn step_euler(&mut self, u: &[f64], dt: f64) -> Vec<f64>
pub fn step_euler(&mut self, u: &[f64], dt: f64) -> Vec<f64>
Step the system using Euler integration.
Sourcepub fn step_response(&mut self, dt: f64, n_steps: usize) -> Vec<f64>
pub fn step_response(&mut self, dt: f64, n_steps: usize) -> Vec<f64>
Compute step response over n_steps time steps.
Sourcepub fn frequency_gain(&self, f: f64) -> f64
pub fn frequency_gain(&self, f: f64) -> f64
Evaluate the frequency response (gain) at frequency f (Hz).
Trait Implementations§
Source§impl Clone for PyControlSystem
impl Clone for PyControlSystem
Source§fn clone(&self) -> PyControlSystem
fn clone(&self) -> PyControlSystem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PyControlSystem
impl Debug for PyControlSystem
Source§impl<'de> Deserialize<'de> for PyControlSystem
impl<'de> Deserialize<'de> for PyControlSystem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PyControlSystem
impl RefUnwindSafe for PyControlSystem
impl Send for PyControlSystem
impl Sync for PyControlSystem
impl Unpin for PyControlSystem
impl UnsafeUnpin for PyControlSystem
impl UnwindSafe for PyControlSystem
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.