Help - Search - Members - Calendar
Full Version: PID Basics
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
BobLfoot
Having read the rather lengthy discussion of gurus like Peter and Ron in a post about PID and going nearly crosseyed I have to ask.

SOOO - When is someone going to write PID for Dummies. THe book intended for the tech who wants to add a PID proportional control to a single loop process and not get a PHD while elarning to tune his loop. The help files for the AB PID instruction have enver been really useful and RSTUNE has always been an expense.

Bottom Line. My plant has several PLC's with PID Instructions in them. From time to time we get asked to add more. How do I know I am adding them correctly and that what we have is tuned for optimum performance?
Sleepy Wombat
Could'nt agree more Bob...

And what would be betrter would be real world examples.. ie we have a flow sensor and variable speed drive with the variable speed dirve conrtolling the flow rate... where do you start, do you bump the drive and measure the response on the flow ? how do you measure the response ? do you need to use specific software or is it through observation ? What does plant constatnt mean ? What do you set the time base of the PID at ?

etc..
BobLfoot
QUOTE(Sleepy Wombat @ Oct 4 2006, 02:41 AM) [snapback]41173[/snapback]

Could'nt agree more Bob...

And what would be betrter would be real world examples.. ie we have a flow sensor and variable speed drive with the variable speed dirve conrtolling the flow rate... where do you start, do you bump the drive and measure the response on the flow ? how do you measure the response ? do you need to use specific software or is it through observation ? What does plant constatnt mean ? What do you set the time base of the PID at ?

etc..


And I know setup will require some Math, but please remember this is PID for dummies. Keep it in grade school algebra at worst.
Ron Beaufort
Greetings to BobLfoot and to Sleepy Wombat ...

to continue the discussion ...

QUOTE
... PID ... gurus like Peter and Ron ...


thanks for the kind compliment, but personally I don’t consider myself a PID “guru” ... but then again, I’ve spent so many long hard hours of studying, and experimenting, and working/fighting with this PID subject that I feel pretty comfortable with what I know about it ... I guess that I might be able to “pass for” a guru - at least until a real one shows up ...

QUOTE
When is someone going to write PID for Dummies. The book intended for the tech who wants to add a PID proportional control to a single loop process and not get a PHD while learning to tune his loop.


(with absolutely no sarcasm/ridicule/etc. intended) the simple answer is: when it becomes financially rewarding to do so ... here’s an open question to ALL readers ... suppose that you could order one handy book which would take you from start to finish in setting up and tuning a basic PID control system for any and all of the Allen-Bradley SLC, MicroLogix, PLC-5, and ControlLogix platforms ... now here’s the question: how much would you be willing to pay for the book? ... and how many other people do you think would also be in the market for such a book? ... according to my sources, a “PID for PLCs” book is NOT likely to end up on the New York Times “Best Seller” list ... so any author would be looking at a LOT of work, for very little (if any) financial reward ... actually I started writing the book that you’re asking for about three years ago ... then I dropped the project when I realized how much time this was going to take - and how little financial reward I was likely to receive for it ... I’ve still got my notes - but no intentions of ever finishing the book ...

QUOTE
The help files for the AB PID instruction have never been really useful and RSTUNE has always been an expense.


no arguments there ...

QUOTE
My plant has several PLC's with PID Instructions in them. From time to time we get asked to add more. How do I know I am adding them correctly and that what we have is tuned for optimum performance?


I’d suggest that you post your efforts on the forum ... there are many people here (myself included) who would be glad to help answer the questions that you’ve just mentioned ... for free ...

QUOTE
And what would be better would be real world examples..


now that’s a TALL order ... the problem is that each and every system has different characteristics ... so what works for “System A” might not work for “System B” - even though to all outward appearances both systems are identical ... the basic idea is that you could look up a certain type system in the “book” - but the recommended settings from the “book” might not work AT ALL for the system that you have in front of you ... but then again, there ARE some generalizations that might get us into the ballpark ...

QUOTE
we have a flow sensor and variable speed drive with the variable speed drive controlling the flow rate... where do you start, do you bump the drive and measure the response on the flow? how do you measure the response? do you need to use specific software or is it through observation? What does plant constant mean? What do you set the time base of the PID at?


keep in mind that this is a “best-guess-from-where-I-sit” type of shot in the dark, but this is how I’d answer that string of questions ... let’s assume (gosh I hate that word) that the PID is already installed and ready to go ... now all that we need to do is “tune” it for the optimum response ...

first (and most important) what do we mean by “optimum” response? ... specifically, what are our tuning goals? ...

here’s a quick sketch to get us started ...

[attachmentid=3251]

note: there is much more on this same subject in this post and the entire thread is worth reading ...

suppose that we compare Figure 1 and Figure 3 just below it (not Figure 2 at the right) ... each one of these trends shows the response to a sudden change (a “step” change) to the system’s setpoint ... quick question: of those two trends, which represents the better response? ... best answer: we don’t know ... sure Figure 1 looks better at first glance ... it has no overshoot ... no oscillation ... Figure 3 looks kind of “sloppy” in comparison ... but let’s go deeper ...

now let’s compare Figure 2 and Figure 4 ... here we see the response to a different type of “upset” to the system ... at the “tick” mark on each of these trends, the load to the system was suddenly increased ... note that the same PID tuning values which gave the nice, neat response of Figure 1, are now giving us a slow, lazy, sluggish recovery back to the setpoint in Figure 2 ... on the other hand, the same PID tuning values which gave us the “sloppy” response in Figure 3 are capable of giving us a much quicker (“tighter”, more “aggressive”) response to a “load change” which gets us back on the target much faster in Figure 4 ...

and so BEFORE WE START TO TUNE THE LOOP we need to ask ourselves what do we really want for a response ... is it “Response A” or is it “Response B” that we consider to be an “optimum” response for our particular system? ...

side trip: and going deeper - if you want/need BOTH responses, then we can do that too ... basically you can program a couple of simple rungs to have your PLC “change/switch/adapt” between the two sets of tuning values at the appropriate times ...

the important thing so far is this: many (most?) people who try to tune a PID loop by trial and error methods (or actually by ANY method) are usually trying (often desperately) to achieve “Response A” - when in many (most?) cases they should actually be trying to get the response shown in Figure 3 instead ...

cause for confusion: ... if a technician is actually trying to achieve “Response B” for a quick/aggressive recovery to “load changes”, then why in the heck does he keep repeatedly making “step changes” to the setpoint (as shown in Figure 3) while he experiments and tunes the system? ... why not just go ahead and make “load changes” instead and concentrate his efforts there? ... the answer is MONEY ... in most industrial systems, making a change to the LOAD would involve the use of expensive raw materials ... and it would generate a certain (large?) amount of waste which would have to be disposed of (usually for even MORE money) ... are we baking cookies? ... melting steel? ... pumping water? ... while we’re experimenting and tuning the loop, where is that “raw material” stuff coming from? ... where is it going to? ... so in simple terms, changing the “load” is usually MUCH more expensive than just changing the setpoint ... THAT’S the secret handshake of why you’ll often see an experienced technician experimenting and tuning the system for the “sloppy-looking” response shown in Figure 3 - even though what he REALLY wants is the “tighter” action of “Response B” as shown in Figure 4 ... the sad side of the story is the poor guy who works very hard to tune the system for the nice, neat appearance of “Response A” - and then can’t understand why resulting response to the “load” changes which eventually come along are so slow and sluggish - as shown in Figure 2 ...

so once we’ve decided on HOW we want the system to respond, what do we do next? ... trial and error tuning? ... could be ... and in MANY cases that approach would work just FINE ... but suppose that the system that we’re tuning is a very slowwwwww system ... we could spend DAYS (or longer) just sitting there cranking in one set of PID numbers after another and watching the system’s response ... over and over and over ... eventually we would probably come up with a set of numbers that we considered “close enough” and then we’d go home ... but wouldn’t it be nice if there were some way to “analyze” the system? ... to make just ONE experimental run and capture some data ... then suppose that we could take that data and crunch the numbers - and come up with a recommended set of PID tuning values ... wouldn’t that be nice? ...

and that’s the approach that I teach in my PID classes ... and now I’m pushing the envelop of what my bo$$ will allow ... he’s never been willing to give me permission to post the formulas that I’ve developed for this “graphical tuning” approach on the internet ... remember, he makes money by selling the classes ... but here’s what he WILL allow me to do ... suppose that someone out there would run the tests themselves on their own system ... suppose that those results were posted here on the forum ... within ten minutes or less, I could crunch the numbers and come up with a set of “recommended” PID tuning values that SHOULD give a “Response A” or a “Response B” outcome for the system in question ... now if anyone is interested in trying that out, take a look at the graphs in this post ... and in this one for some basic samples of what we’d need to make this experiment work ... but don’t start experimenting until I get a chance to tell you how to set up the test to get some meaningful results ... I look at this as a good chance for me to try out my approach on some different systems ... let me know if you're interested ...

and I’m reasonably certain that my distinguish colleague Peter Nachtwey would be willing to apply his more purely “mathematical” approach to the data - as long as it could be collected in more of a “spreadsheet” format ...

think of these “tests” that I’m talking about as something like an “EKG” that the doctor runs on your heart ... basically you run a test ... you chart the results ... you analyze the data to see what needs to happen next ...

QUOTE
And I know setup will require some Math, but please remember this is PID for dummies. Keep it in grade school algebra at worst.


my sentiments EXACTLY ... the math that I use is NEVER more complicated than what it takes to balance a checkbook - or calculate your car’s “miles per gallon” ... (now Peter - on the other hand) ...


and now to try to answer some of the specific questions posed by Sleepy Wombat ... PLEASE remember that this is all “best-guess-based-on-what-you’ve-posted-so-far” type information ...

QUOTE
we have a flow sensor and variable speed drive with the variable speed drive controlling the flow rate... where do you start, do you bump the drive and measure the response on the flow?


(based solely on what you’ve posted) the basic answer is “yes” ...

start with a low (but reasonable) setpoint and let the system settle down ... then make a sudden change to a new higher (but reasonable) setpoint and watch the system’s response ... try to adjust the PID tuning values for a response something like the one shown in Figure 3 above ... the “which-one-which-way” chart at the bottom of this post might help ...

QUOTE
how do you measure the response? do you need to use specific software or is it through observation?


most people just use observation ... the more you do it, the easier it becomes to “know what to look for” ... Figure 3 shows a series of “waves” ... each wave is smaller (roughly one-fourth of the previous wave) ... and after about 4 waves the ripples settle down ... that’s a pretty common “ballpark” approach ...

QUOTE
What does plant constant mean?


that’s debatable ... the way that I’ve USUALLY seen it used, it’s a number that refers to the “Gain” of the system ... here’s an example:

suppose that we set up a PID for MANUAL (not automatic) control of a heating system ... suppose that we set the output (CV) for a constant value of 10% drive to the heating elements ... suppose that the temperature (PV) finally settles down at a constant value of 115 degsF ... now suppose that we suddenly increase the output (CV) to a new higher value of 80% drive to the heating elements ... suppose that the temperature (PV) finally settles down at a new higher value of 375 degsF ... (actually this is the same test shown for the Hotrod system in one of the posts I linked above) ... so the change in our PV (process) is 375 minus 115 equals 260 degsF ... and the change in our CV (control) is 80 minus 10 equals 70% ... now divide the change in the process by the change in the control ... 260 divided by 70 equals 3.714 ... basically this number means that if we make ONE percent increase in our controller output (CV), then we can expect to see a 3.714 degF increase in our process (PV) ... personally I always refer to this as the “Gain” of the system ... but I’ve heard other people/books refer to it as the “Plant Constant” ... and I’m pretty sure that there are other definitions for “plant constant” floating around out there too ... this stuff is hard to nail down ... Peter might have more to add to this ...

