Building a Real-Time System With NI Hardware and Software

Publish Date: Jan 31, 2018 | 90 Ratings | 3.62 out of 5 | Print

Overview

NI real-time hardware and software work together seamlessly to run applications reliably and deterministically with precise timing. This paper explains the different components you need to create an NI real-time system, identifies the hardware and software options available, and outlines how to choose the best options for your project.

Table of Contents

  1. Choose a Development Environment
  2. Select an NI Hardware Platform and I/O Modules
  3. Discussion and Feedback

To build an NI real-time system, you must choose both your development software and hardware platform. Detailed information on the options for each is provided in the following sections. Before reading this paper, it is useful to have a basic understanding of real-time systems and how building one can benefit your projects. Review this information by reading Do I Need a Real-Time System?

When building a real-time system, you must select a real-time-capable OS. NI real-time development tools come packaged with all necessary real-time OS (RTOS) software, meaning that you do not need to choose this component separately. Depending on the hardware platform, NI  uses the NI Linux Real-Time OS or Phar Lap ETS OSs. 

1. Choose a Development Environment

To develop real-time programs, you can use either LabVIEW graphical programming, the LabWindows™/CVI ANSI C environment (for Phar Lap), or a Linux-Compatible C/C++ Development environment of your choice (for NI Linux Real-Time).

Development Option: LabVIEW Real-Time Graphical Programming

Figure 1. Graphical Programming using LabVIEW.

To program NI-supported real-time hardware graphically, you must use LabVIEW along with the LabVIEW Real-Time Module. LabVIEW Real-Time gives you the ability to create reliable, hard real-time applications, download them to hardware, and debug and run them using one tool.

You can use most of the built-in math and signal processing algorithms that come with LabVIEW in your real-time applications, including several proportional integral derivative (PID) control functions. In addition, you can run textual math scripts on your real-time system with the optional LabVIEW MathScript RT Module, or integrate models that you create in The MathWorks, Inc. Simulink ® software or other modeling environments using the optional LabVIEW Model Interface Toolkit.

LabVIEW Real-Time: Developing, Downloading, and Running Applications

When developing real-time applications in LabVIEW, you use the LabVIEW Project Explorer to organize your programs (VIs) and assign the hardware that they will run on. You will develop your code on a general-purpose Windows host computer, and then deploy to your real-time hardware over Ethernet or USB connection.

 

Figure 2. Manage LabVIEW programs (VIs) and assign them to real-time targets using the LabVIEW Project Explorer.

Developing real-time programs in LabVIEW is nearly identical to developing standard LabVIEW applications for your PC. Several additional functions specific to real-time systems are included in the Real-Time VIs palette, including:

  • Watchdog functions to automatically restart some hardware targets if your program stops running
  • Functions to communicate data deterministically between parts of a real-time program
  • Utilities to configure load balancing on systems with multiple CPU cores
  • Timing functions to precisely control the execution of loops in your real-time programs

To test your LabVIEW Real-Time code on your hardware, simply click the run arrow and your application will deploy to your real-time hardware and begin running. You can use standard NI debugging tools such as highlight execution, single stepping, and breakpoints from your development computer, even though your real-time program is actually running on the real-time target.

When you have finalized your real-time program, you can build an executable in LabVIEW and download it to your real-time hardware as a startup application. After rebooting your real-time hardware, your program will automatically run in a reliable, stand-alone fashion.

LabVIEW Real-Time: Assigning Priorities to Parallel Code Sections and Multicore Processing

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, you can easily create applications that execute multiple operations in parallel. Additionally, LabVIEW makes it easy to assign thread priorities with the Timed Loop structure. As shown below, each loop has a configurable timing source, period, priority, and more.

Figure 3. Specify the priority and processor assignment of different code sections using the LabVIEW Timed Loop structure. 

LabVIEW Real-Time supports multicore processing and automatically maps parallel sections of your code to individual OS threads, which eliminates the need to manually create and manage them. By default, these threads are also automatically balanced across the CPUs available on your real-time hardware.

To further increase the performance and reliability of a real-time system, you can choose to manually assign Timed Loops to specific processor cores if wanted. For example, you can dedicate one core of a processor to execute one time-critical loop and isolate it from less important tasks that run on different cores.

Troubleshooting Option: Debugging With the Real-Time Trace Viewer

For advanced multicore debugging, you can use the Real-Time Trace Viewer to verify the performance of your LabVIEW or LabWindows/CVI real-time programs 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 a 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 Trace Viewer to optimize application performance by identifying unwanted execution characteristics and difficult-to-find race conditions.

Development Options for C and C++

If your organization standardizes on C or C++, you can use the LabWindows/CVI development environment, Eclipse, or other development environments. Note that LabWindows/CVI Real-Time supports only the real-time PXI controllers, while targets that use NI Linux Real-time, such as CompactRIO Controllers, are open source, so you can use the development tools of your choice. C/C++ Development Tools for Linux-Real Time in Eclipse are available for download from the NI website.

Back to Top

2. Select an NI Hardware Platform and I/O Modules

All NI real-time hardware platforms are based on a common architecture, which means that programs that you write with LabVIEW Real-Time will work across different NI hardware with only minor modifications, or without modifications. Specifically, each hardware platform features off-the-shelf computing components including a processor, RAM, nonvolatile storage, and an I/O bus interface. Some hardware platforms feature a user-programmable FPGA that you can program using the LabVIEW FPGA Module.

PXI (PCI Extensions for Instrumentation)

The industry-standard PXI platform consists of a rugged chassis with integrated timing and triggering lines, an embedded controller, and plug-in I/O modules. Serial, USB, Gigabit Ethernet, and GPIB ports are also built into the controller. PXI real-time hardware can be programmed using either LabVIEW Real-Time or LabWindows/CVI Real-Time.

If you have an existing PXI controller running Windows that you would like to change to a real-time controller, you can purchase a LabVIEW Real-Time Deployment License to convert your controller, or even set up a dual-boot system.

You can assemble your own PXI real-time system including controller, chassis, I/O modules, and software using the online PXI Advisor.


Figure 4. PXI hardware provides a rugged, high-performance option for your real-time projects.

NI PXI hardware is often used for high-performance real-time systems such as hardware-in-the-loop testing of electronic control units and vibration analysis for machine-condition monitoring applications. When using a real-time PXI system, your applications have access to advanced timing and synchronization hardware features that simplify precise I/O triggering and multimodule synchronization.

CompactRIO

CompactRIO combines a real-time processor, an FPGA, and C Series I/O modules, and comes in both packed and board-level form factors. In addition, serial, USB, and Ethernet ports are built into the controller.

You can assemble your own CompactRIO system including controller, I/O modules, and software using the online CompactRIO Advisor.

 

Figure 5. Packaged CompactRIO controllers provide a flexible, rugged, and portable option for real-time applications.

You can program the processor on CompactRIO controllers using LabVIEW Real-Time or your C/C++ development tool of choice. You can also develop FPGA code using LabVIEW FPGA. To access IO data on the processor, you can use the NI-DAQmx API, NI's best-in-class programming API for measurements, or NI Scan Engine. Alternative, you can access data directly from the FPGA with LabVIEW FPGA. 

 

Figure 6. CompactRIO's heterogeneous architecture features a real-time processor, reconfigurable FPGA, and I/O.

CompactRIO hardware is often used for industrial applications including condition monitoring, hardware-in-the-loop test, physical systems test, and machine control.

CompactRIO board-level controllers, such as CompactRIO Single-Board Controllers (sbRIO) and NI System on Module (SOM), have the same architecture as packaged CompactRIO controllers, but come without rugged packaging, and have a smaller form factor.

Figure 7. CompactRIO board-level controllers feature the same architecture as packaged CompactRIO controllers, but in a smaller form factor.

High-volume applications that require flexibility, reliability, and high performance can benefit from CompactRIO Single-Board Controllers or System On Modules.

Evaluate the LabVIEW Real-Time and LabVIEW FPGA modules with reconfigurable I/O (RIO) hardware with the LabVIEW RIO Evaluation Kit.

Industrial Controller

NI Industrial Controllers are high-performance, fanless industrial computers that offer the highest level of processing power and connectivity for automated image processing, data acquisition, and control applications in extreme environments. These controllers feature up to a 2.2 GHz Intel Core i7 dual-core processor, 8 GB DDR3 RAM, 64 GB storage in a rugged design with no moving parts, and an IP rating up to IP67. A Kintex-7 FPGA improves system performance by providing custom I/O timing, synchronization, control, and image co-processing.

Figure 8. Industrial controllers feature high processing power and connectivity ideal for vision systems.

NI Industrial Controllers give you the ideal connectivity for communication and synchronization to Time Sensitive Networking (TSN)-enabled CompactDAQ chassis, EtherCAT and Ethernet CompactRIO chassis, EtherCAT motion drives, GigE Vision and USB3 Vision cameras, and other automation equipment. In addition, this controller has onboard ISO, TTL, and differential digital I/O, so it can perform synchronization and control tasks without additional tethered I/O.

Still have questions? NI representatives can help you choose the right software, hardware, and I/O for your real-time program—no matter the size of your system. 

Back to Top

3. Discussion and Feedback

Please direct support questions to NI Technical Support.

See contact us for additional resources.

Additional Information: Simulink® is a registered trademark of The MathWorks, Inc. The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a worldwide basis.

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit