Chapter 8

13
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION Chapter VIII PID control A Proportional–Integral–Derivative (PID) controller is a three-term controller that has a long history in the automatic control field, starting from the beginning of the last century. Owing to its intuitiveness and relative simplicity, it has become in practice the standard controller in industrial settings. In addition to satisfactory performance, it provides with a wide range of processes. It has been evolving along with the progress of technology and today’s implementations very often appear in digital form rather than with pneumatic or electrical components. It can be found in virtually all kinds of control equipment, either as a stand-alone (single-station) controller or as a functional block in PLCs and Distributed Control Systems (DCSs). The success of the PID controllers is also enhanced by the fact that they often represent the fundamental component for more sophisticated control schemes that can be implemented when the basic control law is not sufficient to obtain the required performance or a more complicated control task is of concern [18]. Controlled system The controlled physical system is described with the input variables and the output variables. Its response is described in terms of dependence of the output variable on the input variable. These responses between one or several variables can normally be described using mathematical equations based on physical laws. Such physical relationships can be determined by experimentation. Controlled systems are shown as a block with the appropriate input and output variables (Fig. 0.1). Fig. 0.1. Block diagram of a controlled system An example, a water bath is to be maintained at a constant temperature (t 0 ). The water bath is heated by a heating pipe through which steam flows (Fig. 0.2). The flow rate of steam can be manually set by means of a control valve. Here the control system consists of positioning of the control valve which influences the temperature of the water bath. This results in a controlled system with the input variable “position of control valve” and the output variable “temperature of water bath”. Fig. 0.2. Water bath controlled system The following sequences take place within the controlled system: The actual position of the control valve affects the flow rate of steam through the heating pipe The steam flow-rate determines the amount of heat passed to the water bath The temperature of the bath increases if the heat input is greater than the heat loss and drops if the heat input is less than the heat loss Controlled physical system Input variable Output variable

description

pid control

Transcript of Chapter 8

Page 1: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

Chapter VIII

PID control A Proportional–Integral–Derivative (PID) controller is a three-term controller that has a long history in the automatic control field, starting from the beginning of the last century. Owing to its intuitiveness and relative simplicity, it has become in practice the standard controller in industrial settings. In addition to satisfactory performance, it provides with a wide range of processes. It has been evolving along with the progress of technology and today’s implementations very often appear in digital form rather than with pneumatic or electrical components. It can be found in virtually all kinds of control equipment, either as a stand-alone (single-station) controller or as a functional block in PLCs and Distributed Control Systems (DCSs). The success of the PID controllers is also enhanced by the fact that they often represent the fundamental component for more sophisticated control schemes that can be implemented when the basic control law is not sufficient to obtain the required performance or a more complicated control task is of concern [18].

Controlled system The controlled physical system is described with the input variables and the output variables. Its response is described in terms of dependence of the output variable on the input variable. These responses between one or several variables can normally be described using mathematical equations based on physical laws. Such physical relationships can be determined by experimentation. Controlled systems are shown as a block with the appropriate

input and output variables (Fig. 0.1). Fig. 0.1. Block diagram of a controlled system

An example, a water bath is to be maintained at a constant temperature (t0). The water bath is heated by a heating pipe through which steam flows (Fig. 0.2). The flow rate of steam can be manually set by means of a control valve. Here the control system consists of positioning of

the control valve which influences the temperature of the water bath. This results in a controlled system with the input variable “position of control valve” and the output variable “temperature of water bath”. Fig. 0.2. Water bath controlled system

The following sequences take place within the controlled system:

• The actual position of the control valve affects the flow rate of steam through the heating pipe

• The steam flow-rate determines the amount of heat passed to the water bath • The temperature of the bath increases if the heat input is greater than the heat loss and

drops if the heat input is less than the heat loss

Controlled physical system

Input variable Output variable

Page 2: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

These sequences give the relationship between the input and output variables. Before an automatic controller can be defined for a controlled system, the behavior of the controlled system must be known.

Closed-loop control technology Physical process variables such as pressure, temperature or flow-rate often have to be set on large machines or systems. Settings of the variables should not change when a fault or external influence occurs. Such stabilization tasks are undertaken by a closed-loop controller. The variable that is subject to control is called the controlled variable x. Examples of controlled variables are [18]:

• Pressure in a pneumatic accumulator • Pressure of a hydraulic press • Temperature in a galvanizing bath • Flow-rate of coolant in a heat exchanger • Concentration of a chemical in a mixing vessel • Feed speed of a machine tool with electrical drive

