Getting Started with the LabVIEW Real-Time Module

Similar documents
LabVIEW Real-Time Module Release Notes

Getting Started with the LabVIEW Real-Time Module

LabVIEW Real-Time Module for Mac OS X User Manual Addendum

Programming for the LabVIEW Real-Time Module Using LabWindows/CVI

LabVIEW Real-Time Module Release and Upgrade Notes

LabVIEW PDA Module Release Notes

LabVIEW FPGA Module Release Notes

Getting Results with CompactRIO and LabVIEW

NI-Industrial Communications for EtherCAT

LabVIEW Express VI Development Toolkit User Guide

IMAQ Vision Deployment Engine Note to Users

IMAQ Vision Deployment Engine Note to Users

LabVIEW FPGA Module Release and Upgrade Notes

LabVIEW TM Real-Time 2: Architecting Embedded Systems Exercises

NI-DAQ mx Base 1.x. Contents GETTING STARTED GUIDE

Academic Software Solutions

LABVIEW REAL-TIME. Contents. About LabVIEW Real-Time (RT) RELEASE NOTES. Version 6.1

LabVIEW VI Analyzer Toolkit

LabVIEW Release Notes

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

LabVIEW for FTC Release Notes

Hands-on Lab 2: LabVIEW NI-DAQ Basics 2

Step-by-Step Data Acquisition Part II Exercise 2: Generating an Analog Output Waveform

Hardware: Acquiring Data and Communicating with Instruments

LabVIEW Datalogging and Supervisory Control Module

LabVIEW Application Builder User Guide

ESERIES CALIBRATION FIXTURE INSTALLATION GUIDE

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

LabVIEW FPGA Module Release and Upgrade Notes

LabVIEW DataFinder Toolkit

OpenStax-CNX module: m Thermometer VI * National Instruments

LabVIEW Upgrade Notes

LabVIEW TM Basics I Introduction Course Manual

SCB-68 User Guide. 68-Pin Shielded Desktop Connector Block

Where to Start with NI ELVIS

NI USB-6211/6218 OEM

Getting Started with the LabVIEW Robotics Module Version 2011

Using Desktop PCs as RT Targets with the LabVIEW Real-Time Module

The NI TB-2648/2649/2650/2651 terminal blocks configure your NI PXI/PXIe-2531 (NI 2531) in one of the following topologies. 1-wire 8 64 matrix

NI-DAQ mx for USB Devices

Getting Started with LabVIEW Virtual Instruments

Where to Start with NI ELVIS

Foundation Fieldbus Hardware and NI-FBUS Software for Windows 2000/XP

LABVIEW. Contents RELEASE NOTES. Version 6.1

Getting Started with the NI 783x R

NI WSN-9791 Ethernet Gateway

IMAQ Vision 7 Development Module for LabVIEW Release Notes

Table 1. Inputs and Outputs

Getting Started with R Series Intelligent DAQ

Exercise 0 - Open and Run a Virtual Instrument (Slide 12)

LabVIEW VI Analyzer Toolkit

INSTALLATION INSTRUCTIONS Data Management Software Suite in the Evaluation Mode

Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis

M Series USB-6221/6225/6229/6251/6255/6259 OEM Devices

Concept: Debugging. Goal. Description. Implementation. Use the debugging tools built into LabVIEW.

NI USB-622x/625x/628x OEM

Developing Measurement and Control Applications with the LabVIEW FPGA Pioneer System

LabVIEW Real-Time Module Release and Upgrade Notes

Calibrating FieldPoint Analog Input Modules with Calibration Executive

MATRIXx. Platforms, Requirements, and Deliverables RELEASE NOTES. Version 7.1. Documentation

Tutorial: Getting Started with the LabVIEW Simulation Module

NI LabView READ THIS DOCUMENT CAREFULLY AND FOLLOW THE INSTRIUCTIONS IN THE EXERCISES

Lab 4 - Data Acquisition

Getting Started with R Series Multifunction RIO

Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis

Introduction to LabVIEW Exercise-1

Getting Started with the LabWindows /CVI Real-Time Module

LabVIEW. Getting Started with LabVIEW. Getting Started with LabVIEW

System Overview and Terms

Measurement Studio Measurement Computing Edition

Read Temperature Data

Lesson 1 Introduction to LabVIEW. TOPICS LabVIEW Environment Front Panel Block Diagram Dataflow Programming LabVIEW Help and Manuals Debugging a VI

LabWindows /CVI Release Notes Version 2010

Setting up to download Grants Group Application Forms

PHYC 500: Introduction to LabView. Exercise 16 (v 1.2) Controlling hardware with DAQ device. M.P. Hasselbeck, University of New Mexico

NOTE TO USERS NI 61xx Pinout Labels for the SCB-68 Multifunction I/O S Series Modules/Devices Using the 68-Pin Shielded Connector Block

Lab Exercise 4: Analog & Digital I/O Signals

LabVIEW DSP Module Release and Upgrade Notes

Sample. LabVIEW TM Core 1 Exercises. Course Software Version 2010 August 2010 Edition Part Number B-01. LabVIEW Core 1 Exercises

Controller Area Network (CAN) Tutorial

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

LabWindows /CVI Release Notes Version 8.0.1

NI 6703/6704 Calibration Procedure for NI-DAQ mx

Lesson 4 Implementing a VI

NI 6703/6704 Calibration Procedure for Traditional NI-DAQ

NI PXI Installing the NI PXI-8104 INSTALLATION GUIDE

Getting Started with the NI LabVIEW Embedded Module for ADI Blackfin Processors Version 8.6

LabVIEW Release Notes

IVI Compliance Package Release Notes

Lab 1: Getting familiar with LabVIEW: Part I

Virtual Instruments with LabVIEW

INSTALLATION INSTRUCTIONS Data Management Software Suite

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

LabVIEW TM Core 1 Course Manual

Lab Exercise 2: Data Acquisition with NI LabVIEW

The LabVIEW Programming Environment and Basic Operations

ION Demo Kit. Quick Start Guide PERFORMANCE MOTION DEVICES

Quick Start Guide. Cole-Parmer USB-based Data Acquisition Software

C Support for myrio 5.0 User Guide

Getting Results with the NI PXI-6585R

Transcription:

Getting Started with the LabVIEW Real-Time Module Contents This document provides steps to build a simple deterministic application and references to programming examples and documentation for more information as you build the application. Refer to the LabVIEW Real-Time Module User Manual for installation and configuration instructions and for information about programming deterministic applications using LabVIEW. Launching LabVIEW and Exploring Documentation... 1 Creating and Running a Deterministic Application... 3 Creating the Control Loop... 3 Adding Analog Input/Output and Data Processing to the Control Loop... 4 Setting Priority of the VI to Time Critical... 6 Adding Timing to the Control Loop... 6 Sending Data Out of the Time-Critical VI... 7 Downloading and Running the Application... 9 Optimizing the Control Application... 11 Launching LabVIEW and Exploring Documentation The LabVIEW Real-Time Module includes a comprehensive documentation set designed to help you create deterministic applications. The LabVIEW Real-Time Module Bookshelf, available by selecting Help»Search the Real-Time Module Bookshelf from LabVIEW, is a document that contains links to and descriptions of the available Real-Time Module documentation. You must have Adobe Acrobat Reader with Search and Accessibility 5.0.5 or later installed to view the PDFs. (Mac OS) PDF links do not work with the Apple Preview viewer. Refer to the Adobe Systems Incorporated Web site at www.adobe.com to download Acrobat Reader. Launch LabVIEW to open the LabVIEW FieldPoint, LabVIEW, National Instruments, NI, and ni.com are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies. For patents covering National Instruments products, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your CD, or ni.com/patents. April 2003 323525A-01 ni.com 2003 National Instruments Corp. All rights reserved. Printed in Ireland.

