Control Systems Library for Python
This page collects some notes on a control systems library for Python. The plan is to create an alternative to the MATLAB Control System Toolbox™ that can be used in courses and for research. This page collects information about the toolbox, in preparation for actually writing some code. If you stumble across this page and know of a similar package or would like to contribute, let me know.
- 23 May 09: really basic functionality working (Bode and Nyquist plots of transfer functions)
- 24 May 09: looking around for open source control computations - slicot looks like a candidate
I'm trying to sort out the best object structure to use for control system objects. There is already an LTI class in the signal processing module of SciPY, so I might be able to build on that (and hence get those systems for free). Ideally, I'd like to allow for time delay in the linear systems representation, since these come up a lot in my group's research.
Here's some rough thoughts on a possible object structure:
- Option 1: build off of the 'signal.lti' object structure. This has the advantage of being compatible with existing 'signal' package functions. The signal.lti class currently represents systems simultaneously in transfer function, state space and "pzk" forms. Not may functions written for it yet, though.
- Option 2: emulate the MATLAB systems structure. This uses separate classes for transfer functions, state space, "pzk" and frequency response data (frd) forms. There is also a state space format for delay systems, which seems quite useful.
- Option 3: new structure that allows nonlinear computations and other general objects
I'm using the IPython environment, with SciPy extensions for scientific computing plus the matplotlib extensions (which enables MATLAB-like plotting). I am doing all of my playing on OS X, using fink.
Here's what I had to do to get the basic setup that I am using.
- Install SciPy - I did this using fink. Have to use the main/unstable tree.
- Install matplotlib - Need this for plotting
- Install ipython - interactive python interface
Small snippet of code for testing if everything is installed
from scipy import * from matlibplot import * a = zeros(1000) a[:100]=1 b = fft(a) plot(abs(b)) show()
- SciPy.org - main web site for SciPy
- PyRo - Python Robotics library (might be nice to be compatible with this
- SLICOT - Fortran 77 implementations of numerical algorithms for computations in systems and control theory
- Octave Control Systems Toolbox - documentation for the Octave implementation (not sure what code is used for computing results)
- control.py - Python Module for System Dynamics and Controls by Ryan Krauss