Docsity

Understanding the PID Algorithm in Process Control, Notas de estudo de Engenharia Elétrica

Pré-visualização parcial do texto

Baixe Understanding the PID Algorithm in Process Control e outras Notas de estudo em PDF para Engenharia Elétrica, somente na Docsity!

The PID Control Algorithm

How it works, how to tune it, and

how to use it

nd

Edition

John A. Shaw Process Control Solutions December 1, 2003

Introduction ii

John A. Shaw is a process control engineer and president of Process Control Solutions. An engineering graduate of N. C. State University, he previously worked for Duke Power Company in Charlotte, N. C. and for Taylor Instrument Company (now part of ABB, Inc.) in, N. Y. Rochester He is the author of over 20 articles and papers and continues to live in Rochester.

Copyright 2003, John A. Shaw, All rights reserved. This work may not be resold, either electronically or on paper. Permission is given, however, for this work to be distributed, on paper or in digital format, to students in a class as long as this copyright notice is included.

Introduction v

CHAPTER 1 INTRODUCTION

Process control is the measurement of a process variable, the comparison of that variables with its respective set point, and the manipulation of the process in a way that will hold the variable at its set point when the set point changes or when a disturbance changes the process.

An example is shown in Figure 1. In this example, the temperature of the heated water leaving the heat exchanger is to be held at its set point by manipulating the flow of steam to the exchanger using the steam flow valve. In this example, the temperature is known as the measured or controlled variable and the steam flow (or the position of the steam valve) is the manipulated variable.

TIC

Steam

Heated Water

Figure 1 Typical process control loop – temperature of heated water.

Most processes contain many variables that need to be held at a set point and many variables that can be manipulated. Usually, each controlled variable may be affected by more than one manipulated variable and each manipulated variable may affect more than one controlled variable. However, in most process control systems manipulated variables and control variables are paired together so that one manipulated variable is used to control one controlled variable. Each pair of controlled variable and manipulated variable, together with the control algorithm, is referred to as a control loop. The decision of which variables to pair is beyond the scope of this publication. It is based on knowledge of the process and the operation of the process.

In some cases control loops may involve multiple inputs from the process and multiple outputs to the processes. The first part of this book will consider only single input, single output loops. Later we will discuss some multiple loop control methods.

There are a number of algorithms that can be used to control the process. The most common is the simplest: an on/off switch. For example, most appliances use a thermostat to turn the heat on when the temperature falls below the set point and then turn it off when the temperature reaches the set point. This results in a cycling of the temperature above and below the set point but is sufficient for most common home appliances and some industrial equipment.

Introduction 2 To obtain better control there are a number of mathematical algorithms that compute a change in the output based on the controlled variable. Of these, by far the most common is known as the PID (Proportional, Integral, and Derivative) algorithm, on which this publication will focus.

First we will look at the PID algorithm and its components. We will then look at the dynamics of the process being controlled. Then we will review several methods of tuning (or adjusting the parameters of) the PID control algorithm. Finally, we will look as several ways multiple loops are connected together to perform a control function.

1.1 THE CONTROL LOOP

The process control loop contains the following elements:

  • The measurement of a process variable. A sensor, more commonly known as a transmitter, measures some variable in the process such as temperature, liquid level, pressure, or flow rate, and converts that measurement to a signal (typically 4 to 20 ma.) for transmission to the controller or control system.
  • The control algorithm. A mathematical algorithm inside the control system is executed at some time period (typically every second or faster) to calculate the output signal to be transmitted to the final control element.
  • A final control element. A valve, air flow damper, motor speed controller, or other device receives a signal from the controller and manipulates the process, typically by changing the flow rate of some material.
  • The process. The process responds to the change in the manipulated variable with a resulting change in the measured variable. The dynamics of the process response are a major factor in choosing the parameters used in the control algorithm and are covered in detail in this publication.

The interconnection of these elements is illustrated in Figure 2.

Σ Algorithm^ Σ Process Σ

Setpoint

Disturbances

Controller

Output

