Description
Description-Separate-1
Overview
This example demonstrates the scope of LabVIEW functonal global variables when called from TestStand.
Description
When calling LabVIEW code from TestStand which uses global variables, it is important to consider the scope of the variables to ensure that the code behaves as you intend. The term 'global variable' in this document includes any of the following:
- LabVIEW global variables
- Uninitialized shift register (Functional Global Variable, or FGV)
The scope of a LabVIEW global variable is the current application instance of LabVIEW. Each process running LabVIEW code, such as the LabVIEW Development system or the TestStand process (which can load VIs in the LabVIEW Runtime Engine) have a separate set of application instances. Within each process, each LabVIEW project has a separate instance, as well as an additional instance for VIs not called within a project.
Because of this, the following settings must match for VI calls where a global is used to share data:
- LabVIEW Execution System - VIs called in the Runtime Engine are run in the TestStand process, while VIs run in the LabVIEW Development system are run out of process.
- Project Context - If you specify a project in a step which calls a LabVIEW module, the VI is executed in the application instance for that project
The attached example shows how the same global variable can store multiple distinct values when called in a different execution system or project context.
Hardware and Software Requirements
TestStand 2014 or Compatible
LabVIEW 2014 or Compatible
Steps to Implement or Execute Code
- Extract the example files, and open the Global Scope.seq.
- Run the sequence using Execute » Run Mainsequence.
- Observe that the same global variable is used to store different values since the steps each use a different execution system or project context.
Description-Separate-2
Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand