# PID loops

R

#### Robert Wedlock

(Originally posted Fri 11/07/97) Howdy!

I've just automated a 50 foot long rotary kiln for the drying of
coal. Now I am deeply researching PID loops. I need to adjust a
gas valve to maintain a set point temperature coming out of the
dryer... I was wondering if anybody might be able to send me any
PID setting that they know have worked and maybe a little about
the application they were in. I'm thinking I need to have a large
derivative term, small integral term and somewhere in the middle
for the proportional. But I'd like to study some examples.

This is a SLC 5/03.

THANKS!

S

#### Steven Landau

(Originally posted Fri 11/07/97)
This is the way I do it.

1) Set I & D to minimum (SLC cant go to zero)
2) Increase until it just starts to oscillate
3) Reduce gain to 1/2 of oscillation Gain
4) Set I to 2 X period of oscillation
5) then only if required set D to 1/8 of I value.

This is from the help in RSLOGIX500 software it usually works fine
for me.

If the loop off of perfect tuing is costing big \$\$ if lost efficiency,
they spent the money to buy Loop tuning software.

Check to make sure your actuator (output device) is linear. If there
is any backlash in the valve actuator, or control acutator, check this
by plotting controller output vs. measured variable on XY in MMI.
If you get a circle then this may be your problem.

This is a "non math" method I use for loop tuning.

Omega Catalog (temperature) has a similar method listed.

Steve

A

#### Alfredo Espinosa

(Originally posted Fri 11/07/97)
Robert,

You can get information and many examples about PID in:

1) Hang, Lee, Ho, "Adaptive Control", (ISA, 1993)

2) Rovira, Murril, Smith, "Tuning Controllers for setpoint changes",
(Control Engineer, Dec. 1969), pp. 67-69

3) Arruti, Flores, "Introduccion al diseño de controladores PID
digitales (1)", (Automatica e instrumentacion, 1986), pp. 155-159
(In spanish)

4) Stephanopoulos, "Chemical Process Control", (Prentice Hall, 1984)

5) Igermann, "Digital Control Systems", (Spring-Verlay, NY 1981)

6) Kraus, Myron, "Self-Tuning PID Controller Uses Patern Recognition
Approach", (Control Engeneering, Jul. 1984), pp. 106-111

Alfredo Espinosa Reza
Instituto de Investigaciones Electricas

J

#### Jeff Goldsmith

(Originally posted Fri 11/07/97)
Robert:

I think that you're more likely to have most of the control
coming from integral action (reset), with some proportional
action (gain), and little or no derivative action (rate).

While the Allen-Bradley PLC-5 offers the ability to select
between "independent" and "dependent" PID equations, the PID
instruction for the SLC-5/03 and SLC-5/04 uses a "dependent"
equation, where reset and rate actions are proportional to
the gain action. This makes it difficult to get good control
when integral control is dominant.

I've had very good results recently using my own math in CPT
instructions to do PID control. It basically consists of a
subroutine that runs at an interval determined by a transition
of one for the bits in the S:4 real time clock. I do an IIM to
gain and reset terms, and apply limits the reset term. For
"bumpless" auto/manual operation, I add the two terms to get the
control output when in auto, and I subtract the gain term from
the control output to set the reset term when in manual. Then
I do an IOM to set the analog output.

If you'll send me your fax number, I can send you a copy of the
code.

Jeff M. Goldsmith, PE
Ionics Incorporated
Watertown, MA, USA

G

#### Gene Giltner

(Originally posted Mon 11/10/97)
Robert

Why not take it one step farther? Set the temperature setpoint to
reduce the moisture variations of the coal. Measure the moisture
content of the coal as it is being dried and send supervisory setpoints
to the temperature control loop. I just finished a rotary dryer taht was
very well instrumented. At that dryer application we reduced the
moister variations by 60%.

By the way, to tune the loop get a ExpertTune from Allen-Bradley.

Gene

M

#### Mitch Carr

