Help - Search - Members - Calendar
Full Version: Implementing PID Auto Tuning
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Sajid
Hi People,

Just curious about implementing PID algorithm with Auto Tuning feature, all with ladder logic without the use of built in PID instruction for AB ML 1200 PLCs.

I have managed to implement a custom PID equation in my program, with the sole purpose of making things easy for service engineers and customers with tuning the loop.Still working on it.
blink.gif

But then I stumbled upon "Auto Tuning" that i read about in a book.

Just wanted to ask if anyone has tried this before or can you give me some ideas as to where I can find information about Auto Tuning theory/flow charts with respect to digital controllers, and then I could put it in my ladder logic.

Thanks for your help/suggestions.

Sajid
Peter Nachtwey
I think you would be the first to implement auto tuning in ladder. Writing a PID auto tuning program can ony be done by the high priests of PID. What makes you think that these PID priest would want to give away their holy secrets? First you must seek favor of the PID priesthood by gaining a thorough understanding of mathemajic, control theory and system identification. Once these topics are mastered then you can attept to join the PID priesthood. No one tells you that you if or when you become a high priest of PID. The high priests of PID have taken a vow of silence and won't talk to you until you have proven yourself worthy. The high priest of PID rarely share thieir holy secrets with each other.. If you become a high priest you will know. You will also know how to write a PID auto tuning program.

Seriously, why should any body tell you how to write auto tuning software when they are trying to sell auto tuning software? That is like giving away the goose that lays the gold eggs. Do you think the high priests of PID are stupid?



TWControls
I have read this one several times today and I keep cracking up. Nice one Peter
Sajid
QUOTE(Peter Nachtwey @ Sep 9 2006, 09:31 PM) [snapback]39942[/snapback]

I think you would be the first to implement auto tuning in ladder. Writing a PID auto tuning program can ony be done by the high priests of PID. What makes you think that these PID priest would want to give away their holy secrets? First you must seek favor of the PID priesthood by gaining a thorough understanding of mathemajic, control theory and system identification. Once these topics are mastered then you can attept to join the PID priesthood. No one tells you that you if or when you become a high priest of PID. The high priests of PID have taken a vow of silence and won't talk to you until you have proven yourself worthy. The high priest of PID rarely share thieir holy secrets with each other.. If you become a high priest you will know. You will also know how to write a PID auto tuning program.

Seriously, why should any body tell you how to write auto tuning software when they are trying to sell auto tuning software? That is like giving away the goose that lays the gold eggs. Do you think the high priests of PID are stupid?



Thanks Peter for your suggestion.Well I know what you are taking about.There are people who have dedicate their entire time developing Auto Tuning software so that they can make a living out of it.And whos got a problem with them?Not me.

See the kind of situation I am in right now is: I have a tough time with my customers and our commissioning engineers.No matter how nicely I would explain to them,they dont want to understand the fact that if a PID closed loop control is implemented then it requires tuning to obtain best performance.So to make things easy for them I have changed a very general PID equation slightly.And guess what the system,this is a weigh feeder,works very nice and we get the kind of response that we want.

And whats the next step?Auto Tuning.No harm in trying it.
Sleepy Wombat
thumbsupsmileyanim.gif

A laugh a minute when you put on your sarcasim Brother Peter naughty.gif
Peter Nachtwey
QUOTE(Sleepy Wombat @ Sep 12 2006, 04:19 PM) [snapback]40117[/snapback]

thumbsupsmileyanim.gif

A laugh a minute when you put on your sarcasim Brother Peter naughty.gif


My response was written in half in jest or sarcasm. At one time I was clueless too. No one taught me what I know now. I learned it on my own after reading about three or four books over and over and over and over again. The term 'high priests of PID' I used over 3 years ago. Here is a link to a response that I had to a newsgroup

http://groups.google.com/group/sci.engr.co...99a9269a751faa4. In the mid 90s there were a bunch of old process control guys that dominated the forum. I didn't know enough to challenge them. These high priest didn't really know anything an tuned by the seat of their pants. These old farts still have websites that people refer to even though I think that most of it is useless.