The controlled variable is first measured and the corresponding electrical signal is created to allow an independent closed-loop controller to be built up, which has ability to control the output variable y. The measured value of x in the system must then be compared with the desired value w or the desired-value curve (Fig. 0.3). This desired value is known as the reference variable w. The result of a comparison of reference variable and controlled variable is the deviation xd. The result of this comparison determines any action that needs to be taken.

Controlled process, (Conversion function)

Deviation xd value

Reference variable w (desired value)

Controlled variable x (actual value)

Manipulated variable y

Comparator

Fig. 0.3. Functional principle of a closed-loop controller

Page 3: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

Control valve

Comparator

Manipulated value y

M

Controlled process, (Conversion function)

Volumetric flow V m3/s

Applied pressure p (physical value, bar)

Reference variable w (desired value)

+

Measuring element

Controlled variable x (measured value)

Fig. 0.4. Closed-loop control of volumetric flow In closed-loop control the task is to keep the controlled variable value at the desired variable value or to follow the desired-value curve. The controlled variable in any system can be influenced by control system or human. This influence allows the controlled variable to be changed to match the reference variable (desired value). The variable influenced in this way is called the manipulated variable y. Examples of manipulated variable are:

• Position of the venting control valve of an air reservoir, • Position of a pneumatic pressure-control valve, • Voltage applied to the electrical heater of a galvanizing bath, • Position of the control valve in the coolant feed line, • Position of a valve in a chemical feed line.

There are simple or more complex relationships between the manipulated variable and the controlled variable. These relationships result from the physical interdependence of the two variables. The part of the controlled system that describes the physical processes is called the measuring element (Fig. 0.4). Disturbances occur in any controlled system. Indeed, unwanted disturbances are often the reason why a closed-loop control is required. In our example (water bath), the applied

pressure changes the volumetric flow and thus requires a change in the control valve setting. Such influences are called disturbance variables z. The closed loop contains all components necessary for automatic closed-loop control (Fig. 0.5). Fig. 0.5. Closed-loop control with a controller

Physical input variable (e.g.

steam)

Physical output variable (e.g. temperature)

Manipulated variable y

Controlled variable x

(actual value)

Reference variable w

(desired value)

Disturbance variables z

Controller

Controlled system

Page 4: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

The controller has the task of holding the controlled variable as near as possible to the reference variable. The controller constantly compares the value of the controlled variable with the value of the reference variable. From this comparison and the control response, the controller determines and changes the value of the manipulated variable. The dynamic response of a system (also called time response) is an important aspect of system description. It is the time characteristic between the output variable (controlled variable) and the input variable. Particularly important is the behavior of the controlled system when the manipulated variable is changed. Every system has a characteristic dynamic response [18]. In the example of the water bath (Fig. 0.2), a change in the steam valve setting will not immediately change the output variable temperature. Rather, the heat capacity of the entire water bath will cause the temperature to slowly “creep” to the new equilibrium (Fig. 0.6 a). In the steam volumetric flow control, the dynamic response is rapid. Here, a change in the valve setting has an immediate effect on the steam flow rate so that the change in the volumetric flow rate output signal almost immediately follows the input signal for the change of the valve setting (Fig. 0.6 b).

Fig. 0.6. Time response of the controlled system “water bath” (a) and “valve” (b)

Description of the dynamic response of a controlled system In the examples shown in Fig. 0.6, the time response was shown assuming a sudden change in the input variable value. This is a commonly used method of establishing the time response of a system.

Valve setting (%)

Valve setting (%)

Temperature water bath tº (ºC)

Steam volumetric flow (m3/s)

Time t

Time t

Time t

Time t a b

100

50

100

50

8 7 6 5 4

80 70 60 50 40

Valve setting

Temperature water bath

Water bath

Steam volumetric flow

Valve setting

Valve

Page 5: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

