Description
Description-Separate-1
Overview
This example demonstrates how to use the TestStand API to create a new sequence file, add an action step which calls a LabVIEW code module, and configure the parameters for the step.
Description
This example Completes the following tasks using the TestStand API:
- Create an instance of the TestStand engine.
- Create the engine object using the Automation Open node.
- Call Engine.LoadTypePaletteEx() to load any custom types.
- Create a new sequence file using Engine.NewSequenceFile().
- Create two FileGlobal variables which will be used to store the output data from the VI.
- Access the FileGlobals for the sequence files using SequenceFile.FileGlobalsDefaultValues().
- Use the "SetVal" PropertyObject methods, such as PropertyObject.SetValString(), to create the fileGlobals. The option of InsertIfMissing (1) is used to create the properties.
- Call SequenceFile.IncrementChangeCount() to indicate that the file has been modified.
- Create a new LabVIEW step.
- Create the step using the Engine.NewStep() method.
- Access the LabVIEW specific module properties by type casting the Module Object (Step.Module property) to the LabVIEWModule class, using the Variant to Data node.
- Set the LabVIEWModule.VIPath property to the desired VI.
- Call LabVIEWModule.ReloadPrototype() to load the module parameters from the VI.
- To set the parameters, access the LabVIEWModule.LabVIEWParameters collection, which contains an item for each parameter in the VI.
- Set the ValueExpr property for each parameter to the desired property. In this example, the FileGlobals are used here.
- Add the step to the mainSequence of the new sequence file.
- Access the MainSequence using the SequenceFile.GetSequenceByName() method.
- Call Sequence.InsertStep() to add the new step to the sequence.
- Save the sequence file using SequenceFile.Save().
- Release the sequence file using Engine.ReleaseSequenceFileEx(), and close all references. Note that this is called even if an error occurred.
Hardware and Software Requirements
Create Sequence File With LabVIEW Step Using API - TS2019.zip
TestStand 2019 or Compatible
LabVIEW 2020 or Compatible
Create Sequence File With LabVIEW Step Using API - TS2016.zip
TestStand 2016 or Compatible
LabVIEW 2016 or Compatible
Steps to Implement or Execute Code
- Extract the attached file, then open the Top Level - CreateSequenceFile.vi.
- Specify a path for the sequence file in the New Sequence File Path control.
- In the VI Path control, browse to the module.vi included in the example in the Test Module folder.
- Run the VI.
- In the sequence editor, browse to the path you specified in step 1. Verify that a sequence file is present, and it contains a single action step.
Additional Information or References
The following TestStand shipping examples provide additional applications of the TestStand API.
Description-Separate-2
Al B.
Staff Software Engineer - TestStand
CTA/CLD