background image

Chapter 2

PID Algorithms

©

 National Instruments Corporation

2-3

LabWindows/CVI PID Control Toolkit User Manual

Output Limiting

The actual controller output is limited to the range specified for control output, as follows:

and

The following formula shows the practical model of the PID controller.

The PID functions use an integral sum correction algorithm that facilitates anti-windup and 
bumpless manual-to-automatic transfers. Windup occurs at the upper limit of the controller 
output, for example, 100%. When the error (

e

) decreases, the controller output decreases, 

moving out of the windup area. The integral sum correction algorithm prevents abrupt 
controller output changes when you switch from manual to automatic mode or change any 
other parameters.

The default ranges for the SP, PV, and output parameters correspond to percentage values; 
however, you can use actual engineering units. If you use engineering units, you must adjust 
the corresponding ranges accordingly. The 

T

i

 and 

T

d

 parameters are specified in minutes. 

In manual mode, you can change the manual input to increase or decrease the output.

All the PID control functions are reentrant. Multiple calls from high-level functions use 
separate and distinct data.

Note

As a general rule, manually drive the PV until it meets or comes close to the SP 

before you perform the manual-to-automatic transfer.

Gain Scheduling

Gain scheduling refers to a system in which you change controller parameters based on 
measured operating conditions. For example, the scheduling variable can be the SP, the PV, 
a controller output, or an external signal. For historical reasons, the term gain scheduling is 
used even if other parameters, such as the derivative time or integral time parameters, change. 
Gain scheduling effectively controls a system whose dynamics change with the operating 
conditions.

if 

u k

( )

u

max

then 

u k

( )

u

max

=

if 

u k

( )

u

min

then 

u k

( )

u

min

=

u t

( )

K

c

SP PV

(

)

 

1

T

i

----

(

SP PV

)

dt T

d

 

dPV

f

dt

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

0

t

+

=

Summary of Contents for LabWindows/CVI

Page 1: ...LabWindows TM CVI TM PID Control Toolkit User Manual LabWindows CVI PID Control Toolkit User Manual May 2008 371685C 01...

Page 2: ...ebanon 961 0 1 33 28 28 Malaysia 1800 887710 Mexico 01 800 010 0793 Netherlands 31 0 348 433 466 New Zealand 0800 553 322 Norway 47 0 66 90 76 60 Poland 48 22 3390150 Portugal 351 210 311 210 Russia 7...

Page 3: ...l Instruments Corporation National Instruments respects the intellectual property of others and we ask our users to do the same NI software is protected by copyright and other intellectual property la...

Page 4: ...gorithm 2 1 Implementing the PID Algorithm with the PID Functions 2 2 Gain Scheduling 2 3 The Precise PID Algorithm 2 4 Error Calculation 2 4 Proportional Action 2 4 Trapezoidal Integration 2 5 The Au...

Page 5: ...Manual vi ni com Converting between Percentage of Full Scale and Engineering Units 3 9 Using PID on Real Time RT Targets 3 10 Using PID with DAQ Devices 3 10 Appendix A References Appendix B Technical...

Page 6: ...mation bold Bold text denotes items that you must select or click in the software such as menu items and dialog box options Bold text also denotes parameter names italic Italic text denotes variables...

Page 7: ...of the PID Control Toolkit Note When you install the PID Control Toolkit your user account must have administrator privileges Complete the following steps to install the PID Control Toolkit 1 Insert...

Page 8: ...sary information and click Next 5 Check the option if you would like to receive a confirmation email of your activation and click Next 6 After a brief moment you should receive a message indicating wh...

Page 9: ...ol Toolkit functions with National Instruments hardware to develop LabWindows CVI control applications Use I O hardware such as DAQ devices FieldPoint I O modules or GPIB boards to connect your PC to...

Page 10: ...on u t as follows In this equation Kc is the controller gain If the error and the controller output have the same range 100 to 100 controller gain is the reciprocal of proportional band Ti is the inte...

Page 11: ...error as shown in the following formula Trapezoidal Integration Trapezoidal integration is used to avoid sharp changes in integral action when there is a sudden change in the PV or SP Use nonlinear ad...

Page 12: ...al engineering units If you use engineering units you must adjust the corresponding ranges accordingly The Ti and Td parameters are specified in minutes In manual mode you can change the manual input...

Page 13: ...rithm described in the Proportional Action section The formula used to calculate derivative action for the precise PID algorithm is the same formula used to calculate derivative action for the fast PI...

Page 14: ...ror the smaller the integral action as shown in the following formula and in Figure 2 1 Figure 2 1 Nonlinear Multiple for Integral Action SPrng 100 The Autotuning Algorithm Use autotuning to improve p...

