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 July 28th, 2022, 10:47 AM   #31
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 110
Adaptive Auto Tuner

Quote:
Originally Posted by Matjuhnl View Post
Is there a possibility to make a continuous model of the process (FOPDT). So without step response. This would make life a lot easier.
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


...
  Reply With Quote
Old July 28th, 2022, 12:39 PM   #32
Peter Nachtwey
Member
St Kitts and Nevis

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: No income tax, no capital gains tax. Freedom!
Posts: 8,272
Quote:
Originally Posted by destination unknown View Post
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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old July 29th, 2022, 03:13 AM   #33
Matjuhnl
Member
Netherlands

Matjuhnl is offline
 
Join Date: Jun 2020
Location: Somewhere
Posts: 23
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?
  Reply With Quote
Old July 29th, 2022, 03:41 AM   #34
Peter Nachtwey
Member
St Kitts and Nevis

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: No income tax, no capital gains tax. Freedom!
Posts: 8,272
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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old July 29th, 2022, 04:56 AM   #35
Matjuhnl
Member
Netherlands

Matjuhnl is offline
 
Join Date: Jun 2020
Location: Somewhere
Posts: 23
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?
  Reply With Quote
Old July 29th, 2022, 07:15 AM   #36
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 110
Quote:
Originally Posted by Peter Nachtwey View Post
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.

...
  Reply With Quote
Old July 29th, 2022, 09:22 AM   #37
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,813
Quote:
Originally Posted by Peter Nachtwey View Post
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:

Quote:
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();
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Old July 29th, 2022, 11:46 AM   #38
Peter Nachtwey
Member
St Kitts and Nevis

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: No income tax, no capital gains tax. Freedom!
Posts: 8,272
I have an older version of my autotuner here
https://deltamotion.com/peter/py/SysID%20SOPDT.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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old July 29th, 2022, 12:38 PM   #39
Matjuhnl
Member
Netherlands

Matjuhnl is offline
 
Join Date: Jun 2020
Location: Somewhere
Posts: 23
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.
  Reply With Quote
Old July 29th, 2022, 05:04 PM   #40
Peter Nachtwey
Member
St Kitts and Nevis

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: No income tax, no capital gains tax. Freedom!
Posts: 8,272
Quote:
Originally Posted by Matjuhnl View Post
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.

Quote:
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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 2nd, 2022, 04:14 PM   #41
Matjuhnl
Member
Netherlands

Matjuhnl is offline
 
Join Date: Jun 2020
Location: Somewhere
Posts: 23
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?
  Reply With Quote
Old August 2nd, 2022, 09:06 PM   #42
Peter Nachtwey
Member
St Kitts and Nevis

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: No income tax, no capital gains tax. Freedom!
Posts: 8,272
Quote:
Originally Posted by Matjuhnl View Post
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/Recurs...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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 3rd, 2022, 07:38 AM   #43
MaxK
Member
Czech_Republic

MaxK is offline
 
Join Date: Jul 2022
Location: FrozenHell
Posts: 214
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
  Reply With Quote
Old August 3rd, 2022, 07:40 AM   #44
MaxK
Member
Czech_Republic

MaxK is offline
 
Join Date: Jul 2022
Location: FrozenHell
Posts: 214
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.)
  Reply With Quote
Old August 8th, 2022, 11:05 AM   #45
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 110
Quote:
Originally Posted by Peter Nachtwey View Post
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


Quote:
Originally Posted by MaxK View Post
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 by destination unknown; August 8th, 2022 at 11:07 AM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum


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
Slow Acting Long Time Interval PID Tuning GrizzlyC LIVE PLC Questions And Answers 141 March 30th, 2021 06:04 AM
PID tuning methods OysterMan LIVE PLC Questions And Answers 4 March 21st, 2021 10:59 AM
Micrologix 1400 Timed Proportioned Output PID Tuning Paul Begley LIVE PLC Questions And Answers 3 January 13th, 2014 04:26 PM
PID Tuning and Process Modeling kdcui LIVE PLC Questions And Answers 14 October 15th, 2009 01:27 PM
PLC PID Auto Tuning Problem monet LIVE PLC Questions And Answers 6 May 26th, 2009 09:50 AM


All times are GMT -4. The time now is 04:58 PM.


.