balreal_direct_py

Find balanced realisation of continuous (DLTI = False) and discrete (DLTI = True) time of LTI systems using scipy libraries.

The function proceeds to achieve balanced realisation of the state-space system by first solving the Lyapunov equations. They are solved using Barlets-Stewart algorithm for Sylvester equation, which is based on A matrix Schur decomposition.

\[\begin{split}\mathbf{A\,W_c + W_c\,A^T + B\,B^T} &= 0 \\ \mathbf{A^T\,W_o + W_o\,A + C^T\,C} &= 0\end{split}\]

to obtain the reachability and observability gramians, which are positive definite matrices.

Then, the gramians are decomposed into their Cholesky factors such that:

\[\begin{split}\mathbf{W_c} &= \mathbf{Q_c\,Q_c^T} \\ \mathbf{W_o} &= \mathbf{Q_o\,Q_o^T}\end{split}\]

A singular value decomposition (SVD) of the product of the Cholesky factors is performed

\[(\mathbf{Q_o^T\,Q_c}) = \mathbf{U\,\Sigma\,V^*}\]

The singular values are then used to build the transformation matrix \(\mathbf{T}\)

\[\begin{split}\mathbf{T} &= \mathbf{Q_c\,V\,\Sigma}^{-1/2} \\ \mathbf{T}^{-1} &= \mathbf{\Sigma}^{-1/2}\,\mathbf{U^T\,Q_o^T}\end{split}\]

The balanced system is therefore of the form:

\[\begin{split}\mathbf{A_b} &= \mathbf{T^{-1}\,A\,T} \\ \mathbf{B_b} &= \mathbf{T^{-1}\,B} \\ \mathbf{C_b} &= \mathbf{C\,T} \\ \mathbf{D_b} &= \mathbf{D}\end{split}\]

Warning

This function may be less computationally efficient than the balreal Matlab implementation and does not offer the option to bound the realisation in frequency and time.

Notes

  • Lyapunov equations are solved using Barlets-Stewart algorithm for Sylvester equation, which is based on A matrix Schur decomposition.

  • Notation above is consistent with Gawronski [2].

param A:

Plant Matrix

type A:

np.ndarray

param B:

Input Matrix

type B:

np.ndarray

param C:

Output Matrix

type C:

np.ndarray

param DLTI:

Discrete time state-space flag

type DLTI:

bool

param Schur:

Use Schur decomposition to solve the Lyapunov equations

type Schur:

bool

returns:
Tuple of the form (S, T, Tinv) containing:
  • Singular values in diagonal matrix (S)

  • Transformation matrix (T).

  • Inverse transformation matrix(Tinv).

rtype:

tuple of np.ndarrays

References

[1] Anthoulas, A.C.. Approximation of Large Scale Dynamical Systems. Chapter 7. Advances in Design and Control. SIAM. 2005.

[2] Gawronski, W.. Dynamics and control of structures. New York: Springer. 1998