PID Question

Greetings Todd,



sorry that I’m short on time ... can’t look at scaling, etc. right now ... but here’s one MAJOR issue ... you should change your PID “Time Mode” entry from “STI” to “TIMED” ... if you’re going to use “STI” mode, then the PID should be located in an STI file ... yours isn’t ... it’s located in Ladder File #2 and so it’s being executed on each and every scan ... not just once each 0.01 seconds like your “Loop Update” setting indicates ... this is going to cause your Integral and Derivative actions to be erratic (when and if you use them) ... also the settings for these will be “out in left field” from the settings we’d normally expect to see ... I’ve made several posts in the past about this "PID timing" issue ... it would probably be a good idea to search them up ...



I’ll try to look at your scaling tonight ...
 
Thanks for your time

Hi Folks.... Again thanks for your time and attention. Ron...As per your suggestion I searched your posts {about 125 of about 500 of them} and found "PID loop update time and external trigger" I plan on taking it to work tommorow and reading through it. Do you recall others on this subject? If so I'll dig more later.

Thanks again.....Todd
 
I'M NOT AN EXPERT ON PID IN A SLC, but I think you should condition the PID block rung with a timer. The timer should be set to make the PID block execute at the same frequency as you have in the Loop Update parameter.

Someone please correct me if I am wrong.
 
Greetings OkiePC,

with the SLC platform, the PID should be on an unconditional rung ... the "trigger" is built-in ... you're probably thinking of the larger PLC-5 platform ... that one (usually) does require an external "trigger" on the PID rung ...

note: if the SLC processor ever scans the PID with "false" logic, then unpleasant things happen to the Integral term ... basically, the Integral action goes back to zero and has to start over again ...

and note to Todd,

this post covers most of the issues associated with the way you have your PID's "Time Mode" set up ... I suggest that you start by reading the first post in the thread .... sorry that I still haven't had time to look at your scaling yet ...

and incidentally, the P, I, and D papers that Dan was kind enough to mention are available as PDF files in the "sample lesson" section of my company's website ... since they're each quite long, the PDF format is usually easier to handle than printing them out from the forum ...
 
Last edited:
1st pop quiz

Hi folks... My 1st pop quiz. What have I learned so far? I need to change my "Time mode" to Timed and when in "timed mode" my PID funtion is "looked at" every "Loop update" time by the program.{does this make sense to anyone but me?} STI mode is "looked at" every scan of the program. Someone grade me before I go to far!!!!

Later...Todd
 
Greetings Todd,



when in "timed mode" my PID funtion is "looked at" every "Loop update" time by the program.




it makes sense ... but there’s a more accurate way to say it ... this is better:



when in “timed mode” my PID function is “looked at” every scan ... but it is only “executed” by the processor every “Loop Update” time ...



specifically, the processor “sees” the PID (and actually updates the PID’s internal timer in the background) ... but the PID calculations (for P and I and D) are only done when the PID’s internal timer says “ok, time’s up ... now it’s time to calculate a new value for CV” ... so in this mode, you just have to leave the rung “true” continuously and the PID’s internal timer automatically takes care of “triggering” the PID into making its calculations on a proper schedule ...



STI mode is "looked at" every scan of the program.



better would be:



STI mode is “executed” by the processor on each and every scan ...



specifically, the calculations for P and I and D are done each and every time the processor scans the PID rung with true logic ... in this mode, the system expects YOU (the programmer) to make sure that the processor only scans the PID rung with the proper timing ... specifically, the timing of WHEN the PID rung gets scanned should match the setting of the “Update Time” on the PID setup screen ...



disclaimer: remember that we’re discussing the PID for an SLC processor here ... the rules are different with the larger PLC-5 system ...
 
Last edited:
Ron...thanks for the info regarding the differences between SLC and PLC5 PID instructions. I have a bad habit of generalizing when it comes to these processors, and it's caused me to put my foot in my mouth yet again. I looked at all my SLC programs and found three written by a vendor and one that I wrote that violate the rule by using a timer/DN to condition the PID block. Now I guess I'll have to get my butt out on the plant floor and fix them. A question for you first:

I need my PID action to "freeze" when a motor stops turning, and pick up where it left off when the motor starts again. Can I do this by enabling the manual bit? And do I need to MOV the PV to the SP while in manual?

Thanks
Paul C.
 
Ron. Thanks...This really clears it up in my mind and makes even more sense now. {Did I ever tell you that "You da man!!!"?} Thanks Okie for hanging in on this thread.

Later....Todd
 
Also.. Before I get too far along...

Hi folks... Before I get too far along in my project, Could I get your opinion on my method of trimming my analog output to the slave drive. If you go back and look at my code you'll see that I plan on manipulating the offset to trim the output. At 1st I was trying to manipulate the rate, but thats when I ran into the issue of math over run faults. Is this an acceptable method?

Thanks and Later....Todd
 
response for OkiePC ...

Greetings Paul,



regarding the tendency to “generalize” when it comes to the Allen-Bradley PLC-5 and SLC-500 platforms ... you’re certainly not alone there ... while the two platforms are more similar than they are different, some of the biggest differences of all come into play with the PID instructions ... and there are MAJOR differences in this area ...



as for your setups that use an external timer to “trigger” the PID ... I think that you’ll find that the existing configuration acts more like a Proportional-only controller than anything else ... since the Integral action gets cancelled out each time the PID rung is scanned with false logic, the Integral term likely contributes little or nothing to the CV ... the Derivative action (if you’re using it) also usually acts weird with this “external trigger” setup ... you’ll almost certainly have to retune the loops once you correct the timing issues ... but once that’s done, you’ll probably see much more consistent operation ...



I need my PID action to “freeze” when a motor stops turning, and pick up where it left off when the motor starts again. Can I do this by enabling the manual bit?



in simplest terms, yes ... with the SLC platform, the PID instruction just quits driving the CV location while operating in the manual mode ... so “freezes” is a perfectly good word for the action involved ...



side trip: note that this is very different from the PID as used in the PLC-5 ... there the manual mode (actually there are two modes which can be considered “manual”) continues to drive the CV ... the value used for the CV comes from either the “Tieback” or from the “Set Output” setting – depending on which of the two “manual” modes is currently selected ... and just to make it even more interesting, the “Set Output” mode is usually called the “Software Manual” (SWM) mode when working with the PD-type control block ...



And do I need to MOV the PV to the SP while in manual?



this depends on your application ... but most probably not ... the big question is: what will you do with the SP once you leave the manual mode and go back to automatic? ... if the answer is simply: “put the SP back where it was originally” then there is probably little reason to change the SP while you’re in the manual mode ...



PAUL2.JPG




here we have a simple system which uses a “dummy” input to the PID ... from point A to point B the PV (red trace) is tracking the SP “right on target” at a setting of 4096 ... the CV is simmering along at 1638 from point M to point N ... at point B the SP is suddenly increased from 4096 to a new setting of 5734 at point C ... the Proportional action responds by increasing the CV from point N to point O ... the PV continues on from point B to point E ... remember that for this demonstration it’s just a “dummy” signal and cannot change ... the Integral action responds to the continuous error by ramping the CV up from point O to point P ... and now we come to your question ...



at point P the PID is placed in the manual mode ... notice that the CV simply “freezes” at its current value as it goes from point P to point Q ... then at point Q the PID is returned to the automatic mode ... notice that the Integral action picks up right where it left off and continues ramping the CV from point Q to point R ... if I understand your question, this is the action you want ...



at point R we try a slightly different approach ... again the PID is placed in manual mode ... but this time we also force the SP to take on the current PV value ... so the SP goes from point D down to point E ... meanwhile the CV remains “frozen” at its current value and continues on from point R to point S ...



at point S we return to the automatic mode ... but what good is automatic mode if we leave the SP at its “not-quite-right” setting of 4096? ... and so at point F we raise the SP back up to our desired setting of 5734 ... the PID responds to the sudden increase in “error” with a “bump” in the CV from point S to point T ...



