02-13-2020 11:38 AM
I have a MainSequence which has the following
Setup
SubSequence 1
SubSequence 2
SubSequence 3
Cleanup
In SubSequence 1, I have to launch a LabVIEW Module which monitors my parameters and allow me to terminate the application with a Stop Button. Inside my LabVIEW Module I will have an Event Structure to handle the Stop button Event. My desire behavior for pushing the Stop Button is to
- Stop the LabVIEW Module
- Have SubSequence 1 go to Cleanup immediately
- Have MainSequence go to Cleanup immediately once SubSequence 1 finishes execution
Can you recommend a clean way to handle this inside my LabVIEW Module Stop Button Event? I already have my Sequence Reference wired into the LabVIEW module. I assume to call some Sequence API in this case?
Any recommendations would be appreciated.
Thank you
Solved! Go to Solution.
02-13-2020 02:20 PM
A user initiated stop is considered a terminate in my opinion. So you can just call the terminate method. Either pass a boolean back to TestStand and do it in the post expression for the step or do it using the sequence context they passed in. In my opinion the more TestStand you can keep out of your VIs the better off you are. This makes your VIs more flexible in terms of using them in LabVIEW only applications as well as TestStand applications. However, sometimes it is a good idea to have some TestStand API stuff in your VI. Like if you want to monitor the termination status inside LabVIEW so you can know to kill a long running VI or not.
Either way the method to terminate is: RunState.Execution.Terminate()
Or inside of a VI you will need to pass your sequence context reference to a property node and get the Execution object. Then use an invoke node to call Terminate. Don't forget to close the Execution object if you do this.
Hope this helps,
02-13-2020 02:51 PM
Thanks and I will keep this idea in mind.