pathsim.blocks.lti module

class pathsim.blocks.lti.StateSpace(A=-1.0, B=1.0, C=-1.0, D=1.0, initial_value=None)[source]

Bases: Block

This block integrates a LTI MIMO state space model with the structure

\[\begin{split}\begin{eqnarray} \dot{x} &= \mathbf{A} x + \mathbf{B} u \\ y &= \mathbf{C} x + \mathbf{D} u \end{eqnarray}\end{split}\]

where A, B, C and D are the state space matrices, x is the state, u the input and y the output vector.

Parameters:
  • A (array) – state space matrices

  • B (array) – state space matrices

  • C (array) – state space matrices

  • D (array) – state space matrices

  • initial_value (array, None) – initial state / initial condition

set_solver(Solver, **solver_args)[source]

set the internal numerical integrator

Parameters:
  • Solver (Solver) – numerical integration solver class

  • solver_args (dict) – parameters for solver initialization

update(t)[source]

update system equation fixed point loop

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

solve(t, dt)[source]

advance solution of implicit update equation of the solver

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

Returns:

error – solver residual norm

Return type:

float

step(t, dt)[source]

compute timestep update with integration engine

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

Returns:

  • success (bool) – step was successful

  • error (float) – local truncation error from adaptive integrators

  • scale (float) – timestep rescale from adaptive integrators

class pathsim.blocks.lti.TransferFunction(Poles=[], Residues=[], Const=0.0)[source]

Bases: StateSpace

This block integrates a LTI (MIMO for pole residue) transfer function.

The transfer function is defined in pole-residue form

\[\mathbf{H}(s) = \mathbf{C} + \sum_n^N \frac{\mathbf{R}_n}{s - p_n}\]

where ‘Poles’ are the scalar poles of the transfer function and ‘Residues’ are the possibly matrix valued (in MIMO case) residues of the transfer function. ‘Const’ has same shape as ‘Residues’.

Upon initialization, the state space realization of the transfer function is computed using a minimal gilbert realization.

The resulting statespace model of the form

\[\begin{split}\begin{eqnarray} \dot{x} &= \mathbf{A} x + \mathbf{B} u \\ y &= \mathbf{C} x + \mathbf{D} u \end{eqnarray}\end{split}\]

is handled the same as the ‘StateSpace’ block, where A, B, C and D are the state space matrices, x is the internal state, u the input and y the output vector.

Parameters:
  • Poles (array) – transfer function poles

  • Residues (array) – transfer function residues

  • Const (array, float) – constant term of transfer function