Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
LabVIEW Zone LabVIEW Tools Network Resources LabVIEW Champions Student Corner User Groups Discussion Forum Code Sharing Learning Center

Adding an HMI to your Programmable Automation Controller (PAC)

Overview

As the industrial landscape continues to move toward a more automated environment, engineers implementing monitoring and control applications encounter increasingly complex systems. Such industrial control systems often consist of independent Programmable Automation Controllers (PACs) managing specific, individual tasks. As these distributed systems increase in complexity, the control and monitoring tasks must be divided among several such PACs, networked together. Ensuring proper operation of this distributed industrial process requires the direction of system managers and operators. Yet while a central control “hub” is appropriate for managerial supervision, the distributed system is incomplete without Human Machine Interfaces (HMIs) for more direct interaction.


An Industrial Touch Panel Computer

The LabVIEW Touch Panel module completes the National Instruments offering for managing remote systems by extending the LabVIEW graphical programming environment to rugged HMI industrial computers. This application note discusses the benefits of the LabVIEW Touch Panel module and provides a detailed step-by-step tutorial for adding an HMI to your existing PAC system.

PAC & HMI


Programmable Automation Controllers (PACs) exist in a variety of applications spanning several industries. Typical examples of a PAC include the National Instruments CompactRIO and Compact FieldPoint product lines (refer to the links below for details). Each system contains an embedded controller in addition to hardware modules for input/output. While their specific uses vary greatly, the need for effective management of these remote systems is universal. A typical distributed system may look something like Figure 1 below.


Figure 1: A Distributed Control System.

PACs can be distributed throughout a single manufacturing facility or deployed in the field over a wide expanse. The central database or control system provides supervisor-level monitoring, but may not always be immediately accessible. Since most PACs are embedded controllers, they have no user interface of their own; thus, there is a need for Human Machine Interfaces (HMIs) at key access points to complete the system.

CompactRIO and Compact FieldPoint are examples of these “headless” systems; they require the use of additional hardware for a user interface. National Instruments touch panel hardware, such as the family of 6" and 12" touch panel computers (TPCs), provide a robust and compact solution for industrial HMIs. Rugged physical specifications and a variety of I/O ports provide for easy integration into existing networks. (See the related links below for more details on National Instruments touch panel hardware). Such an HMI equips the operator with direct access to specific control or monitoring systems.

However, adding a user interface only solves part of the distributed problem. Equally important as the PACs and HMIs in a distributed system is the infrastructure with which they communicate. Network topologies involving Ethernet, serial, and wireless protocols create an intelligent, distributed system to control industrial processes. Because of the availability and reliability of existing Ethernet networks, a protocol such as TCP/IP or UDP is most often employed for the purpose of networking PAC nodes. The availability of wireless standards, such as 802.11b, also provide for very scalable and flexible network solutions.

The TCP/IP libraries and functions available with LabVIEW provide an easy-to-use API for networking distributed systems. Several examples of message-based protocols exist and have been successful in managing such systems. (Refer to the links below for details). However, as the demands of distributed applications increase, the simple client-server architecture inherent to TCP/IP can become cumbersome. The LabVIEW Touch Panel module and Shared Variable simplify the development of distributed control and monitoring applications.

See Also:
NI TPC 2106/T Product Page
NI TPC 2012 Product Page
Programmable Automation Controllers (PACs)

The LabVIEW Touch Panel Module


The LabVIEW Touch Panel Module provides a single, integrated graphical environment for developing HMI and PAC applications. The LabVIEW Project Explorer window facilitates the distribution of these complex systems across multiple targets and operating systems. With the Touch Panel module, the LabVIEW Project includes supports for programming touch-screen HMIs as well. (Refer to the links below for details). The benefits of programming desktop and Real-Time applications with LabVIEW can now be extended to Windows CE and Windows Mobile powered devices. Some of these benefits include:
  • Rapid HMI application development using the NI LabVIEW graphical development environment
  • Communication with external devices through Bluetooth, Wi-Fi (802.11), IrDA, and serial protocols
  • Integration with the LabVIEW Datalogging and Supervisory Control (DSC) module
In addition to these, the LabVIEW Shared Variable provides a powerful, configuration-based environment to facilitate the development of an otherwise complicated communication infrastructure. The tight integration of touch panels, PACs, and shared variables within the LabVIEW Project Explorer window obviates the development of complex network architectures, shifting the focus instead to industrial process control and development. Built on the National Instrument Publish-Subscribe Protocol (NI-PSP), shared variables simplify network communication to reading and writing data through variable nodes on the block diagram, as shown below in Figure 2.


Figure 2: Shared Variable Communication

For more specific information on Shared Variables, refer to the links below.
See Also:
Using LabVIEW to Develop Applications for Windows CE OS Devices
Using the LabVIEW Shared Variable

Adding a Touch Panel Interface to your PAC Step-by-Step


The LabVIEW project and shared variable bring the development of Real-Time PAC and HMI touch panel applications into one integrated programming environment. Adding an HMI to an existing “headless” PAC system, such as CompactRIO or Compact FieldPoint, is greatly simplified with the LabVIEW Touch Panel module and shared variable. The following tutorial provides step-by-step instructions for adding an HMI to an existing LabVIEW Real-Time project. The hardware setup required for this tutorial includes an NI-TPC 2106/T, Real-Time target (such as Compact FieldPoint), and a development system.

  1. First connect the development computer, Touch Panel Computer, and Real-Time Target to the same subnet over Ethernet.  The hardware setup should resemble the figure below.
  2. ADD CONTENT on how to add TPC Service Support