(Originally posted Mon 11/10/97)
I first must assume this is a motor actuated rotary valve of some
kind rather than a solenoid valve.

A 'large' derivative term might just be exactly what you DON'T want.
Consider that an Integralerivative ratio greater than 4:1 is almost
guaranteed to oscillate. Next, look for the presence of a dominant
transport lag. In a lot of gas fired air heating applications there
is transportation of hot air to the sensor. The time taken for the
air to reach the sensor causes a dominant lag with no dissipation in
heat - Derivative will kill you if this is the case. Whereas Derivative
is of great benefit in conduction heated systems (nice and linear)
you will actually set up an oscillation by virtue of the Derivative
term. The next thing you must consider wrt gas heated systems is the
dynamics of the valve. Derivative may ask for output (actuator)
changes that the mechanics just cannot achieve. We won't even talk
backlash.

You probably need a large Prop Band and an Integral term about twice
the motor travel time as a starting point. If you can throw the loop
into oscillation, great, the period of oscillation can be used as the
Integral term and then just fiddle the PB until you get it right.

Regards,
Mitch

D. Mitchell Carr, Strategic Marketing Manager
Eurotherm Controls Inc

J

#### Jeff Goldsmith

(Originally posted Thu 11/13/97)
Robert:

One thing that you must be careful with is the impact of larger
tuning parameter settings in a PID controller. It's often
confusing (this is very true for the Allen-Bradley PID instruction)
whether a larger number represents more control action or less
control action.

The proportional term is usually called "proportional band" or
"gain". These have reciprocal actions, and the typical
relationship is PB=100/Gain. For PB (the unit is usually percent),
an increased value represents less control action. For Gain, an
increased value represents more control action.

The integral term is usually called "reset", "resets per minute",
or "minutes per reset". The latter two are reciprocals, while
the first could be either. For R/M, an increased value represents
more control action. For M/R, an increased value represents less
control action.

It's important to study your controller documentation carefully.
The A-B PID instruction supposedly uses Gain and M/R, so big
numbers represent increased proportional action and decreased
integral action. However, because the SLC-5/03 PID instruction
uses a dependent PID equation, you can't get much integral action
if the Gain parameter is small.

Gain and Resets/Minute. It's so much less confusing when a
larger number represents more control action, and zero represents
no control action.

Jeff M. Goldsmith, PE ([email protected])
Ionics Incorporated
Watertown, MA, USA

J

#### Jeff Lloyd

(Originally posted Fri 11/14/97)
I would recommend that you investigate the Internal Model Control
methods for a truly effective understanding of what you do when you
tune PID controllers. I recently attended a course on the subject
run by the good people from CICS (Newcastle, Australia). It
reawakened my interest in some of the theory that I thought was only
useful to pass an engineering degree.

How would you like to fine-tune your controller with one parameter
instead of three? Email me if you want a basic overview. If you're
serious give CICS a call...

You can find CICS at:
http://www.cicsauto.com.au/Enhanced/frame.html

Regards
Jeff Lloyd
:::: Electrical Instrument Engineer, Mackay Sugar, Farleigh Mill
:::: Farleigh Via Mackay, Queensland 4741, Australia
:::: http://www.home.aone.net.au/jefflloyd/

M

#### Mitch Carr

(Originally posted Thu 11/13/97)
> To anyone out there who's coding PID: Please, Please, Please use Gain and Resets/Minute. It's so much less confusing when a larger number represents more control action, and zero represents no control action. <

Jeff,
With all due respect, I haven't seen it done this way in years - at least not with respect to temperature PID. For a start, it is *P*ID, not *G*ID. Prop Band has classically been in percent of span which goes back to the old puff and blow systems and all that mechanical yuck. At least in temperature we have seen that span is pretty cruel since it is based on sensor range and thermocouples don't die at convenient even multiples of ten. For this reason, you are seeing more and more instruments with Pb in engineering units. Gain may be sensible as well but Gain, by definition is not Prop Band but the inverse. As for Resets per minute ... If the controller has automatic Reset then OK, express it in Resets per minute but heck, again it is P*I*D and I is Integral Time Constant and time constants are expressed in seconds or minutes.

