PID Tutorial

Control Systems & Robotics Topics
Post Reply
User avatar
Shane
Captain
Captain
Posts: 226
Joined: Sun Jul 19, 2009 9:59 pm
Location: Jönköping, Sweden

PID Tutorial

Post by Shane » Fri Oct 16, 2009 3:47 pm

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 for 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 re-evaluated for use on modern digital control systems.

While the 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 and from commercial equipment to academia.

We will discuss controller tuning methods and criteria. Also discussed will be the digital PID control algorithm, how it works, the various implementation methods and options, and how these affect the operation and tuning of the controller.

1. The Process
1.1 The Feedback Control Loop
Image1.gif
Image1.gif (1.75 KiB) Viewed 5619 times
The system measures the process, compares it to a setpoint, and then manipulates the output in the direction which should move the process toward the setpoint.

1.2 Valve Linearity
Valves are usually non-linear. That is, the flow through the valve is not the same as the valve position. Several types of valves exist:
  • Linear
    Same gain regardless of valve position
  • Equal Percentage
    Low gain when valve is nearly closed
    High gain when valve is nearly open
  • Quick Opening
    High gain when valve is nearly closed
    Low gain when valve is nearly open
Image2.gif
Image2.gif (2.91 KiB) Viewed 5619 times
As we will see later, the gain of the process, including the valve, is very important to the tuning of the loop. If the controller is tuned for one process gain, it may not work for other process gains.

Valve Linearity: Installed characteristics
The flow vs. percent open curve changes due to the head loss in the piping
Image3.gif
Image3.gif (2.85 KiB) Viewed 5619 times
At low flow, the head loss through the pipes is less, leaving a larger differential pressure across the valve.
At high flow, the head loss through the pipe is more, leaving a smaller differential pressure across the valve.
Image4.gif
Image4.gif (2.84 KiB) Viewed 5619 times
The effect is to increase the non-linearity of most valves.

1.3 Fail Open Valves
Valves are usually either: Fail Closed, air to open or

Fail Open, air to close
  • Regardless of the way the valve operates, the operator is interested in the knowing and adjusting the position of the valve, not the value of the signal. "Up is always open"
  • All controllers have some means of indicating the controller output in terms of the valve position. When the operator increases the output as indicated on the controller, the valve opens.
Indication Inversion
Image5.gif
Image5.gif (5.53 KiB) Viewed 5619 times
The output indication is inverted.

The controller action takes the valve action into acount.

The flow loop is direct acting.

Most analog controllers work like this.

Signal Inversion
Image6.gif
Image6.gif (5.5 KiB) Viewed 5619 times
The output signal is inverted. The controller action ignores the valve action.

The flow loop is reverse acting. Some distributed control systems work like this.

2 - The Control Loop
2.1 The Process Response to the Controller

Steady state relationships: changing load
Image7.gif
Image7.gif (3.55 KiB) Viewed 5619 times
Image8.gif
Image8.gif (3.89 KiB) Viewed 5619 times
When the load changes, either the process value changes or the valve position must be changed to compensate for the load change.

2.2 Process Dynamics: Simple lag
Image9.gif
Image9.gif (1.55 KiB) Viewed 5619 times
Image10.gif
Image10.gif (3.08 KiB) Viewed 5619 times
2.3 Process Dynamics: Dead time
Image11.gif
Image11.gif (1.75 KiB) Viewed 5619 times
Dead Time: A delay in the loop due to the time it takes material to flow from one point to another

Also called: Distance Velocity Lag

Transportation Lag
Image12.gif
Image12.gif (1.58 KiB) Viewed 5619 times
Image13.gif
Image13.gif (1.6 KiB) Viewed 5619 times
Most loop combine dead time and lag.

2.4 Measurement of dynamics
The dynamics differ from one loop to another.
However, they usually result in a response curve like this:
Image14.gif
Image14.gif (2.73 KiB) Viewed 5619 times
L is Lag—the largest lag in the process loop.
D is "Pseudo Deadtime"—the sum of the deadtime and all lags other than the largest lag.

2.5 Disturbances
Almost all processes contain disturbances.

Disturbances can enter anywhere in the process.

The effect of the disturbance can depend on where it enters the loop.

Most disturbances cannot be measured.
Image15.gif
Image15.gif (4.83 KiB) Viewed 5619 times
3 PID Algorithm
3.1 Controller Action

PROCESS ACTION

Defines the relationship between changes in the valve and changes in the measurement.

DIRECT Increase in valve position causes an increase in the measurement.

REVERSE Increase in valve position causes a decrease in the measurement.


CONTROLLER ACTION

Defines the relationship between changes in the measured variable and changes in the controller output.

DIRECT Increase in measured variable causes an increase in the output.

REVERSE Increase in measured variable causes a decrease in the output.


The controller action must be the opposite of the process action.

3.2 Auto/Manual
Manual Mode:

The operator adjust the output to operate the plant.

During startup, this mode is normally used.
Image16.gif
Image16.gif (2.71 KiB) Viewed 5619 times
Automatic Mode:

The control algorithm manipulates the output to hold the process measurements at their setpoints.
Image17.gif
Image17.gif (2.43 KiB) Viewed 5619 times
This should be the most common mode for normal operation.

3.3 Key concepts
The PID control algorithm does not "know" the correct output to bring the process to the setpoint.
  • It merely continues to move the output in the direction which should move the process toward the setpoint.
  • The algorithm must have feedback (process measurement) to perform.
The PID algorithm must be "tuned" for the particular process loop. Without such tuning, it will not be able to function.
  • To be able to tune a PID loop, each of the terms of the PID equation must be understood.
  • The tuning is based on the dynamics of the process response.
3.4 The PID Control Algorithm
The PID control algorithm comprises three elements:
  • Proportional - also known as Gain
  • Integral - also known as Automatic Reset or simply Reset
  • Derivative - also known as Rate or Pre-Act
The algorithm is normally available in several combinations of these elements:
  • Proportional only
  • Proportional and Integral (most common)
  • Proportional, Integral, and Derivative
  • Proportional and Derivative
We will examine each of the three elements below:

3.4.1 Proportional
E = Measurement - Setpoint (direct action)

E = Setpoint - Measurement (reverse action)

Output = E * G + k
Image18.gif
Image18.gif (2.7 KiB) Viewed 5619 times
The output is equal to the error times the gain plus the manual reset.
If the manual reset stays constant, there is a fixed relationship between the setpoint, the measurement, and the output.

Proportional—units
The proportional or gain term may be calibrated in two ways:

Gain and Proportional Band

Gain = Output/Input

Increasing the gain will cause the output to move more.

Proportional band is the % change in the input which would result in a 100% change in the output.

Proportional Band = 100/Gain

We will use gain in this document.

Proportional—Output vs. Measurement
Image19.gif
Image19.gif (1.59 KiB) Viewed 5619 times
(Reverse acting)
Image20.gif
Image20.gif (2.15 KiB) Viewed 5619 times
Proportional only control produces an offset. Only the adjustment of the manual reset removes the offset.

Proportional—Offset
Offset can be reduced by increasing gain.
Image21.gif
Image21.gif (3.95 KiB) Viewed 5619 times
Proportional control with low gain
Image22.gif
Image22.gif (3.97 KiB) Viewed 5619 times
Proportional control with higher gain

Proportional—Reducing offset with manual reset
Offset can be eliminated by changing manual reset.
Image23.gif
Image23.gif (3.95 KiB) Viewed 5619 times
Image24.gif
Image24.gif (4.25 KiB) Viewed 5619 times
Proportional control different manual reset

3.5 Adding automatic reset
With proportional only control, the operator "resets" the controller (to remove offset) by adjusting the manual reset:
Image25.gif
Image25.gif (3.09 KiB) Viewed 5619 times
This manual reset may be replaced by automatic reset which continues to move the output whenever there is any error:
Image26.gif
Image26.gif (3.31 KiB) Viewed 5619 times
This is called Reset or Integral Action.

Note the use of the positive feedback loop to perform integration.

Reset or integral mode
Reset Contribution:

Out = g X Kr X integral of error

where g is gain, Kr is the reset setting in repeats per minute.
Image27.gif
Image27.gif (2.22 KiB) Viewed 5619 times
Units used to set integral or reset

Assume a controller with proportional and integral only.

Calculation of repeat time: (gain and reset terms used in controller)

With the error set to zero (measurement input = setpoint), make a change in the input and note the immediate change in output. The output will continue to change (it is integrating the error). Note the time it takes the output to, due to the integral action, repeat the initial change made by the gain action.
Image28.gif
Image28.gif (2.48 KiB) Viewed 5619 times
Some control vendors measure reset by repeat time in minutes. This is the time it takes the reset (or integral) element to repeat the action of the proportional element.

Others measure reset by repeats per minute.
  • Repeats per minute is the inverse of minutes of repeat
This document will use repeats per minute.

3.4.2 Derivative
First used as a part of a temperature transmitter ("Speed-Act™" - Taylor Instrument Companies) to overcome lag in transmitter measurement.

Also known as Pre-Act and Rate.

Derivative Contribution:

Out = g x Kd x de/dt

where g is gain, Kd is the derivative setting in minutes.

Response of controller with proportional and derivative:
Image29.gif
Image29.gif (2.62 KiB) Viewed 5619 times
The amount of time that the derivative action advances the output is known as the "derivative time" measured in minutes.

All major vendors measure derivative (Derivative, Rate) the same.

Complete PID response
Non-Interactive (text book) form:
Image30.gif
Image30.gif (2.71 KiB) Viewed 5619 times
Out = G(e + R+ D )

Where
G = Gain
R = Reset (repeats per minute)
D = Derivative (minutes)

4 PID Concepts
4.1 Interactive or Non-interactive PID Algorithm
"Interactive" and "Non-interactive" refer to interaction between the reset and derivative terms. This is also known as "series" or "parallel" derivative.

Almost all analogue controllers are interactive.

Many digital controllers are non-interactive, some are interactive

The only difference is in the tuning of controllers with derivative.

Non-Interactive (Parallel):
Image31.gif
Image31.gif (2.55 KiB) Viewed 5618 times
Out = G(e + R+ D )

Interactive (series):
Image32.gif
Image32.gif (2.65 KiB) Viewed 5618 times
Out = (RD+1)G(e + R+D )

4.2 Converting between interactive and non-interactive
Applies only to 3-mode controllers

To convert from non-interactive to interactive:

Gn = Gi (1 + Ri Di)
Rn = Ri/(1 + Ri Di)
Dn = Di/(1 + Ri Di)

In other words, with a non-interactive controller the gain should be higher, the reset rate lower, and the derivative lower than on a commercial interactive controller.

4.3 External feedback
Image33.gif
Image33.gif (2.84 KiB) Viewed 5618 times
The integral function implemented using a positive feedback.
Image34.gif
Image34.gif (2.91 KiB) Viewed 5618 times
If the input to the positive feedback loop is taken from the signal to the process, it is called "external feedback" or "reset feedback". At steady state the controller output is the Gain multiplied by Error added to external feedback. If the error is zero, the output is equal to the external feedback.

4.4 Saturation Properties
Another difference is in the "Saturation Properties"

eg. what happens when output has been at the upper or lower limit.

Standard algorithm

Described above.

Output stays at limit until measurement crosses setpoint.


"Integrated velocity form"

Similar to equation:

Output = Last output + gain x (error - last error + reset x error)

Output pulls away from limit one reset time before measurement crosses setpoint.

  • For most applications, there is no difference. For some batch startup problems, the "integrated velocity form" algorithm works best.
  • Standard works best for high gain/low reset rate applications.
5 Controller Features
Gain on process rather than error

In applications with high gain, a step change can result in a sudden, large movement in the valve.
  • Not as severe as the derivative effect, but still can upset the process
  • Solution: let gain act only on process rather than error.
Derivative on process rather than error

A step change in the setpoint results in a step change in the error.
  • The derivative term acts on the rate of change of the error.
  • The rate of change of a step change is very large.
  • An operator step change of the setpoint would cause a very large change in the output, upsetting the process.
  • Solution: let derivative act only on process rather than error.
6 Loop Tuning
Tuning Criteria (How do we know when its tuned)

Elementary methods
  1. The plant didn’t blow up.
  2. The process measurements stay close enough to the setpoint.
  3. They say it’s OK and you can go home now.
Informal methods

1 Optimum decay ratio (1/4 wave decay).
Image35.gif
Image35.gif (1.57 KiB) Viewed 5618 times
2 Minimum overshoot.
Image36.gif
Image36.gif (1.1 KiB) Viewed 5618 times
3 Maximum disturbance rejection.
Image37.gif
Image37.gif (1.65 KiB) Viewed 5618 times
The choice of methods depends upon the loop’s place in the process and its relationship with other loops.

