[][src]Type Definition automatica::linear_system::discrete::Ssd

type Ssd<T> = SsGen<T, Discrete>;

State-space representation of discrete time linear system

Implementations

impl<T: ComplexField> Ssd<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 discrete time systems, given the input condition. Input vector must have the same number of inputs of the system.

x = (I-A)^-1 * B * u
y = (C * (I-A)^-1 * B + D) * u

Arguments

  • u - Input vector

Example

use automatica::Ssd;
let a = [-1., 1., -1., 0.25];
let b = [1., 0.25];
let c = [0., 1., -1., 1.];
let d = [0., 1.];

let sys = Ssd::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: Scalar> Ssd<T>[src]

Trait for the set of methods on discrete linear systems.

pub fn evolution_fn<F>(
    &self,
    steps: usize,
    input: F,
    x0: &[T]
) -> EvolutionFn<'_, F, T>

Notable traits for EvolutionFn<'a, F, T>

impl<'a, F, T> Iterator for EvolutionFn<'a, F, T> where
    F: Fn(usize) -> Vec<T>,
    T: AddAssign + Float + MulAssign + Scalar
type Item = TimeEvolution<T>;
where
    F: Fn(usize) -> Vec<T>, 
[src]

Time evolution for a discrete linear system.

Arguments

  • step - simulation length
  • input - input function
  • x0 - initial state

Example

use automatica::{linear_system::discrete::DiscreteTime, Discretization, Ssd};
let disc_sys = Ssd::new_from_slice(2, 1, 1, &[0.6, 0., 0., 0.4], &[1., 5.], &[1., 3.], &[0.]);
let impulse = |t| if t == 0 { vec![1.] } else { vec![0.] };
let evo = disc_sys.evolution_fn(20, impulse, &[0., 0.]);
let last = evo.last().unwrap();
assert_abs_diff_eq!(0., last.state()[1], epsilon = 0.001);

pub fn evolution_iter<I, II>(
    &self,
    iter: II,
    x0: &[T]
) -> EvolutionIter<'_, I, T>

Notable traits for EvolutionIter<'a, I, T>

impl<'a, I, T> Iterator for EvolutionIter<'a, I, T> where
    I: Iterator<Item = Vec<T>>,
    T: AddAssign + Float + MulAssign + Scalar
type Item = Vec<T>;
where
    II: IntoIterator<Item = Vec<T>, IntoIter = I>,
    I: Iterator<Item = Vec<T>>, 
[src]

Time evolution for a discrete linear system.

Arguments

  • iter - input data
  • x0 - initial state

Example

use std::iter;
use automatica::{linear_system::discrete::DiscreteTime, Discretization, Ssd};
let disc_sys = Ssd::new_from_slice(2, 1, 1, &[0.6, 0., 0., 0.4], &[1., 5.], &[1., 3.], &[0.]);
let impulse = iter::once(vec![1.]).chain(iter::repeat(vec![0.])).take(20);
let evo = disc_sys.evolution_iter(impulse, &[0., 0.]);
let last = evo.last().unwrap();
assert!(last[0] < 0.001);

impl<T: ComplexField + Float + RealField> Ssd<T>[src]

#[must_use]pub fn is_stable(&self) -> bool[src]

System stability. Checks if all A matrix eigenvalues (poles) are inside the unit circle.

Example

use automatica::Ssd;
let sys = Ssd::new_from_slice(2, 1, 1, &[-0.2, 0., 3., 0.1], &[1., 3.], &[-1., 0.5], &[0.1]);
assert!(sys.is_stable());