Sometime along the way I realized that these high priests were imposters and I because to challenge what they said. Finally I got down right in-their-face and telling them how they were wrong and I posted links to .pdf files on my web site that proves it.

Now there are guys like the control guru that tells it like it is, finally. However, even now these process guys see the PID world through their process eyes. As you know I make motion controllers so almost of my applications are motion control applications but I branch out at try to understand all PID applications. Nothing winds up my integrator like someone handing out advices on systems he know nothing about. Just as bad are those that have tune 20 to 30 PID loops that are all the same and then he believes that all the PIDs are the same.

Once you become a high priest of the PID you realize that it is all about plant. You have to know the plant before you can 'tune' the system and tuning isn't done anymore. See the current control guru blog topic
http://www.controlguru.com/?p=89#respond

This is how calculating PID gains is done. You ID the system by finding the plant gain and time constants. Then you apply the formulas that are use to CALCULATE and NOT tune the controller gains. It is very fast and efficient but it also takes the 'art' out of tuning. When I reached this point it took a while realize that I see tuning in a much different way than most.

BTW, the control guru is showing how he can calculate a model so he can predict very accurately how the PV will respond to the CV for minutes into the future. When you can do that then you know your plant.
There is no more guess work or trial and error.

It kind of takes the fun out of it.

Now I look at the threads asking for PID help. For the most part they want a quick fix and not true understanding. True understanding can't be done on a thread or couple of threads. See the Controlguru site. It takes a novel. I let someone else answer those quick fix threads as long as the information is correct. The PID gains are just ways of moving poles and zeros around. To get a desired response. Most don't even know what the desired response should be.






Ron Beaufort
as always, Peter, I am truly impressed ... (NO sarcasm intended) ...

QUOTE
The PID gains are just ways of moving poles and zeros around. To get a desired response. Most don't even know what the desired response should be.


there are also many among us (myself included) who don't even know what a "pole" or a "zero" is ... is there somewhere (book, site, etc.) that you could recommend that covers that type of information? ... personally, I'd like to know more about your techniques, but I don't have the math background to understand what you're talking about ... (I’m groaning here in anticipation of a ten-pound textbook on higher math - suitable for a two-semester course at the university level) ...

my own approach to "systematic" (as in slightly beyond "seat-of-the-pants") tuning is to graph the response of the system through a couple of simple tests, and then print the graph on paper ... from that graph I can usually measure, mark, and calculate my way through a systematic "starting point" of reasonable values for P, I, and D ... this method works reasonably well for MOST systems ... and it works VERY well at teaching technicians (no, not engineers) what to look for as they work on (and around) PID-controlled systems ... basically: "this is what the response looks like when it's right" ... and "this is the part of the system to start troubleshooting when the response looks wrong" ... and "here's how the Allen-Bradley PID instruction fits into the system" ...

and now a note to Sajid ...

about two years ago I wrote an "autotuning" algorithm for a heat control loop ... my boss wanted this done so that some equipment that our company was involved in installing could be reasonably-well “tuned” by the installers - until the engineers arrived to do the final touchup ... I used basically the same “graphical” approach that I mentioned above - but automated it for use in a QBasic application ... it worked “ok” ... while working on this project, I quickly found out that the SLC-5/05 processor did not have enough horsepower to handle the math involved ... specifically, the data needed to be captured in an array (floating point register) and then the numbers had to be crunched to find values for “maximum rate of rise” and “deadtime” and “time constant” and so on ... and then finally the recommended values for P, I, and D could be calculated ...



in short, I don’t think that the MicroLogix processor you mentioned is going to be up to the data storage task ... at least not if you use the same “storage intensive” approach that I used ... if you decide to forge ahead with your project, I would strongly recommend that you find at least one or two “sample” processes and then MANUALLY calculate the appropriate tuning values for them ... once your manual approach has been tested and proven valid, then (and only then) would I recommend that you try to implement the same method in an “automatic tuner” ... but that’s just my advice ...



good luck with your project ... and please keep us posted ...

low on the pole
why not buy rockwells pid loop software. it works

Ron Beaufort
Greetings low on the pole,

QUOTE
why not buy rockwells pid loop software. it works


if you're asking ME, then ...

yes, RSTune works fine ... but the idea behind this project was to have a quick "just-push-this-button" solution and have the PLC "autotune" itself ... the on-site installers weren't exactly "computer literate" individuals and setting up the RSTune on a computer was pretty much beyond their current capabilities ...

if you're asking Sajid, then I'm pretty much in agreement with you ... personally I don't think that the work that he'll spend on the "autotune" project will be worth his time ... what most people would like to see is a "try before you buy" demonstration of RSTune ... that's usually not possible ... so if it doesn't work on HIS system, then a customer is usually stuck with a software package that doesn't answer his needs ... and according to some people, it doesn't work on ALL systems ... frankly, I'm suspicious of those reports ... my guess is that the PID controls in those systems aren't set up correctly in the first place ... timing issues, scaling, etc. are usually the culprits ...
Peter Nachtwey
QUOTE(Ron Beaufort @ Sep 13 2006, 09:05 AM) [snapback]40154[/snapback]

there are also many among us (myself included) who don't even know what a "pole" or a "zero" is ... is there somewhere (book, site, etc.) that you could recommend that covers that type of information? ... personally, I'd like to know more about your techniques, but I don't have the math background to understand what you're talking about ... (I’m groaning here in anticipation of a ten-pound textbook on higher math - suitable for a two-semester course at the university level) ...

Have you visited the controlguru site?
Do understand the tuning equations? The way the Controlguru calculates plnat gain and time constants manually is pretty much the same as the way I have see you do it. The Controlguru just takes this a step further by putting the plant data into formulas to calculate the PID gains. I know how these equations are derived and how they work.

I don't have my control books here so I don't remember the exact names. I know that one is written by Nise and the the other by Philips and Nagle. I am not kidding about reading the books over and over and over....

QUOTE

about two years ago I wrote an "autotuning" algorithm for a heat control loop

Is that when you bought the lambda tuning text for $30?

QUOTE

I quickly found out that the SLC-5/05 processor did not have enough horsepower to handle the math involved

Oh, this must be why know one has successfully written a auto tuning program in a PLC.

I would use the data from the RSLogix trend data just like the 'Hotrod' data supplied by Ron Beaufort a couple years ago. It would be nice if this data could be exported in a comma separated variable file.
See the current http://www.controlguru.com article.

Ron, you should look at the advanced control thread on plcs.net. I am surprised I don't have a half dozen questions.
Ron Beaufort
Greetings Peter,

I wish I had time right now to write more ... all I can manage right now are just a quick few notes ...

QUOTE
Have you visited the controlguru site?


I've browsed it - but not had time to dig ... yet ...

QUOTE
Do understand the tuning equations?


I haven't dug that deep ... yet ...

QUOTE
The way the Controlguru calculates plnat gain and time constants manually is pretty much the same as the way I have see you do it.


graphically? ... by marking up a printed copy of the trend? ... maybe I'm wrong (probably?) but I thought that you guys were doing this with math - and ONLY math ... specifically, with no graphs ...

QUOTE
The Controlguru just takes this a step further by putting the plant data into formulas to calculate the PID gains. I know how these equations are derived and how they work.


once I graphically get the gain, deadtime, time constant, etc. values from the graph, then I too run those values through "formulas" to calculate the PID settings ... this works to get a "ball park" set of tuning values ... in the examples I've tried this on, the "ball park" values are REALLY close ... in other cases, a fair amount of "tweaking" is necessary ... but at least we're not talking about starting out with a "blind-guess-shot-in-the-dark" starting point ...