important side-trip note: there is more to this particular subject than I have time for right now ... when I say “basically” I mean “BASICALLY” ... tip: when you get up to higher temperatures, a one percent increase in CV will NOT still give you a 3.714 degF increase in temperature ... but we don’t have time to go into all of that today ...

QUOTE
What do you set the time base of the PID at?


if you don’t have ANYTHING to go by, just set it for 0.50 second and get on with your life ... here’s more ... the “natural period of oscillation” of the system shown in this "rerun" post is about 3.54 minutes per cycle ... the “book” recommends a PID update setting of one/tenth of that value ... so about 0.354 minutes - about 21.24 seconds ... personally, I never shoot for less than 20 executions/updates per cycle ... so in this example, I would set the update time for about 0.177 minutes - or 10.62 seconds ... this setting should be “fast enough” to give us “satisfactory” control ... anything faster is (theoretically at least) simply wasting processor scan time, etc. and over-burdening the processor with extra/unnecessary calculations ...

but now then ... in many (most?) cases, we also use the PID to make certain handy “scaling” calculations for us ... things like the “Scaled PV”, etc. ... if we only update the PID once every ten seconds or so, the operators might get the impression that the “dial-is-stuck” because the numbers on their displays don’t change fast enough to suit them ... so the machine works fine with the recommended update - but the humans usually want something a little more “real-time” on their HMI screen ... so everything considered, an “update” setting of more than about 1 second is probably going to be asking for complaints ... are we having fun yet? ...

I’d like to add more to this discussion - but my wife and I have to go give blood this afternoon ... the Red Cross is calling and BEGGING for a donation ... they say they’re literally to the point of postponing surgeries for people because they’re so short ... if that’s a plug for the Red Cross - then so be it ...

finally ... the chart below has helped a lot of people ... no, it’s not the pot of gold at the end of the rainbow ... just a handy “getting started” point ...

[attachmentid=3252]

PS Edit ...

I'll add this much just before I go ...

I have this recurring fantasy where someone from Allen-Bradley calls me up some day and makes me an offer that I can’t refuse ... basically they want to hire me (full-time and with benefits) to write a complete PID book (“for Dummies” if you insist) for all of their processor families ... and I don’t even have to move away from Charleston to some distant land of ice and snow ...

I always hear the “Somewhere Over the Rainbow” theme song from “The Wizard of Oz” playing in the background whenever I have this little daydream ...

oops! gotta go ... the phone’s ringing again ... maybe it’s really them this time ...
Bill Linne
QUOTE
Now here's the question: how much would you be willing to pay for the book? ... and how many other people do you think would also be in the market for such a book?


Of my OWN money, $75 to $100 sounds fair. Spending "company" money, double that (it becomes a "shop reference" if the company tilts for the cost).

I suspect your biggest obstacle would be advertising. Can get pricey, and your "target" audience is rather small in terms of trying to make mass-marketing cost-effective. On the other hand, think of all the systems integration houses and the people therein who would do immoral things to obtain such a reference!

Okay, I've probably expended or exceeded my allowance of 'PID High Priest' attention time.

BobLfoot
Great Response Ron. I've read it thru and letting it bounce around the empty space I call a brain. I'm sure I'll have questions in the coming weeks. Appreciate the offer and I will take you up on it someday soon. Hope Peter chimes in soon too.
Sleepy Wombat
Thanks again for your lamens learned approach to PID... I raised the quesitons to get the ball rolling, and yes what you have said is what i do in practice generally due to time contraints, but have never been able to collate the toughts and process so elequently as you have seemed to...BIG THANKS mate......very intested in the calc's you use blush.gif ,
Pity, cloning isn;t avail yet, i am sure that a lot of people in the land of OZ would enjoy your teaching methods...mmm mabey you should do the world circuit....

