[−][src]Type Definition automatica::linear_system::continuous::Ss
type Ss<T> = SsGen<T, Continuous>;
State-space representation of continuous time linear system
Implementations
impl<T: ComplexField> Ss<T>
[src]
Implementation of the methods for the state-space
pub fn equilibrium(&self, u: &[T]) -> Option<Equilibrium<T>>
[src]
Calculate the equilibrium point for continuous time systems, given the input condition
x = - A^-1 * B * u
y = - (C * A^-1 * B + D) * u
Arguments
u
- Input vector
Example
use automatica::Ss; let a = [-1., 1., -1., 0.25]; let b = [1., 0.25]; let c = [0., 1., -1., 1.]; let d = [0., 1.]; let sys = Ss::new_from_slice(2, 1, 2, &a, &b, &c, &d); let u = 0.0; let eq = sys.equilibrium(&[u]).unwrap(); assert_eq!((0., 0.), (eq.x()[0], eq.y()[0]));
impl<T: ComplexField + Float + RealField> Ss<T>
[src]
Implementation of the methods for the state-space
#[must_use]pub fn is_stable(&self) -> bool
[src]
System stability. Checks if all A matrix eigenvalues (poles) are negative.
Example
use automatica::Ss; let sys = Ss::new_from_slice(2, 1, 1, &[-2., 0., 3., -7.], &[1., 3.], &[-1., 0.5], &[0.1]); assert!(sys.is_stable());
impl Ss<f64>
[src]
Implementation of the methods for the state-space
pub fn rk2<F>(
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
n: usize
) -> Rk<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
[src]
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
n: usize
) -> Rk<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
Time evolution for the given input, using Runge-Kutta second order method
Arguments
u
- input function returning a vector (column mayor)x0
- initial state (column mayor)h
- integration time intervaln
- integration steps
pub fn rk4<F>(
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
n: usize
) -> Rk<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
[src]
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
n: usize
) -> Rk<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
Time evolution for the given input, using Runge-Kutta fourth order method
Arguments
u
- input function returning a vector (column mayor)x0
- initial state (column mayor)h
- integration time intervaln
- integration steps
pub fn rkf45<F>(
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
limit: Seconds<f64>,
tol: f64
) -> Rkf45<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
[src]
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
limit: Seconds<f64>,
tol: f64
) -> Rkf45<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
Runge-Kutta-Fehlberg 45 with adaptive step for time evolution.
Arguments
u
- input function returning a vector (column vector)x0
- initial state (column vector)h
- integration time intervallimit
- time evaluation limittol
- error tolerance
pub fn radau<F>(
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
n: usize,
tol: f64
) -> Radau<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
[src]
&self,
u: F,
x0: &[f64],
h: Seconds<f64>,
n: usize,
tol: f64
) -> Radau<'_, F, f64>ⓘ where
F: Fn(Seconds<f64>) -> Vec<f64>,
Radau of order 3 with 2 steps method for time evolution.
Arguments
u
- input function returning a vector (column vector)x0
- initial state (column vector)h
- integration time intervaln
- integration stepstol
- error tolerance
Trait Implementations
impl<T: ComplexField + Float> DiscreteTime<T> for Ss<T>
[src]
fn discretize(&self, st: T, method: Discretization) -> Option<Ssd<T>>
[src]
Convert a linear system into a discrete system.
Arguments
st
- sample timemethod
- discretization method
Example
use automatica::{linear_system::discrete::DiscreteTime, Discretization, Ss}; let sys = Ss::new_from_slice(2, 1, 1, &[-3., 0., -4., -4.], &[0., 1.], &[1., 1.], &[0.]); let disc_sys = sys.discretize(0.1, Discretization::Tustin).unwrap(); let evo = disc_sys.evolution_fn(20, |t| vec![1.], &[0., 0.]); let last = evo.last().unwrap(); assert_relative_eq!(0.25, last.state()[1], max_relative = 0.01);