The response of a system to a sudden change of the input variable value is called the step response. Every system can be characterized by its step response. The step response also allows a system to be described with mathematical formulas. This description of a system is also known as dynamic response, demonstrated in Fig. 0.7. Here the manipulated variable y is suddenly increased (see left diagram). The step response of the controlled variable x is a settling process with transient overshoot [18]. Another characteristic of a system is its behavior in equilibrium, the static behavior. Static behavior of a system is reached when none of the variables values change with time. Equilibrium is reached when the system has settled. This state can be maintained for an unlimited time. The output variable is still dependent on the input variable – this dependence is shown by the characteristic of a system. The characteristic of the “valve” system from our water bath example (Fig. 0.2) shows the relationship between volumetric flow and valve position (Fig. 0.8). The characteristic shows whether the system is a linear or non-linear system. If the characteristic is a straight line, the system is linear. In our “valve” system, the characteristic is non-linear. Many controlled systems that occur in practice are non-linear. However, they can often be approximated by a linear characteristic in the range in which they are operating.

Fig. 0.8. Characteristic curve of the “valve” system

Controllers The previous sections dealt with the controlled system - the part of the system which is controlled by a controller. This section looks at the automatic controller. The controller is the device in a closed-loop control that compares the measured value (actual value) with the reference value (desired value), and then calculates and outputs the manipulated variable y. The above section showed that controlled systems can have very different responses. There are systems which respond quickly, those that respond very slowly and systems with storage property [18].

Fig. 0.7. Step response

Controlled variable x Manipulated variable y

y x

t t

Controlled system

Valve setting y (mm)

Volumetric flow x (m3/s)

applied pressure p

Page 6: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

For each of these controlled systems, changes to the manipulated variable y must take place in a different way. For this reason there are on the market various types of controllers, each with its own control response. The control engineer has the task of selecting the controller with the most suitable control response for the controlled system. The control response is the way in which the controller derives the manipulated variable from the system deviation.

Time response of a PID controller Every controlled system has its own time response. This time response depends on the design of the machine or system and cannot be influenced by the control engineer. The time response of the controlled system must be established through experiment, simulation or theoretical analysis. The controller is also a system and has its own time response. This time response is specified by the control engineer in order to achieve good control performance. The time response of a typical continuous-action (called PID) controller is determined by its three components:

• Proportional component (P component), • Integral component (I component), • Derivative component (D component).

The proportional controller In the case of the proportional (P) controller, the actuation signal is proportional to the system deviation. If the system deviation value x0 is large, the value of the manipulated variable value y0 is large. If the system deviation is small, the value of the manipulated variable is small. The time response of the P controller in the ideal state is exactly the same as the input variable (Fig. 0.9). The relationship of the manipulated variable to the system deviation is the proportional coefficient or the proportional gain Kp. These values can be set on a P controller. It determines how the manipulated variable is calculated from the system deviation. The proportional gain is calculated as:

Kp = y0 / x0, where y0 is manipulated variable and x0 is system deviation. If the proportional gain is too high, the controller will undertake large changes of the manipulating element for slight deviations of the controlled variable. If the proportional gain is too small, the response of the controller will be too weak, resulting in unsatisfactory control. A step in the system deviation will also result in a step in the output variable. The size of this step is dependent on the proportional gain.

Fig. 0.9. The time response of the P controller

Controller System deviation xd Manipulated variable y

xd

x0

y

y0 t t

Page 7: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

Fig. 0.10. Curves of different controllers An important property of the P controller is that as a result of the rigid relationship between system deviation and manipulated variable, some offset always remains (difference between the P controller and Reference variable curves in a stable state in Fig. 0.10). The P controller cannot compensate this remaining offset.

The integral controller The integral (I) controller adds the system deviation over time. It integrates the system deviation. As a result, the rate of change of the manipulated variable (and not the absolute

value) is proportional to the system deviation. This is demonstrated by the step response of the I controller: if the system deviation value suddenly increases from 0 to a certain value, the manipulated variable value increases continuously (Figs. 0.10 and 0.11). The greater

the system deviation, the steeper the increase in the manipulated variable. For this reason the I controller is not suitable for totally compensating remaining offset (system deviation). If the system deviation is large, the manipulated variable changes quickly. As a result, the system deviation becomes smaller and the manipulated variable changes more slowly until equilibrium is reached [18]. Nonetheless, a pure I controller is unsuitable for most controlled systems, as it either causes oscillation of the closed loop or it responds too slowly to system deviation in systems with a long time response. In practice there are hardly any pure I controllers.

Fig. 0.11. The time response of I controller

System deviation xd Manipulated variable y Controller

xd y

t t

Page 8: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

The derivative controller The derivative (D) controller evaluates the speed of change of the system deviation. This is also called differentiation of the system deviation. If the system deviation is changing fast, the manipulated variable is large. If the system deviation is changing slowly, the value of the manipulated variable value is small. A controller with the D component alone does not make