QUOTE
I’d like to add more to this discussion - but my wife and I have to go give blood this afternoon ... the Red Cross is calling and BEGGING for a donation ... they say they’re literally to the point of postponing surgeries for people because they’re so short ... if that’s a plug for the Red Cross - then so be it ...


I always thought that your blood would be worth bottling. thumbsupsmileyanim.gif clapping.gif

Peter Nachtwey
I would like to know:
1. Does anybody follow the www.controlguru.com website? There is a good example about a heat exchanger there. There are simple equations there that allow one to calculate Kc, Ti and Td. The trick is to calculate gain ( Kp ), Tp and dead time.
2. How much is it worth to you to have your PIDs tuned? What if your PIDs can be tuned over the internet using goto meeting?
3. How much are you willing to learn. A better question would be how many hours do you think it should take?

PIDs are not for dummies. The trick is to educate the dummies so they aren't dummies anymore.

QUOTE

And what would be betrter would be real world examples.. ie we have a flow sensor and variable speed drive with the variable speed dirve conrtolling the flow rate... where do you start,

First you must know your system.
Ron points out that you must know the response you want.
These two items are used to calculate the PID gains.

QUOTE

do you bump the drive and measure the response on the flow ?

That may work. Usually trends like a RSLogix trend that shows how the system responds to changes in the output work well.

QUOTE

how do you measure the response ?

Sometime you can just eye ball it as in the current www.controlguru.com example. Other times it can be very complicated and requires very sophisticated math.

QUOTE

do you need to use specific software or is it through observation ?

Either may work but using the software approach is usually more accurate.

QUOTE

What does plant constatnt mean ?

This is difficult. Ask in the Advanced Control thread on plcs.net. I am trying to keep all the advanced stuff in one place so it doesn't get lost.

QUOTE

What do you set the time base of the PID at ?

It should be 10 times faster than the closed loop or plant time constant, which ever is shorter. I prefer faster. I know this isn't much help without knowing what a time constant is.

Everyone wants a quick fix. It isn't possible. If your plant has PIDs to tune why not hire somebody to do it?

BTW, I too have been asked to write a book by a publisher, but as Ron pointed out, it isn't worth it unless you do it for marketing or can use the book in a training class. I have enough material for about 3 books.

I agree that example are necessary. Would you work through the examples using Scilab, Matlab or Mathcad? What about the examples on www.controlguru.com?


BobLfoot
An entire quote from Peter on PID's and NO MATH - That deserves a medal - LOL.

Thanks for the response Peter. I will check out controlguru.com and spend a little time with my systems. Guess PID's are like any other "higher level" PLC command. To understand them takes a little effort. Guess I'll just have to knuckle down and jump in. The wizard will have to relinqish his cloak for the robe of a PID acolyte.
Sleepy Wombat
QUOTE
Does anybody follow the www.controlguru.com website?
Yep, you kindly pointed us in that direction in another thread....have read a few articles but i need to start from the beginning in his logical order..generally i can grasp the math as you probably know from the sliding mode control excel sheet i did after you pointed me to that info on your site a few years ago... I also remember the Hot rod discussion from the begginning...

QUOTE
How much is it worth to you to have your PIDs tuned? What if your PIDs can be tuned over the internet using goto meeting?
Generally i don;t have to much problem tunning the loops through observation and experience my self....PID's tuned over the internet...now there;s an interesting businness idea....

QUOTE
How much are you willing to learn. A better question would be how many hours do you think it should take?
Unfortunately, at the moment it is how many hours in a day do i have available to learn to the in depth level that i might want to...

QUOTE
PIDs are not for dummies. The trick is to educate the dummies so they aren't dummies anymore
. thumbsupsmileyanim.gif

QUOTE
I agree that example are necessary. Would you work through the examples using Scilab, Matlab or Mathcad? What about the examples on www.controlguru.com?
Will check control guru examples .. about to go away and commission again....

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.