Example Code

Archived: Data Acquisition Reference Application for LabVIEW

Code and Documents

Attachment

Overview


This document has been archived and is no longer updated by National Instruments.

The Data Acquisition Reference Application for LabVIEW is a specific application implementation based on the framework defined in the Data Acquisition Reference Design. This application uses the FlexSignal Reference Library to acquire data from DAQmx devices, TDMS files, or simulated signals. The data can be logged to TDMS files and viewed in several different displays such as a power spectrum, harmonic cursor, and RMS chart. The Channel Monitor XControl is used as a general channel monitoring tool to show overall level and time domain signals.

Demo

Here's a quick demo of the Data Acquisition Reference Application:

Software Architecture

This reference application’s software architecture is described in the Data Acquisition Reference Design for LabVIEW.  Refer to that document for details on the implementation of architecture.

Project Libraries

There are four Project Libraries associated with this reference application.  Each one serves a specific function.  These libraries are described below.

Data Acquisition Reference Design

This is the top-level Project Library and contains the main application.  It also holds the System Configuration.ctl type definition.  

The best place to start with customizing the code is with the System Configuration type definition.  This type definition contains information that will be used by most of the other Project Libraries.  Any changes here will be propagated to them.  Add the data types that you think you’ll need for data acquisition and data logging.

The GUI of the main application consists of a toolbar of icons for actions and the Channel Monitor XControl

Figure 1 - GUI of main application

The Channel Monitor XControl gives the user another way to interact with the data as well as some feedback to the applied configuration settings and if the acquisition is active. 

Consider the most appropriate default data view for the application and use it in the main GUI.

Configuration [FlexSignal]

The Configuration [FlexSignal] Project Library handles the entire interactive configuration of the application.  The Channel Configuration.vi is based on the Queued State Machine Template from the Asynchronous Message Handler (AMC) Reference Library.  The real complexity in the code is due to the multiple acquisition sources and the use of tree controls to interact with the configuration.  The tree control provides a convenient and efficient way to graphically interact with the information, but adds considerable complexity to the VI (as opposed to simple tab controls).

The GXML Reference Library is used to store the system configuration in a XML format.  GXML provides an easy way to convert between XML and LabVIEW datatypes and also has features to accommodate versioning of the files so when the application changes, the old files can be updated to the latest configuration.

The design of the configuration GUI can be the most challenging part.  It is a balance between the features the user needs and how to make the interaction intuitive.  Remember to update the Load/Save Config from/to File VIs so your configuration can be saved to disk and think about how to handle configuration versioning moving forward.

Analog Input [FlexSignal]

The Analog Input [FlexSignal] Project Library is the acquisition engine of the application.  In this case, the acquisition source is the FlexSignal Reference Library which can acquired data from DAQmx devices, TDMS files, or simulated signals.  The main VI of the Project Library is “DAQ Analog Input.vi”.  This VI is an action engine with three states: Configure and Start, Read, and Close.

Figure 2 - DAQ Analog Input.vi block diagram

This VI contains all of the specific acquisition code.  To change or modify the way the data is acquired, change this code.

The DAQ AI Engine State.vi receives messages generated by user events (such as pressing the Start button) and translates it into the appropriate next state for the DAQ process.  This VI does not need to be modified unless the states or commands for the DAQ process are changed.

The other VIs (Get AI Channel Names and Get AI Input Range) are helper VIs used to setup the Channel Monitor XControl.

Logging [TDMS]

The Logging [TDMS] Project Library is very similar to the Analog Input Project Library.  It has two main pieces which are the logging action engine and the state controller.  The TDMS Data Logging VI contains all of the code for logging data to disk. 

This is the VI to modify if you want to change the file type, file naming convention or add other application information to the log file such as test run, user, hardware settings, etc.

Figure 3 - TDMS Data Logging.vi block diagram

The TDMS Log Engine State.vi receives messages generated by user events (such as pressing the Log button) and translates it into the appropriate next state for the Logging process.  This VI does not need to be modified unless the states or commands for the Logging process are changed.

Display Windows

Refer to the Data Acquisition Reference Design for LabVIEW for details on the Display Windows Project Library.

Software Requirements

AMC Reference Library v2.1 or later

Channel Monitor XControl v1.1 or later

FlexSignal Reference Library v1.1.2 or later

Harmonic Cursor XControl v1.0 or later

GXML Reference Library v1.3.2 or later

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
AeroSoul
Active Participant
Active Participant
on

AMC Reference Library

GXML Reference Library

 

These two are the only i could find with quick googling, both on VIPM.

Contributors