dialog box shown in Figure 1. Open and explore the LabVIEW Real-Time Module Bookshelf. Figure 1. The LabVIEW Dialog Box The LabVIEW Help contains VI reference information for all Real-Time VIs. You can access the LabVIEW Help by selecting Help»VI, Function, & How-To Help. Open and explore the LabVIEW Help. The RT Module allows you to select the host computer or an RT target as an execution target to run VIs built in LabVIEW. The LabVIEW dialog box indicates the current execution target. The default execution target is the development machine, or host computer. Refer to Chapter 3, Real-Time Module Environment, of the LabVIEW Real-Time Module User Manual for information about the selecting execution targets. When you select an RT target an RT Series plug-in device or networked RT Series device as the execution target, the LabVIEW development environment continues to run on the host computer but VIs run on the RT target. Refer to Chapter 1, Introduction, of the LabVIEW Real-Time Module User Manual for information about RT targets. Getting Started with the LabVIEW Real-Time Module 2 ni.com

Creating and Running a Deterministic Application Creating the Control Loop This section describes the steps to create a deterministic PID control application. The application receives an analog input, processes the data using PID control VIs, and outputs the resulting control data. Refer to the LabVIEW PID Control Toolset User Manual for information about the PID control algorithm and the PID Control Toolset VIs. Refer to the LabVIEW Real-Time Module User Manual for information about Real-Time Module features. Complete the following steps to create a control loop for the control VI. 1. Open a blank VI and display the block diagram. 2. Place a While Loop on the block diagram. Refer to the LabVIEW User Manual for information about using While Loops. 3. Right-click the conditional terminal and select Create Control from the shortcut menu to create and wire a Stop button control to the conditional terminal. The block diagram should look similar to Figure 2. Figure 2. Control Loop The While Loop runs all code within its boundaries until the conditional terminal receives a TRUE value. Use the conditional loop as the control National Instruments Corporation 3 Getting Started with the LabVIEW Real-Time Module

loop in the next section. If you press the Stop button on the front panel, the button passes a TRUE value to the conditional terminal. Adding Analog Input/Output and Data Processing to the Control Loop Complete the following steps to add analog input/output and a PID control VI to the control loop. 1. Place the AI Sample Channel VI in the control loop on the block diagram. (FieldPoint) Use the FP Read VI. 2. Right-click the device input of the AI Sample Channel VI and select Create»Control from the shortcut menu. This creates a control for the device input on the front panel. (FieldPoint) Create a control for the FieldPoint IO Point In input of the FP Read VI. 3. Enter the device number or name of the data acquisition I/O device in the device control on the front panel. Refer to Chapter 2, Installing and Configuring the RT Module and RT Targets, of the LabVIEW Real-Time Module User Manual for information about device configuration. 4. Create a control for the channel input of the AI Sample Channel VI as you did in step 3 and set the control to the input channel. 5. Place the PID VI in the control loop on the block diagram. You also can create custom control VIs using LabVIEW. 6. Wire the sample output of the AI Sample Channel VI to the process variable input of the PID VI. (FieldPoint) Wire the Value output of the FP Read VI to the process variable input of the PID VI. 7. Create controls for the PID gains and setpoint inputs of the PID VI. 8. Place the AO Update Channel VI in the control loop on the block diagram. (FieldPoint) Use the FP Write VI. 9. Wire the output output of the PID VI to the value input of the AO Update Channel VI. (FieldPoint) Wire the output output of the PID VI to the value input of the FP Write VI. 10. Create controls for the device and channel inputs of the AO Update Channel VI and set the controls to the device number and output channel number. (FieldPoint) Create a control for the FieldPoint IO Point In input of the FP Write VI. Getting Started with the LabVIEW Real-Time Module 4 ni.com

The block diagram for a DAQ system should look similar to Figure 3. Figure 3. DAQ Control Loop The block diagram for a FieldPoint I/O system should look similar to Figure 4. Figure 4. FieldPoint Control Loop National Instruments Corporation 5 Getting Started with the LabVIEW Real-Time Module

