Skip to content
/ pyctrl Public

pyctrl is an open source modern control library

License

Notifications You must be signed in to change notification settings

mgama1/pyctrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyctrl

Pyctrl is an open source modern control library

Features

  • state space to transfer function
  • tranfer function to state space
  • System Solution
  • Controlability
  • Observability
  • Stabillity
  • Stepresonse
  • Pole placement

Dependencies

  • numpy
  • sympy
  • mpmath
  • matplotlib

Documentation

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)
Out:

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

In :
A=np.array([[3, 10],[5,2]])
B=np.array([1,1])
x0=np.array([1,0])
u=1

pyc.solve(A,B,x0,u)
Out:

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

In :
pyc.step(n,d)
Out:

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)
Out[8]:

Contributing

Contributions are always welcome!

linkedin twitter

MIT License

About

pyctrl is an open source modern control library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages