A Python package for system dynamics and control systems utilities (using numpy, sympy, and control)
This package now published on PyPI and can be installed with
pip install dysys
To import the package into a script, use
import dysys as ds
Create a symbolic state-space model:
A = [[-4, -3, 0], [0, -8, 4], [0, 0, -1]]
B = [[0], [1], [0]]
C = [[0, 1, 0]]
D = [[0]]
sys = ds.sss(A, B, C, D) # Create a symbolic state-space model
import dysys as ds
import control
import matplotlib.pyplot as plt
Define a transfer function using the dysys
package as follows:
H = ds.tf(
[1_000_000, 300_000_000], # Numerator coef's
[1, 1030, 40200, 10_300_000, 100_000_000] # Denominator coef's
)
Get a list of transfer functions that are the canonical factors of H
{.py}:
factors = H.factor_canonical(check=True) # Check that the factors are correct
Print the factors:
for factor in factors:
print(factor)
Generate a Bode plot:
control.bode_plot([H] + factors, dB=True, wrap_phase=True)
plt.gcf().legend(
list(map(lambda x: x._repr_latex_()[1:-1], [H] + factors)),
loc="outside center right",
)
plt.show()
If you have issues, please report them on the issues page.