# Direct¶

class sharpy.rom.balanced.Direct[source]

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].

Parameters
• A (np.ndarray) – Plant Matrix

• B (np.ndarray) – Input Matrix

• C (np.ndarray) – Output Matrix

• DLTI (bool) – Discrete time state-space flag

• Schur (bool) – Use Schur decomposition to solve the Lyapunov equations

Returns

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

• Transformation matrix (T).

• Inverse transformation matrix(Tinv).

Return type

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

The settings that this solver accepts are given by a dictionary, with the following key-value pairs:

Name

Type

Description

Default

Options

tune

bool

Tune ROM to specified tolerance

True

use_schur

bool

Use Schur decomposition during build

False

rom_tolerance

float

Absolute accuracy with respect to full order frequency response

0.01

rom_tune_freq_range

list(float)

Beginning and end of frequency range where to tune ROM

[0, 1]

convergence

str

ROM tuning convergence. If min attempts to find minimal number of states.If all it starts from larger size ROM until convergence to specified tolerance is found.

min

reduction_method

str

Desired reduction method

realisation

realisation, truncation