You are on page 1of 9

PID Loop Implementation - Forums.MrPLC.

com Page 1 of 9

Greetings Bob ...


Sparky

Ive had a little bit of spare time ... heres what Ive been able to come up with so far ...
Group: MrPLC Member
Posts: 330
first of all, from your mention of the SWM (Software Manual) mode, it looks like youve
Country: United States
decided to use the PD-type control block for your PID ... this is fine perfect in fact ...
the only reason that I might recommend using the N-type control block instead would be
From: Charleston, SC
based on the fact that your plant might also use the older classic type PLC-5
processors for PID control ... (note that Software Manual mode would be called the
Set Output Mode if you had been talking about the older N-type of PID control
block) ...

you didnt specify which of the two available PID Equation settings that you intend to
use ... the newer Independent setting is the default and many people like it because
it is generally a little bit easier to tune than the Dependent form ... the basic idea is
that with the Independent setting, the three components of the controllers output
(Proportional action, Integral action, and Derivative action) are all separate
(independent) of each other ... specifically, you can increase or decrease the effect of
any one action without changing the effect of the others ... on the other hand, when
using the Dependent equation, any change in the Proportional setting will always have
a simultaneous effect on the Integral action and also on the Derivative action ... with all
of that having been said, it usually looks like the Independent equation is the better
way to go ...

but ...

regardless of everything that Ive just written, personally Id still recommend that you
bite the bullet and use the Dependent equation for this project ... heres the reason ...
most other PID controllers use this old-fashioned dependent-gains type of equation
instead of the new-fangled independent-gains system that sounds so attractive ... and
this includes the SLC and MicroLogix platforms and most other non-Allen-Bradley
brands of controllers too ... also, most experienced people who have developed a seat
of-the-pants-feel for PID tuning, have done so with the older dependent equation ...
and most published systems and recommendations for tuning are also based on the
older dependent equation ... this means that any more-of-this-and-less-of-that type
of advice that youre likely to receive is probably going to be based on the DIFFERENT
reaction of the older the equation ... so everything considered, Id go with the
Dependent equation if I were you ... still its your personal choice to make ... for most
systems, either equation will give the same degree of control ... specifically, there is
usually NO DIFFERENCE in the quality of control just usually a slightly easier or
slightly harder - job when it comes time to tune the loop for your systems
characteristics ...

moving right along ... you said:

QUOTE

I want to use a PID Loop Control. Any guidance for setpoints?

your use of the plural for setpoints is a little bit out of line ... heres the basic idea ...

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 2 of 9

there is only ONE setpoint for each PID loop ... with Allen-Bradley systems, the word
setpoint always means the target setting ... specifically, its the desired
temperature/flow/level/pressure/etc. that were trying to achieve with our PID
controller ... Im guessing that you originally used the word to mean the settings for the
tuning parameters and not to refer to the target setting ... if I understand your
project correctly, the setpoint will be your desired target of 50 degrees F ...

just so that everyone stays on the same page, here is a brief rundown of the MAIN
abbreviations that well be using in this project ...

SP = the Setpoint this is what we want ... (ex: our target/desired room
temperature is 50 degrees) ...

PV = the Process Variable this is what weve got ... (ex: our current/actual room
temperature is 59 degrees - too hot) ...

CV = the Control Variable this is what the PID controller is doing to the output device
(ex: increase the control valve signal from 31% to 33% for more cooling effect) ... note
that while it might seem logical, CV does NOT stand for Control Valve like some
beginners assume ...

and now we come to a fork in the road ...

if were using the recommended Dependent equation, the PID tuning parameters will
be:

Kc for the Proportional setting ...


Ti for the Integral setting ...
Td for the Derivative setting ...

but if were using the default Independent equation, the PID tuning parameters will
be:

Kp for the Proportional setting ...


Ki for the Integral setting ...
Kd for the Derivative setting ...

now before I run out of time, lets run through the basic mechanics of setting this PID
thing up ... keep in mind that all of the following information is based on several
assumptions (gosh I hate that word) about your system ...

one assumption is that the input signal (PV/room temperature) arrives at the PID as a
raw integer data value which ranges from 0 to 4095 ... if this assumption is not correct,
then you need to tell us exactly how the signal is set up before we go any further ... in
my example, Ive used N7:54 as the PV location ...

next we need to know how the input signal is scaled ... Ive assumed that your room
temperature transmitter puts out a 4.00 mA signal when the room temperature is 0
degrees F ... this would correspond with a raw data value of 0 at N7:54 ... Ive also
assumed that your room temperature transmitter puts out a 20.00 mA signal when the
room temperature is 500 degrees F ... this would correspond with a raw data value of
4095 at N7:54 ...

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 3 of 9

naturally these assumptions are almost certainly wrong ... for one thing, the wallpaper
would catch fire at a room temperature of 500 degrees F ... but I included these
examples to demonstrate the type of detailed information that well need in order to get
this thing working ...

my assumptions on the output signal will probably be more accurate ... the output signal
(CV/drive-to-the-valve) will leave the PID as a raw integer data value which ranges from
0 to 4095 ... in my example, this output signal will be sent to N7:75 ...

Ive assumed that your control valve accepts a 4.00 mA signal as a fully closed
command ... this would correspond with a raw data value of 0 at N7:75 ... Ive also
assumed that your control valve accepts a 20.00 mA signal as a fully open
command ... this would correspond with a raw data value of 4095 at N7:75 ...

again, if any of these assumptions are wrong, well need more accurate information
before we can get this thing working ...

moving along, here are some just getting started examples for discussion purposes ...
your addresses and settings will certainly be different ...

note to all readers: there are MAJOR (I repeat MAJOR) differences between how PID
controls are set up in the various Allen-Bradley platforms and sometimes even within
the same platforms ... in other words, the arrangement that Im showing here will NOT
work correctly in an SLC or MicroLogix system ... but thats another kettle of fish to be
fried another day ...

the first rung above shows a repeating trigger arrangement using an XIO for a TON
timers Done bit and the TON timer itself ... the timers Preset value determines the
cycles period ... well use the timers Done bit in the next rung as a trigger event to
force the PID into a regularly scheduled (tick-tock-tick-tock) operation ...

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 4 of 9

the second rung shows the PID instruction using a PD-type control block address
triggered by the timers Done bit as described above ...

the N7:54 Process Variable (PV) location shown is just an example ... in your system,
this COULD BE the location used by your room temperature transmitter AS LONG AS
the transmitters full-scale range of values runs from 0 to 4095 ... secret handshake: the
PID always expects its PV values to range full-scale from 0 to 4095 ... the PID can still
be made to work if this range is incorrect but it wont give the best possible control ...
if your input transmitter wont provide the required 0 to 4095 range, then you should tell
us about that in your next post ...

the Tieback setting has been entered as 0 ... this disables the Tieback/Manual
feature ... we can add this functionality later if you need it ... chances are that you won
need it at all ... lets just leave it turned off for now ...

the N7:75 Control Variable (CV) location shown is just an example ... in your system,
this COULD BE the location used by your control valve AS LONG AS the valves full-
scale range of values runs from 0 to 4095 ... secret handshake: the PID always outputs
its CV values to range full-scale from 0 to 4095 ... if your output device wont accept
this specified 0 to 4095 range, then youll have to program some type of math function
to properly scale the PIDs output value before presenting it to the output device ...

this is one of the two pages of settings for a PID using the PD-type control block ... note
that some versions of RSLogix5 have slightly different settings ... the entries that Ive
highlighted in yellow are the MUST SET entries that we need to work with to get
started ...

the PID Equation setting for Dependent has already been discussed above ... if you
decide to use the alternate setting of Independent please let us know ...

the Control Action setting specifies how the PID will mathematically calculate the
amount of Error ... for some people, the work Error means some type of fault has
occurred ... when the PID uses this word, it just means how-far-off-target-are-we? ...

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 5 of 9

here are the two possible selections for Control Action and what is meant by each ...

