Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: May 6, 2009


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Selecting Your LabVIEW Real-Time Deployment Platform

56 ratings | 3.95 out of 5
Read in | Print

Overview

National Instruments real-time products combine the NI LabVIEW graphical development environment with the deterministic performance of dedicated hardware to deliver applications with precise timing, increased reliability, and stand-alone operation. This document offers information and advice to help you select the correct real-time target for your application needs.

Real-Time Basics

Real-time operating systems evolved to facilitate two main types of applications: event response and closed loop control systems. Event response applications require a response to a stimulus in a determined amount of time. An example of such a system is an automotive airbag system. Closed loop control systems continuously process feedback in order to adjust an output; an automotive cruise control system is an example of a closed-loop control system. Both of these types of systems require the completion of an operation within a specific deadline. This type of reliable timing performance is referred to as determinism.

Operating systems such as Microsoft Windows and Mac OS provide an excellent platform for developing and running your non-critical measurement and control applications. However, because these operating systems are designed for general purpose use, they are not the ideal platform for running applications that require deterministic performance or extended uptime.

General-purpose operating systems are optimized to run a variety of applications simultaneously, ensuring that all applications receive some processing time. These operating systems must also respond to interrupts from peripherals such as the mouse and keyboard. The user has limited control over how these tasks are handled by the processor. As a result, high-priority tasks can be preempted by lower priority tasks, making it impossible to guarantee a response time for your critical applications.

In contrast, real-time operating systems allow you to prioritize tasks so that the most critical task can always take control of the processor when needed. This property enables you to program an application with predictable timing characteristics.

For more information on the real-time concepts, view the What is Real-Time? white paper.

LabVIEW Real-Time Application Development

LabVIEW is a graphical development environment designed for engineers who need to design flexible, scalable measurement and control systems. LabVIEW is a fully functional graphical programming language with the flexibility of a traditional text-based language. The intuitive graphical development environment combines the ease of use of configuration-based tools with the flexibility of a powerful programming language. The LabVIEW compiler generates optimized code with execution speeds comparable to that of compiled C programs.

The LabVIEW platform provides tight integration between software and hardware, eliminating the need for different programming languages to communicate with different hardware components. The LabVIEW Project streamlines the development of large-scale applications by making it easy to create and manage source code, view source dependencies, and configure hardware resources. You can deploy your applications from the LabVIEW Project to a variety of targets including, your local PC, real-time controllers, HMIs, FPGAs, PDAs, etc.

Figure 1 - LabVIEW Project Explorer

The LabVIEW Real-Time Module extends LabVIEW graphical programming to create reliable deterministic applications. With LabVIEW Real-Time, you define program operation using one tool that spans each phase of the development process, including system configuration, algorithm prototyping, and application deployment. With LabVIEW Real-Time, you can develop on a Windows system and then download applications to run on dedicated real-time hardware targets based on off-the-shelf computing components and a real-time operating system. While the development experience is similar to that of desktop systems, the LabVIEW Real-Time Module adds tools to the environment to take full advantage of the real-time deployment platform.

Figure 2 - Rapid Development with Real-Time Code Generation

The LabVIEW Real-Time Module includes the Real-Time Project Wizard, which you can use to quickly create a basic real-time project. You can choose from several common real-time architectures, specify communication and data logging options, and define a real-time target on which to deploy the application. In a matter of minutes, you can have a host application, a target application, and shared variables used to communicate between the two. The Real-Time Project Wizard helps new users get up and running quickly, and can also serve as a valuable stepping stone for complex projects based on recommended real-time programming techniques.

Figure 3 - LabVIEW Real-Time Project Wizard

Real-Time Project Wizard Demonstration

Assigning Thread Priority to LabVIEW Code

The dataflow programming model of LabVIEW frees you from the sequential architecture of text-based programming languages. Because the execution order is determined by the flow of data between nodes and not by sequential lines of text, you can easily create applications that execute multiple operations in parallel. Additionally, LabVIEW makes it easy to assign thread priorities with the Timed Loop. As shown below, each loop can contain a separate task with configurable timing source, period, priority and more.


[+] Enlarge Image

Figure 4 - LabVIEW Timed Loop Configuration

LabVIEW Real-Time and Multicore Processing

Since LabVIEW is multithreaded, it can inherently take advantage of Symmetric Multiprocessing (SMP), where two or more identical processors are connected to a single shared memory. SMP systems can easily move tasks between processors to balance the workload efficiently. Most general purpose operating systems (Windows, Linux, MacOS, etc.) support SMP, however, this is not commonly available in real-time. LabVIEW Real-Time supports multicore processing and has options for both automatic and manual processor assignment. The automatic option allows the LabVIEW Real-Time Module to distribute threads across the available processor cores. 

