# PID Control Theory

Ηλεκτρονική - Συσκευές

15 Νοε 2013 (πριν από 4 χρόνια και 5 μήνες)

110 εμφανίσεις

PID Control Theory

What is PID control?

PID can be described as a set of rules with which precise regulation of a closed
-
loop control system
is obtained.

Closed loop control means a method in which a real
-
time measurement of the process
being controlled
is constantly fed back to the controlling device to ensure that the value which is
desired is, in fact, being realized.

The mission of the controlling device is to make the measured
value, usually known as the PROCESS VARIABLE, equal to the desired value,

usually known as the
SETPOINT.

The very best way of accomplishing this task is with the use of the control algorithm we
know as PID.

In its basic form, PID involves three mathematical control functions working together: Proportional
-
Integral
-
Derivative.

The most important of these, Proportional Control, determines the magnitude
of the difference between the SETPOINT and the PROCESS VARIABLE (known as ERROR), and then
applies appropriate proportional changes to the CONTROL VARIABLE to eliminate ERROR.

Ma
ny
control systems will, in fact, work quite well with only Proportional Control.

Integral Control
examines the offset of SETPOINT and the PROCESS VARIABLE over time and corrects it when and if
necessary.

Derivative Control monitors the rate of change of

the PROCESS VARIABLE and
consequently makes changes to the OUTPUT VARIABLE to accomodate unusual changes.

Each of the three control functions is governed by a user
-
defined parameter.

These parameters
vary immensely from one control system to another, and
, as such, need to be adjusted to optimize
the precision of control.

The process of determining the values of these parameters is known as PID
Tuning.

PID Tuning, although considered "black magic" by many, really is, of course, always a well
-
defined
techn
ical process.

There are several different methods of PID Tuning available, any of which will
tune any system.

Certain PID Tuning methods require more equipment than others, but usually
result in more accurate results with less effort.

The
P

stands for p
roportional control,

I
for integral control and
D

for derivative control.

This is also
what is called a three term controller.

The basic function of a controller is to execute an algorithm (electronic controller) based on the
control engineer's input (tun
ing constants), the operators desired operating value (setpoint) and the
current plant process value.

In most cases, the requirement is for the controller to act so that the
process value is as close to the setpoint as possible.

In a basic process contro
l loop, the control
engineer utilises the PID algorithms to achieve this.

The PID control algorithm is used for the control of almost all loops in the process industries, and is
also the basis for many advanced control algorithms and strategies. In order f
or control loops to
work properly, the PID loop must be properly tuned. Standard methods for tuning loops and criteria
for judging the loop tuning have been used for many years, but should be reevaluated for use on
modern digital control systems.

While th
e basic algorithm has been unchanged for many years and is used in all distributed control
systems, the actual digital implementation of the algorithm has changed and differs from one
system to another.

How a PID Controller Works

The PID controllers job is

to maintain the output at a level so that there is no difference (error)
between the process variable (PV) and the setpoint (SP).

In the diagram shown above the valve
could be controlling the gas going to a heater, the chilling of
a cooler, the pressure in a pipe, the flow through a pipe, the level in a tank, or any other process
control system.

What the PID controller is looking at is the difference (or "error") betw
een the PV and the SP.

It
looks at the absolute error and the rate of change of error.

Absolute error means
--

is there a big
difference in the PV and SP or a little difference?

Rate of change of error means
--

is the difference
between the PV or SP get
ting smaller or larger as time goes on.

When there is a "process upset", meaning, when the process variable or the setpoint quickly
changes

-

the PID controller has to quickly change the output to get the process variable back
equal to the setpoint.

If
you have a walk
-
in cooler with a PID controller and someone opens the
door and walks in, the temperature (process variable) could rise very quickly.

Therefore the PID
controller has to increase the cooling (output) to compensate for this rise in temperatu
re.

Once the PID controller has the process variable equal to the setpoint, a good PID controller will not
vary the output.

You want the output to be very steady (not changing).

If the valve (motor, or
other control element) are constantly changing, ins
tead of maintaining a constant value, this could
case more wear on the control element.

So there are these two contradictory goals.

Fast response (fast change in output) when there is a
"process upset", but slow response (steady output) when the PV is cl
ose to the setpoint.

Note that the output often goes past (over shoots) the steady
-
state output to get the process back
to the setpoint.

For example, a cooler may normally have it's cooling valve open 34% to maintain
zero degrees (after the cooler has be
en closed up and the temperature settled down).