E=SP-PV ... suppose that we use this setting ... suppose that the PV (input) starts to
climb ... suppose that it keeps climbing higher and higher ... with this particular setting
for Control Action, the PID will eventually make the CV (output) start to fall
(decrease) ...

E=PV-SP ... suppose that we use this setting ... suppose that the PV (input) starts to
climb ... suppose that it keeps climbing higher and higher ... with this particular setting
for Control Action, the PID will eventually make the CV (output) start to rise
(increase) ...

basically the question that were asking ourselves here is this: which way do we want
the CV (output) to move in response to a steadily rising PV (input) signal? ... some
people needlessly confuse this simple issue by referring to one setting as direct acting
and to the other setting as indirect acting ... but then other people reverse those same
definitions ... one mans direct is another mans indirect ... personally, I refuse to
enter into that particular debate ... in the case of the cooling project at hand, the
E=PV-SP is PROBABLY the correct setting ... but ... if the control valve happened to
have a higher-signal-causes-lower-flow type of action, then the setting would have to
be reversed to properly control the systems operation ...

notice that the Update Time setting has been entered as 1 second and that this entry
exactly matches the 1 second cycle of the timers Done bit trigger event on the PID
rung ... this is probably the most misunderstood of all of the PID settings ... many
people tinker around with this one in a effort to speed up or slow down the response
of the PID during their tuning procedures ... this should NOT be done ... the basic idea is
that this internal setting (the Update Time) needs to match the external setting of
the PIDs trigger event ... if the two settings dont match, then any calculated tuning
values for the Integral setting and for the Derivative setting will be skewed ... and
(very important) those two settings will be skewed in OPPOSITE directions and in
DIFFERENT amounts ... Ive covered this particular topic in this thread for those who
want to know more about it ... there are quite a few related posts - so if you want the
whole story, dont just quit reading after the first one ...

so as Ive said, the internal and the external values must match each other ... now
the question becomes how fast or how slow - do we need to update the PID? ... the
basic answer is that fast enough is fast enough ... specifically, anything faster wont
buy us any better control ... but anything slower WILL degrade the control ... Im just
going out on a limb here and guessing that once per second is going to be plenty fast
enough for this particular project ... Im almost certain that this will be ok since you
mentioned that your existing control scheme is using an update of once each 30
seconds ... now if it turns out that my guess is too fast, then its not going to hurt
anything ... once we get the loop functioning, we might come back and fine tune this
setting ... in the meantime, lets go with a 1 second setting and get on with things ... if
you want to read more about this, then this thread might be interesting ...

the Engineering Unit Maximum setting should match the full-scale reading of your
room temperature transmitter ... Ive just guessed at a value of 500 for this one Im
almost certain that this will be too high ... in my example, the value of 500 would mean
500 degrees F ... just to nail this down for any beginners who might be reading along
with us, Engineering Units simply means Human Units ... in other words, were trying

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 6 of 9

to specify a number range that will be meaningful to us as


engineers/humans/operators/etc. ... but we cant just pick a number out of the air ... to
get the optimum control, we need the number that will match the full-scale reading of
the PLCs input signal ... for most PLC-5 systems this will be the human units reading
which matches the full-scale raw data reading of 4095 ... and so when a wide-open
signal of 4095 comes in, what number do we want our operator to see on his display? ...
well need to know the answer to that one, Bob, before we go much further ...

along the same lines, the Engineering Unit Minimum setting should match the low-
end reading of your room temperature transmitter ... Ive just guessed at a value of 0
for this one ... in my example, the value of 0 would mean 0 degrees F ... along the
same lines as the maximum signal, when a low-end signal of 0 comes in, what number
do we want our operator to see? ... and again, Bob, well need an answer to that one
too ...

for the Input Range Maximum setting, we need to know what the full-scale reading
will look like to the PLC in its raw data format ... for most PLC-5 input modules (like
the very common 1771-IFE), this is the 4095 value that Ive entered for my example ...
other temperature modules (like the 1771-IXE) give signals that are in different
ranges ... so here we need to know what specific input module youre using and
exactly how its been configured for operation in your particular system ... smart money
says that 4095 is the right number, but we wont know for sure until you get back to us
with more detailed information ...