To further increase the performance and reliability of a real-time system, you can easily assign Timed Loops to specific processor cores. You can dedicate one core of a processor to execute a time-critical loop and isolate it from less important tasks that run on different cores. You can use the Processor Assignment section of the Configure Timed Loop dialog box to designate the thread to run only on a specific processor core, as shown below.

Figure 5 -LabVIEW Timed Loop Processor Assignment

Debugging and Verifying the Timing of LabVIEW Real-Time Applications

LabVIEW Real-Time features built-in tools for debugging and optimizing real-time applications. Using standard graphical debugging tools such as execution highlighting, probes, and breakpoints you can view variable values and single-step through the execution of your application.

For advanced multicore debugging, you can use the Real-Time Execution Trace Toolkit  to verify the performance of your real-time applications without halting or pausing execution of the code. With minimal modifications to your real-time code, you can log application performance to a file and send it to the host computer for viewing and analysis. The trace tool viewer graphically displays multithreaded code execution while highlighting thread swaps, mutexes, and memory allocations. You can use the Real-Time Execution Trace Toolkit to optimize application performance by identifying undesirable execution characteristics and difficult-to-find race conditions.

Figure 6 - Advanced Debugging with LabVIEW Execution Trace Toolkit

In addition, you can use the LabVIEW VI Analyzer Toolkit to quickly identify style, performance, and documentation gaps of LabVIEW Real-Time applications. The toolkit interactively provides direct links to the sections of code identified and creates a report for automatic documentation of recommended changes. When followed, the guidelines provided by the VI Analyzer Toolkit result in flexible, robust, and performance-optimized software applications.

LabVIEW Real-Time Deployment Platforms Overview

All LabVIEW Real-Time deployment platforms are based on a common hardware and software architecture. Each hardware target uses off-the-shelf computing components such as a microprocessor, RAM, nonvolatile storage, and an I/O bus interface. The embedded software included on a real-time target consists of a real-time operating system, driver software, and a specialized version of the LabVIEW run-time engine.


[+] Enlarge Image

Figure 7 - Real-Time Hardware Architecture

Each LabVIEW Real-Time platform has distinct characteristics geared toward a particular subset of use cases. PXI and PCI systems deliver higher performance while Compact FieldPoint and Compact Vision Systems deliver a high degree of ruggedness and reliability. The CompactRIO system provides a combination of performance and reliability. All platforms have the option to function as autonomous systems.

PXI Real-Time Systems

Real-time PXI systems consist of a rugged chassis, embedded controller, and plug-in I/O modules. The real-time PXI platform is often used for high-performance systems such as hardware-in-the-loop test of electronic control units and vibration analysis for machine-condition monitoring applications.

Figure 8 - Example PXI Real-Time System

NI RT Series PXI controllers run the ETS real-time operating system and application software on a dedicated high-performance microprocessor. The embedded software has access to all I/O in the PXI system, taking advantage of the PXI advanced timing and synchronization features to achieve precise I/O triggering and multi-module synchronization.

PXI Application Example

Lockheed Martin and G Systems used LabVIEW Real-Time and PXI to implement a wind tunnel test system for the F-35 Joint Strike Fighter. The new test system, developed in less than four months, replaced VME-based equipment to acquire, analyze, and store dynamic pressure data from a next-generation jet fighter engine design. The final system uses NI PXI-4472 dynamic signal acquisition modules to capture 128 channels of simultaneously sampled dynamic pressure measurements. LabVIEW Real-Time was chosen because it ensures maximum reliability for the test system to preclude any unnecessary test runs.

By using LabVIEW Real-Time and PXI, Lockheed Martin engineers now configure their test system 10 times faster than their previous VME equipment while doubling their channel count. In addition, the test cycle time was reduced from 2 s to 50 ms.

For more information about this application, refer to the NI customer solution, Lockheed Martin Reduces Costs and Time Testing F-35 Joint Strike Fighter with LabVIEW Real-Time.

CompactRIO Real-Time Systems

The CompactRIO programmable automation controller (PAC) is an embedded control and acquisition system for applications requiring reliability and performance. With the system’s small size, ruggedness, and flexibility, engineers, scientists, and embedded developers can use CompactRIO hardware for a variety of industrial and embedded control and acquisition applications.

