1. Purpose of Custom Workspace Objects
Many applications have unique needs that can benefit from customized tools. NI VeriStand is an open environment that you can easily customize in a variety of ways. With custom workspace objects, you can create user-defined controls and indicators for use with the NI VeriStand workspace. So if a particular display is not available out of the box, it can be modified or created to best serve the user’s needs.
2. Methods of Creation
Before creating custom controls, you should first decide what changes you want to make. Then, you can determine which of the following three common methods to use when creating your custom control. In all three of the cases, you will be editing a file in LabVIEW, which must be copied into the Display Templates folder in the NI VeriStand directory. You should develop your custom control in a separate folder and keep only finished custom controls in the Display Templates folder. Once you have copied the file, drop it in the workspace to verify the behavior of the control.
Name your files descriptively so you can identify them in NI VeriStand. The words before the dash in the file name describe the type of device and determine the directory under which the control appears in the Workspace Controls menu. The words after the dash will be the individual identifier in that directory. For example, the Numeric Indicator with Min/Max Latching is named “Numeric Indicator – Min Max Tracker” and shows up as seen below:
Use the following method if you want to make only small changes to the appearance of the control. Open the existing file and save a copy with a new name in a new place. Make the desired changes to the appearance of the control and save. Copy this file into the Display Templates folder and verify the behavior of the control in NI VeriStand.
See the Aerospace Objects example on the NI VeriStand Add-Ons page for additional guidance.
For performance, NI VeriStand often decimates the data that it sends to the workspace. If your application requires a lossless display, such as for graph indicators, then use the following method. Open the existing “Graph – Simple” control found in the Display Templates folder and save a copy with a new name in a new place.
The waveform data inside of the while loop has been buffered so that channel information is not lost. Extract Y values from this waveform using “Get Waveform Components” and manipulate them to fit the form of the new display you wish to create. Do not delete the original graph. You need it to make the SubVIs function. Instead, hide it outside of the frame of the front panel. To prevent it from showing when the panel is resized, you can right-click and choose to “Scale object with pane.”
The “Setup” and “Hold” buttons will still function for your new display as they control the data coming into the top level VI. If you want to still use the “Hide Legend” and auto scaling buttons, you need to wire them to property nodes of your new display. You will be able to only modify the code in the top level VI.
Free Label Template
To create a display that has unique functionality or that requires significant changes to the user interface or logic of an existing control, use the following method. Open the “Decoration – Free Label” control in the Display Templates folder and save a copy with a new name in a new place.
This control has a basic structure for interfacing with NI VeriStand that provides the most flexibility for creating a custom control. Create your own SubVI to gather initial conditions from the user and drop it in the “LaunchConfigDialog” case of the user event. Most of your code should go into the event structure inside the middle while loop. Use the “Timeout” case to execute code for the usual behavior of the control.
See the Numeric Min/Max example on the NI VeriStand Add-Ons page for additional guidance.
3. Suggestions for Development
Some general practices can assist you in effectively developing your custom workspace object. If you are unsure about the soundness of the logic in your program, then you should isolate it in the LabVIEW environment first. It is much faster to debug logic in LabVIEW than if it is embedded in the custom workspace object code, which relies on the NI VeriStand environment as well. A tool called “Sample Waveform” is a VI that provides incoming data in a similar format to the NI VeriStand environment for graphing situations, and may be useful in building test programs in LabVIEW. You can download it on this page.
The “Select Channel Dialog” tool is available to select channels to read from a visual tree structure. It may be helpful in writing the user interface for a custom control. For a more complete description and an example, see the Numeric Indicator with Min Max Latching.
You may need to create a source distribution before you can drop and run your custom workspace object in NI VeriStand. This will be true when you have created your own Sub VIs within your workspace object or if you get an error for a missing or broken VI when you try to drop your control in NI VeriStand. Refer to the LabVIEW Help article titled “Building a Source Distribution” for detailed help. Be sure to create an .llb file as the destination for your SubVIs and all dependencies. When you preview the build, you should see only your main custom workspace object file and the .llb. Copy both of these files into the Display Templates folder before dropping the object. For an example of a source distribution, see the Numeric Indicator with Min Max Latching.
Sometimes the changes you make in a custom workspace object do not immediately show after copying a new version of the file into the Display Templates folder and dropping a new instance into the workspace. This is related to the software’s memory management, which keeps copies of the file rather than reloading it. Quick fixes include changing the mode of the workspace from edit to run to edit, waiting a short period of time, or restarting the workspace on NI VeriStand. You should also note that the Screens folder of the NI VeriStand directory keeps copies of the workspace objects. You can safely delete any copies of old versions of the workspace objects if preferred.
If you need data to persist across NI VeriStand sessions, then you can save it as a part of the variant data of the custom control in the .rig file, just as it is saved from initialization dialogs. See the “LaunchConfigDialog” case of the User Event in the Free Label Template for an example of how to save this data.
Through the open environment of NI VeriStand, you can use custom NI VeriStand workspace objects to satisfy unique applications needs. The three common methods of creating a custom interface are cosmetic changes, the graph template, and the free label architecture. Each of these methods is best suited to different levels of customization, with free label being the most flexible. It is good practice to test new algorithms in the LabVIEW environment before testing them in NI VeriStand, and source distributions will need to be created to run custom workspace objects that use SubVIs. Once a custom workspace object is complete and copied into the Design Templates folder, it is natively integrated into NI VeriStand for use like the packaged interfaces.
Browse custom workspace objects and other NI VeriStand add-ons at the NI VeriStand Add-Ons Page.