National Instruments 371685C-01 用户手册

下载
页码 39
Chapter 3
Using the PID Control Toolkit
3-10
ni.com
value of 1 produces an output of 10 for a difference between the SP and PV of 10, 
regardless of the output range and setpoint range.
Using PID on Real-Time (RT) Targets
Some PID applications are deterministic and, therefore, cannot be run on desktop operating 
systems. Because the PID Library is supported on real-time (RT) targets, you can use it to 
develop deterministic applications. For more information about developing and running 
RT applications, refer to the LabWindows/CVI Real-Time Module Help.
Because RT systems do not support user interfaces, you cannot use wizard-based autotuning 
in PID applications that are targeted for RT platforms. Any applications that are targeted for 
RT must not include the following functions:
PidAutotuneShowDialog
PidAutotuneCloseDialog
However, you can use other functions in the Autotuning class to tune the PID controller in 
applications targeted for RT platforms.
Using 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 a DAQ device.
1.
Configure the DAQ device and channels for both input and output. Also configure the 
sample clocks, if necessary.
2.
Call 
PidCreate
 to create the PID controller. Then call 
PidSetAttribute
 to configure 
the controller attributes.
3.
Within the control loop, complete the following steps:
a.
Read the input from the DAQ device.
b.
Modify/manipulate the input so that it can be provided to the controller. This step is 
optional and required only in cases in which the controller input is derived from the 
acquired DAQ input.
c.
Supply this input to the controller and obtain the controller output.
d.
Modify/manipulate the controller output so that it can be used as the DAQ device 
output. This step is optional and required only in cases in which the output on the 
DAQ device is derived from the controller output.
e.
Write the output to the DAQ device.
4.
Discard the controller to release its resources. Also clear all the DAQ tasks. In some 
cases, just before clearing the DAQ tasks, the DAQ device outputs a 0.