PID Tuning tool

There are plenty of other methods, here's a ControlLogix PID Adaptive Auto Tuner. Tunes with the PID loop in auto, no open loop step response required.

https://youtu.be/YBUi6PCI06U


...
That is a good effort by someone. I saw that on a sub-reddit forum. It still uses a step response. I wonder what values for the PID they use for initial values for the controller gains? I didn't see where that data was entered.


I looks like the program is continually updating the model while it is trying to reach the set point and for a while after. Eventually this will not help unless the set point changes again.



I can see the code was written in python using tkinter as the interface.


I have thought about doing something similar for hydraulic motion controllers but it hasn't been a priority.
 
This looks like a dream. Is there any way to share this application? And is there a possibility to link this application with an OPC-UA server?
 
I could but the video is old and I have improved the algorithm since then. The algorithm I am using is Levenberg-Marquardt. This is an excellent algorithm to use if you are using C. However, the program I showed is written in Python and the python implementation is very slow. If you are using python, I would look at the Nelder-Mead algorithm. Everyone discounts the Nelder-Melder algorithm because it is crude but it works well. You can find the Nelder-Mead algorithm in Numerical Recipes in C and other places on the internet. I haven't done any test yet but the Levenberg-Marquard algorithm takes ove 20 minutes on my I7-4770s CPU.

Way back in 2005 when I was contributing to the www.controlguru.com site. I was told to use Levenberg-Marquardt. I think it is a good algorirthm. We use it for tuning our motion controllers now. The Levenberg-Marguardt algorithm in C is so fast that the operator isn't aware of the delay. I think only the python implementation is too slow but it works. If 20 minutes waiting for a solution doesn't bother you then try the Levenberg-Marquardt minimization function in python.


When it comes to linear or non-linear systems, nothing bothers me as long as I am told what kind of system I am tuning so I can compensate for any of the odd-ball features of the system.

You should know that the valve identification worked best with 10 linear gain segments but I tried many other ways of compensating for the non-linear gain before I settle on the 10 linear segments approach. 20 segments might be better yet.
 
It is not a matter of time. I just want to pull a good model out of my process without a step response. Are there applications for this?
 
That is a good effort by someone. I saw that on a sub-reddit forum. It still uses a step response. I wonder what values for the PID they use for initial values for the controller gains? I didn't see where that data was entered.


I looks like the program is continually updating the model while it is trying to reach the set point and for a while after. Eventually this will not help unless the set point changes again.



I can see the code was written in python using tkinter as the interface.


I have thought about doing something similar for hydraulic motion controllers but it hasn't been a priority.

The initial values were chosen at random to show it doesn't really matter where you start from, which is useful for a start-up environment or even an existing loop.
It allows you to tune while the process is under some closed loop control.

Here’s an example of an open loop tune from a ramp response.


https://youtu.be/v1EZgpl2QF8

...
OpenLoopRamp.png


It’s still in development but I’ve posted it on https://github.com/Destination2Unknown
Current setup is for Logix PLC’s using pylogix.

...
 
If you are using python, I would look at the Nelder-Mead algorithm. Everyone discounts the Nelder-Melder algorithm because it is crude but it works well. You can find the Nelder-Mead algorithm in Numerical Recipes in C and other places on the internet.

Have to love this description of Nelder/Mead (also called downhill simplex) from NRinC:

However, the downhill simplex method may frequently be the best method to use if the figure of merit is "get something working quickly" for a problem whose computational burden is small.

The method has a geometrical naturalness about it which makes it delightful to describe or work through

Hard to not want to try a method described as "delightful" not to mention the wonderful name of the main routine: amoeba();
 
I have an older version of my autotuner here
https://deltamotion.com/peter/py/SysID SOPDT.zip
It has Ron Beaufort's "HotRod" data for an example problem.
The code can use 3 methods to minimize the error between the actual and estimated response.
Nelder-Mead is the one I use. Powell's method works OK too. BFGS should be the best, but it has problems. It keeps quitting too early due to resolution problems. BFGS seems to work great if given a perfect mathematical model but not with real data. I have spent a lot of time comparing these problems. Nelder-Mead always works.

Destination Unknown and I could put those making auto tuners out of business.

I think if I trained 10 people, we could tune all the systems in North America remotely.
Destination Unknown could find 9 more missing persons, train them, and tune all of the EU.
Something similar could be done for Asia.

The Nelder-Mead/Downhill Simplex/Amoeba method is not only simple, N-M works when other methods fail. The reason is that the Nelder-Mead method doesn't rely on finding derivatives or slopes.

Before the CCP-virus I was working on a method of computing the x, y, x and yaw, pitch and roll of a Six Degree of Freedom platform (6DOF). Each of the 6 cylinders had an analog/resistive feedback but they were noisy. The x, y, z and yaw, pitch and roll would never converge because of the noisy feedback, so I had to use a method that didn't use derivatives or slopes.

Now that computing power and algorithms are plentiful, there are no more excuses for running systems in manual or poorly tuned systems.

Here is an example where a simple PID will not work Controllers like the HYD02, M02AS and RMC100 will fail on this system.
https://deltamotion.com/peter/Videos/NF-FOA.mp4
Some on this forum have had a chance to tune this system as part pf an advanced training class. It was designed to be purposely difficult to tune. The auto tuners presented so far would all fail on this system. PID does not work all the time. Think about how you would control the position of the end of a slinky with dead time.
 
I have also made an auto FOPDT tuner. I am really happy with it. I tuned 25+ loops with good results.

The challenge is to get the right model. I hope that with destination unknown's tool this will be easier. I first have to collect data from an installation to test this tool.
 
The challenge is to get the right model.
yes, but you can only generate a FOPDT model. What if the system really requires a SOPDT model. FOPDT works but SOPDT often works much better.

I hope that with destination unknown's tool this will be easier. I first have to collect data from an installation to test this tool.
Destination Unknown also uses a FOPDT model. I can try both FOPDT and SOPDT on the same data and see which one provides the best fit by comparing the sum of squared errors. Usually the SOPDT model does better. There really isn't such a thing as a FOPDT system. There is time constant of the thermal mass of what is being heated or cooled and then there is the time constant of the sensor itself. The time constant of the sensor can only be ignored it the temperature sensor responds to temperature changes extremely qucikly compared the the time constant of the thermal mass.
 
I am still looking for a tool that can detect a model on the fly.

What I have found so far is the tool from Control station. The tool is called Loop pro tuner. It seems to be able to do what I want.

However, the results are not good enough. Do you have better tools?
 
I am still looking for a tool that can detect a model on the fly.

What I have found so far is the tool from Control station. The tool is called Loop pro tuner. It seems to be able to do what I want.

However, the results are not good enough. Do you have better tools?
Here is a start.
https://en.wikipedia.org/wiki/Recursive_least_squares_filter
This works sort of. It will not work if the temperature stays constant. Like all system identification/modeling programs, there needs to be some variation or rate of change in the feed back as a function of a change in the control output to accurately determine the time constants or open loop pole locations. If you run this algorithm while sitting at a constant temperature with a constant output, the model will degrade so it should be disabled when at a steady state.

There is no magic. There needs to be an excitation by changing the control output and recording the response.

I did not like this algorithm as it works in the z or discrete domain. Since my sample times are relatively fast relative to the system, the open loop poles would be to close to 1 so any noise could move the poles out side of the unity circle which is like moving the poles to the right hand side of the s-plane.
NOT GOOD.

I can go on but there is no point unless you are familiar with working in the z domain.

In motion control I can use the data from the last move and update the model before the next move is made. This will work well if the moves are relatively short. The ratio of accelerating and decelerating time to constant velocity time must be high enough.
 
Matjuhnl what is your final goal?
Peter shows you the way.
But I can’t even imagine how to prevent disturbance influence during identification process
 
I please to excuse me, I have one stupid question:
Why do all your models include dead time? Do all your systems have transport delay (conveyors, pipelines, etc.)? What is the reason?

Peter Nachtwey's "Hotrod.zip" example is approximated pretty well by the following function

W(s) = 3,77142857142857/ ((170,2864769*s+1)* (36,0195267*s+1)* (14,57362541*s+1)* (11,51468826*s+1))

destination unknown example (post 36):

W(s) = 2,22 / ((91,225*s+1)* (21,3625*s+1))
(If I get data (not image) maybe I can improve the model.)
 
yes, but you can only generate a FOPDT model. What if the system really requires a SOPDT model. FOPDT works but SOPDT often works much better.


Destination Unknown also uses a FOPDT model. I can try both FOPDT and SOPDT on the same data and see which one provides the best fit by comparing the sum of squared errors. Usually the SOPDT model does better. There really isn't such a thing as a FOPDT system. There is time constant of the thermal mass of what is being heated or cooled and then there is the time constant of the sensor itself. The time constant of the sensor can only be ignored it the temperature sensor responds to temperature changes extremely qucikly compared the the time constant of the thermal mass.

I use both models as well but the FOPDT is slightly faster to approximate, which is handy if you are doing multiple models.

A SOPDT AutoTuner:
https://www.youtube.com/watch?v=AegXD9AdtEA


I please to excuse me, I have one stupid question:
Why do all your models include dead time? Do all your systems have transport delay (conveyors, pipelines, etc.)? What is the reason?

Peter Nachtwey's "Hotrod.zip" example is approximated pretty well by the following function

W(s) = 3,77142857142857/ ((170,2864769*s+1)* (36,0195267*s+1)* (14,57362541*s+1)* (11,51468826*s+1))

destination unknown example (post 36):

W(s) = 2,22 / ((91,225*s+1)* (21,3625*s+1))
(If I get data (not image) maybe I can improve the model.)


The FOPDT and SOPDT models are used as an approximation, and in general fit a lot of systems. Also there are a lot of tuning rules that are based on FOPDT and SOPDT models, less so for higher order systems.
 
Last edited:

Similar Topics

http://www.pas.com/tunewizard I've been using this a lot lately, used to cost $10k but now it is free (hoping you will pay for support or buy...
Replies
15
Views
11,092
Hello, I am attempting to tune a PID loop on a process. The process involves a valve with electronic actuator that has quite a high deadband...
Replies
10
Views
2,315
so i have 4 25gpm wells feeding a 1000gal tank (T-1), with an additional 15gpm from a decant tank for 3hrs every 12hrs. P1 and P2 both controlled...
Replies
154
Views
36,305
Hi everyone, yet another PID problem. I'm hoping I understand enough of the process I'm controlling that my request for help is reasonable. If a...
Replies
113
Views
28,809
I haven't had to tune a PID loop in a very long time. It's actually a PI loop for a pulse width modulation s.v. What was the name of that tuning...
Replies
16
Views
4,192
Back
Top Bottom