Figure 3: Initial Hardware Setup
_
  1. Download the HMIPAC.zip file from the related links section below. Note that there are two top level folders within the zip file: “Tutorial” and “Solution.” The “Tutorial” folder contains the files necessary to complete these step-by-step instructions, while the “Solution” folder contains the completed application.

  2. Open the existing LabVIEW Real-Time project HMI_PAC.lvproj in the “Tutorial” folder. It should look like the following:
    _
    Figure 4: LabVIEW Real-Time Project Window
    _
  3. This simple example is intended to simulate data acquisition. The Generator.vi on the Real-Time target will continuously publish a sine, square, or sawtooth wave depending on the “type” input. Since the Generator.vi will be embedded on the Real-Time target, its front panel will not be visible. Thus a touch panel is necessary for an HMI. The HMI.vi will get the data from the Generator.vi and display it on the graph on its front panel:
    _
    Figure 5: HMI.vi Front Panel
    _
  4. We need to add the Touch Panel to the project to target the hardware. Right-click the “Project: HMI_PAC.lvproj” in the Project Explorer and select New » Targets and Devices… Select the Existing target or device bullet and expand the Touch Panel folder to see the touch panel. Click TOUCH PANEL WINDOWS CE Device and click “OK” to add the touch panel to our project.

  5. After adding the touch panel to the project, we must add its VI, called HMI.vi. Do this by right-clicking on the Touch Panel target in the project explorer window and selecting Add File… Browse to the HMI.vi file, click “OK” to add the file to the project.

  6. The block diagram is incomplete as it does not have any means of communicating with the PAC. We need to add shared variables to communicate with the Real-Time target. Begin by creating a library for the shared variables. Right-click the Real-Time target in the project explorer window and select New » Library. An “Untitled Library” will appear under the Real-Time target.

  7. Save the library by right-clicking “Untitled Library” and selecting Rename. Name this library as “Variables” and save it to the “Tutorial” folder.

  8. Add the shared variables to the library by right-clicking the “Variables” library and selecting New » Variable. The Shared Variables Properties window will appear.

  9. First we’ll configure the data that will be graphed on the touch panel. (Refer to the shared variable properties window as shown in the figure below.) Do this by changing the name to “Data” and the data type to array of double. Set the Variable Type to Network-Published, and the variable can be read from or written to any place on the network. The properties window should now look like this:
    _
    Figure 6: Configured Shared Variable Properties Window
    _
  10. Click the “OK” button, the shared variable “Data” will now appear under the “Variables” library:

  11. We need to add the other two variables to the library. Do this by right-clicking the “Variables” library again and selecting New » Variable. Repeat the steps above twice more for two additional shared variables:
    Name Data Type
    Stop Boolean
    Waveform Type Int16
  12. The PAC and the touch panel will communicate through the shared variables. The PAC will write values to the “Data” variable, and the touch panel will display those on its front panel graph. The touch panel in turn will write values to the “Stop” and “Waveform Type” variables, and the PAC will read from them. This allows the operator to select a waveform type on the touch panel to change the data sent by the PAC.

  13. To complete the application, we need to add the variables to the Generator.vi on the Real-Time target. Open the VI and drag the “Data” variable from the project explorer to the block diagram as shown below. Also, drag the “Waveform Type” variable and two copies of the “Stop” variable to the same block diagram.
    _
    Figure 7: Add Shared Variable to Block Diagram
    _
  14. The HMI needs to read the data from the “Waveform Type” variable. Right-click on the variable and select Change to Read. Do the same with one of the “Stop” variables such that the block diagram resembles the figure below:
    _
    Figure 8: Completed Generator.vi Block Diagram
    _
  15. Now that we have added the variables to the Generator.vi, we must add them to the HMI as well. Open the HMI.vi and drag the “Data” shared variable from the project explorer to the block diagram. Right-click the “Data” shared variable node of the block diagram and select Change to Read.
  16. Drag the “Waveform Type” and “Stop” variables to the HMI.vi block diagram and wire it as shown:
    _
    Figure 9: HMI.vi with Shared Variables
    _
  17. Select File » Save All from the project explorer window to save the project.

  18. To use shared variables on the touch panel, we need to install shared variable support. Do this by running the setup.exe located in the C:\Program Files\National Instruments\LabVIEW 8.2\PDA\Utilities\Variables directory. This will install support on the touch panel while it is connected to computer via ActiveSync.

  19. The touch panel application is not yet complete, as it is not deployed on the touch panel hardware. Create the deployable application by right-clicking the Build Specifications under the touch panel target in the project explorer window and selecting New » Application (EXE).

  20. Select the HMI.vi and click the right-arrow button to make it appear under Top-Level VI. The dialog box should now look like the following:
    _
    Figure 10: Build Specification Source Files
    _
  21. Click the “OK” button, and the build specification “My Application” will appear in the project explorer window as shown below:
    _
    Figure 11: Project Explorer with Touch Panel Build Specification
    _
  22. At this point, the VI is still on the development machine. Download the application to the touch panel by right-clicking the “My Application” build specification and selecting Run.

  23. We must also download the Real-Time portion of the application. Right-click the build specification under the Real-Time target and select Build. Right-click the build specification again and select Deploy. This will deploy the Real-Time executable and shared variables.

  24. The touch panel and PAC are now communicating through the “Data,” “Waveform Type,” and “Stop” shared variables. We can disconnect the USB cable, and the PAC and touch panel will continue to communicate.

  25. Our HMI is now complete and the distributed system is independent of the development machine. Our setup now resemble the following:
    _
    Figure 12: Touch Panel - PAC System Diagram
    _
  26. Refer to the LabVIEW Help files for more detailed instructions.

    Conclusion

As industrial applications become more complex, the role of individual, specialized Programmable Automation Controllers (PACs) becomes increasingly significant. The monitoring of such a distributed system from one central location also becomes impractical. A Human Machine Interface (HMI) solves this problem and completes the distributed application by providing the operator with direct access to the PAC’s that compose it. The LabVIEW Touch Panel module and shared variable extend the LabVIEW graphical programming environment to this HMI platform, reducing development time and application complexity. Managing PAC, HMI, and network communication development is thus greatly simplified within the LabVIEW Project Explorer window. Refer to the links below for more specific information on these topics and more:
Related Links:
Using the LabVIEW Shared Variable
Programmable Automation Controllers (PACs)