Measurement

Figure 2 Interconnection of elements of a control loop.

The following signals are involved in the loop:

Introduction 4

Setpoint

Manual Mode

Output ∆

Measured Variable

Control Algorithm

e

Process

Figure 3 A control loop in manual.

In most plants the process is started up with all loops in manual. During the process startup loops are individually transferred to automatic. Sometimes during the operation of the process certain individual loops may be transferred to manual for periods of time.

Figure 4 A control loop in automatic

The PID algorithm 5

CHAPTER 2 THE PID ALGORITHM

In industrial process control, the most common algorithm used (almost the only algorithm used) is the time-proven PID— P roportional, I ntegral, D erivative— algorithm. In this chapter we will look at how the PID algorithm works from both a mathematical and an implementation point of view.

2.1 KEY CONCEPTS

- The PID control algorithm does not “know” the correct output that will bring the process to the set point.

The PID algorithm merely continues to move the output in the direction that should move the process toward the set point until the process reaches the set point. The algorithm must have feedback (process measurement) to perform. If the loop is not closed, that is, the loop is in manual or the path between the output to the input is broken or limited, the algorithm has no way to “know” what the output should be. Under these (open loop) conditions, the output is meaningless.

- 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 and is will be discussed in later chapters.

2.2 ACTION

The most important configuration parameter of the PID algorithm is the action. Action determines the relationship between the direction of a change in the input and the resulting change in the output. If a controller is direct acting, an increase in its input will result in an increase in its output. With reverse action an increase in its input will result in a decrease in its output.

The controller action is always the opposite of the process action.

2.3 THE PID RESPONSES

The PID control algorithm is made of three basic responses, Proportional (or gain), integral (or reset), and derivative. In the next several sections we will discuss the individual responses that make up the PID controller.

In this book we will use the term called “error” for the difference between the process and the set point. If the controller is direct acting, the set point is subtracted from the measurement; if reverse acting the measurement is subtracted from the set point. Error is always in percent.

Error = Measurement-Set point (Direct action)

Error = Set point-Measurement (Reverse action)

The PID algorithm 7 2.5 PROPORTIONAL—OUTPUT VS. MEASUREMENT

One way to examine the response of a control algorithm is the open loop test. To perform this test we use an adjustable signal source as the process input and record the error (or process measurement) and the output.

As shown below, if the manual reset remains constant, there is a fixed relationship between the set point, the measurement, and the output.

Time

Output

Error

Figure 7 Proportional only controller: error vs. output over time.

2.6 PROPORTIONAL—OFFSET

Proportional only control produces an offset. Only the adjustment of the manual reset removes the offset.

Take, for example, the tank in Figure 8 with liquid flowing in and flowing out under control of the level controller. The flow in is independent and can be considered a load to the level control.

The flow out is driven by a pump and is proportional to the output of the controller.

The PID algorithm 8

LC

Flow In

Flow out

L

L

L

Figure 8 Proportional only level control

The flow from the tank is proportional to the level. Because the flow out eventually will be equal to the flow in, the level will be proportional to the flow in. An increase in flow in causes a higher steady state level. This is called “offset”.

Assume first that the level is at its set point of 50%, the output is 50%, and both the flow in and the flow out are 500 gpm. Then let’s assume the flow in increases to 600 gpm. The level will rise because more liquid is coming in than going out. As the level increases, the valve will open and more flow will leave. If the gain is 2, each one percent increase in level will open the valve 2% and will increase the flow out by 20 gpm. Therefore by the time the level reaches 55% (5% error) the output will be at 60% and the flow out will be 600 gpm, the same as the flow in. The level will then be constant. This 5% error is known as the offset.

Offset can be reduced by increasing gain. Let’s repeat the above “experiment” but with a gain of 5. For each 1% increase in level will increase the output by 5% and the flow out by 50 gpm. The level will only have to increase to 52% to result in a flow out of 600 gpm, causing the level to be constant. Increasing the gain from 2 to 5 decreases the offset from 5% to 2%. However, only an infinite gain will totally eliminate offset.