The AI Sample Channel VI reads analog data from the specified device channel and sends the data to the PID VI. The PID VI processes the data using a PID control algorithm. The AO Update Channel VI returns the results to the specified device channel. Refer to the LabVIEW PID Control Toolset User Manual for information about using PID VIs. Refer to the examples\real-time\rt Control.llb for examples of control VIs. Setting Priority of the VI to Time Critical Adding Timing to the Control Loop To ensure determinism you must assign time-critical priority to the control loop. A VI set to time-critical priority receives enough processor resources to complete time-critical tasks. 1. Right-click the connector pane icon at the top right corner of the VI and select VI Properties from the shortcut menu to open the VI Properties dialog box. 2. Select Execution from the Category pull-down menu. 3. Select time critical priority (highest) from the Priority pull-down menu. 4. Click the OK button to set the priority. Refer to Chapter 4, Building Deterministic Applications, of the LabVIEW Real-Time Module User Manual for information about dividing and prioritizing application tasks. Refer to the Priority Trouble VI in the examples\real-time\rt Tutorial.llb for an example of priority settings. You must add a timing mechanism that pauses, or sleeps, the control VI to ensure that other VIs in the application have enough processor resources to complete. A time-critical VI that does not have any sleep time completely monopolizes the embedded CPU resources. 1. Place the Wait Until Next ms Multiple VI in the control loop on the block diagram. 2. Right-click on the millisecond multiple input of the Wait Until Next ms Multiple VI and select Create»Constant from the shortcut menu. 3. Enter 10 into the millisecond multiple constant. The timing mechanism assures you that the control loop code runs and then sleeps until the time equals 10 ms from the start of the iteration. Other VIs in the application can run during the sleep time. 4. Select File»Save As and save the VI as First PID Control.vi. Getting Started with the LabVIEW Real-Time Module 6 ni.com

The block diagram should look similar to Figure 5. Figure 5. DAQ Control Loop with Timing Refer to Chapter 5, Creating Deterministic Control Applications, of the LabVIEW Real-Time Module User Manual for information about the different methods for timing control loops. Refer to the examples\ Real-Time\RT Timing.llb for examples of different timing methods. Sending Data Out of the Time-Critical VI The First PID Control VI can run on the RT target at time-critical priority, but you might need to monitor the status of the VI as it runs on the target. Also, you might need to update the values of control loop parameters. Use the Real-Time FIFO VIs to send data between the First PID Control VI and a normal priority communication VI that also runs on the RT target. The communication VI on the RT target can receive data from the First PID Control VI and then use network communication methods to update a host computer VI. Refer to the LabVIEW Real-Time Module User Manual for information about using the Real-Time FIFO VIs. National Instruments Corporation 7 Getting Started with the LabVIEW Real-Time Module

Complete the following steps to control the Stop button from the host computer. 1. Open the First PID Control VI in LabVIEW. 2. Remove the Stop button control wired to the conditional terminal of the control loop on the block diagram. 3. Place the RTFIFOCreate VI to the left of the control loop on the block diagram. 4. Right-click the name input of the RTFIFOCreate VI and select Create»Constant from the shortcut menu. Enter Stop Control into the name constant. 5. Wire a numeric constant to the type input of the RTFIFOCreate VI. The type input represents the type of data that you want the RT FIFO to contain. 6. Place the RTFIFORead VI in the control loop on the block diagram. 7. Right-click the While Loop and select Add Shift Register from the shortcut menu. Use While Loop shift registers to pass data from one iteration to the next. Refer to the LabVIEW User Manual for information about using shift registers. 8. Wire the rt fifo output of the RTFIFOCreate VI to the left terminal of the shift register and then wire the terminal to the rt fifo input of RTFIFORead VI. 9. Add another shift register and repeat step 8 to wire the error out output of the RTFIFOCreate VI to the error in input of the RTFIFORead VI. 10. Wire the rt fifo and error out outputs of the RTFIFORead VI to the right terminal of the shift registers. 11. Place the Equal? function in the control loop to the left of the conditional terminal. Wire the element out output of the RTFIFORead VI to the x input of the Equal? function. Right-click the y input of the Equal? function and select Create»Constant from the shortcut menu. Enter 1 into the constant. 12. Wire the x = y? output of the Equal? function to the conditional terminal of the control loop. 13. Select File»Save As and save the VI as Second PID Control.vi. Getting Started with the LabVIEW Real-Time Module 8 ni.com

The block diagram should look similar to Figure 6. Downloading and Running the Application Figure 6. DAQ Control Loop with RT FIFOs You have created the time-critical control loop that runs on the RT target. You can use the RT Engine - Normal Priority Loop (TCP Comm).vi and the Host Machine (TCP Comm).vi examples located in the examples\real-time\rt Tutorial.llb for the normal priority and host computer VI. Complete the following steps to download the RT target VIs and test the functionality. 1. Without closing the Second PID Control VI, open the RT Engine - Normal Priority Loop (TCP Comm) VI and view the block diagram. 2. In the upper-right corner of the Second PID Control VI front panel there is a connector pane image of the VI. Click and drag the image to the block diagram of the RT Engine - Normal Priority Loop (TCP Comm) VI to use the Second PID Control VI as a subvi in the normal priority communication VI. 3. From the RT Engine - Normal Priority Loop (TCP Comm) VI block diagram, select Browse»Show VI Hierarchy to open the Hierarchy window. Notice that the thumbtack for RT Engine - Normal Priority National Instruments Corporation 9 Getting Started with the LabVIEW Real-Time Module

Loop (TCP Comm) VI is in the horizontal position, shown at left, indicating that you have not downloaded the VI to the RT target. 4. Select Operate»Download Application to download the VI. LabVIEW prompts you to save the VI. Save the VI as Top Level Application.vi. The block diagram should look similar to Figure 7. Figure 7. Communication VI 5. Select View»Redraw in the Hierarchy window to refresh the screen. Notice in the Hierarchy window that now the thumbtack for RT Engine - Normal Priority Loop (TCP Comm) VI is in the vertical position, shown at left, which indicates that you have downloaded the VI to the RT target. 6. Click the Run button. LabVIEW runs the VI on the RT target. 7. Select File»Exit without closing RT Engine VIs to close LabVIEW on the host computer while continuing to run the VIs on the RT target. 8. Start LabVIEW again and open the Host Machine (TCP Comm) VI. This VI publishes and controls the Stop button in the time-critical VI on the RT target. Test the functionality of the Stop button. 9. Exit LabVIEW by selecting File»Exit and when prompted close all VIs running on the RT target. Getting Started with the LabVIEW Real-Time Module 10 ni.com

Optimizing the Control Application Now that you have created a basic application, you can optimize the control application. Complete the following additional tasks to experiment with deterministic programming techniques. Optimize the time-critical VI further by moving all front panel control and indicator references out of the time-critical loop and to the host VI using the Real-Time FIFOs VIs. You can use the RT Communication Wizard to move all front panel controls and indicators out of a time-critical VI. Refer to Chapter 4, Building Deterministic Applications, of the LabVIEW Real-Time Module User Manual for information about using the RT Communication Wizard. Optimize the data acquisition. Other Data Acquisition VIs offer better performance for real-time applications. The AI SingleScan VI allows you to use hardware timing to validate that the loop is keeping real-time. Refer to the LabVIEW Real-Time Module User Manual for information about timing control loops using the AI SingleScan VI and for information about optimizing VIs for real-time performance. Use different control algorithms. The PID Control Toolset, which contains many different control algorithms, installs with the Real-Time Module. In this exercise, you used the PID VI, but you can use the other control VIs available in the toolset. National Instruments Corporation 11 Getting Started with the LabVIEW Real-Time Module