Passing Clusters to Code Modules - LabVIEW
- Updated2024-11-26
- 3 minute(s) read
Passing Clusters to Code Modules - LabVIEW
This example demonstrates how to pass a TestStand container as a LabVIEW cluster to a LabVIEW VI. The container consists of several different data types. The VIs are compiled into a DLL and called as functions.
Example File
Location
<TestStand Public>\Examples\Fundamentals\Passing Clusters to Code Modules\Passing Clusters to Code Modules.seq
Highlighted Features
- Data types
- LabVIEW Adapter
- Local variables
Major API
None
Prerequisites
You do not need to have the LabVIEW development system installed to use this example, but you must have the LabVIEW development system installed if you want to review the source VIs.
How to Use This Example
The sequence specifies ContainerOut and ContainerIn container local variables, which you can review on the Variables pane. When the sequence runs, TestStand copies the values in the ContainerOut container to the individual local variables, and then copies the values again to the ContainerIn container. A VI handles both operations. Before you run the sequence, the ContainerOut container contains values, the ContainerIn container contains default values, and the individual local variables contain default values.
Complete the following steps to use this example.
- Select Execute»Test UUTs to run the sequence.
- Enter any serial number in the UUT Information dialog box and click OK. TestStand launches a Results for Unbundle dialog box that lists values loaded from the individual local variables, which specified default values before you executed the sequence.
- Click OK in the Results for Unbundle dialog box. TestStand launches another Results for Unbundle dialog box that lists values loaded from the ContainerIn container, which specified default values before you executed the sequence.
- Click OK when TestStand informs you that the sequence passed.
- Click Stop in the UUT Information dialog box to end the execution.
You can review the two Message Popup steps in the sequence to verify that the appropriate sources are providing values. You can open VI1.vi and VI2.vi, located in the <TestStand Public>\Examples\Fundamentals\Passing Clusters to Code Modules directory, to see how the data is being copied. The VI1.vi uses an unbundle function to separate the values from the cluster, and the VI2.vi uses a bundle function to combine individual values into a single cluster.
To pass a TestStand container as a cluster to a VI, you must complete the following tasks:
- Define the container as a custom data type.
- Specify that objects of the data type can be passed as clusters.
- Ensure that the Cluster Item Label for each item in the data type matches the label of the LabVIEW cluster.
Complete the following steps to use the Types window to review the data type definition for a container.
- In the Sequence File window, right-click the ContainerIn container on the Variables pane and select View»Type Definition from the context menu to launch the Types window.
- Right-click the ClusterType data type and select Properties from the context menu to launch the Type Properties dialog box. Because the sequence is using a VI, you must enable cluster passing for the data type.
- Click the Cluster Passing tab. Notice that the Allow Objects of This Type to be Passed as LabVIEW Clusters option is enabled. The Cluster Item Label option for each item matches the control labels in the VI.
- Click OK to close the Type Properties dialog box.