Derivative managed to escape all this, probably because it is such as new concept (only thirty or forty years) ;-) but then it all comes down to a matter of interpretation. I do have an engineer who, at one time, thought it stood for 'Pelvic Inflamatory Disease'.

Cheers,
Mitch

D. Mitchell Carr, Strategic Marketing Manager
Eurotherm Controls Inc

K

#### Kurt O. Monnig

>Gain and Resets/Minute. It's so much less confusing when a
>larger number represents more control action, and zero represents
>no control action.

>Jeff M. Goldsmith, PE ([email protected])

Great Idea!

For those of us who are not theory purists, it is a LOT easier to understand, use and explain when implemented in this fashion:

Just think of it as three radio dials - adjust the Gain dial until you are close. Use the Integral dial to get closer. If you need faster response, turn up the Derivative dial.

When you are under pressure to get the line running, this makes life easier.

Kurt O. Monnig, CMfgE
Automation Horizons, Inc.
[email protected]

J

#### John Rezabek

(Originally posted Thu 12/04/97)
> Just think of it as three radio dials - adjust the Gain dial until you are close. Use the Integral dial to get closer. If you need faster response, turn up the Derivative dial.<

Kurt,

derivative more in terms of ensuring less overshoot.

My favorite analogy for derivative is the ferry boat driver (who aims
for zero overshoot). As he approaches his destination / docking point,
he throws the engine into reverse (forgive me for my ignorance of the
proper nautical terms). This is how derivative works. Yes I suppose
the principle allows the ferry driver to make his crossing more
quickly ...... but only in a zero-overshoot or minimal overshoot
scenario.

Derivative action works off the rate-of-change of the error (Setpoint
minus PV). When the PV (controlled variable) is approaching setpoint,
the error rate of chage is negative (its "sign" is negative - the
error is getting smaller). So when the PV is approaching setpoint, the
derivative term acts to "back off" on the manipulated variable. When
the PV is moving away from setpoint, the derivative term adds more MV.
The steeper the approach toward setpoint, the more derivative "puts on
the brakes".

Regards,
John Rezabek
[email protected]
BP Oil Lima Refinery

M

#### Mitch Carr

(Originally posted Thu 12/04/97)
John Rezabek wrote:
> derivative more in terms of ensuring less overshoot.

Ah, the pitfall. John, it is common for people to believe D is for
overshoot and for many years it was all most of us had. Nowadays we
have a technology base that can differentiate large signal response
from small signal response. Derivative has a great stabilizing
effect even when you look at the Bode plots (theory works this time).
To use it effectively for overshoot you also have to seriously
methods now for overshoot. The Fuzzy folks create phantom setpoints
or use setpoint ramping while others restrict or switch on the
various terms at intermediate points in an attempt to curb overshoot.
We have a method I can't describe that allows you to 'tune' your
overshoot but all of these techniques work pretty well. More than
their usefullness to curb overshoot, they allow you to really crank
down on the PID terms to give radically improved small signal
response.

Regards,
Mitch

D. Mitchell Carr, Strategic Marketing Manager
Eurotherm Controls Inc

S

#### Scott Efting

(Originally posted Thu 12/04/97)
John

It's been my experience that derivative that operates on the error between
setpoint and the process signal is not practical when you have setpoint that
varies. Every time you change the setpoint the D section see this as a
rapidly changing error and gives a big kick to output causing the process to
become unstable. Derivative that operates on only how quickly the process
variable is changing is much more effective. This type aids on setpoint

Scott Efting
Process Instructor
Consummers Energy

V

#### Vitor Finkel

(Originally posted Fri 12/05/97)
>derivative more in terms of ensuring less overshoot.
>
>My favorite analogy for derivative is the ferry boat driver (who aims
>for zero overshoot). As he approaches his destination / docking point,
>he throws the engine into reverse (forgive me for my ignorance of the
>proper nautical terms). This is how derivative works. Yes I suppose
>the principle allows the ferry driver to make his crossing more
>quickly ...... but only in a zero-overshoot or minimal overshoot
>scenario.

Sorry, but from my point of view, your example matches better
a feed-forward then derivative action.

>Derivative action works off the rate-of-change of the error (Setpoint
>minus PV). When the PV (controlled variable) is approaching setpoint,
>the error rate of chage is negative (its "sign" is negative - the
>error is getting smaller). So when the PV is approaching setpoint, the
>derivative term acts to "back off" on the manipulated variable.

Not exacly, it does what it is intended to do, regardless of "approaching
set point" or not. It does not notice how far away from set point you are.
It only notices the speed of change and it's direction. If it is changing
upwards, Derivative says go down, if it is changing fast, derivative says
go qwickly the other way. If changes are really slow, derivative don't care
about it. When the error is Positive, derivative "correction" is negative,
and vice-versa, regardless of error size, it depends upon error propagation
speed only, to put it bluntly, IMHO.

>When the PV is moving away from setpoint, the derivative term adds more MV.
>The steeper the approach toward setpoint, the more derivative "puts on
>the brakes".

The Stepper it goes away from the set-point, derivative says come back here,
don't go away. It tries to counteract any qwick changes of the variable.
The faster the change, the stronger the derivative action. Always pulling
on opposite direction to variable speed, always trying to reduce the speed
of output change, regardless of the fact that error is positive or negative.

Vitor Finkel
P.O. Box 16061
22222.970 Rio de Janeiro Brazil

J

#### John Rezabek

(Originally posted Fri 12/05/97)
Dear Vitor,

You are correct that my analogy is flawed . . . for the ferry boat pilot
doesn't reverse his engines in the midst of his crossing, when his
"error-rate-of-change" is easily greater or equal to that when he's
approaching his destination.

Close to shore, however, he would be reversing them "more" if he were
approaching fast, and "less" if he were approaching slowly, etc. A
little like derivative anyhow. Haven't heard any better analogies have
you?

> regardless of "approaching set point" or not. It does not notice how
far away from set point you are

You overreact a bit to my use of "approaching"; I simply mean "moving
toward"; "when the error is getting smaller". Inasmuch as the error and
the sign of the derivative depends on the setpoint, derivative "cares"
about it. Otherwise I think we're saying the same thing.

> Always pulling on opposite direction to variable speed, always trying
to reduce the speed of output change

> When the error is Positive, derivative "correction" is negative, and
vice-versa

hmmm this is hard to describe without a good illustration. Imagine a
trend of setpoint and PV in closed loop, underdamped response, positive
SP change. Divide the trend into four initial regions, with a boundary
each time PV crosses setpoint and each time the de/dt is zero. (Four
divisions per "cycle") If we tabulate the "signs" of each term ( P , I ,
D ) in these regions:

