# PID loops

D

#### David Lawton

(Originally posted Tue 12/09/97)
I tend to agree with David B. on this one. I have found that in process
engineering, where speed of response tends to be less time-critical, a PI
controller normally provides perfrectly acceptable performance.

Just a few thoughts about the good old D term.
First off, the derivative term can produce a "violent" controller output in
response to a
step input e.g. change of setpoint, because d/dt (step) = infinity when it
"steps".
One way around this is clearly to "rate-limit" the step input.
Other stuff to consider if you're that way inclined..........
By doing an open-loop step response and measuring K (gain), T1 (time to reach
10%) and T2 (time to reach 90% of steady state), it's possible to use this
numbers to determine "rule-of-thumb" values for P, Ti and Td.
where P=(1.2*T2)/(K*T1)
Ti = 2*T1
Td = 0.5*T1

The other important thing that needs careful consideration is the SAMPLING
TIME of the PID controller. Again, rul of thumb is Td/2.

You could get sexier and start calculating Kalman controllers and such things,
although my PID controllers tend to be PLC-based, with "built-in" function
blocks to carry out the PID function. However, I have written Kalman control
loops using C before now (PC-based) - but this was generally Study based
rather than industry based.

Anyone else care to join this debate............
Regards
David Lawton.

J

#### John Rezabek

(Originally posted Tue 12/09/97)
David,

We use derivative extensively in temperature control loops. Most modern
refineries are highly heat-integrated, so disturbances in the various
media used for preheat, cooling, reboilers, etc. are numerous. We use
DCS primarily for control, which offers a selection of PID algorithms
that avoid some of the pitfalls of "textbook" PID. One of our favorites
is "Integral Only Response to Setpoint Change". I'm not an algorithm
scholar, but as I recall this is not all that tough to implement in the
"velocity" form of PID, if you're rolling your own.

If you apply a contemporary PID loop tuning application (e.g. Protuner),
you might be suprised to find that a derivative term shows up quite
often in the "optimal" tuning. As Mr. Cowley very appropriately points
out, PID is often inherently incapable of being truly "optimal", since
there are always constraints, interactions, etc., outside of the "ideal"
SISO system. I think a good tuning package should at least offer some MV
(manipulated variable) specification like "10% MV overshoot", as well as
a diverse menu of PV / error optimization choices. Even with these
smarter packages, you frequently need to zero out the derivative term if
you know you're looking at a noisy flow loop as opposed to a slower
temperature or linear composition.

The "rules of thumb" that Servoboy offers look similar to Z-N open-loop
numbers. I've been taught that these are fine if you're aiming to
control a level (an integrating process, which Ziegler and Nichols used
to derive their version of "optimal") and you're OK with
quarter-amplitude damping. More often then not, in our industry we shy
away from "tight" level control, opting instead to use the surge
capacity of vessels to smooth downstream disturbances.

I'd be interested to learn how others administer and track PID tuning
changes. Can operators access tuning? Process supervisors? All
engineers? Do they log before / after data or any comments? In my
experience, loose control over these areas leads to fewer loops in
"auto" than there ought to be . . .

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

G

(Originally posted Tue 12/09/97)
Another way to eliminate the violent controller output in response to a
setpoint change is with the use of Velocity Feed Forward. This
term is calculated by doing a derivative calc on the Setpoint but
use the oposite sign of the error derivative, give the VFF term the
same gain as the error derivative, add this term to the others (P, I, &
D terms) and when there is a change in setpoint, the sepoint and error
derivative terms will cancel each other out, eliminating the controller
surge due to sepoint changes. The error derivative then only adds to
controller output when there is a change in error due to the process, not
the setpoint.

B

#### Bill Sturm

(Originally posted Tue 12/09/97)
I use derivative in motor velocity and position loops. What I have
found that I can use significantly higher gain if I damp it with
some derivitive. The control loop becomes very tight, but does
not overshoot or become unstable.

