Type Definition au::transfer_function::continuous::Tf[][src]

type Tf<T> = TfGen<T, Continuous>;

Continuous transfer function

Implementations

impl<T: Float> Tf<T>[src]

pub fn delay(tau: Seconds<T>) -> impl Fn(Complex<T>) -> Complex<T>[src]

Time delay for continuous time transfer function. y(t) = u(t - tau) `G(s) = e^(-tau * s)

Arguments

  • tau - Time delay

Example

use au::{num_complex::Complex, Seconds, Tf};
let d = Tf::delay(Seconds(2.));
assert_eq!(1., d(Complex::new(0., 10.)).norm());

#[must_use]pub fn init_value(&self) -> T[src]

System inital value response to step input. y(0) = G(s->infinity)

Example

use au::{poly, Tf};
let tf = Tf::new(poly!(4.), poly!(1., 5.));
assert_eq!(0., tf.init_value());

#[must_use]pub fn init_value_der(&self) -> T[src]

System derivative inital value response to step input. y'(0) = s * G(s->infinity)

Example

use au::{poly, Tf};
let tf = Tf::new(poly!(1., -3.), poly!(1., 3., 2.));
assert_eq!(-1.5, tf.init_value_der());

#[must_use]pub fn sensitivity(&self, r: &Self) -> Self[src]

Sensitivity function for the given controller r.

             1
S(s) = -------------
       1 + G(s)*R(s)

Arguments

  • r - Controller

Example

use au::{poly, Tf};
let g = Tf::new(poly!(1.), poly!(0., 1.));
let r = Tf::new(poly!(4.), poly!(1., 1.));
let s = g.sensitivity(&r);
assert_eq!(Tf::new(poly!(0., 1., 1.), poly!(4., 1., 1.)), s);

#[must_use]pub fn compl_sensitivity(&self, r: &Self) -> Self[src]

Complementary sensitivity function for the given controller r.

         G(s)*R(s)
F(s) = -------------
       1 + G(s)*R(s)

Arguments

  • r - Controller

Example

use au::{poly, Tf};
let g = Tf::new(poly!(1.), poly!(0., 1.));
let r = Tf::new(poly!(4.), poly!(1., 1.));
let f = g.compl_sensitivity(&r);
assert_eq!(Tf::new(poly!(4.), poly!(4., 1., 1.)), f);

#[must_use]pub fn control_sensitivity(&self, r: &Self) -> Self[src]

Sensitivity to control function for the given controller r.

           R(s)
Q(s) = -------------
       1 + G(s)*R(s)

Arguments

  • r - Controller

Example

use au::{poly, Tf};
let g = Tf::new(poly!(1.), poly!(0., 1.));
let r = Tf::new(poly!(4.), poly!(1., 1.));
let q = g.control_sensitivity(&r);
assert_eq!(Tf::new(poly!(0., 4.), poly!(4., 1., 1.)), q);

impl<T: Float + RealField> Tf<T>[src]

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

System stability. Checks if all poles are negative.

Example

use au::{Poly, Tf};
let tf = Tf::new(Poly::new_from_coeffs(&[1.]), Poly::new_from_roots(&[-1., -2.]));
assert!(tf.is_stable());

pub fn root_locus(&self, k: T) -> Vec<Complex<T>>[src]

Root locus for the given coefficient k

Arguments

  • k - Transfer function constant

Example

use au::{num_complex::Complex, poly, Poly, Tf};
let l = Tf::new(poly!(1.), Poly::new_from_roots(&[-1., -2.]));
let locus = l.root_locus(0.25);
assert_eq!(Complex::new(-1.5, 0.), locus[0]);

pub fn root_locus_plot(self, min_k: T, max_k: T, step: T) -> RootLocus<T>[src]

Create a RootLocus plot

Arguments

  • min_k - Minimum transfer constant of the plot
  • max_k - Maximum transfer constant of the plot
  • step - Step between each transfer constant

step is linear.

Panics

Panics if the step is not strictly positive of the minimum transfer constant is not lower than the maximum transfer constant.

Example

use au::{num_complex::Complex, poly, Poly, Tf};
let l = Tf::new(poly!(1.), Poly::new_from_roots(&[-1., -2.]));
let locus = l.root_locus_plot(0.1, 1.0, 0.05).into_iter();
assert_eq!(19, locus.count());

impl<T> Tf<T>[src]

#[must_use]pub fn static_gain<'a>(&'a self) -> T where
    &'a T: 'a + Div<&'a T, Output = T>, 
[src]

Static gain G(0). Ratio between constant output and constant input. Static gain is defined only for transfer functions of 0 type.

Example

use au::{poly, Tf};
let tf = Tf::new(poly!(4., -3.),poly!(2., 5., -0.5));
assert_eq!(2., tf.static_gain());

impl<T: Float> Tf<T>[src]

pub fn discretize(&self, ts: Seconds<T>, method: Discretization) -> Tfz<T>[src]

Convert a continuous time transfer function into a discrete time transfer function using the given method.

  • ts - Sampling period in seconds
  • method - Discretization method

Example

use au::{polynomial::Poly, Discretization, Seconds, Tf, Tfz};
use au::num_complex::Complex64;
let tf = Tf::new(
    Poly::new_from_coeffs(&[2., 20.]),
    Poly::new_from_coeffs(&[1., 0.1]),
);
let tfz = tf.discretize(Seconds(1.), Discretization::BackwardEuler);
assert_eq!(0.1 / 1.1, tfz.real_poles().unwrap()[0]);

pub fn discretize_with_warp(
    &self,
    ts: Seconds<T>,
    warp_freq: RadiansPerSecond<T>
) -> Tfz<T>
[src]

Convert a continuous time transfer function into a discrete time transfer function using Tustin method with frequency pre-warping.

  • ts - Sampling period in seconds
  • warp_freq - Pre-warping frequency in radians per second

Example

use au::{polynomial::Poly, Discretization, RadiansPerSecond, Seconds, Tf, Tfz};
use au::num_complex::Complex64;
let tf = Tf::new(
    Poly::new_from_coeffs(&[2.0_f32, 20.]),
    Poly::new_from_coeffs(&[1., 0.1]),
);
let tfz = tf.discretize_with_warp(Seconds(1.), RadiansPerSecond(0.1));
assert_eq!(-0.6668982, tfz.real_poles().unwrap()[0]);

Trait Implementations

impl<T: Float> Plotter<T> for Tf<T>[src]

fn eval_point(&self, s: T) -> Complex<T>[src]

Evaluate the transfer function at the given value.

Arguments

  • s - angular frequency at which the function is evaluated