CompactRIO combines a real-time controller, a reconfigurable chassis, and I/O modules. Along with an industrial Freescale processor that can operate networked or stand-alone, the real-time controller features a DC power supply input, an Ethernet port(s) for networking, built-in Web servers, a serial port for connecting to peripherals, a USB port, and nonvolatile storage for data logging. The reconfigurable chassis contains an embedded Xilinx field-programmable gate array (FPGA) that is programmable for implementing custom timing, triggering, signal processing, and control of the I/O modules plugged into the chassis. There are a variety of NI C Series modules for I/O such as strain gage and accelerometer inputs; up to ±300 V analog I/O with low- and high-speed data rates; 12, 24, and 48 V industrial digital I/O; 5 V/TTL digital I/O; counter/timers; pulse generation; motion control; CAN communication; and high-voltage/current relays.

Figure 9 - Example CompactRIO Real-Time System

You can use the LabVIEW Real-Time Module to create a program to reliably run on the CompactRIO real-time controller. Choose from more than 600 built-in LabVIEW functions, including direct access to I/O modules, to build your application for real-time control, analysis, data logging, and communication. You can also integrate existing C/C++ code with LabVIEW Real-Time code. For applications that require custom timing and signal processing, you can use the LabVIEW FPGA Module to program and customize the FPGA within the CompactRIO chassis. Develop your LabVIEW Real-Time and/or LabVIEW FPGA applications on a host computer using graphical programming and download the applications to CompactRIO to run stand-alone or networked to other systems. You can also use LabVIEW to quickly build an HMI or user interface for your CompactRIO system that can run on a networked PC or embedded touch panel.

CompactRIO Application Example

Drivven, Inc. used LabVIEW Real-Time and CompactRIO to build a full-authority, FPGA-based engine control system for a high-performance motorcycle engine. Engine control requires deterministic loop times on the order of milliseconds and precise fuel and spark timing on the order of microseconds. Using three custom-created modules and CompactRIO, Drivven carefully tapped into critical motorcycle sensors and actuators. These sensors provided signals and events such as intake air pressure and temperature, coolant temperature, and throttle position.

While riding the bike at many different combinations of throttle position and engine speed, Drivven recorded the data to 1 Mb files. Periodically, an engineer in a chase vehicle would wirelessly FTP the data files from the CompactRIO to a laptop and analyze them immediately for coverage of operating points. A laptop-based LabVIEW application quickly sorted the data into speed/load operating tables while filtering out transient data. Drivven then used CompactRIO to prototype a research-oriented engine control unit, achieving performance comparable to the factory engine control unit, yet providing the flexibility to carry out future control algorithm research and development not possible with production-oriented electronics.

Using LabVIEW Real-Time and CompactRIO, Drivven spent about 12 percent of the time and about three percent of the typical cost of prototyping an engine control system from custom-designed hardware. Compact RIO and LabVIEW Real-Time delivered the reliability and precise timing resources required, and the system was rugged enough to withstand the high temperature and vibration of the operating environment.

For more information about this application, refer to the NI customer solution.

Single-Board RIO Real-Time System

CompactRIO and Single-Board RIO share the RIO architecture to facilitate rapid prototyping and deployment for your embedded systems. Single-Board RIO is an embedded controller and acquisition device that integrates a real-time processor, an FPGA chip, and I/O on a single circuit board. The device is designed to be easily embedded in high-volume applications that require flexibility, reliability, and high performance. The deployed controllers run the same code developed in simulation to reduce cost and time to market.   

The NI Embedded Software Evaluation Toolkit includes all you need to evaluate the NI LabVIEW Real-Time and LabVIEW FPGA programming experience used to develop embedded applications for NI reconfigurable I/O (RIO) hardware platforms. 

Figure 10 - Example Single-Board RIO Real-Time System

Single-Board RIO Application Example

Ventura Aerospace used LabVIEW Real-Time and Single-Board RIO to create an FPGA-based fire monitoring and suppression control system to prevent catastrophic fires within FedEx freight aircraft. The Fire Control Unit at the center of the system contains a Single-Board RIO, power supply, signal conditioning daughterboard, and Ethernet switch to read temperatures from infrared sensors and process and record the data. Cargo airplanes have multiple cargo containers and each one has a Fire Control Unit consisting of a Single-Board RIO and daughterboard. Using LabVIEW, they programmed intelligence into both the Fire Control Unit and the Fire Control Hub to be able to self-identify aircraft type and position based on the installation. The system runs with full autonomy to monitor the temperature and control the suppression system that deploys foam into a container if a fire is detected. All of this is possible because of the reliability of the real-time processor, FPGA, and I/O featured on the NI RIO hardware.

