qom.solvers.stability module

Module to solve for stability.

References

class qom.solvers.stability.RHCSolver(As=None, Coeffs=None, params: dict = {}, cb_update=None)

Bases: object

Class to solve for stability using the Routh-Hurwitz criterion.

Initializes As, Coeffs, params and updater.

Parameters:
  • As (list or numpy.ndarray, optional) – Drift matrix.

  • Coeffs (list or numpy.ndarray, optional) – Coefficients of the characteristic equation.

  • params (dict) –

    Parameters for the solver. Available options are:

    key

    value

    ’show_progress’

    (bool) option to display the progress of the solver. Default is False.

  • cb_update (callable, optional) – Callback function to update status and progress, formatted as cb_update(status, progress, reset), where status is a string, progress is a float and reset is a boolean.

  • note: (..) – At least one of the parameters As and Coeffs (preferably Coeffs) should be non-None.:

desc = 'Routh Hurwitz Criterion Solver'

Description of the solver.

Type:

str

get_coeffs()

Method to obtain the coefficients (\(a_{i}\)) of the characteristic equation for \(\det(\lambda I_{n} - A_{n \times n}) = 0\) given by

\[a_{0} \lambda^{n} + a_{1} \lambda^{n - 1} + ... + a_{n} = 0.\]
Returns:

Coeffs – Coefficients of the characteristic equation.

Return type:

numpy.ndarray

get_counts()

Method to obtain the number of positive real eigenvalues of the drift matrix.

Returns:

counts – Number of positive real eigenvalues for each drift matrix.

Return type:

numpy.ndarray

get_indices()

Method to obtain the indices where the sequence, \(\{T_{0}, T_{1}, ..., T_{n}\}\) changes sign [1]. Here, \(T_{k} = \det(M_{k})\) are the determinants of the sub-matrices, where \(M_{k}\) is the square sub-matrix of \(M\) comprising of its first \(j\) rows and columns, with \(T_{0} = a_{0}\).

The matrix \(M\) is defined as [1],

\[\begin{split}M_{ij} = \begin{cases} a_{2i - j}, ~ \mathrm{if} ~ 0 \le 2 i - j \le n \\ 0, ~ \mathrm{otherwise} \end{cases}\end{split}\]

where the indices of \(M\) are 1-based.

Returns:

Indices – Indices where the sequence changes sign, as 0 and 1 for each drift matrix.

Return type:

numpy.ndarray

name = 'RHCSolver'

Name of the solver.

Type:

str

required_params = []

Required parameters of the solver.

Type:

list

set_params(params)

Method to validate and set the solver parameters.

Parameters:

params (dict) – Parameters of the solver.

solver_defaults = {'show_progress': False}

Default parameters of the solver.

Type:

dict

qom.solvers.stability.get_counts_from_eigenvalues(As=None, Coeffs=None, params: dict = {}, cb_update=None)

Function to obtain the number of positive real eigenvalues of the drift matrix.

Parameters:
  • As (list or numpy.ndarray, optional) – Drift matrix.

  • Coeffs (list or numpy.ndarray, optional) – Coefficients of the characteristic equation.

  • params (dict) –

    Parameters for the solver. Available options are:

    key

    value

    ’show_progress’

    (bool) option to display the progress of the solver.

  • cb_update (callable, optional) – Callback function to update status and progress, formatted as cb_update(status, progress, reset), where status is a string, progress is a float and reset is a boolean.

Returns:

counts – Number of positive real eigenvalues for each drift matrix.

Return type:

numpy.ndarray