Gain, however, cannot be made infinite. In most loops there is a limit to the amount of gain that can be used. If this limit is exceeded the loop will oscillate.

2.7 PROPORTIONAL—ELIMINATING OFFSET WITH MANUAL RESET

Offset can also be eliminated by adjusting manual reset. In the above example (with a gain of two) if the operator increased the manual reset the valve would open further, increasing the flow out. This would cause the level to drop. As the level dropped, the controller would bring the valve closed. This would stabilize the level but at a level lower than before. By gradually increasing the manual reset the operator would be able to bring the process to the set point.

The PID algorithm 10

X Gain UL

LL

LAG

Set Point

Process

Controller

Positive Feedback Loop

Figure 10 Addition of automatic reset to a proportional controller

The positive feedback loop will cause the output to ramp whenever the error is not zero. There is an output limit block to keep the output within specified range, typically 0 to 100%.

This is called “ Reset ” or Integral Action. Note the use of the positive feedback loop to perform integration. As long as the error is zero, the output will be held constant. However, if the error is non-zero the output will continue to change until it has reached a limit. The rate that the output ramps up or down is determined by the time constant of the lag and the amount of the error and gain.

2.9 INTEGRAL MODE (RESET)

If we look only at the reset (or integral) contribution from a more mathematical point of view, the reset contribution is:

Out = g × Kr × (^) ⌡⌠^ e dt

where g = gain

Kr = reset setting in repeats per minute.

At any time the rate of change of the output is the gain time the reset rate times the error. If the error is zero the output does not change; if the error is positive the output increases.

The PID algorithm 11 Shown below is an open loop trend of the error and output. We would obtain this trend if we recorded the output of a controller that was not connected to a process while we manipulated the error.

Time

Output

Error

Figure 11 Output vs. error over time.

While the error is positive, the output ramps upward. While the error is negative the output ramps downward.

2.10 CALCULATION OF REPEAT TIME

Most controllers use both proportional action (gain) and reset action (integral) together. The equation for the controller is:

Out = g ( e + Kr ⌡⌠^ e dt )

where g = gain

Kr = reset setting in repeats per minute.

If we look an open loop trend of a PI controller after forcing the error from zero to some other value and then holding it constant, we will have the trends shown in Figure 12.

The PID algorithm 13

Time

Output

Error

%

% 0

τd

Derivative time

Gain effect

Derivative effect

Figure 13 Output vs. error of derivative over time

The derivative advances the output by the amount of derivative time.

This diagram compares the output of a controller with gain only (dashed line) with the output of a controller with gain and derivative (solid line). The solid line is higher than the dashed line for the time that the process is increasing due the addition of the rate of change to the gain effect. We can also look at the solid line

as being “leading” the dashed line by some amount of time (τd).

The amount of time that the derivative action advances the output is known as the “derivative time” (or Preact time or rate time) and is measured in minutes. All major vendors measure derivative the same: in minutes.

The PID algorithm 14

2.12 COMPLETE PID RESPONSE

If we combine the three terms (Proportional gain, Integral, and Derivative) we obtain the complete PID equation.

Setpoint

Manual Reset

∆^ Output

Measured Variable

× G

e Σ

e×G

d

dt

dt

Figure 14 Combined gain, integral, and derivative elements.

This is a simplified version of the PID controller block diagram with all three elements, gain, reset, and derivative.

Out = G(e + R⌡⌠edt + D

de

dt

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

This is a general form of the PID algorithm and is close to, but not identical to, the forms actually implemented in industrial controllers. Modifications of this algorithm are described in the next chapter.

2.13 RESPONSE COMBINATIONS

Most commercial controllers allow the user to specify Proportional only controllers, proportional-reset (PI) controllers, and PID controllers that have all three modes. The majority of loops employ PI controllers. Most control systems also allow all other combinations of the responses: integral, integral-derivative, derivative, and proportional-derivative. When proportional response is not present the integral and derivative is calculated as if the gain were one.