Pyctrl is an open source modern control library
- state space to transfer function
- tranfer function to state space
- System Solution
- Controlability
- Observability
- Stabillity
- Stepresonse
- Pole placement
- numpy
- sympy
- mpmath
- matplotlib
importing:
from pyctrl import * pyc=pyctrl()
convertion from state space to transfer function¶
In
A=np.array([[3, 10],[5,2]]) B=np.array([1,1]) C=np.array([1,0]) D=np.array([0]) pyc.ss2tf(A,B,C,D)
conversion from transfer function to state space¶
the default is the controllble form
In :
n=np.array([4]) d=np.array([1,2,10]) pyc.tf2ss(n,d)
Out:
(array([[ 0., 1.], [-10., -2.]]), array([0., 1.]), array([0., 4.]), array([0.]))
In :
pyc.tf2ss(n,d,"observable")
Out:
(array([[ 0., -10.], [ 1., -2.]]), array([0., 4.]), array([0., 1.]), array([0.]))
solution of a system¶
checking for stability, observability, and controllability¶
In [12]:
A=np.array([[3, 10],[5,2]]) B=np.array([1,1]) C=np.array([1,0])
stability
In [13]:
pyc.isStable(A)
Out[13]:
True
observability
In [14]:
pyc.isObservable(A,C)
Out[14]:
True
controllability
In [15]:
pyc.isControllable(A,B)
Out:
True
step response of the system¶
Pole placplacement¶
In :
A=np.array([[0, 1,0],[0,0,1],[-2,-3,-5]]) B=np.array([0,0,1]) pyc.placePoles(A,B,-4+3j,-4-3j,-4)
Contributions are always welcome!