This reference example includes a recommended architecture for performing low channel count multi-channel PID control on a Real-Time (RT) CompactRIO (cRIO) controller with a host user interface. Channel I/O is performed using the cRIO chassis configured for Scan Mode.
Description The LabVIEW Project consists of two major components. The RT application running on the cRIO controller (cRIO 9074 for this example) and the operater interface running on development environment on a host machine. The RT application is the PID Control (RT VI).vi and the operator interface is listed as HMI (Host VI).vi. The two running applications communicate using Network Published Shared variables. Here is a snapshot of the project layout:
The RT application PID Control (RT VI).vi is broken up into 3 sections; Initialize, Control, Shutdown.
The Initialize section initializes the Network Published Shared Variables, PID Gains, and Arrays used during the control process.
The Control Process section runs two parallel loops. The Deterministic Control Loop (which is synchronized with the Scan Engine) is responsible for performing the PID control on 4 temperature process variables. This is achieved by reading the Scan I/O Variables from the cRIO modules, implementing PID control to those values (Using the PID.vi which is included in the PID and Fuzzy Logic Toolkit), and then writing the command output to the output modules using the Scan I/O Variables. The Non-Deterministic UI and Network Loop is responsible for communicating with the HMI (Host VI) using Network Published Shared Variables. The status of each channel, PID Gains, and output limits information is passed to the HMI (Host VI) from the controller. The HMI (Host VI) can also issue new set points, output ranges, PID gains, and commands to stop through the Non-Deterministic Loop.
The Shutdown section sets the outputs of the cRIO modules to a safe value.
The Host VI (HMI (Host VI).vi) is also broken up into 3 sections; Initialize, Main UI, Shutdown.
The Initialize section initializes Network Published Shared Variables (heartbeat and idle checking)
The Main UI Loop is responsible for sending the output range, PID gains, heartbeat, and setpoint information to the RT control application on the cRIO. It also produces a useful display on the front panel which shows a graph of the process data.
The Shutdown section gives you the option to send an idle command to the controller to halt control while the Host VI is not running.
Steps to Implement or Execute Code
Begin by running the Host VI (HMI (Host VI).vi) and setting your desired Idle functionality and Control Parameters. You also have the ability enable or disable the Control Process.
Once you have configured the Host Interface as desired, begin the RT Application VI PID Control (RT VI).vi. The Host UI should now update with the appropriate values from the controller.
Adjust the Parameters and Setpoint as desired.
Make sure to properly shutdown both of the VI's using the corresponding Stop buttons. Optionally, the control process will also return to an idle state if the network connection with the host is lost.
LabVIEW 8.6 or higher Development Environment
LabVIEW Real-Time 8.6 or higher
LabVIEW PID and Fuzzy Logic Toolkit
Computer with LabVIEW Development Environment
cRIO Controller (This example uses a cRIO-9074 integrated controller but other cRIO setups can be used)