Software architecture for RIO embedded control and monitoring applications
A standard software architecture that lends itself to a wide variety of system controller designs that require a PC-based user interface.
Introduction
Many NI Academic RIO Device embedded control and monitoring applications benefit from the standard software architecture pictured above. The Academic RIO Device connects to the physical system by way of sensors, actuators, indicators, and user interface devices. All communication with other devices, including the LabVIEW development computer, is through the network, even when the Device connects to the PC by USB cable (the
USBLANUSB-based local area network (LAN) established between the Academic RIO and the PC host computer.
is established by the USB cable). The PC host provides a user interface (UI), also known as human-machine interface (HMI), by which the user can connect to the Device, observe the status of the running application and control its behavior, and download datalog files.
The Home Security System application applies the standard software architecture to a practical example modeled on a real product.
This guide will briefly outline the role of each of the VI components of the software architecture and describe common communication mechanisms between the VIs.
PC Host
The User Interface VI (UI) provides a window into the operation of the RT VI as well as a means to control the application. The UI provides a user-friendly experience, its front-panel is carefully laid out, and is responsive to user inputs such as button clicks and mouse movements. The UI often includes the ability to connect to and disconnect from the RT VI without disturbing the RT application itself. The UI contains three distinct processes:
UI Event Handler – Handles user events such as keyclicks and mouse movements with a LabVIEW “Event Structure.” The Event-Driven Producer/Consumer State Machine design pattern works particularly well here; see the textbook by Bress referenced below for more details.
Command Sender – Typically incorporated into the UI Event Handler, the Command Sender issues command messages to the RT application using a network stream channel with the “zero timeout” option to minimize delay (latency) through the network; with this option the network stream is a type of
messageTransfer every value of intermittent data with low latency.
communication. For example, the UI front panel button “reset” could trigger a similarly-named string to be inserted into the network stream channel that will eventually be interpreted by the RT VI to restart itself.
Academic RIO Device
RT VI
The RT VI embodies the system controller. The implementation details vary widely depending on the needs of the particular application and the relative level of necessary complexity. The RT VI contains three processes:
Message Handler – The message handler contains one or more parallel process loops (“while-loop” structures) that implement the functionality of the particular application. The process loops pass messages to each other through queues and are implemented as Queued State Machines, as well. For example, the Home Security System contains a system manager, error handler, timer, and other process loops related to the user interface, and is an example of the general-purpose Queued Message Handler with Multiple Process Loops design pattern.
High-performance data acquisition or hardware I/O functionality not available on the default Academic RIO Device FPGA personality would necessitate the development of an FPGA VI, too. The RT VI Message Handler controls the FPGA VI by manipulating the front-panel controls of the FPGA VI with programmatic front-panel communication (RT), a type of
messageTransfer every value of intermittent data with low latency.
communication, and retrieves the state of the FPGA VI indicators using the same technique.
For more information
NI LabVIEW for CompactRIO Developer's Guide (http://www.ni.com/compactriodevguide/)
From the webpage: 'The National Instruments CompactRIO Developers Guide provides an overview of recommended architectures and development practices when programming NI CompactRIO controllers. Intended as complementary material to standard LabVIEW Real-Time Module and LabVIEW FPGA Module training, this guide features documentation and examples as a framework for designing industrial control and monitoring applications.'