Building Custom Devices for NI VeriStand

Publish Date: Mar 22, 2016 | 16 Ratings | 2.62 out of 5 | Print | 5 Customer Reviews | Submit your review


NI VeriStand provides a software framework for creating real-time testing applications using a configuration-based development approach. All of the common tasks or functionality of a real-time test system have been implemented and optimized inside the NI VeriStand Engine. While NI VeriStand provides most of the general functionality required for a real-time testing application, NI has designed the environment to be customized and extended when necessary to ensure it always meets application requirements.

You can use NI VeriStand custom devices to add more functionality to the NI VeriStand Engine. NI VeriStand custom devices are created with NI LabVIEW software using a template library installed with NI VeriStand that includes interfaces to the NI VeriStand data and timing resources. This gives custom devices the ability to behave as native tasks within the NI VeriStand Engine. Examples of how this interface is used include adding support for a third-party hardware I/O interface or implementing custom functionality such as inline signal processing.

To demonstrate how to create and use an NI VeriStand custom device, this paper uses an example custom device that adds the ability to log data locally to the real-time system that is running your NI VeriStand system definition.

Table of Contents

  1. Custom Device Application Description
  2. Adding the Custom Device to NI VeriStand
  3. Using the Custom Device With NI VeriStand 
  4. Understanding How the Custom Device Works
  5. Summary

1. Custom Device Application Description

NI VeriStand natively supports logging and running test profiles on real-time systems; however, this requires having a host computer running the NI VeriStand workspace connected to the real-time hardware to start the logging task and capture the logged data. This white paper describes an example custom device that makes it possible for data to be logged to the local machine running your NI VeriStand system definition to implement headless data logging. The following sections demonstrate how to install and use the custom device and then examine how to create the custom device from the template that NI provides with NI VeriStand. 

Note: This custom device is included with NI VeriStand 2011 and later.  You can find the custom device library and the source files to build the custom device in the custom device directory below.

Download example code for NI VeriStand 2010.

Download example code for NI VeriStand 2009.

Download the NI VeriStand evaluation.

Back to Top

2. Adding the Custom Device to NI VeriStand

The instructions below describe how to add a custom device for use in your NI VeriStand project.

1.     Download and move the following files before opening NI VeriStand:

  • Move the Source Files to any location on your computer.
  • Move the Source Distribution Files from the Custom Device llbs folder to

–         Windows XP: C:\Documents and Settings\All Users\Documents\National Instruments\NI VeriStand\Custom Devices

–         Windows Vista/7: C:\Users\Public\Documents\National Instruments\NI VeriStand\Custom Devices

2.     Open NI VeriStand.

3.     Select the Sinewave Delay project file to make it your active project.

4.     Click Configure Project to open the NI VeriStand Project Explorer (NI VeriStand 2010 and later).

5.     Expand the System Definition File section and double-click the Sinewave Delay.nivssdf file to open the System Explorer.

6.     Expand the Controller section.

7.     Add the custom device by right-clicking Custom Devices in the configuration tree.

8.     Notice that the default Configuration Channels have already been defined and added.


9.     (Optional) Edit the device Name and TDMS File Path.

  • Note that C: is the root directory on the real-time system (ftp: IP AddressC:). 

10.   Select Logging Channels and click the http:/ to add channels to the custom device.

  • In general, give an appropriate name for the channel because this is what appears under the Logging Channels section and in the Technical Data Management Streaming (TDMS) file. You will add the channels Sine Output and Time.

11.   Make mapping connections.

  • This lets you link the channels from your NI VeriStand system definition that will be logged to the custom device logging channels.
  • Click the Mappings Dialog button in the toolbar to bring up the System Configuration Mappings.

  • Select a source and a destination, and then click .

–        Do this for Sinewave Out1 and Sine Output.


–      Do this for System Time and Time.


  • You should now see mappings similar to the picture below:

12.   Click OK to close the Mappings Dialog.

13.   Double-check the Controller settings to verify the operating system and IP address.

14.   Save and close the System Explorer.

Back to Top

3. Using the Custom Device With NI VeriStand 

Control Logging From the NI VeriStand Workspace