Region I: e positive; int(e)dt positive; de/dt negative (initial move
"up")
Region II: e negative; int(e)dt negative; de/dt positive (initial
overshoot)
Region III: e negative; int(e)dt negative; de/dt negative (quarter-wave
Region IV: e positive; int(e)dt positive; de/dt positive (quarter-wave
"undershoot")

I'm not sure about the "sign" of the integral per se; but I think what I
say is true of the "incremental" contribution of the integral term.

These "regions" repeat each cycle. Half the time, the sign of the
derivative term is the same as the proportional term (and the error).
While I also like to think (as you state) that derivative always resists
movement away from setpoint, it seems that this isn't always the case??
Half the time its sign is the same as the error...

Best Regards,
John Rezabek
[email protected]
BP Oil Lima Refinery

V

#### Vitor S. Finkel

(Originally posted Mon 12/08/97)
>You are correct that my analogy is flawed . . . for the ferry boat pilot
>doesn't reverse his engines in the midst of his crossing, when his
>"error-rate-of-change" is easily greater or equal to that when he's
>approaching his destination.
>
>Close to shore, however, he would be reversing them "more" if he were
>approaching fast, and "less" if he were approaching slowly, etc. A
>little like derivative anyhow. Haven't heard any better analogies have
>you?

Dear John,
Sorry, can't help you at that. Out of better analogies for the moment.

>> regardless of "approaching set point" or not. It does not notice how
>far away from set point you are

>You overreact a bit to my use of "approaching"; I simply mean "moving
>toward"; "when the error is getting smaller". Inasmuch as the error and
>the sign of the derivative depends on the setpoint, derivative "cares"
>about it. Otherwise I think we're saying the same thing.

Derivative alone depends only on error speed, not on error magnitude.
It doesn't care if error is getting smaller or bigger. What you are
describing is the behaviour of the Derivative + Gain interaction.

>> Always pulling on opposite direction to variable speed, always trying
>to reduce the speed of output change

>> When the error is Positive, derivative "correction" is negative, and
>vice-versa

I dont think so. Where error ( positive or negative ) is going up,
derivative pulls it down, and converselly.
It doesn't mind the error amplitude or sign, instead of to error it
really reacts to speed and direction of measured variable, not to the
error.

>hmmm this is hard to describe without a good illustration. Imagine a
>trend of setpoint and PV in closed loop, underdamped response, positive
>SP change. Divide the trend into four initial regions, with a boundary
>each time PV crosses setpoint and each time the de/dt is zero. (Four
>divisions per "cycle") If we tabulate the "signs" of each term ( P , I ,
>D ) in these regions:

>Region I: e positive; int(e)dt positive; de/dt negative (initial move
>"up")
>Region II: e negative; int(e)dt negative; de/dt positive (initial
>overshoot)
>Region III: e negative; int(e)dt negative; de/dt negative (quarter-wave
>Region IV: e positive; int(e)dt positive; de/dt positive (quarter-wave
>"undershoot")

Sorry, now you've got me completelly lost...

>I'm not sure about the "sign" of the integral per se; but I think what I
>say is true of the "incremental" contribution of the integral term.

Integral slowly pulls variable towards set-point, reducing error.
Derivative does not recognize error, but try to compensate any sudden
changes in variable absolute value.
If you compare your variable to a boat in the middle of a lake, derivative
could be the water resistance (drag). The faster you try to go, the more
it will resist you, werever you are going to, approaching or getting away
from docking point, it doesn't care. Move slowly if you don't want to feel
derivative in action.

>These "regions" repeat each cycle. Half the time, the sign of the
>derivative term is the same as the proportional term (and the error).
>While I also like to think (as you state) that derivative always resists
>movement away from setpoint, it seems that this isn't always the case??
>Half the time its sign is the same as the error . . .

Sorry, I think I diverge here. "Derivative always resists movement".
(Period)
It doesn't care if movement is away or towards set point. Resistance
will be larger when PV change ( speed ) is larger, regardless if
PV is approaching or going away from set-point.

Take Care, I've seen as many discussions on P,I,D behaviour as on WINDOWS
( any flavour ) against any other operational system as to be adequate
for Control.

Vitor Finkel [email protected]
P.O. Box 16061 tel (+55) 21 285-5641
22222.970 Rio de Janeiro Brazil

A

#### Alan Cowley

(Originally posted Tue 12/09/97)
Vitor, John

I am following with interest your discussion on the correct way to
understand the operation of the classic PID loop controller, with
endless PID discussion wars is well put - I hope my thoughts below
do not stir controversy

I suggest that a large part of the difficulty is directly due to the
fact that the PID controller is a theoretical model for MAINTAINING
a steady state. In this case a deviation of the measured variable
from its desired (steady) value is corrected by changing the value
of a (single) controlled variable.

In this situation the first intuitive action is to change the
controlled variable in the direction that will oppose the detected
change in measured variable and by an amount that is proportional to
the error - this is Proportional Action.

The second intuitive action is to compensate for the fact that with
Proportional Action alone there can be no static correction without
a static error. Therefore PA on its own will frequently result in an
offset between the desired value and the measured value. This is
corrected by "re-setting" the controlled variable to the point where
the (average) error is returned to zero. This is done by the
Integral Action term.

The third intuitive action is to "notice" when the error is changing
and to try to "anticipate" the control action that will be
necessary. This is the function of the Derivative Action term, a
primitive type of feed-forward.

The whole concept relies on the premise that the system under
control is (approximately) linear and that any deviation of
measured value from desired value is due to an unwanted disturbance
to the system under control.

When this second assumption is not correct, as in the case where a
sudden change in desired value (setpoint) is deliberately made, the
PID controller is out of its element. The degree to which it can
cope depends on the particular characteristics of the system under
control and the compromise which the control engineer makes in
setting the three control terms.

When the MAIN goal of the control system design is to handle
deliberate changes to setpoint the PID controller needs a lot of
help! Typically the measure of "goodness" of control in this case
has to do with the trajectory traced by the measured variable in
reaching the new setpoint.

While minimum time to reach and remain within the new target
measurement band may be the important parameter it is not always so.
The "best" trajectory may be the one that achieves the change with
least energy; least plant stress (eg thermal stress); least lost
product - or a specific shape of measured variable/time graph. In
most cases trajectory control needs a more complex model-based
controller (of course the PID is itself a simple model-based controller).

The particular analogy (or system) used in thinking about the issues
will tend to shape the conclusions reached, but the basic principles
remain the same. The "docking boat" analogy suffers from the
difficulty that there are TWO controlled variables, speed and
position, which BOTH have to be brought to pre-defined setpoints at
the same time. The difficulty is compounded by the additional fact
that one of these controlled variables is the derivative of the
other! This is the test of a Master Mariner!

Hope this helps,

Alan Cowley
Process Innovation & Research
Sydney, Australia

D

#### David B.

(Originally posted Mon 12/08/97) We almost never use derivative action in our PID loops. Because
the derivative action is proportional to the change in the error
signal, the smallest noise spike in the process variable or
instaneous setpoint change could result in a huge swing in the control
action. As a result while derivative action seems great in theory,
it can often give disastrous results in practice.

I would be interested in hearing about other engineer's experiences
with derivative control. What applications has it proved successful?
What applications has it resulted in instability?

C

#### Carl Lemp

(Originally posted Tue 12/09/97)
I also never use derivative on fast acting loops because the tuning
becomes so touchy. However, a small amount of derivative can help
eliminate overshoot when trying to tune the inner loop of a cascade
temperature controller on a batch chemical reactor.

Carl Lemp

M

#### Mitch Carr

(Originally posted Tue 12/09/97)
> We almost never use derivative action in our PID loops. Because
> the derivative action is proportional to the change in the error
> signal, the smallest noise spike in the process variable or
> instaneous setpoint change could result in a huge swing in the control
> action. As a result while derivative action seems great in theory,
> it can often give disastrous results in practice.

You are absolutely correct --- depending upon the process.

> I would be interested in hearing about other engineer's experiences
> with derivative control. What applications has it proved successful?
> What applications has it resulted in instability?

It is actually quite simple. Any process which is driven from a motor or mechanical actuator such as an extruder screw, haul-off, etc will not benefit from Derivative. First, Derivative lift will probably be eaten by the lags in the mechanical devices. Second, the Derivative action will cause excessive wear.

Any process which behaves as a dominant transport lag will probably go into oscillation because of Derivative. For example, a fast heater in an air stream where the thermocouple is far downstream. A thickness loop for extruded material where haul-off determines thickness - this is pure lag with no time constant whatsoever.

Processes which can be nicely modeled as second or first order systems with no dominant lag are best for Derivative benefit. A simple example is a heater. Virtually all electrically heated
temperature control loops which do not involve fluid flow can benefit greatly from Derivative

My experiences are mostly in temperature control. I am sure others have experiences in other areas.

Regards,
Mitch

D. Mitchell Carr, Strategic Marketing Manager
Eurotherm Controls Inc