Ventura Aerospace rapidly prototyped their system using CompactRIO and created a final deployed solution with Single-Board RIO in under a year.  They developed a working prototype in just 3 months with LabVIEW, CompactRIO, and C series analog and digital modules.  Because of the small size and low cost, Single-Board RIO was deployed as the final solution with onboard analog inputs connected to the infrared sensors.  The transition was seamless due to the common hardware architecture shared between CompactRIO and Single-Board RIO. They were able to meet their aggressive deadlines with rapid prototyping and fast deployment from CompactRIO to Singe-Board RIO.

For more information about this application, refer to the NI customer solution.

Compact FieldPoint Real-Time Systems

Compact FieldPoint is a mature programmable automation controller (PAC) platform that consists of an embedded processor and a wide variety of I/O modules. Compact FieldPoint features industrial grade hardware, reliable performance, and easy-to-use measurements and control. Common use cases include process and discrete control systems that open and close valves, run control loops, log data on a centralized or local level, and perform real-time simulation and analysis.

Figure 11 - Example Compact FieldPoint Real-Time System

Real-Time Vision System

NI offers a range of vision hardware for real-time applications, including the Smart Camera for all-in-one solutions, the Compact Vision System for incorporating multiple cameras, and PXI/PCI interfaces for meeting system level needs. 

NI Smart Cameras are industrial, high-quality image sensors combined with power processors to create rugged, all-in-one solutions for machine vision applications. The high-quality Sony CCD image sensor acquires monochrome SXGA resolution (up to 1280 x 1024) images. Camera I/O includes two optoisolated digital inputs, two optoisolated digital outputs, one RS 232 serial port, and two gigabit Ethernet ports. NI Smart Cameras integrate easily with Programmable Automation Controllers (PACs), PLCs, and industrial HMIs.

Compact Vision Systems are small, rugged systems optimized for machine vision application such as automated inspection. A single Compact Vision System includes an embedded processor with a real-time operating system, connections for three IEEE 1394 DCAM cameras, a local video display, an Ethernet port, 15 digital inputs, and 14 digital outputs. The Compact Vision System is compatible with more than 100 industrial cameras and offers reconfigurable I/O FPGA for high-speed custom digital control or stepper motor control.

Figure 12- Examples of real-time vision hardware, including the Smart Camera, Compact Vision System, and a PXI interface for image acquisition

Compact Vision System Application Example

Soliton Technologies used LabVIEW Real-Time and the Compact Vision System (CVS) to achieve six-sigma repeatability standards in inspection of automobile spark plugs.  They built a real-time vision-based system to measure the dimensions of the spark plugs and analyze the sparking distance on the production line.

The CVS offers determinism, ruggedness, small size, and compatibility with more than 40 cameras.  The NI Vision Assistant proved instrumental in developing an algorithm to ensure repeatability of two pixels.  Using the batch processing feature, Soliton Technologies inspected stored spark plug images and tabulated intermediate results with a systematic approach.  The CVS added value to the circle detection algorithm with the ability to fix tradeoff between accuracy and processing time.  This vision system took only eight weeks to develop and has the reliability and repeatability for the necessary measurements.

Other Real-Time Systems

Many test and measurement applications today are based on PCI systems, which allow the use of NI PCI-based hardware along with LabVIEW Real-Time. You can convert an industrial PC, single-board computer, PC-104 processor board, or even a standard desktop PC to a real-time target, as long as the hardware meets the system requirements  of the ETS real-time operating system.

Figure 13- Examples of other real-time targets, such as an Industrial PC, a Desktop PC, a Single-Board Computer (SBC), and a PC-104 Processor Board

LabVIEW Real-Time Deployment Platform Comparison

Each LabVIEW Real-Time deployment platform is designed for a slightly different application. PCI and PXI systems provide the highest performance while Compact FieldPoint and Compact Vision System deliver the most rugged hardware. The CompactRIO platform provides a combination of performance and rugged hardware. In this section, we compare each LabVIEW Real-Time hardware platform on the basis of I/O availability, performance, and physical attributes.

I/O Availability

The I/O availability of a platform is a measure of the variety of I/O options available for the platform. I/O availability takes into account the availability of standard driver application program interfaces (APIs), as well as the overall I/O customizability and expandability of the platform. NI platforms include a wide variety of I/O modules, including off-the-shelf, custom-built, and third-party modules. The off-the-shelf modules use standard driver APIs. Some NI platforms offer customizability by interfacing with custom-built modules, while others support customizable third-party I/O modules. Many NI platforms are expandable to include multiple chassis, computers, or backplanes.

I/O Availability

PXI

  Good

  Better

  Best

Variety
Standard Driver APIs
Customizability
Expandability

Figure 14 - Input/Output Device Comparison for LabVIEW Real-Time Systems

