Python for Controls, System Dynamics, and Mechatronics

A Python Module for System Dynamics and Controls

Here is a module I am working to make it easier for my students to use Python in my "System Dynamics" and "Feedback Control" courses:
windows .exe
source .tar.gz

If you do not have authority to install one of the above files, you can place this file in your current working directory or any directory in your PYTHONPATH:
controls.py

Examples for ME 356 System Dynamics

python_examples_10_19_09.zip

An Introduction to Python for Control, System Dynamics, and Mechatronics


Python logo

These are some Python files I put together to help my mechatronics students use Python for modeling dynamic systems. Feel free to use them however you please. If you add to them, please email me your improvements.

Bode Plot Generation

python_lowpass_demo
This is a basic demo of how to generate a Bode plot from a transfer function, using a lowpass RC filter as an example.



Step Response and Swept Sine Response of a First Order System

Systems Intro V2
Introduction to step responses and system identification.




Fourier Analysis


Basic Fourier analysis example:
fourier_example

A Fourier homework assignment:
fourier_hw_example
fourier_hw1.txt (data file 1)
fourier_hw2.txt (data file 2)

Example of how to read data from text files:
data_read_example.py

Determine expressions for y(t) based on taking the FFT of the data. Data is tab delimited in 2 columns - t and y(t). Verify your expression for y(t) by plotting your expression over top of the data from the file.

Be sure to clearly label your plots and submit your code.




System Modeling/Identification Homework

System 1 - step response
System 2 - step response
System 1 - swept sine response
System 2 - swept sine response
Plot the step responses and swept sine responses vs. time from the data files. Find the transfer function for each system by taking the fft of the sweptsine data (generate Bode plots). Taking the step response and Bode plot together for each system, estimate the parameters for each system (come up with a transfer function model with known coefficients).
Verify your transfer functions by overlaying Bode plots from your model and the data.