The instructions below describe how to interface to the custom device from the workspace.

1.     Right-click on Sinewave Delay.nivsproj»Deploy.

2.     Launch the Workspace Window.

3.     Once in the workspace, change to edit mode <Ctrl-M> and add a Numeric Control – Medium to the workspace.

4.     Click the Channel Browse button, navigate to Controller»Custom Devices»RT Logging»Configuration Channels, and select File Number.

  • This variable controls when a new file is created along with the number appended to the file name.

5.     Click OK. Click OK again.

6.     Place down a Boolean control, click the Channel Browse button, and navigate to Log to RT File?.

  • This variable controls when data is logged or not logged. True = Logging; False = No Logging.


7.     Click OK. Click OK again.

8.     Change back to run mode <Ctrl-M>.

9.     Log data by making the Log to RT File? Boolean true for some period of time. Stop logging by changing the Boolean back to false.

Retrieving the Data Log Files

The instructions below describe how to retrieve the data log files.

Note: This template has been designed so that the file reference is closed only when the File Number variable is changed or when a new configuration is downloaded.

1.     For a real-time target, open an FTP window to the real-time system (the data log file is located in the root directory).

  • Copy both the data log file (*.tdms) and index file (*.tdms_index) to your host computer.

2.     For the Windows OS, the file is located at C:\.

3.     Open the data log file (*.tdms).

This can be done in LabVIEW using the TDMS File or in NI VeriStand with the TDMS File Viewer tool.

Back to Top

4. Understanding How the Custom Device Works

The initial template VIs are created by using a set of VIs that are installed with NI VeriStand. You can find them at \National Instruments\LabVIEW\vi.lib\NI VeriStand\Custom Device Tools\Custom Device Utility Library. 

Setting Up the Custom Device Template

Note: The version of LabVIEW used to create the custom device must match the version of NI VeriStand with which it will be used.

  1. Open the Custom Device Template Tool folder and open Custom Device Template Tool VI.
    • Change the target folder location and custom device name as desired. Leave the Execution mode as Asynchronous for this custom device.
  2. Run and then close the VI. You can now work from the newly created project.
    • Three default VIs are created for you to begin from:

      When a custom device is first added to the System Explorer, the Initialization VI runs immediately to set up the channels and default values, and then the main page is displayed in the System Explorer. When the configuration is run or deployed, the real-time driver is downloaded and run with the NI VeriStand Engine.
  3. Open the RT Logging Initialization
  4. Create and save a global variable. You can use this global variable to hold string constants and help prevent user errors.
    • Drop a global variable from the functions palette (Programming»Structures). Double-click it to open and configure it. Save it as RT Logging Global in the library.
    • Add four string controls to the global VI. Duplicate the name inside the actual string control and then save these as default values (Edit»Make Current Values Default) as shown below. Save and close the VI.
  5. Create the RT Logging Initialization VI, as in the project attached and shown below. See the completed source code for further VI detail. This gives an example of how to set custom device descriptions and properties, create custom device sections, and add custom device channels.

When this initialization VI is run, it gives the following default configuration with two sections (Configuration Channels and Logging Channels) and three channels under the first section.


Customizing Configuration Pages