Mathematical criteria
Mathematical methods—minimization of index
Image38.gif
Image38.gif (1.83 KiB) Viewed 5618 times
IAE - Integral of absolute value of error
ISE - Integral of error squared
ITAE - Integral of time times absolute value of error
ITSE - Integral of time times error squared:
  • These mathematical methods are used primarily for academic purposes, together with process simulations, in the study of control algorithms.
On-line trial tuning (The "by-guess-and-by-golly" method)
  1. Enter an initial set of tuning constants from experience. A conservative setting would be a gain of 1 or less and a reset of less than 0.1.
  2. Put loop in automatic with process "lined out".
  3. Make step changes (about 5%) in setpoint.
  4. Compare response with diagrams and adjust.
Ziegler Nichols tuning method: open loop reaction rate

Also known as the "reaction curve" method

The process must be "lined out"—not changing.

With the controller in manual, the output is changed by a small amount.

The process is monitored.
Image39.gif
Image39.gif (2.4 KiB) Viewed 5618 times
The following measurements are made from the reaction curve:

X % Change of output
R %/min. Rate of change at the point of inflection (POI)
D min. Time until the intercept of tangent line and original process value

The gain, reset, and Derivative are calculated using:
GainResetDerivative
PX/DR--
PI0.9X/DR0.3/D-
PID1.2X/DR0.5/D0.5D
Ziegler Nichols tuning method: open loop point of inflection
Another means of determining parameters based on the ZN open loop.

After "bumping" the output, watch for the point of inflection and note:

Ti min Time from output change to POI
P % Process value change at POI
R %/min Rate of change at POI (Same as above method)
X % Change in output. (Same as above method)

D is calculated using the equation:

D=Ti - P/R

D & X are then used in the equations on the previous page.

Ziegler Nichols tuning method: open loop process gain
Mathematically derived from the reaction rate method.

Used only on processes that will stabilize after output step change.

The process must be "lined out"—not changing.

With the controller in manual, the output is changed by a small amount.

The process is monitored.
Image40.gif
Image40.gif (2.73 KiB) Viewed 5618 times
ResetDerivative[/td]--[/td]0.3/D-[/td]0.5/D0.5D[/td]
Gain
PL/GpD
PI0.9 L/GpD
PID1.2 L/GpD
Ziegler Nichols tuning method: closed loop

Steps

Place controller into automatic with low gain, no reset or derivative.

Gradually increase gain, making small changes in the setpoint, until oscillations start.

Adjust gain to make the oscillations continue with a constant amplitude.

Note the gain (Ultimate Gain, Gu,) and Period (Ultimate Period, Pu.)

The Ultimate Gain, Gu, is the gain at which the oscillations continue with a constant amplitude.
Image41.gif
Image41.gif (1.96 KiB) Viewed 5618 times
The gain, reset, and Derivative are calculated using:
GainResetDerivative
P0.5 GU
PI0.45 GU1.2/Pu
PID0.6 GU2/PuPu/8
Controllability of processes

The "controllability" of a process is depends upon the gain which can be used.

The higher the gain:
  • the greater rejection of disturbance and
  • the greater the response to setpoint changes.
Image42.gif
Image42.gif (2.73 KiB) Viewed 5618 times
The predominate lag L is based on the largest lag in the system.

The subordinate lag D is based on the deadtime and all other lags.

The maximum gain which can be used depends upon the ratio .

From this we can draw two conclusions:
  • Decreasing the dead time increases the maximum gain and the controllability.
  • Increasing the ratio of the longest to the second longest lag also increases the controllability.
Flow loops
Flow loops are too fast to use the standard methods of analysis and tuning.

Analogue vs. Digital control:
  • Some flow loops using analogue controllers are tuned with high gain.
  • This will not work with digital control.
With an analogue controller, the flow loop has a predominate lag (L) of a few seconds and no subordinate lag.

With a digital controller, the scan rate of the controller can be considered dead time.

Although this dead time is small, it is large enough when compared to L to force a low gain.

Typical digital flow loop tuning: Gain= 0.5 to 0.7

Reset=15 to 20 repeats/min..

no derivative.
Post Reply

Return to “Control Systems & Robotics”