Solution
In TestStand, if you execute a sequence which runs a code module, you are unable to terminate the sequence until that code module completes. This can be a problem in cases where you have a code module acquiring data or executing for an extended period of time and you decide to stop the test before it completes.
To ensure that your sequence terminates when you click the
Terminate Execution button, you can use the Termination Monitor within your code module. As your code module executes, the Termination Monitor will check to see if the
Terminate Execution button was clicked in TestStand. If it has, then the code module returns and the sequence terminates as desired.
LabVIEW:The image below shows the Termination Monitor functioning in a LabVIEW code module.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
You can initialize the Termination Monitor at the beginning of your code module and check the status of it periodically. TestStand - Get Termination Monitor Status VI will return true if TestStand is attempting to terminate the sequence. In code modules that run for an extended time, you should check the status frequently and exit the module if TestStand is attempting to terminate.
The image below shows the Sequence Editor running with the LabVIEW example code module.
You can find the LabVIEW example code on the
following location:
<TestStand Public> \Examples\Fundamentals\Termination Monitor\LabVIEWLabWindows™/CVI™:You can perform the same functionality in LabWindows/CVI using the
TS_CancelDialogIfExecutionStops command. This function monitors the TestStand environment to detect when execution is terminated or aborted. If terminated, then the LabWindows/CVI code module is cancelled and returns.
You can find the LabWindows/CVI example code on the following location:
<TestStand Public> \Examples\Fundamentals\Termination Monitor\CVI