now remember that I don’t know anything about your system ... but “smart money” says that you probably don’t want that annoying “bump” in the CV to occur each time you switch over from the manual mode to the automatic mode ... if so, then my best guess is that changing the SP while in the manual mode is probably just going to cause more trouble than it’s worth ...



now to close out with a brief discussion of the pitfalls of using an external “trigger” for a PID rung with the SLC platform ...



PAUL3.JPG




here we’ve started a test with our SP dialed in at 5734 ... the PV is a “dummy” which has been set for demonstration purposes at a constant 4096 ... we’ll keep our PID in the “TIMED” mode throughout the entire test ... when the test was started, the PID rung was being “triggered” once each 1.00 second by a timer’s Done bit ... if we run through the basic math involved with our “start test” conditions, we get E=SP-PV ... so 5734 minus 4096 gives 1638 for an Error signal ... if we multiply that by our Proportional (Kc) setting of 0.80 we get 1310 ... and that’s what the PID is cranking out for its CV reading as we start the test at point A ... and notice that our Integral action has been turned off by a Ti setting of 0.00 ... specifically, we’re using a Proportional-only controller for our “start test” conditions ... and also note that our improper “triggering” of the PID rung has no effect (pro or con) on our Proportional action ... because the Proportional action is instantaneous and is not “time related” ...



at point B we’ve dialed in some much-needed Integral action by changing our Ti setting to 0.50 ... but notice that the Integral action takes all the way to point C before it has any effect at all on the CV ... and even at that point, the Integral action is just a wimpy little increase of only 43 units ... we need more power ...



and so at point D we decide to scrap that improper external “trigger” arrangement for the PID rung ... and now look at our Integral action kick in and start ramping our CV signal up ...



summing up, the biggest problem with using an external “trigger” for a PID rung with the SLC platform is that the arrangement pretty much neutralizes any effect of the Integral term ... remember that the Integral action is “zeroed out” each time the rung is scanned with false logic ... and so then the Integral has to “start over” again each time the rung is scanned with true logic ... the poor Integral has a very hard time trying to make any headway at all with this type of arrangement ...



I hope this helps ... and thanks for bringing the subject up for discussion ...
 
Last edited:
Hi folks... Before I get too far along in my project, Could I get your opinion on my method of trimming my analog output to the slave drive. If you go back and look at my code you'll see that I plan on manipulating the offset to trim the output. At 1st I was trying to manipulate the rate, but thats when I ran into the issue of math over run faults. Is this an acceptable method?

Thanks and Later....Todd
I thought I'd try this again, in case someone hadn't seen it. I would appreciate any and all opinions or suggestions.

Thanks and Later....Todd
 
CLEARLY...

All posts made to this point are over Todd's head.

Gee, doesn't that seem to be the nature of Canned-PID Routines when one must be subjected to the math involved in the particular Canned-Routines.

There ARE better ways!

You can ALWAYS roll-yer-own!

That, however, requires that you understand how to handle math in a dynamic situation.

Damn, I've always wanted to take the time to develop an explanation for rolling-yer-own. It is, however, very extensive... very math-intensive.

Maybe...

PS...

This roll-yer-own, through ladder, can work fine if the speed/timing demands are not too great. If they are, then a specially PID routine might be more in order. If not, then roll-yer-own works very well!
 
Last edited:

Similar Topics

Been working with PLCs for a couple of decades, but almost 100% DirectLogic. Have a customer who wanted me to make a couple of simple changes to a...
Replies
3
Views
1,099
New to the EcoStruxure programming software (I'm an AutomationDirect guy) and I've been banging my head against the wall trying to figure out how...
Replies
2
Views
992
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,073
So I have a PID loop on an 1756-L61 running V17 software just for background. Also the PID PV is a pressure transmitter and the CV is speed sent...
Replies
1
Views
863
Hi All I'm using Cohen-Coon method to calculate initial PID parameters. So, I have Model Gain that has been calculated from live data. Could...
Replies
55
Views
30,976
Back
Top Bottom