Derivitive seems to be the most useful when you have rapidly
changing conditions.

Bill Sturm

K

#### Kent Qi

(Originally posted Wed 12/10/97)
I agree that the derivative part should not be used in most PID control
loop unless you have to. In our plant, there are about 1000 PID loops
where mostly use PI only. However, we do have some pressure loops
use the derivative. For example, a split range pressure control loop uses
a very high derivative. It is a split ranged such that the output of the
controller will move the air injection valve if it is less than 50%, and will
move the vent valve if more than 50%. The pressure can be maintained
perfectly with the fast movement in the valve. With the split range, you
may argue that it is not a simple PID loop. But it is really works.

Theoretically, the derivative term can be used to compensate the time
delay in the process dynamics. Look at the PID tuning parameters from
either IMC method or the Direct Synthesis method (they are all belonged
to model based PID tuning ), the derivative term is the direct result of the
time delay.

Back to reality, I will not use the derivative for noisy measurements such
as flow loops. I will use it carefully in other situations.

Kent Qi
Process Control Engineer
Agrium Inc.

J

#### Jeff Lloyd

(Originally posted Thu 12/11/97)
Has anybody mentioned the fact that most computer based PID controllers filter the error before differentiating. I call the time constant of this
filter Gamma. Gamma can be tuned in some and is fixed in others.

I really like the IMC (Internal Model-based Control) theory for best understanding of controllers, modelling and processes. It gives me the best link between the theory I did as an undergraduate and the real world.
I have found it to be a most intriguing and refreshing approach to process control.

Does anybody else agree?
Does anybody want any info on this?
Mr Kent Qi, you have my attention, what is Direct Synthesis?

Rules of thumb for selecting PID gains depend entirely on the type of process, ie. lag only, time delay with lag, integrating, etc., so be aware of this when applying them.

Thank you everyone for your opinions and practical interpretations on PID.
They are really appreciated.

Regards

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

B

#### Bruce Durdle

(Originally posted Thu 12/11/97)
nother major constraint that has to be thought about when setting up
PID loops in the "real" world is the effect of changes in the
manipulated variable - tight regulation of the controlled variable
often requires that the MV is subject to very large swings. This is
especially so with level - because the level response is slow, fast
control action requires that flows used for manipulation are subject
to swings through 100% of range. Not the best if you are working
with a process where flow must be reasonably steady.

This seems to be an area where the wet industries have different
requirements from the position control experts. Unfortunately, most
of the available textbooks used by teaching institutions (at least in
the EE area) are written by the latter.........

Personally, D is a "no-no" unless there are special requirements.
With a DCS or PLC, the effect of the finite sample time can cause
problems. With temperature control loops using sensors directly
connected to input cards and capable of a wide temperature range, the
resolution of the sample can be significant if only a small range is
required, and cause relatively large bumps if D is used - so D is not
that good an idea on these loops, where process-wise it can be
used.

Regards,

Bruce.

by the latter and
Bruce Durdle
[email protected]

C

#### Claudio Pires

(Originally posted Tue 01/06/98)
Hi, all!
I have been to a startup and had to tune some PID loops.
I haven't needed to use the derivative gain...I, empirically, just set
values of proportional and integral parameters.
And what I have noticed is what I'd like to share with you...correct me
if I'm wrong...
The greater the proportional gain, the more 'highlighted' the error gets...
the greater the integral gain, faster is the response of your final
control element as it detects the error...
...I'm just trying to get some practical observations instead of all the
theory that I haven't seen people use...just imagining trend charts behavior...
How to empirically set PID parameters? ...not talking about Zigler-Nichols
and etc...

D

#### Don Baechtel

(Originally posted Wed 01/07/98)
I don't think that you have it quite right yet, but your getting there.
Think of the proportional gain as a scaling factor or conversion
between the setpoint and the PID output. In a perfect system with
no error, which is what you are trying to achieve, the proportional
gain Kp scales or converts the setpoint units to the output units.
Not enough Kp and you won't get enough output and the following
error will start to build. Too much Kp and the output will
overcompensate causing overshoot and possible oscillation or unstable
behavior. In a non-perfect system the Kp converts the error units to
PID output. How fast do you want or can your system respond to an
error of a given magnitude? The maximum amount of Kp you can use is
determined by your system's response time constant or "inertia".

The integral gain Ki is used to remove standing error.
Sometimes in real (non-perfect) systems there is some bias that keeps
Kp from diving the error to zero. These could be friction, analog
signal bias, gravity, etc. Ki is used to increase or decrease the
PID output over time until the error = 0. If a standing error
exists, Ki will continue to increase/decrease the output until the
error = 0. The magnitude of Ki will change how fast the output rate
of change will be. Unfortunately, Ki wants any error over time to
integrate to zero: any positive error must be matched by an equal
amount of negative error. Without any dampening factors, such as
friction, Ki will cause your system to overshoot and oscillate
or "hunt" about error = 0. Several techniques are used to minimize
this effect.

The derivative gain Kd is used as a dampening factor.
If the error increases rapidly, Kd will add to the PID output.
As the error decreases, Kd will subtract from the effect of Kp and
help prevent overshoot. The end effect of Kd is to increase the
frequency response of your system. The system will respond quicker
to disturbances or setpoint changes producing less error.
You will notice over some range increasing Kd will allow you to
also increase Kp without overshoot. But if you increase Kd too much
the noise in the system will be amplified by the derivative term
and cause you system to appear "nervous" or unstable.
In essence with all the PID gains you can not ask the system to
respond faster than its natural time constant or you will get a
somewhat unstable system.

Many people overlook the advantages of feedforward.
In a perfect system the error is always zero and the PID has an
output = 0 always. The feedforward term drives the controller
output to produce the proper output calculated from the setpoint
commands. With a proper calibrated feedforward term, the PID only
responds to unmodeled disturbances and other effects. Without a
feedforward the PID must generate the entire command output, which
means there must be some error, which means the system is not perfect.

There are some addition tricks used to minimize error due to integral
windup and other PID problems, but they are somewhat application dependent.

With the appropriate settings for feedforward and the PID gains your
system will respond quickly with minimal error and maximum stability.

S

#### Simon Martin

(Originally posted Wed 01/07/98)
Claudio,
I can speak empirically about controlling servo motors (1ms update rate), but the effects should be similar on other slower implementations (flame shields up just in case).

1) Proportional gain (Op = Kp * E)
The correction factor is directly proportional to the error. This gives the "tightness" of the control. If Kp is too low position control is "sloppy", if Kp is too high then system oscillates. Rule of thumb on a servo system: increase Kp until motor starts to "buzz", back off 25%.

2) Integral gain (Oi = Ki * SUM(E))
The correction factor is directly proportional to the sum of the errors. This is where implementations differ. The sum can be over a certain number of samples or can be continuous, either option can have an upper limit or be free. The implementation will affect greatly the stability of the system at border conditions (large errors, or errors over a long period). Under normal operating conditions the integral gain gives accuracy over long periods of constant operation as it accounts for error over time, unfortunately this causes overshoot. If you have a system with "rapidly changing" setpoints then try and keep Ki to a minimum. As a rule of thumb I always set Ki to 0 and if everything worked OK then I left it there, otherwise I crept it up until I reached the maximum permissible overshoot for the system UNDER A NORMAL WORKING CYCLE, or the error on the fly was small enough.

3) Derivative gain (Od = Kd * DELTA(E))
The correction factor is directly proportional to the change in error. If you have a "rapidly changing " system then Od should try to compensate for it, improving the reaction time. As a rule of thumb if this factor was necessary I set it at 1/8 of the P gain.

I usually found that manual tuning gave me better results than autotune routines, BUT that if you do have autotune routines then they can get you to a close starting position. Tuning can be done with your finger on the motor or listening (if you are in a quiet environment), but fine tuning needs an oscilloscope.

Simon Martin <[email protected]>

A

#### A. V. Pawlowski

(Originally posted Fri 01/09/98)
> ...I'm just trying to get some practical observations instead of all the
theory that I haven't seen people use...<

I don't want to start an argument, but let's not denegrate theory or
theorists. I have a lot of field experience and I DO use theory.
"Practical" methods are good, but not a substitute. In fact, many of
the best were derived from theory. I personally always want to know
how/why things work, both because I am curious and if I understand it,
maybe I can adapt the method to new situations/problems.

S

#### Simon Martin

(Originally posted Fri 01/09/98)
Dear Mr. Pawlowski et al,

Your point is well taken. I have been working in controls for the last 8 years now, unfortunately my background is not Electronics/Control based so my theoretical knowledge of controls is very basic, but the upside of the coin is that I can see things from a different perspective. Be that as it may, the only tool in my bag is experience.

I would like to learn the theoretical side of things, but as you can see by my mail address, this is easier said than done.

Can anyone recommend an educational organization that provides distance tuition in control theory, or some texts that would be applicable to my background? I have browsed some technical libraries (on-line and off-line) but the number of texts is either very restricted so I cannot find what I am looking for, or so vast that I don't know where to start. Help would be appreciated.

Simon Martin <[email protected]>

T

#### Timothy A. Haley

(Originally posted Fri 01/09/98)
Try the Instrument Society of America. They are offering internet based
courses and have several Independant Leaning Modules, Videos, Software,
etc. They can be found at:

http://www.isa.org

D

#### David Lawton

(Originally posted Fri 01/09/98)
Simon

It pretty much depends on what specific theory you're interested in.
I could mention a few books from my University days (note to the moderator -
I'm not on any form of commission here - okay?!!);

Control System Design Bernard Friedland ISBN 0-07-100420-3
Feedback Control Systems John Van de Vegte ISBN 0-13-313495-4

The Art of Electronics Horowitz & Hill

The control ones are pretty theoretical, but provide sound theory (the
Friedland book is my favourite) - note that neither is dedicated to PID
though.

Theory is one thing - experience is quite another. Sound theory is good, but
there's no substitute for a few years experience..........
David.

D

#### Derek Jones

(Originally Wed 01/14/98)
FAO: Simon Martin

I can highly recommend "CONTROL ENGINEERING" by Noel Morris;
McGraw-Hill; ISBN 0-07-084666-9

The factors that affect practical tuning of closed loop control
systems are as follows
2) Load inertia and capacity of system to overcome (capacity
response rate)
3) "Rigidity" of coupling through system & transportation delays
(Time Constants of system elements)
5) Susceptibility to internal noise

Often, the Derivative component is unnecessary in critically damped,
linear systems and can be wound out/ disconnected. (Exceptions may
occur in a] systems that are intentionally non-linear, b] overdamped
linear systems with excessive deadbands or transportation delays and
c] some positioning systems. In linear systems, careful scrutiny of
the degree to which transportation errors are present and the level of
steady state gain needed should be made. In systems of all types,
electrical and/or mechanical coupling shortfalls and one has to decide
if these are prompting an apparent but incorrect need for the Derivative
component). Reference Derivative has a legitimate role to play in
overdamped linear systems providing the need for overdamping has been
verified.

