Chapter 3
Using the PID Control Toolkit
LabWindows/CVI PID Control Toolkit User Manual
3-6
ni.com
Using PID with Autotuning
You can use autotuning to improve controller performance. There are two ways in which you
can autotune a controller.
•
Wizard-Based Autotuning
—You can use the PID Autotuning Wizard to tune the
parameters.
•
Classic Autotuning
—You can use the functions in the Autotuning class to develop a
custom autotuning user interface.
Complete the following steps to autotune a controller. These steps explain both wizard-based
and classic autotuning.
1.
Call
PidCreateWithAutotune
to create the controller and obtain the PID handle that
identifies that controller in subsequent function calls. The PID Library invokes the
callback function provided to
PidCreateWithAutotune
when the following PID
events occur:
•
pidNoiseEstimateEvent
—Noise estimation is complete
•
pidRelayCycleEvent
—A setpoint relay cycle is complete
•
pidAutotuneEvent
—Autotuning is complete
When you use wizard-based autotuning, the library invokes the callback function only
when the autotuning is complete.
2.
Provide 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 wizard-based autotuning. This function launches the Autotuning Wizard. To use
classic autotuning, call the functions in the Autotuning class.
4.
Once the control loop ends, call
PidDiscard
to discard the PID controller and release
its resources.
Distributing Applications That Use Wizard-Based Autotuning
Use the LabWindows/CVI application distribution feature to deploy applications you create
using the PID Control Toolkit. The PID Control Toolkit installs
CVIPIDRuntime.msm
in the
C:\Program Files\Common Files\Merge Modules
directory. This file installs
CVIPIDAtUI.dll
in the
system
directory. If you deploy applications that use wizard-based
autotuning, you must add this merge module to the distribution.
The version of LabWindows/CVI you are using determines how you add the merge module
to the distribution. If you are using LabWindows/CVI 7.
x
, create a file group in the
distribution kit named
_MSMS_
. Include
CVIPIDRuntime.msm
in that file group. Build the
distribution kit, and
CVIPIDRuntime.msm
will be seamlessly merged in as an MSI merge
module, instead of just being included as a file.