any sense, as a manipulated variable would only be present during changes in the system deviation (Figs. 0.10 and 0.12) [18]. Fig. 0.12. The time response of the D controller

Combination of several controllers The PI controller combines the behavior of the P and I controller. This allows the advantages of both controller types to be combined: fast reaction and compensation of remaining offset. For this reason, the PI controller can be used for a large number of controlled systems. In addition to proportional gain, the PI controller has a further characteristic value that indicates the behavior of the I component: the reset time (integral-action time) Tr. The reset time Tr is a measure for how fast the controller resets the manipulated variable (in addition to the manipulated variable generated by the P component) to compensate for a remaining offset. In other words: the reset time is the period by which the PI controller is faster than the pure I controller. Behavior is shown by the time response curve of the PI controller (Figs. 0.10 and 0.13) [18].

The reset time is a function of proportional gain Kp as the rate of change of the manipulated variable is faster for a greater gain. In the case of a long reset time, the effect of the integral component is small as the summation of the system deviation is slow. The effect of the integral

component is large if the reset time is short. The effectiveness of the PI controller increases with the increase in the proportional gain Kp and the increase in the I component (i.e., decrease in the reset time). However, if these two values are too extreme, the controller’s intervention is too coarse and the entire control loop starts to oscillate. Response is then not stable. The point at which the oscillation begins is different for every controlled system and must be determined during commissioning. The PD controller consists of a combination of the P and D controller. The D component in the PD controller describes the rate of change of the system deviation. The greater the rate of change – that is the size of the system deviation over a certain period – the greater the D component. In addition to the control response of the pure P controller, large system

Fig. 0.13. The time response of the PI controller

System deviation xd Manipulated variable y Controller

xd y

t t Tr

System deviation xd Manipulated variable y Controller

xd y

t t

Page 9: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

deviations are met with very short but large responses. This is expressed by the derivative-action time (rate time) Td. The derivative-action time Td is a measure for how much faster a PD controller compensates a change in the controlled variable than a pure P controller. A jump in the manipulated variable

compensates a large part of the system deviation before a pure P controller would have reached this value. The P component therefore appears to respond earlier by a period equal to the rate time (Fig. 0.14) [18]. Fig. 0.14. The time response of the PD controller

Two disadvantages result in the PD controller seldom being used. Firstly, it cannot completely compensate the remaining offset (Fig. 0.10). Secondly, a slightly excessive D component leads quickly to instability of the control loop. The controlled system then tends to oscillate. In addition to the properties of the PI controller, the PID controller is complemented by the D controller. This takes the rate of change of the system deviation into account. If the system deviation is large, the D component ensures a momentary extremely high change in the manipulated variable. While the influence of the D component falls immediately, the influence of the I component increases the manipulated variable value slowly. If the change in system deviation is slight, the behavior of the D component is negligible. This behavior has the advantage of faster response and quicker compensation of system deviation in the event of changes in the setup value or disturbance variable values. The disadvantage is that the control loop is much more prone to oscillation and that setting is therefore more difficult [18]. Fig. 0.15 shows the time response of a PID controller. As a result of the D component, this controller type is faster than a P controller or a PI controller (Fig. 0.10). This manifests itself in the derivative-action time Td. The derivative-action time is the period by which a PID controller is faster than the PI controller.

Tuning criteria or “How do we know when it’s tuned?” One of the most important and most ignored facets of closed-loop tuning is the determination of the proper values tuning parameters.

Fig. 0.15. The time response of the PID controller

System deviation xd Manipulated variable y Controller

xd y

t Td Tr

t

System deviation xd Manipulated variable y Controller

xd y

t t Td

Page 10: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

Controller tuning means the adjustment of the controller to a connected technical process. The control parameters have to be selected such that the most favorable control action of the closed-loop control is achieved, under the given operating conditions.

The extremes: instability or no response The closed-loop performance must fall between two extremes. First, the closed-loop must respond to a change in the set point and to disturbances. That is, an error, or difference in the process and the set point, must eventually result in the manipulation of the output so that the error is eliminated. If the gain, reset, and derivative of the loop are turned to zero, there will be no response. The other extreme is instability. An unstable closed-loop system will oscillate without bound. A set point change will cause the closed-loop system to start oscillating, and the oscillations will continue. At worst, the oscillations will grow (or diverge). Proper tuning of a closed-loop system will allow the system output to respond to set point changes and disturbances without causing instability.