Each section and channel has a default page (VI), which runs if no GUID is wired. If you need to customize (Log to RT File? example below), you can begin with a template VI and customize this. The following steps show an example of how to create a custom page for the Log to RT File? channel, so that you can set a Boolean default value to initially log or not log.

  1. Open the Page Template.vit located in the project as shown below.
  2. Choose Open Additional Copy»Continue and change the type from Template VIs to VIs. Then navigate to the location of your current project and choose Name the VI (example name: RT Logging Log to RT File»Save the VI. Drag the new VI into your project under RT Logging Custom Device.lvlib.


  3. You can now change the VI code to match the attached RT Logging Log to RT File, as shown below.

    • Add a Default Value Boolean button.

A.      Add a Boolean button to the front panel.

B.      Change the Initialization code to initialize the default value button, as shown below.

C.      Add an event case to handle the Boolean value change.

      • Add an event case to the main event structure for when there is a value change to the Boolean button.
      • Wire the new value into an NI VeriStand – Set Custom Device Channel Default Value VI to set the new default value.

D.      Similar steps were taken to create custom VIs for the File Number, RT Logging Channel Main VI (in which you can add channels), and RT Logging Channel Individual VI (run for each channel). For the RT Logging Channel Main VI, the VI was slightly more customized with extra code to prompt the user for a channel name and check to see if that name already exists as a channel.


Creating XML File and GUIDs

Each custom device requires a partner XML file because this is used by the System Explorer to define file paths and associate GUIDs to VIs. A default XML file is programmatically created for you when you use the Custom Device Template Tool. This XML file is loaded and parsed when you first load NI VeriStand; therefore, any changes are implemented when NI VeriStand next opens. You can generate custom GUIDs using the GUID Generator in the Custom Device Template Tool.


Note: You do not need to create a GUID/custom GUID for every channel. You can use a default GUID and VI if one is not defined.


Example: RT Logging Log to RT File VI;

GUID: 46E671BD-29EF-89FF-629A-9E63FA00C654


Lastly, the Glyph defines which picture is by the section or channel. The path to find different glyphs that are shipped with NI VeriStand is C:\ProgramData\National Instruments\NI VeriStand\System Explorer\Glyphs. This custom device uses the default fpga channel.png, which results in a  by each channel. For the sections, default fpga category is used, which results in .

You can copy and paste the entire page section (<page> ... </page>) to repeat for multiple GUIDs and VIs.


Customizing the Real-Time Engine VI


The default template real-time VI (shown below) is used as a starting point for creating the custom device real-time VI.

Remove the first two VIs and change the timed While Loop to a regular While Loop because you do not need (or want) your logging device to make any other Timed Loops run late. Data is maintained in the first-in-first-out memory buffer (FIFO) until you read and log it, which creates a lossless logging solution. You also implement custom error handling after the code has finished.

The real-time VI begins by initializing shift registers and unbundling data passed from the host. Inside the While Loop, the VI waits indefinitely for the real-time FIFO to have data. Once data arrives, the VI checks to see if the File Number has changed and then either closes the current file and creates a new one or continues with the current file. This is why changing the File Number closes the current file and creates a new one.

Note: A single data point is lost for this iteration while closing and opening files.

After the While Loop stops, the file is closed.


Creating a Source Distribution to Install to NI VeriStand

After you have created all VIs and have solid run arrows  indicating that you have an executable custom device, you must create source distributions, which are used by both the NI VeriStand System Explorer and NI VeriStand Real-Time Engine.

Add the newly created pages to the build specifications:

  • Open the build specification properties: Right-click build»Properties.
  • In the Source Files section, highlight any newly created VIs and click the arrow to include them.

  • In the Source File Settings, change the destination for each new VI to RT Logging Folder.


Once finished, click OK. No changes need to be made for the real-time VI.

To build the configuration and engine, right-click on each and choose Build. This automatically creates a source distribution and (by default) places the configuration and engine in the NI VeriStand\Custom Devices folder.

After the source distributions have been created, you can run NI VeriStand.

Back to Top

5. Summary

This white paper discussed how to create, add, and use custom devices with NI VeriStand. See the NI VeriStand documentation and the NI VeriStand Custom Device Developer's Guide to learn more about NI VeriStand custom devices.


Back to Top

Customer Reviews
5 Reviews | Submit your review

where is the example files  - Jun 3, 2017

I didn't see them

Section 1: What's the directory path?  - May 11, 2016

In section 1, it states: "Note: This custom device is included with NI VeriStand 2011 and later. You can find the custom device library and the source files to build the custom device in the custom device directory below." but then does NOT give what the "custom device directory" is "below". What is it? Thanks.

  - Nov 26, 2012

Is such a description available for VeriStand 2011? I assume, as the example files are available only for 2009 and 2010, this document is adjusted for those older versions.

  - Jul 12, 2012

The files for this example are not compatible for VeriStand 2011. Is there another way to use this in 2011 or another example with compatable files?

Good Work  - Nov 8, 2010

Fairly complicated with the total number of items to customize, but a very good document. Thanks.

View more reviews

Bookmark & Share


Rate this document

Answered Your Question?
Yes No