Peter Plays with Python and PID

Designing a motion system and want some tips? Run into a problem? Talk about it here!

Peter Plays with Python and PID

Postby Peter Nachtwey » Thu Jan 25, 2018 4:02 pm

Attached is a python file that can simulate move absolute commands. The picture shows a simple move using only proportional gain. At this time there are no feed forwards.
The simplest way to run the software is to download Anaconda
https://www.anaconda.com/download/
and install it. There is an editor or IDE called Spyder that will run the program.
You could download python, numpy, scipy and matplotlib separately for a leaner installation but it takes a little work to get these packages working.

The goal is to provide a simple way of testing how different controller gains and system parameters affect the motion.
This is not a work of art.....yet.
Attachments
HydSim-linear0a.zip
Python code for the simulator
(2.71 KiB) Downloaded 34 times
MoveAbs(200,500,2000,200).PNG
Example move plot
MoveAbs(200,500,2000,200).PNG (55.97 KiB) Viewed 132 times
Peter Nachtwey
 
Posts: 156
Joined: Wed Jan 02, 2008 5:58 pm

Re: Peter Plays with Python and PID

Postby shen » Thu Feb 01, 2018 6:12 pm

It is a three order profile
shen
 
Posts: 1
Joined: Tue Nov 03, 2015 10:28 pm

Re: Peter Plays with Python and PID

Postby Peter Nachtwey » Wed Feb 07, 2018 11:41 am

This is a second order motion profile.
pos(t)=a+b*t+c*t^2 when accelerating and decelerating.
The velocity profile is linear.
The acceleration is c/2 or 0.
on iyeya.cn I show s-curve ramps using sin() and cos() functions.
Image
Third order motion profiles require a lot of code.
This is a third order motion profile
http://deltamotion.com/peter/Maxima/Seg1234567.html
A proper third order motion profile is very complicated.
Peter Nachtwey
 
Posts: 156
Joined: Wed Jan 02, 2008 5:58 pm


Return to Motion System Design

Who is online

Users browsing this forum: No registered users and 1 guest

cron