QUOTE
I don't have my control books here so I don't remember the exact names. I know that one is written by Nise and the the other by Philips and Nagle. I am not kidding about reading the books over and over and over....


over and over and over is not a problem ... my problem is that many (most?) books that I read seem to be written BY people who understand - FOR people who understand ... there are precious few that are suitable for people who don't already know a LOT about the subject at hand ... that's why I spend most of my "research/learning" time doing experiments ... the things I see (and learn) that way seem to make more sense to me ...

QUOTE
Is that when you bought the lambda tuning text for $30?


no ... that was completely unrelated ... but if the boss had wanted a "no-overshoot-allowed-and-we-don't-care-how-long-it-takes-to-recover" response (basic lambda idea) then I could easily have accommodated that in my program ... basically it just takes running the same "graphically derived" data through a slightly different set of formulas ... he wanted more of an "aggressive" response for this particular system ...

QUOTE
I quickly found out that the SLC-5/05 processor did not have enough horsepower to handle the math involved


QUOTE
Oh, this must be why know one has successfully written a auto tuning program in a PLC.


actually it could have handled the MATH involved ... but storing enough data to analyze was the biggest problem ... sorry if I didn't make that clear before ...

QUOTE
I would use the data from the RSLogix trend data just like the 'Hotrod' data supplied by Ron Beaufort a couple years ago. It would be nice if this data could be exported in a comma separated variable file.


I've never tried this, but I'm pretty sure (90%) that it could be done ... probably just a few extra steps with Excel would be necessary ...

QUOTE
See the current controlguru article.


wish I had the time ... maybe in a couple of weeks ... the bo$$ keeps coming up with things for me to do ...


Last quote of Rons
Ron, you should look at the advanced control thread on plcs.net. I am surprised I don't have a half dozen questions.

again ... time is the issue ...

thanks for your thoughts ... I'll get back to you ...

EDIT ... I have NO idea what's wrong with my "quotes" ... if I get it figured out, I'll try to fix it later ...

TWControls
QUOTE(Ron Beaufort @ Sep 14 2006, 02:24 PM) [snapback]40220[/snapback]
EDIT ... I have NO idea what's wrong with my "quotes" ... if I get it figured out, I'll try to fix it later ...

Not sure what was wrong with your post quotes. Took the last quote out and made it and the rest of the quotes worked. I hope that is ok.

TW
Peter Nachtwey
QUOTE

QUOTE
I would use the data from the RSLogix trend data just like the 'Hotrod' data supplied by Ron Beaufort a couple years ago. It would be nice if this data could be exported in a comma separated variable file.


I've never tried this, but I'm pretty sure (90%) that it could be done ... probably just a few extra steps with Excel would be necessary ...

That is what I did with the hotrod data you sent me.

The control guru can calculate out a model for the plant using his Control Station software. I just use my Mathcad.

I have written auto tuning software for our motion controllers that does much the same as the Control Station software or Expertune only we tune motors and hydraulic systems.



Chris Elston
QUOTE(TWControls @ Sep 14 2006, 03:54 PM) [snapback]40224[/snapback]
QUOTE(Ron Beaufort @ Sep 14 2006, 02:24 PM) [snapback]40220[/snapback]
EDIT ... I have NO idea what's wrong with my "quotes" ... if I get it figured out, I'll try to fix it later ...

Not sure what was wrong with your post quotes. Took the last quote out and made it and the rest of the quotes worked. I hope that is ok.

TW




The setting was set to TEN QUOTES, I change it to 30.

Ron Beaufort
QUOTE
The setting was set to TEN QUOTES, I change it to 30.


thanks, Steve ... that was driving me nuts - and that's not a long trip from where I usually stay ...

and thanks to TW for the "quick fix" on my previous post ...
TerryRWood
GOOGLE... "Ziegler Nichols Tuning Method"


Some of this may help someone start figuring it all out...

Small overview
http://www.htservices.com/Applications/Process/PID3.htm
http://www.act-control.com/ZN.HTM

TRW
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.