If someone
opens the cooler, walks in, walks around to find something, then walks back out, and then closes
the cooler door
--

the PID controller is freaking out because the temperature may have raised 20
de
grees!

So it may crank the cooling valve open to 50, 75, or even 100 percent
--

to hurry up and
cool the cooler back down
--

before slowly closing the cooling valve back down to 34 percent

The PID control algorithm

The following is a brief description o
f the standard PID control algorithm used in most controllers.

Proportional Contol (gain)

The first element of PID control to be developed is Proportional control. The equation is simple:

error = measurement
-

setpoint (direct action)

or

error = setpoint

-

measurement (reverse action)

Note the action may be either direct or reverse. In a direct acting control loop an increase in the
process measurement causes an increase in the ouput to the final control element.

The proportional only equation is:

output
= gain x error + bias

The bias is sometimes known as the manual reset. Some control systems (such as Foxboro
products, use proportional band rather than gain. The proportional band and the gain are related
by:

Gain is the ratio of the change in the output to the change in the input.

Proportional band is the amount the input would have to change in order to

cause the output to
move from 0 to 100% (or vice versa)

With proportional only control the controller will not bring the process measurement to the setpoint
with out a manual adjustment to the bias (or manual reset) term of the equation. In the early days

of control the operator, upon observing an offset in the control loop would correct the offset by
manually "reseting" the controller (adjusting the bias).

Integral Control (automatic reset)

Rather than to require that the operator "manually reset" the c
ontrol loop whenever there was a
load change control functions were developed to "automatically reset" the controller by adjusting
the bias term when ever there was an error. This "automatic reset" is also known simply as "reset"
or as "integral".

The most

common way to implement integral mode in analog controllers is to use a positive
feedback into the output.

The equation for PI control is:

out = gain x (error + integral(error)dt)

The amount of reset used is measured in terms of "reset time" in minutes or its inverse, "reset rate"
in repeats per minute. The following test can be perfored on a controller w
hich is not connected to
the process:

1. an adjustable signal is connected to the input.

2. the output is indicated or recorded.

3. wtih the controller manual the setpoint and the input are set to the same value.

4. the controller is switched to automatic.

Becuase the error is zero, the output does not change.

5. The input to the controller is changed by a small amount. The output will move suddenly due to
the gain. The output will continue to change at a constant rate. The time is measured from the time
of

the intitial change until the time that the instant change is repeated by the constant movement.
The repeat time, or reset time, is the time it takes for the reset effect to repeat (or move the output
the same amount as) the gain effect. Its inverse is re
set rate, measured in repeats per minute.

Derivative Control (Pre
-
Act
(TM)

or Rate)

The third term of PID control is derivative, also known as Pre
-
Act (trade mark of Taylor Instr
ument
Companies, now ABB), and rate.

The derivative term looks at the rate of change of the input and adjusts the output based on the
rate of change. The derivative function can either use the time derivative of the error, which would
include changes in th
e setpoint, or of the measurement only, excluding setpoint changes.

The equation for the derivative contribution (assuming derivative on error) is:

Out = g
x

K
d

x

de/dt

The amount of derivative used is measured in minutes of derivative. To illustrate the m
eaning of
minutes of derivative, consider the following open loop test:

1. Connect a signal generator with a ramp cability to the input of a controller. The controller output
is connected to a recorder. Configure the controller with some gain, no reset, an
d no derivative.

2. With a constant output from the signal generator and the controller in manual, adjust the
setpoint to be equal to the input from the signal generator.

3. Place the controller into automatic mode.

4. Start the ramp.

5. Later stop the ram
p.

6. Repeat the above steps with some derivative. Compare the trend records of the controller's input
and output.

On the following trend record

note that when the ramp is started
, with no derivative (dashed line) the output ramps up due to the
change in input and the gain. Using derivative (solid line) the output jumps up, rises in a ramp, then
jumps down. The difference
in time

between the solid line and the dashed line represent
s the
amount of derivative, in units of time (usually minutes).

Putting it together: PID control

Combining the three elements, gain, integral, and derivative, we have the equation:

Where

G = Gain

R = Reset (repeats per minute)

D = Derivative (minutes)

Shown graphically:

Note that in the equation the gain is multiplied by all three terms. This is importan
t for the PID
equation to be able to be tuned by any of the standard tuning methods

Cascade Control uses the output of the
primary

controller to manipulate the setpoint of the
secondary

controller as if it were the final control element.

Allow faster secondary controller to handle disturbances in the secondary loop.

Allow secondary controller to handle non
-
linear valve and other final control element problems.

Allow operator to directly control secondary loo
p during certain modes of operation (such as
startup).

Secondary loop process dynamics must be at least four times as fast as primary loop process
dynamics.

Secondary loop must have influence over the primary loop.

Sec
ondary loop must be measured and controllable.

Cost of measurement of secondary variable (assuming it is not measured for other reasons).

:

Ratio control

Ratio control is used to ensure that two or more flows are kept at the same ratio even if the flows
are changing.

Applications of ratio control:

Blending two or more flows to produce a mixture w
ith specified composition.

Blending two or more flows to produce a mixture with specified physical properties.

Maintaining correct air and fuel mixture to combustion.

The contr
olled flow(FIC
-
102) is increased and decreased to keep it at the correct ratio with the wild
flow.

The "wild flow" (FI
-
101) is the flow not controlled by this loop. It may be controlled by some other
control loop.

The "controlled flow" is controlled by thi
s loop with a setpoint equal to the measured wild flow
multiplied by some value (FF
-
102).

The measured wild flow is multiplied by a value that may be fixed or may be adjustable by the
operator. The result of the multiplication becomes the setpoint of the c
ontrolled flow controller.

The options, such as tracking, that apply to cascade control also apply to ratio control. The
controlled flow controller is a "secondary loop" in a cascade pair with the wild flow measurement
and ratio multiplication.

Override
control is used to take control of an output from one loop to allow a more important loop
to manipulate the output.

The output from two or more controllers are combined in a high or low selector. The output from
the selector is the highest or lowest indivi
dual controller output. The selector is shown in the
diagram by the < or > symbol.

The steam header must be maintained above a minimum pressure. Steam from the header is u
sed
to heat water in a heat exchanger. The temperature of the hot water is controlled by TIC
-
101. It is
more important that the header pressure be above its minimum than that the water temperature be
at its setpoint.

The setpoint of the steam header pressu
re controller is set at the minimum steam pressure (below
the normal pressure). If the pressure falls below its setpoint, the pressure controller's output will
decrease. When it is less than the output of the temperature controller the pressure controller
will
begin to close the valve.

The water temperature will fall below its setpoint, but it is more important that the steam header
pressure be maintained.

Reset windup

Reset windup describes several situations in which the reset element of the controller c
ontinues to
increase (or decrease) the output of the controller even when the change in output does not cause
any change in the process measurement (controlled variable). With no resulting decrease in error,
the output will continue to increase until it re
aches its limit.

The problem with reset windup is that, when the condition causing the windup is eliminated, the
output must “wind down” for a period of time before the decreasing output has any effect on the
process.

The original form of reset windup occu
rred with pneumatic controllers. The standard pneumatic
signal was from 3 to 15 psig. However, if the controller was supplied by, for example, a 25 psig
instrument air source, the reset of the controller could cause the output to continue to increase
above

15 psig, the point at which the valve was fully open, up to almost the pressure of the
instrument air supply. Then, when conditions changed and the controller should begin closing the
valve, the output would have to fall from 25 psig to 15 psig before hav
ing any effect on the position
of the valve. Even though the controller should have been closing the valve, the valve was still wide
open. This would usually result in an overshoot in the process above its set point.

This form of reset windup was long ago
corrected by placing pressure limits on the controller output
to keep it within the 3
-
15 psig signal range. This same technique is used in electronic and digital
controllers.

A typical cause of reset windup is where the output from the controller to a valv
e is limited, perhaps
by an override controller. The signal from the override controller controls the valve, perhaps holding
it at a limit lower than 100%. Meanwhile, the controller’s output continues to increase, in a vain
attempt to open the valve. Event
ually, the controller output will reach 100% even though the valve
is far from fully open. If conditions change and the valve position should be decreased, the
controller will have to ramp the output down from 100% to the actual valve position before havin
g
any affect on the valve.

A solution to reset windup is external feedback, also known as External reset or reset feedback. This
method uses a positive feedback loop to f
orm the reset section of the control algorithm. The actual
signal going to the valve (or the valve position, if accurately measured) is fed back into the lag unit
that is part of the positive feedback equation. The error multiplied by the gain is, with zer
o and
100% limits applied, the new output of the controller. This output will be greater than the external
feedback if the error is positive and less than the external feedback if the error is negative. If there
is no error (process measurement equals set
point) the output is the same as the feedback