Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Jack H.Automating manufacturing systems with PLCs.2005.pdf
Скачиваний:
261
Добавлен:
23.08.2013
Размер:
5.34 Mб
Скачать

plc pid - 25.12

25.3.4 PID Control Systems

Proportional-Integral-Derivative (PID) controllers are the most common controller choice. The basic controller equation is shown in Figure 25.13. The equation uses the system error e, to calculate a control variable u. The equation uses three terms. The proportional term, Kp, will push the system in the right direction. The derivative term, Kd will respond quickly to changes. The integral term, Ki will respond to long-term errors. The values of Kc, Ki and Kp can be selected, or tuned, to get a desired system response.

de u = Kce + Kiedt + Kd -----

dt

Figure 25.13 PID Equation

Kc

Ki Relative weights of components Kd

Figure 25.14 shows a (partial) block diagram for a system that includes a PID controller. The desired setpoint for the system is a potentiometer set up as a voltage divider. A summer block will subtract the input and feedback voltages. The error then passes through terms for the proportional, integral and derivative terms; the results are summed together. An amplifier increases the power of the control variable u, to drive a motor. The motor then turns the shaft of another potentiometer, which will produce a feedback voltage proportional to shaft position.

 

proportional

 

PID Controller

 

V

Kp ( e)

 

 

V

 

 

+V

 

integral

+

 

 

 

 

 

+

e

 

u

 

 

Ki ( e)

+

amp

motor

 

 

 

 

-

derivative

+

-V

 

 

d

 

 

 

 

Kd dt----e

 

 

 

Figure 25.14 A PID Control System

plc pid - 25.13

Recall the cruise control system for a car. Figure 25.15 shows various equations that could be used as the controller.

PID Controller

θ

 

 

 

 

 

 

dverror

 

 

= Kpverror + Ki

verror dt

----------------

gas

 

+ Kd

dt

 

PI Controller

 

 

 

 

 

 

 

θ

gas

= Kpverror + Kiverror dt

 

 

 

PD Controller

 

 

dverror

 

 

 

 

θ

 

 

 

 

 

 

 

 

 

----------------

 

 

gas

= Kp verror + Kd

dt

 

 

 

PController

θgas = Kpverror

Figure 25.15 Different Controllers

When implementing these equations in a computer program the equations can be rewritten as shown in Figure 25.16. To do this calculation, previous error and control values must be stored. The calculation also require the scan time T between updates.

u

 

= u

 

+ e

 

K

 

+ K

Kd

 

 

K

 

– 2

Kd

Kd

 

 

 

 

T + ----- + e

 

 

----- + e

-----

 

n

 

n – 1

 

n

 

p

i

T

n – 1

 

 

p

 

T

n – 2 T

Figure 25.16 A PID Calculation

The PID calculation is available as a ladder logic function, as shown in Figure 25.17. This can be used in place of the SUB and MUL functions in Figure 25.12. In this example the calculation uses the feedback variable stored in Proc Location (as read from the analog input). The result is stored in N7:2 (to be an analog output). The control block uses the parameters stored in PD12:0 to perform the calculations. Most PLC programming software will provide dialogues to set these value.