along the same lines, for the Input Range Minimum setting, we need to know what the
low-end reading will look like to the PLC in its raw data format ... for most PLC-5
input modules (like the 1771-IFE), this is the 0 value that Ive entered for my
example ... again, we need to know what specific input module youre using and
exactly how its been configured for operation in your particular system ...

for most systems, the example values that Ive shown for Output Limit High % and for
Output Limit Low % settings will be correct ... specifically, these settings determine
just how high and just how low our PID is allowed to drive its CV (output) signal ...
in some systems, a wide-open signal of 100% might be much too high for safe,
reliable operation ... in those cases, the Output Limit High % setting might be dialed
back to (for example) just 75% or 80% to keep things from vibrating off the wall ...
along the same lines, the Output Limit Low % setting might be used to keep-the-
valve-cracked-open just a little bit so that the system will simmer along even when
the PID tries to close the valve completely ... since we cant see your system in
operation, tweaking little things like that are up to you, Bob ... but the more you can tell
us about your system, then the more we can help ...

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 7 of 9

the Setpoint setting is the desired target value that we want the PID to maintain ...
this will generally be expressed in the same Engineering Units format that we specified
for our scaling on the Configure screen ... somewhere along the line, youll probably
want to allow the system operator to make changes to this particular setting without
being forced to use RSLogix5, of course ... in most cases an HMI is used to manipulate
the value here ... as a learning thing do a right-click on the value and notice that a
tool-tip pops up with the correct address for the setpoint ... using my example, this is
PD9:0.SP ... the same tool-tip feature works for all of the entries on the PID screen
but be aware that some older versions of RSLogix5 had some bugs that gave the wrong
addresses for a few of the settings ... if you suspect that type of mischief, use the
Instruction Set Reference Manual to nail things down ...

anyway ... the value of 50 that Ive entered for the Setpoint in my example is your
desired target value of 50 degrees F as far as I understand your project ...

notice that I didnt highlight the A/M Station Mode setting for our just getting started
setup ... this setting is associated with the Tieback feature that we decided not to
activate for the time being ... just make sure that this setting stays at its default value
of Auto until/unless we get around to using it ...

that brings us to the Software A/M Mode setting ... this is something that you asked
about in an earlier post ... its a very handy feature that youre probably going to need
to use ... basically you can double-click this little box and select either the Auto or the
SW Manual mode ... in Auto mode the PID will be trying to control the CV (output)
signal ... in Software Manual mode youll be able to drive the CV manually by entering
the desired output value in the Set Output % setting at the bottom of this screen ...
(and please dont bother to ask me why they didnt keep these two go-together entries
side-by-side) ... youll DEFINITELY want to experiment with this particular manual
control feature during the earliest stages of setting up the PID ... basically, if things
start going crazy while youre tuning the loop, this is usually your quickest and
handiest method of forcing the output to a rock-steady signal of (for example) 15% to
settle things down ...

next we come to three entries that Ive highlighted in blue ... these are the tuning

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 8 of 9

parameters (theyre never called setpoints) that youll have to adjust in order to
tune the system for proper operation ... Im going to keep this particular tuning step
on the back burner for now ... but basically, youll have to put SOMETHING into the
Proportional Gain entry before the PID will start to put out any type of signal at all ... I
always just start with a value of 1 (as shown in the example) and make sure that the
PID is driving the CV in the correct DIRECTION for a rising and then for a falling
input signal ... this is part of commissioning the system before any serious tuning
takes place ... going just a little bit further, Id recommend that you leave the
Derivative Rate setting at 0 until much later in the game ... there is NOTHING wrong
with using Derivative action ... but its kind of like using garlic when you first learn how
to cook ... a little bit goes a LONG way especially if youre not used to using it ... as for
the Reset Time setting this will control the amount of Integral action from the
PID ... if youre using the Dependent equation (as Ive recommended) then you enter
a SMALLER number here to Increase the Integral action ... and you must enter a
LARGER number here to Decrease the Integral action ... by convention, entering a 0
value will turn the Integral action completely off ...

as I said, well come back to these tuning parameters later in the game after weve
confirmed that the PID is correctly set up and properly scaled for the input and output
devices that youre using ...

now for the Deadband setting ... Id strongly recommend that you leave this entry at
its default value of 0 until MUCH later in the game ... in fact, this will probably need to
stay at 0 permanently ... some people make a lot of mistakes with the Deadband idea ...
the most common misconception is to assume that the Deadband specifies a range of
acceptable values ... in other words, I need to keep the PV (input) within this range
or else! ... that approach wont work the way most people expect it to ... in simplest
terms, the Deadband range tells the PID: ok ... were close enough for government
work so dont change the output signal again until we leave this Deadband range ...
oops! ... if we dont change the output signal until we LEAVE the Deadband, then were
guaranteeing that the input signal will eventually drift outside of our intended range ...
nailing this down, the Deadband (if you use one at all) must be much tighter than your
required specification range ... if its not, then youre definitely going to exceed the
specification range that you require ... you can read more about the Deadband in this
post... in the meantime, just leave this one set for 0 and lets get on with more
important things ...

now to on to the Output Bias % setting ... notice that Ive entered a 0 into this one for
my getting started example ... but what youre going to find is that the 0 wont always
stay there ... specifically, this one is going to jump around on you as the system
operates in its various modes PARTICULARLY whenever you use the Software Manual
mode and the Reset Time setting remains at 0 ... secret handshake: the PID
sometimes uses this location behind your back as an internal math register ... let it do
that ... just BE SURE to remember that once youve cranked in a value for the Integral
actions Reset Time entry, youll need to come back here and type in a 0 again ... if
you dont, then the left-over value specified here in the Output Bias setting will be
ADDED TO the PIDs CV (output) signal ... and incidentally, this location is where well
eventually dial in the feed forward signal that our distinguished colleague Peter
Nachtwey will certainly be interested in using ...

now a reality check ... so far Im up to eight pages of typing and were just getting
started ... no complaints ... actually I enjoy this stuff - just in case you couldnt guess ...

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006
PID Loop Implementation - Forums.MrPLC.com Page 9 of 9

but notice that Ive only mentioned about half of the settings on the PID setup
screens ... and as for the settings that I HAVE mentioned, each one of them could use a
LOT more detail ... and we havent even started to tune the loop yet ... my point is this:
I personally consider this PID subject to be the deep end of the pool when it comes to
PLC knowledge ... now youve already told us that this is something of a critical system
that youre working on ... youre worried about faulting the system and so on ... well,
heres some friendly advice ... it might be a good idea to learn how to swim in a less-
threatening environment before you try jumping right into the deep end of the pool ...
well help where we can, but its still your neck thats on the block ...

heres just a suggestion: do you have (or can you put) a spare PLC-5 on the network
(Data Highway Plus or Ethernet) with your existing system? ... if you can, then consider
this approach ... suppose that you were to program a simple MSG (Message) instruction
to read the existing PLCs input signal (example: N7:54) and store it into your spare
PLC ... and suppose that you were to program the spare PLC with a PID to use that
input signal ... and suppose that once the PID in that spare PLC has calculated its
output, suppose that you were to program another simple MSG instruction to send that
output signal back over the network and into the existing PLC (example: N7:75) ... see
where Im going with this? ... the basic idea is that you could get all of your getting-
started-learning-PID exercises done with very little (if any) risk of faulting (or otherwise
affecting) your existing system ... once youve gotten everything nailed down and
properly tuned, THEN you could program the final working version into the existing
production PLC during a scheduled down-day at some time in the future ... I know
that this approach works because I frequently use it in the lab for my students who want
to see a quick demonstration of PID control but who dont have time to take the full
week-long PID course ...

I hope this helps ... I look forward to hearing from you soon ...

--------------------

http://forums.mrplc.com/index.php?showtopic=9376&pid=42085&st=0&#entry42085 10/23/2006

You might also like