Академический Документы
Профессиональный Документы
Культура Документы
Overview
The Real-Time Control on CompactRIO (RIO Scan Interface) sample project implements deterministic, software-based control of a plant. This sample project uses the RIO Scan Interface (RSI), which is an alternative to programming with the LabVIEW FPGA Module, to perform I/O on the FPGA. The RSI programming mode is available on most CompactRIO and Single-Board RIO devices and is sufficient for applications that require single-point access to I/O at rates of a few hundred Hertz.
Table of Contents
1. Developer Walkthrough 2. Features 3. Basis 4. System Requirements 5. Overview 6. Running this Sample Project 7. Modifying this Sample Project
1. Developer Walkthrough
See a developer walkthrough of the RIO sample projects.
2. Features
Deterministic, software-based controlThe real-time controller executes parallel control algorithms that run at different rates. RIO Scan InterfaceThe RIO Scan Interface provides single-point updates to I/O variables at rates up to a few hundred Hertz without requiring FPGA programming. User interfaceThe user interface VI interacts with the CompactRIO device and displays data. This VI can disconnect from the device and reconnect at any time without affecting the control loop. Error handlingThe application reports and logs all errors from the CompactRIO device, shutting down on any critical error.
3. Basis
This sample project is based on the Simple State Machine and Queued Message Handler templates. Refer to the Simple State Machine and Queued Message Handler templates and their documentation, available from the Create Project dialog box, for information about how these templates work.
5. Overview
This sample project consists of nine parallel loops across two execution targets. The following loops run in parallel on the desktop computer: Handling events from the user interface (UI Main.vi - Event Handling Loop)Produces messages to the UI Message Loop based on front panel events. Handling messages from the user interface and other loops on the desktop computer (UI Main.vi - UI Message Loop) Displaying messages and data from the CompactRIO device (UI Main.vi - Monitoring Loop)Displays the latest values of information acquired from RT Loop - System Health and Monitoring.vi. The following loops run in parallel on the real-time controller: Controlling the plant (RT Loop - RSI Control.vi)Reads from the NI 9205 inputs, applies a control algorithm to each channel, and writes to the NI 9263 outputs. The control algorithm uses setpoint data and PID gains sent from the user interface. Monitoring temperature and stopping the control loop (RT Loop - RSI Low Speed.vi)Reads temperature data from the NI 9213 and a DI line from the NI 9422 and determines whether to stop the control loop and write to DO lines on the NI 9485. Handling commands from the user interface (RT Loop - UI Commands.vi)Reads commands that are sent from UI Main.vi on the development computer and produces the appropriate messages. Handling messages from all loops on the real-time controller (RT Main.vi - Message Handling Loop)Consumes messages from all loops that run on the real-time controller. Ensuring the RT controller remains responsive (RT Loop - Watchdog.vi)Pets the watchdog, ensuring the RT controller remains responsive. Monitoring diagnostic information from the real-time controller (RT Loop - System Health and Monitoring.vi)Monitors CPU and memory usage of the real-time controller and information about
1/2
www.ni.com
Monitoring diagnostic information from the real-time controller (RT Loop - System Health and Monitoring.vi)Monitors CPU and memory usage of the real-time controller and information about the RSI. This information is written to network-published shared variables and appears on the Data Monitoring and System Monitoring tabs of UI Main.vi. No LabVIEW code runs on the FPGA. Instead, the RSI runs on the FPGA, scans the C Series modules for input and output changes, and passes updated values to the NI Scan Engine. The NI Scan Engine, which is running on the real-time controller, updates the I/O variables with data from the RSI. This update provides single-point data from C Series I/O to both the real-time VI and the user interface.
7. Modifying this Sample Project Adapting this Sample Project to Your Hardware
The following steps refer to NI CompactRIO devices, but you also can adapt this sample project to an NI Single-Board RIO device that supports the RIO Scan Interface. 1. Ensure all devices are configured and connected to the same network as the development computer. 2. In the Project Explorer window, add or discover your RT CompactRIO target to the top-level project item. 3. Add or discover your CompactRIO chassis to the RT Compact RIO target you added in the previous step. Ensure the chassis is set to Scan Interface mode. 4. Add or discover your C Series input module to the CompactRIO chassis you added in the previous step. 5. Drag the following project items from the default RT CompactRIO target to the one you added in step 2: Error Handlers folder Globals folder Support VIs folder RT Loops folder Type Definitions folder Deterministic Loop Variables.lvlib Shared Variables.lvlib RT Main.vi 6. Delete the default RT CompactRIO Target project item that no longer has any VIs associated with it. 7. Open RT Loop - RSI Control.vi and replace the Shared Variable Nodes with ones that represent the I/O channels you want to use. For example, to use Mod5/AI2, drag this input channel from the Project Explorer window to the block diagram. The actual channels you read from and write to depend on your application. 8. Open RT Loop - RSI Low Speed.vi and replace the Shared Variable Nodes with ones that represent the I/O channels you want to use.
2/2
www.ni.com