NI VeriStand Add-Ons Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

NI VeriStand Example Program - Asynchronous Messaging User Interface

NI VeriStand 2010 Example Program - Asynchronous Messaging User Interface

Overview

The NI VeriStand Asynchronous Messaging User Interface (NIVS AMUI for short) example program demonstrates mechanisms that facilitate rapid LabVIEW User Interfaces (UI) development to get and set NI VeriStand channel data.

Combined with other functionality in the Execution API, you can build an efficient LabVIEW-centric user interface to channels in the NI VeriStand engine much quicker than if developing with the Execution API directly.  This functionality is commonly used to augment or replace the Workspace with native LabVIEW front panels in NI VeriStand systems.  The NIVS AMUI originated with customer UI requirements, and has evolved over months of feedback and use.  The NIVS AMUI has three primary goals.

  1. Abstract the Execution API for R/W channel data in LabVIEW
  2. Facilitate a variety of data types and control appearances
  3. Facilitate and optimize LabVIEW UI development for NI VeriStand systems

Consider the workflow in this graphic.

2011-07-18_162940.png

In this workflow, the operator logs in and selects which system to deploy from a launch pad.  The operator needn't know what a system definition is, or that NI VeriStand is running in the background.  The launch pad deploys the appropriate system definition to the execution target and starts the corresponding LabVIEW UI on the execution host.

The LabVIEW UI is used in lieu of, or in tandem to, the NI VeriStand Workspace.  The UI consists of various data types, such as floating point indicators for analog input channels and Boolean controls for digital output channels.  It also consists of various control images, such as tanks and hoppers to indicate process volumes and valves to indicate flow control.  The UI communicates channel values, alarm conditions, physical states, and other aspects of the deployed system to the operator.  The LabVIEW block diagram supplements the UI with code to launch pop-ups and dialogs, lock out certain controls, etc.

The operator can quit the UI and return to the launch pad.  The process is repeated.  This is a simple example.

Concept of Operation

Note: NIVS AMUI leverages advanced LabVIEW tools including XControls and LabVIEW Object Oriented Programming.  If you use the NIVS AMUI example program without understanding the basics of XControls and LVOOP, you will likely not have a pleasant or supportable experience.  While it's not necessary to completely understand these tools to make use of NIVS AMUI, you must understand them well to debug or extend NIVS AMUI.

The NIVS AMUI is divided into four main parts.

  1. Data Repository - This is the NI VeriStand channel data table exposed by the Workspace manager reference in NI VeriStand's Execution API.
  2. Common Process - The common process is responsible for two things.
    1. Updating the NIVS AMUI XControls with the corresponding NI VeriStand channel values.
    2. Updating NI VeriStand channels with new values from NIVS AMUI XControls.
  3. NIVS AMUI Interface - This is a collection of properties and methods that primarily define two things.
    1. The interface between the NIVS AMUI XControls and the Common Process.
    2. The behavior of the NIVS AMUI XControls.
  4. NIVS AMUI XControls - The NIVS AMUI XControls serve two functions.
    1. Define the visual appearance of the XControl.
    2. Provide a framework for the NIVS AMUI Interface functions that define the behavior of the XControls.

Now we'll discuss the basic operation of the NIVS AMUI.

Initialization
  1. NIVS AMUI initializes when a LabVIEW VI containing an NIVS AMUI XControl is opened, or when an NIVS AMUI XControl is placed on the front panel of a new VI.
  2. The NIVS AMUI XControl starts the Common Process in a background thread.  The Common Process initializes the Workspace Manager refnum and obtains a reference to the active System Definition.
  3. The NIVS AMUI XControl joins a collection of NIVS AMUI XControls maintained by the Common Process.  When it joins, it sends information about itself to the Common Process such as its type of NIVS AMUI XControl, its Refnum, and its NI VeriStand channel mapping.

Updating the Data Repository

2011-07-18_172146.png

  1. In the context of NIVS AMUI, updates to the Data Repository (the NI VeriStand channel data table) originate with the NIVS AMUI XControls.  The XControls will update the repository when the operator changes the value of the XControl on the VI's front panel, when the LabVIEW block diagram writes a value to the XControl's terminal, or when the XControl value is changed via property node.  LabVIEW's XControl framework provides an event structure to handle these events.  In the corresponding event case, the XControl calls methods in the NIVS AMUI Interface class (right-most arrow).
  2. In the NIVS AMUI Interface class, a reference library called Asynchronous Message Communication (AMC) sends a message to the Common Process.  The message includes a unique identifier for the XControl and the new value (middle arrow).
  3. The Common Process uses the unique identifier to look up the NIVS AMUI XControl in the collection.  Once retrieved, it extracts the NI VeriStand channel path string.  The Common Process then calls NI VeriStand - Set Channel Value with the channel path string and new value.  This action updates the NI VeriStand channel data table via the Workspace manager (left-most arrow).

Note: The Workspace manager maintains a lossless connection with the engine's Communication Receive Loop.  This is a low priority loop.  Updates to the channel in the engine are only guaranteed when the entire NI VeriStand engine is running on-time.

Updating the XControls

2011-07-19_123811.png

  1. The Common Process is responsible for updating the NIVS AMUI XControls with the corresponding NI VeriStand channel values.  The Common Process periodically queries NI VeriStand - Get Multiple Channel Values for channel data (left-most arrow).
  2. The Common Process uses the NIVS AMUI XControl's Refnum to update the value of the XControls with the new values from NI VeriStand.
ShutdownWhen the Common Process detects that all NIVS AMUI XControls have left memory, it cleans up references and shuts itself down.

Instructions for Use

To use the NIVS AMUI example program, first install AMC for LabVIEW 2010.  Start NI VeriStand and open the Sinewave Delay.nivsproj.  Assuming the shipping example has not been changed, run the NI VeriStand project.  Extract the attached ZIP file to your computer and open the NIVS AMUI.lvproj.  Open Basic Demo.vi.  You should see a pop-up that a required operation is being performed.

In LabVIEW's application group in the taskbar, you should see two VIs: Basic Demo.vi and NIVS AMUI Common Process.vi.  The Common Process is running and should not be stopped because it is the interface between NI VeriStand and the NIVS AMUI XControls.  Run Basic Demo.vi.  You'll see the value of the two numeric controls change as the Sinewave Delay system  updates the value of the Alarm Count user channel.  If you place Basic Demo next to NI VeriStand's Workspace, you'll see all three Alarm Count indicators (two in LabVIEW and one in NI VeriStand) update at the same time.  You can also set the value of Alarm Count from Basic Demo and the value will reflect in the Workspace.  The Radio Button is mapped to the same channel.  If you set the Alarm Count to 0, you'll see the Radio Button go false.  When Sinewave Delay increments Alarm Count, the radio button will go true.  Stop and close Basic Demo.vi.  NIVS AMUI Common Process.vi should stop and close automatically.

Here's a walk through of the example that ships with NIVS AMUI.

Here's a walk through of using the NIVS AMUI to develop a LabVIEW UI for an NI VeriStand System.

Installing the NIVS AMUI Example Program

To use the example program, download the attached ZIP file.  Unzip the add-on files to your machine.  Download the error file and place it in <user.lib>\errors.

Add-on Requirements to Run the Example Program

All attempts have been made to provide an add-on compatible with the NI VeriStand shipping examples.  The nature of some add-ons requires additional software or hardware to function.

You'll need the Asynchronous Message Communication (AMC) Reference Library to run the NIVS AMUI example program.

Software

This example program was created for use with NI VeriStand 2010.  To use this example program you must have the following software installed:

  • NI VeriStand 2010
  • LabVIEW 2010
  • Asynchronous Message Communication

Hardware

This add-on requires the following hardware.

  • A Windows system capable of running the NI VeriStand Sinewave Delay shipping example.

Requirements to Modify the Example Program

  • LabVIEW 2010
  • NI VeriStand 2010 (Execution API support)

You'll find a documentation folder in the ZIP.  Please refer to the Extending NIVS AMUI for further instructions.

Changelist

Here I'll keep track of changes to the example program.

Package 1.0.0.0

  • Interface Class 1.0.0.7
    • string Process Name
    • queue type def AMC Message Queue
    • string Control Name
    • string GUID
    • [control refnum] Facade Controls
    • &struct Container State DVR
    • &nivs root type System Def Root DVR
    • &string NIVS Channel Path DVR
    • &[string] Start NodePathArray
    • variant Persistent Data
    • Configuration Dialogs
      • Map Control to NIVS Channel
      • Message New Timeout to Common Process
  • NIVS AMUI DBL Class 1.0.0.5
    • &dbl Data DVR
  • NIVS AMUI Boolean Class 1.0.0.1
    • &boolean Data DVR
  • NIVS AMUI Numeric 1.0.0.3
    • &struct Class Data DVR
      • Scale Factor
      • Offset
    • Configuration Dialogs
      • Set Scale Factor and Offset
  • NIVS AMUI Digital Class 1.0.0.4
    • &struct Class Data DVR
      • Display Format
        • Format
        • Precision
      • Text Colors
        • Text Color
        • Background Color
    • Methods
      • Set Digital Text Color
      • Set Digital Precision
  • NIVS AMUI Numeric With Scale 1.0.0.1
  • NIVS AMUI Slide Class 1.0.0.9
    • &struct Class Data DVR
      • Range
        • Minimum
        • Maximum
        • Increment
        • Minor Increment
        • Start
    • Configuration Dialogs
      • Update Slide Range
  • NIVS AMUI Knob Class 1.0.0.9
    • &struct Class Data DVR
      • Range
        • Minimum
        • Maximum
        • Increment
        • Minor Increment
        • Start
    • Configuration Dialogs
      • Update Slide Range
  • NIVS AMUI Common Process 1.0.0.0
    • Messages
      • ""
      • Initialize
      • Register New Control
      • Unregister Control
      • Publish From Common Process
      • Publish To Common Process
      • Update Process Timeout
      • Terminate Common Process
      • Exit
    • Actions
      • Idle
      • Initialize VeriStand References
      • Initialize / Remove All Controls
      • Register New Control
      • Unregister Control
      • Publish From Common Process
      • Publish To Common Process
      • Get Number of Controls
      • Get Control Type
      • Destroy VeriStand References

Known Issues

Known issues with the NIVS AMUI example program.

  • 1.0.0.0
    • It's possible for the common process to launch successfully and the Launch and Run Common Process VI to timeout before the shared queue is created in the common process.  No error is thrown in this case.  The launcher VI might throw an error in the Wait case if the heartbeat is not detected by the timeout.
    • The NIVS AMUI Interface Class » Convert State for Save Wrapper does not write the NIVS Channel Path or Start NodePathArray to persistent data space if the string or array are empty.  This may not be desired behavior.


Bug Fixes

Bug fixes as they are implemented.

Support and Contact

This example program is provided as open-source software.  If it does not meet your exact specification, you are encouraged to modify the source code to meet your needs.  It is not officially supported by National Instruments.

National Instruments does not support this code or guarantee its quality in any way. THIS EXAMPLE PROGRAM 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/).

Contributors