A good, practical and safe approach to tuning closed loops is to start
by de-gaining the controller by a known factor (F1) of between 100 and
1,000, setting the Proportional term to zero, setting the Integral term
1) If not already accomplished, scale the reset term to within +/- 10%
of operational calibration by calculation
2) Adjust the Proportional term to zero and the Integral term to maximum
(overdamped).
3) Run the system and set the controller to just under critically damped
by introducing a small (5%-20%) stepped change to the input signal (or
equivalent) and incrementally increasing the Proportional gain until the
reset term displays a slight tendency to ring. If the system remains
overdamped for all available Proportional values, reduce the Integral
term by a factor of 10 and repeat step 3), starting with the
Proportional term returned to zero each time.
4) Once set to just under critically damped, decrease the Proportional
term and increase steady state gain by factor F1. However, the
controller should only be given the gain the process requires. Practical
systems are usually comprised of elements capable of a resolution of
requires. (Generally, there is no point of trying to set a loop to
achieve stability and accuracy at 1/10,000 when the set point can only
be set to 1/100). The higher the system gain, the more critical will be
the coupling requirements and the more difficult the loop will be to
stabilise.

The response of a system to a stepped change provides information about
the system constants. Initially there is little change in response
(indicating the degree to which transportation delays and deadbands
exist).
The tangent of the steepest slope of the response curve is taken to be
the initial slope of a single exponential curve. The time interval
between the application of the step change and the point where the
tangent of the steepest slope intercepts with the initial value of the
output is taken as the transport lag of the system. "Ziegler and
Nichol's charts" show the transient response to a step change and
controller settings can be based on readings from these charts.

1) Proportional action only

Proportional bandwidth = RT x 100
-----------
% of scale

Where T = Transport Lag of the process
R = reaction rate of the process

The process reaction rate is determined as follows:

actual control change x 100
R = -------------------------------
control scale x time (t1)

For example, if temperature is being controlled and the controller is
scaled 0-750 Deg C, and the process reaction curve gives a temperature
rise, Theta, of 40 Deg C in a time t1 = 2 min, the reaction rate is

40 x 100
R = ---------- = 2.667 per cent/ minute
750 x 2

2) Proportional plus integral action

Proportional bandwidth = RT x 110
-----------
% of scale

Integral action time = 3.33 T

3) Proportional plus integral plus derivative

Proportional bandwidth = RT x 83
-----------
% of scale

Integral action time = 2T
Derivative action time = 0.5T

Care must be taken to ensure that, if used, analogue amplifiers do not
enter saturation and that error signals are not being limited or
clipped. There is only one good solution to induced noise - eliminate
the source. EM induction, misalignment and PSU shortfalls all fit into
this category and can only be remedied at source.
In the case of multiple or nested loops, loops closest to the control
device should be calibrated and stabilised first with any outer loops
disconnected.
Loops nested to levels greater than 3 may need special methods.

Best regards,
Derek Jones

B

#### Bruce Durdle

(Originally Wed 01/14/98)
FAO: > A good, practical and safe approach to tuning closed loops is to start
> by de-gaining the controller by a known factor (F1) of between 100 and
> 1,000, setting the Proportional term to zero, setting the Integral term
> high. Then follow these steps:

What is "de-gaining"?

Zero proportional term OK if it is "gain" - not such a good idea if
it is "Proportional Band".

> 1) If not already accomplished, scale the reset term to within +/- 10%
> of operational calibration by calculation

Not sure what is meant by this - is it the theoretical time constant
of the controlled system?

> 2) Adjust the Proportional term to zero and the Integral term to maximum
> (overdamped).

Again, check that integral term is "Minutes per Repeat", not "Repeats
per Minute".

<snip>
> 4) Once set to just under critically damped, decrease the Proportional
> term and increase steady state gain by factor F1. However, the
> controller should only be given the gain the process requires. Practical
> systems are usually comprised of elements capable of a resolution of
> only one decade better than the steady state accuracy the process
> requires. (Generally, there is no point of trying to set a loop to
> achieve stability and accuracy at 1/10,000 when the set point can only
> be set to 1/100). The higher the system gain, the more critical will be
> the coupling requirements and the more difficult the loop will be to
> stabilise.

What is the difference between "Proportional term" and "Steady-state
Gain"? In most of the controllers I have been involved with, there is
a gain or PB adjustment, an Integral Time or Reset rate adjustment,
and a Derivative Time adjustment. Some also have a Derivative Gain
setting.

