dysys

Submodules

Package Contents

Classes

StateSpace

Subclass of control.StateSpace with extra methods

StateSpaceSymbolic

Represents a continuous LTI state-space model in symbolic form

TransferFunctionSymbolic

Represents a SISO continuous LTI transfer function model in symbolic form

TransferFunction

Subclass of control.TransferFunction with extra methods

Functions

eigenvalue_matrix_np2sp(eval_list)

Returns the symbolic eigenvalue matrix from a list

modal_matrix_np2sp(evec_array)

Returns the symbolic modal matrix from a numpy array

stability_from_eigenvalues(eval_list)

Returns the stability as str of from a list of eigenvalues

sss(A, B, C, D[, E, F])

Create a StateSpaceSymbolic object

tfs(H[, s])

Create a TransferFunctionSymbolic object

tf(*args, **kwargs)

Create a TransferFunction object

Attributes

s

dysys.eigenvalue_matrix_np2sp(eval_list)

Returns the symbolic eigenvalue matrix from a list of eigenvalues from numpy

dysys.modal_matrix_np2sp(evec_array)

Returns the symbolic modal matrix from a numpy array of eigenvectors

dysys.stability_from_eigenvalues(eval_list)

Returns the stability as str of from a list of eigenvalues

class dysys.StateSpace

Bases: control.StateSpace

Subclass of control.StateSpace with extra methods

eig()

Returns the eigenvalue matrix Lambda

class dysys.StateSpaceSymbolic(A, B, C, D, E=None, F=None)

Represents a continuous LTI state-space model in symbolic form

eig()

Returns L, M: the eigenvalue and eigenvector matrices of A

diag_transformation(reals_only=False, sort=True, normalize=False)

Return (P, D), where D is diagonal and D = P^-1 * self.A * P

This returns self.A.diagonalize() from SymPy.

Parameters:
  • reals_only – bool. Whether to throw an error if complex numbers are need to diagonalize. (Default: False)

  • sort – bool. Sort the eigenvalues along the diagonal. (Default: True)

  • normalize – bool. If True, normalize the columns of P. (Default: False)

is_diagonalizable(reals_only=False, **kwargs)

Returns True if self.A is diagonalizable.

This returns self.A.is_diagonalizable() from SymPy.

Parameters:

reals_only (-) – bool, optional If True, it tests whether the matrix can be diagonalized to contain only real numbers on the diagonal. If False, it tests whether the matrix can be diagonalized at all, even with numbers that may not be real.

state_transition_matrix(t)

Returns the state transition matrix

state_free_response(t, x0)

Returns the free response of the state vector

output_free_response(t, x0)

Returns the free response of the output vector

state_forced_response(t, u)

Returns the forced response of the state vector

output_forced_response(t, u)

Returns the forced response of the output vector

state_response(t, x0=None, u=None)

Returns the state response for initial condition x0 and input u

output_response(t, x0=None, u=None)

Returns the output response for initial condition x0 and input u

to_numpy(params={})

Returns A, B, C, D as NumPy arrays

Parameters:

params (dict) –

to_control(params={})

Returns an equivalent Control Systems package control.StateSpace object

Parameters:

params (dict) –

dysys.sss(A, B, C, D, E=None, F=None)

Create a StateSpaceSymbolic object

class dysys.TransferFunctionSymbolic(H, s=None)

Represents a SISO continuous LTI transfer function model in symbolic form

__call__(s)

Evaluate the transfer function at a complex frequency s

__str__()

Return str(self).

__factor_p(p, poles=True)
factor()

Returns an overall gain and a list of standard-form terms

__num_den_lists(params={})

Returns num and den coefficients as lists

Parameters:

params (dict) –

to_control(params={})

Returns an equivalent Control Systems package control.TransferFunction object

Parameters:

params (dict) –

poles()

Returns a dict of the symbolic poles as keys and multiplicity as values

zeros()

Returns a dict of the symbolic zeros as keys and multiplicity as values

dc_gain()

Returns the DC gain of the transfer function

frequency_response_function(w=sp.symbols('w', real=True))

Returns the symbolic frequency response function (FRF)

Evaluates H(jw). Assumes the region of convergence for the corresponding Fourier transform is congruent with that of the Laplace transform.

Parameters:

w (sympy.Symbol) – The frequency symbol

forced_response(t, u=None, U=None, laplace=False)

Returns the forced response of a SISO system

The inverse Laplace transform is used to compute the forced response. Exactly one of arguments u or U may be provided.

Parameters:
  • t (sympy.Symbol) – The time symbol

  • u (sympy.Expr) – The input as a time-dependent expression

  • U (sympy.Expr) – The input as a Laplace transform (must use symbolic sp.symbols(“s”) if using this option)

  • laplace (bool) – If True, returns Laplace transform Y(s) of the output

dysys.tfs(H, s=None)

Create a TransferFunctionSymbolic object

dysys.s
class dysys.TransferFunction

Bases: control.TransferFunction

Subclass of control.TransferFunction with extra methods

pop_conjugate(root, roots)

Pop the conjugate of a root in roots list

Finds the closest root in roots to the complex conjugate of root. Uses the “closest” metric of the Euclidean distance.

poly_factors_canonical(p)

Returns polynomial factors in canonical form

factor_canonical(check=False)

Returns a list of transfer functions in canonical form, the product of which equals self.

dysys.tf(*args, **kwargs)

Create a TransferFunction object