Page 15: ...ng controller is proportional only the autotuning algorithm identifies the ultimate gain Ku and ultimate period Tu If the existing model is PI or PID the autotuning algorithm identifies the dead time...

Page 16: ...PI 0 18Ku 0 8Tu PID 0 25Ku 0 5Tu 0 12Tu Table 2 3 Tuning Formula under P Only Control Slow Controller Kc Ti Td P 0 13Ku PI 0 13Ku 0 8Tu PID 0 15Ku 0 5Tu 0 12Tu Table 2 4 Tuning Formula under PI or PI...

Page 17: ...d loop PID control It is not necessary to switch off the existing controller and perform the experiment under open loop conditions In the setpoint relay experiment the SP signal mirrors the SP for the...

Page 18: ...rocess For example a time constant of 60 s is typical for a temperature control loop in a small system In this case a cycle time of 6 s is sufficient Faster cycling offers no improvement in performanc...

Page 19: ...dures Closed Loop Ultimate Gain Tuning Procedure Although the closed loop ultimate gain tuning procedure is very accurate you must put your process in steady state oscillation and observe the PV on a...

Page 20: ...set the output to a nominal operating value and allow the PV to settle completely Record the PV and output values 2 Make a step change in the output Record the new output value 3 Wait for the PV to s...

Page 21: ...n the system 4 Once the control loop ends call PidDiscard to discard the PID controller and free its resources You can call PidSetAttribute with the pidAttrOutputMin and pidAttrOutputMax attributes to...

Page 22: ...tem Therefore if correctly sampled any frequency components of the measured signal that are greater than one tenth of the sampling frequency are a result of noise in the measured signal Gains in the P...

Page 23: ...ide the PV to the controller in a loop and obtain the controller output which is again applied on the system 3 While the PID control loop is being run call PidAutotuneShowDialog if you want to use wiz...

Page 24: ...the pidGSAttrGainScheduleCriteria attribute to set the gain scheduling criteria Call PidSetGainScheduleAttribute and PidGetGainScheduleAttribute to set and get gain scheduling attributes The pidGSAtt...

Page 25: ...adLagNextOutput to obtain the output This output is either applied to the system or to the controller based on whether the lead lag is being used as an input or an output filter 3 Once the control loo...

Page 26: ...ll PidSetRampAttribute to set the ramp generator attributes 3 Use PidRampNextOutput to obtain the output of the ramp in a loop 4 Call PidRampDiscard to discard the ramp generator and release its resou...

Page 27: ...PID with DAQ Devices This section addresses several important issues you might encounter when you use the DAQ APIs to control actual processes Complete the following steps to use the PID Library with...

Page 28: ...h a timer construct such as a timer control or asynchronous timer or a while loop with a delay or sleep operation at the end Hardware Timed In hardware timed control loops the timing is controlled by...

Page 29: ...ocess control programming The Corripio 1990 publication is an ISA Independent Learning Module book It is organized as a self study program covering measurement and control techniques selection of cont...

Page 30: ...r Standard Service Program Membership This program entitles members to direct access to NI Applications Engineers via phone and email for one to one technical support as well as exclusive access to on...

Page 31: ...answers you need contact your local office or NI corporate headquarters Phone numbers for our worldwide offices are listed at the front of this manual You also can visit the Worldwide Offices section...

Page 32: ...is feature B bias The offset added to a controller s output bumpless transfer A process in which the next output always increments from the current output regardless of the current controller output v...

Page 33: ...ch a measured variable is compared to its desired value to produce an actuating error signal that is acted upon in such a way as to reduce the magnitude of the error feedback loop See closed loop G ga...

Page 34: ...ain Kc Controller gain L lag A lowpass filter or integrating response with respect to time linearity factor A value ranging from 0 to 1 used to specify the linearity of a calculation A value of 1 indi...

Page 35: ...is applied to the integral of the error signal and a derivative gain D is applied to the derivative of the error signal The controller output is a linear combination of the three resulting values PID...

Page 36: ...the controlled process variable span The algebraic difference between the upper and lower range values T time constant T In process instrumentation the value T in minutes in an exponential response te...

Page 37: ...ning procedure 3 2 control strategy designing 3 1 controller action 2 1 gain 2 1 output 2 2 PID 1 3 conventions used in the manual vii Corripio A B A 1 D DAQ devices using PID with 3 10 derivative act...

Page 38: ...2 1 controller output 2 2 error calculation 2 2 nonlinear adjustment of integral action 2 2 output limiting 2 3 partial derivative action 2 2 proportional action 2 2 trapezoidal integration 2 2 gain...

Page 39: ...ements 1 1 T technical support B 1 timing information acquiring 3 1 timing setting 3 1 training and certification NI resources B 1 trapezoidal integration 2 2 2 5 troubleshooting NI resources B 1 tuni...

Reviews: