You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old January 10th, 2022, 09:00 AM   #1
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 38
Python PID Tuner

Python PID Tuner based on a Process Reaction Curve (PRC) and First Order Plus DeadTime (FOPDT) system model.
It takes a PRC and tries to fit a FOPDT model and then returns tuning values.
A PRC is an open loop step response e.g. PID loop in Manual and set to 10%

https://github.com/Destination2Unknown/PythonPID_Tuner

Step1.JPG

Step2.jpg

Step3.JPG
  Reply With Quote
Old January 10th, 2022, 10:57 AM   #2
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,719
Good. Now there is another.
You have extra factors of 2 in your IMC gains that I don't think should be there.
Where did you get the equations for calculating the controller gains?
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old January 11th, 2022, 12:44 PM   #3
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 38
Quote:
Originally Posted by Peter Nachtwey View Post
Good. Now there is another.
You have extra factors of 2 in your IMC gains that I don't think should be there.
Where did you get the equations for calculating the controller gains?
I didn't see any that had a simple FOPDT model with a tune comparison. It's just a general tuner... every system has different requirements but this might be useful as a starting point.
I think they are standard enough but I'll have to double check them, do you have a preferred method?
  Reply With Quote
Old January 11th, 2022, 01:38 PM   #4
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,719
I have auto tuners written for motion controllers, FOPDT and SOPDT. I would prefer to use SOPDT over FOPDT because there really are always at least two poles ( time constanst ).

A python program
https://deltamotion.com/peter/py/SysID%20SOPDT.zip

A pdf that shows how I derive formulas for controller gains that work better with dead time. The times are in minutes so the dead time is quite long compared to the plant time constant.
https://deltamotion.com/peter/Mathca...PDT%20I-PD.pdf

A simpler approximation of the dead time.
https://deltamotion.com/peter/Mathca...FOPDT%20PI.pdf

You can PM me if you want to go deeper.

A SOPDT example that started in 2005 using Ron Beaufort's "hot rod" data.

I have many examples of how to derive the controller parameters. The better the approximation for the dead time the better the controller will be able to handle long dead times. However, this is a limit. At this point one needs to use a Smith Predictor.
https://deltamotion.com/peter/Mathca...09deg%20db.pdf

All the calculations are shown. You can see I can derive then using my Mathcad.
I have been writing auto tuners for 20 years now. I mostly work on motion control.

I have a YouTube channel "Peter Ponders PID"
https://www.youtube.com/results?sear...er+ponders+pid
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon

Last edited by Peter Nachtwey; January 11th, 2022 at 01:44 PM.
  Reply With Quote
Old January 13th, 2022, 01:02 PM   #5
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 38
Quote:
Originally Posted by Peter Nachtwey View Post
I have auto tuners written for motion controllers, FOPDT and SOPDT. I would prefer to use SOPDT over FOPDT because there really are always at least two poles ( time constanst ).

A python program
https://deltamotion.com/peter/py/SysID%20SOPDT.zip

A pdf that shows how I derive formulas for controller gains that work better with dead time. The times are in minutes so the dead time is quite long compared to the plant time constant.
https://deltamotion.com/peter/Mathca...PDT%20I-PD.pdf

A simpler approximation of the dead time.
https://deltamotion.com/peter/Mathca...FOPDT%20PI.pdf

You can PM me if you want to go deeper.

A SOPDT example that started in 2005 using Ron Beaufort's "hot rod" data.

I have many examples of how to derive the controller parameters. The better the approximation for the dead time the better the controller will be able to handle long dead times. However, this is a limit. At this point one needs to use a Smith Predictor.
https://deltamotion.com/peter/Mathca...09deg%20db.pdf

All the calculations are shown. You can see I can derive then using my Mathcad.
I have been writing auto tuners for 20 years now. I mostly work on motion control.

I have a YouTube channel "Peter Ponders PID"
https://www.youtube.com/results?sear...er+ponders+pid
The FOPDT provides a good starting point especially if the second time constant is relatively small. These are only approximations anyway, no model is perfect.
As you've shown there are numerous methods to obtain a model and tune, so this is just a sample as to what's out there.

I'll have a look at your links with regards SOPDT, thanks.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
OT: Basic Python PID Simulator destination unknown LIVE PLC Questions And Answers 21 January 3rd, 2022 12:45 PM
PID for MicroLogix 1500 - conversion issues ... Ron Beaufort LIVE PLC Questions And Answers 5 November 8th, 2005 11:03 AM
learning PID for Allen-Bradley ... Ron Beaufort LIVE PLC Questions And Answers 9 August 23rd, 2005 03:40 PM
AB PLC5 PIDs Derek McFarland LIVE PLC Questions And Answers 23 March 2nd, 2005 03:18 AM
how often should I trigger the PID? Ron Beaufort LIVE PLC Questions And Answers 11 February 22nd, 2003 12:57 PM


All times are GMT -4. The time now is 02:50 PM.


.