Informal methods There are several rules of thumb for determining the quality of the tuning of a closed-loop control [19]. Traditionally, quarter wave decay (Fig. 0.16) has been considered to be the optimum decay ratio. This criterion is used by the Ziegler Nichols tuning method, among others. There is no single combination of tuning parameters that will provide quarter wave decay. If the gain is increased and the reset rate is decreased by the correct amount, the decay ratio will remain the same. Quarter wave decay is not necessarily the best tuning for either disturbance rejection or set point response. However, it is a good compromise between instability and lack of response.

Fig. 0.16. Quarter wave decay

Fig. 0.17. Overshoot following a set point change For some closed-loops the objective of the tuning is to minimize the overshoot of the controlled system output variable value following a set point value change (Fig. 0.17). The choice of methods depends upon the loops place in the process and its relationship with other loops [19].

PID control in STEP 7 STEP 7 offers special FBs for PID control, which are continuous control FB (CONT_C), step control FB (CONT_S), and pulse duration modulation FB (PULSEGEN) [20].

Page 11: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

The controller blocks implement a purely software controller with the block providing the entire functionality of the controller. The data (e.g. cyclic calculation) used for PID control are stored in DBs assigned to the FB. This allows the FBs to be called as often as necessary. A controller implemented with the controller blocks is not restricted to any particular application. The performance of the PID controller and its processing speed are only dependent on the performance of the selected CPU. Continuous Controller FB41 “CONT_C” is used to control technical processes with continuous input and output variables. During parameter assignment, it is possible to activate or deactivate subfunctions (e.g. derivative controller, integral controller) of the PID controller to adapt the controller to the process. The PID algorithm operates as a position algorithm. The P, I, and D controllers are connected in parallel and can be activated or deactivated individually. This allows P, PI, PD, and PID controllers to be configured. Pure I and D controllers are also possible. It is possible to switch over between a manual and an automatic mode [20]. Step Controller FB42 “CONT_S” is used to control technical processes with digital manipulated value output signals for integrating actuators. During parameter assignment, you can activate or deactivate subfunctions of the PI step controller to adapt the controller to the automated process. Pulse Generation FB43 “PULSEGEN” is used to structure a PID controller with pulse output for proportional actuators. By using FB43 “PULSEGEN”, a PID two or three step controllers with pulse duration modulation can be configured. In two-step control, only the positive pulse output QPOS_P of FB43 “PULSEGEN” is connected to the on/off actuator. In the three-step control mode, the actuating signal can adopt three states. The values of the binary output signals QPOS_P and QNEG_P of the FB43 “PULSEGEN” are assigned to the statuses of the actuator. The FB43 “PULSEGEN” is normally used in conjunction with the continuous controller FB41 ”CONT_C” (Fig. 0.18) [20].

Fig. 0.18. Combination of FB "CONT_S" and "PULSGEN" The continuous controller FB41 “CONT_C” forms the manipulated value LMN, which is converted to pulse-break signals QPOS_P or QNEG_P by the pulse generator FB43 “PULSEGEN”. The duration of a pulse per period (QPOS_P) is proportional to the input variable INV (Fig. 0.19) [20].

Page 12: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

Fig. 0.19. Pulse Duration Modulation

Self check 1. Which of the following tasks are associated with process control (multiple

answers)? a. Measurement b. Comparison c. Quality Analysis d. Adjustment e. Calculation

2. A deviation from the set point due to disturbance is … a. Error. b. Offset. c. Rate of change.

Page 13: Chapter 8

AAPPPPLLIICCAATTIIOONN OOFF PPLLCC IINN IINNDDUUSSTTRRIIAALL AAUUTTOOMMAATTIIOONN

3. What is the continuing error due to the inability of a control system to keep the

measured variable at the set point called? a. Disturbance b. Offset c. Pressure

4. Which of the following statements is true? a. A disturbance is an undesired change that can affect the reference variable. b. A disturbance is an undesired change that can affect the manipulated variable. c. A disturbance is an undesired change that can affect the controller. d. A disturbance is an undesired change that can affect the controlled system

(process). 5. Which controller type eliminates the offset?

a. P b. PI c. PD d. D

6. Which controller type is also called differentiation of the system deviation? a. P b. I c. PI d. D

7. Which of the following variables are commonly measured or monitored in process control applications (multiple answers)? a. Pressure b. Viscosity c. Nitrogen content d. Flow rate e. Temperature