PXI and PCI I/O available for Real-Time systems include the following:

  • Data Acquisition (Analog and Digital)
  • Dynamic Signal Acquisition
  • Image Acquisition
  • Motion Control
  • FPGA-based Reconfigurable I/O (RIO)
  • CAN
  • Serial
  • GPIB
  • Ethernet
  • Chassis Expansion via MXI
  • IEEE 1394 Hard Drivers and Cameras
  • External USB Hard Drives
  • Third-Party Hardware

Figure 15 - PXI and PCI I/O Modules

NI PXI and PCI modules have standard driver APIs, while third-party modules offer customizable I/O. In addition, software-transparent I/O expandability is available with NI MXI. Using MXI, you can daisy-chain two or more systems together so that all I/O is controlled by a single PXI or Desktop PC controller.

You can incorporate expansion I/O into your real-time PXI system with a deterministic Ethernet chassis for C series modules.  The chassis communicates deterministically over an open, real-time Ethernet protocol called EtherCAT.  You can daisy-chain multiple chassis to expand I/O in time-critical applications.

Figure 16 - Deterministic Ethernet Expansion Chassis

CompactRIO Real-Time systems can take advantage of any of the following I/O modules:

  • Analog Input
  • Analog Output (voltage and current)
  • CAN
  • Motion
  • Digital Input and Output
  • Relay Output
  • Counter, Pulse Generation
  • Custom Modules

Figure 17 - CompactRIO I/O Modules

For more information on I/O available for CompactRIO, view the CompactRIO Product Selection Guide.

A CompactRIO real-time system can be expanded using a deterministic Ethernet chassis for C series modules.  All of the software will run on the same controller and you are able to increase the number of channels or module types included in your time-critical application.

Smart Camera I/O includes two optoisolated digital inputs, two optoisolated digital outputs, one RS 232 serial port, and two gigabit Ethernet ports.  The Compact Vision System includes connections for three IEEE 1394 DCAM cameras, a local video display, an Ethernet port, 15 digital inputs, and 14 digital outputs.  To learn more about compact vision systems, see Compact Vision Systems NI CVS-145x Rugged Systems Run LabVIEW Real-Time.

Performance

The performance of LabVIEW Real-Time systems can be measured in terms of deterministic execution, I/O timing, triggering, synchronization, and processor speed. Determinism is the most fundamental component of all real-time systems. It is defined by how consistently a system is able to perform a given operation within a fixed amount of time. Determinism is affected by the OS, software program architecture, and integration of application software with I/O timing and synchronization capabilities. The processor speed determines the minimum loop-cycle time.

Performance

PXI

  Good

  Better

  Best

Deterministic Execution

Timing, Triggering, and Synchronization
Processor Speed

Multicore Processing

Figure 18 - Performance Comparison for LabVIEW Real-Time Systems

For detailed performance benchmarks, refer to the following documents:

Physical Attributes

In addition to deterministic performance, real-time operating systems impart a higher level of reliability because they are specialized, streamlined operating systems that use fewer resources and eliminate the fragilities of standard operating systems. In addition to a highly reliable software framework, LabVIEW Real-Time platforms include hardware modifications that deliver a high level of physical reliability suitable for industrial environments.

Physical Attributes

PXI

Vision Systems

Standard or Industrial PCs

  Good

  Better

  Best

Ruggedness

Varies
Portability

Figure 19 - Physical Attribute Comparison for LabVIEW Real-Time Systems

National Instruments offers a variety of rugged real-time hardware platforms that extend the application space for LabVIEW Real-Time into harsh environments where the hardware must withstand extreme temperatures, shock, vibration, and intermittent power failures. The CompactRIO, Compact FieldPoint, and Compact Vision System platforms are designed with no moving parts, eliminating the most common failures due to shock and vibration.

Try LabVIEW Real-Time Today

In summary, you can use LabVIEW Real-Time to develop a variety of applications including high-reliability test systems, deterministic closed-loop control applications, and autonomous-operation systems. With a variety of hardware deployment platforms to choose from, you can select the hardware that matches the I/O, performance, and size requirements of your application.

For a demonstration of LabVIEW Real-Time, to request a visit from your local field engineer, or to attend a FREE Developing Real-Time Systems with LabVIEW seminar contact National Instruments at (800) 433-3488 or visit ni.com/realtime.

To test-drive LabVIEW Real-Time today, visit the LabVIEW Real-Time On-line Evaluation.

Downloads

wp2435.pdf

figure5_lv_vi_htspclcpxi.jpg

figure4_adv_lv_debugging.jpg

figure3_lv_timed_loop.jpg

56 ratings | 3.95 out of 5
Read in | Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).