(rest snipped)

One lesson I have obtained from this newsgroup is that for a very simple device the
humble PID controller attracts an awful lot of attention. Perhaps a
few references to basic practical control-oriented texts would be
worth adding to the FAQ list!

Bruce Durdle
[email protected]

J

#### Jeff Lloyd

(Originally posted Wed 02/11/98)
A few people have enquired about IMC - Internal Model-based Control.

The people to talk to are CICS Automation in Newcastle Australia.

http://www.cicsauto.com.au/

Or contact Sam Crisafulli [email protected]

I have only introductory knowledge on IMC. While at the course conducted
for my company by CICS, I was pleasently surprised with the link between
practical control systems, classical Laplace based theory and PID
controllers. I'm sure most of my collegues are of the same opinion.

I will attempt to summarise it. Model based control as presented
demonstrates that by developing a model for your controlled plant, you can
determine useful PID gains directly using mathematical formulae. They
determine these formulae by building a model of the process then effectively
'inverting' it. Sounds a bit theoretical doesn't it? It works because the
system is dynamic and has feedback. It I always thought you should be able
to do this .

Using a manual step change and observing the output you can determine
Process gain, integration (if applicable), lag, time delay, etc. Using this
data in appropriate formulae you determine proportional gain, integral gain
and derivative gain (and its associated gamma).

The formulae have been derived especially for different types of plant. For
example there are formulae for a process with proportional gain and lag
only, different formulae for a process that integrates and different again
for processes with time delay. I have attached an Excel Spreadsheet with
these formulae in them to give you some idea about what I talking about.

I have also written a Visual Basic 5 application that simulates a PID
controller and some basic processes. It demonstrates the effectiveness of
the formulae. I will send you this if you wish, just let me know if you
have VB5 or not. If you don't, I'll have to send you a complete VB setup
(approx 1.6MB).

Regards

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

P

#### Paul Salessy COTEMS

If it's never too late, read the article page 15 in the Control Engineering Europe of Jan/Feb 2000 or go to our web site at the address:
http://www.cotems.com
Our Graphidor has been developed 22 years ago to give the operators a practical tool without calculations, after we have used multivariable control with all the theory need for.
Regards.
.

J

#### jmGiraud

Thanks to all of you from the list.
You look sound and solid, for sure.
Coming back to the object, others would approach diiferently, mostly in two ways.

1. the Lead/Lag is also a kind of PID.
It works. In simple words, this control algorithm is one that distorts first and reshapes after. In this way, it has lesser influence on the overall loop behavior than the PID. This is why this algorithm has low overshoot (that can be overrided) and fast recovery.
It absorbs a sizable chunk of the dynamics of the entire system.

2 .whereas the project is a mass balance one,
the technical solution includes the evaluation of the calorical mass to dry the coal. That done,
infeed the signal into a feedforward loop.
A feedback from a relative humidity XTR must be included in the loop.
[email protected]

K

#### Kent Qi

I agree that the derivative part should not be used in most PID control loop unless you have to. In our plant, there are about 1000 PID loops where mostly use PI only. However, we do have some pressure loops use the derivative. For example, a split range pressure control loop uses a very high derivative. It is a split ranged such that the output of the controller will move the air injection valve if it is less than 50%, and will move the vent valve if more than 50%. The pressure can be maintained perfectly with the fast movement in the valve. With the split range, you may argue that it is not a simple PID loop. But it is really works.

Theoretically, the derivative term can be used to compensate the time delay in the process dynamics. Look at the PID tuning parameters from either IMC method or the Direct Synthesis method (they are all belonged to model based PID tuning ), the derivative term is the direct result of the time delay.

Back to reality, I will not use the derivative for noisy measurements such as flow loops. I will use it carefully in other situations.

Kent Qi
Process Control Engineer
Agrium Inc.