NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a LabVIEW Module Stop Button to programmatically bring my Test Sequences to Cleanup

Solved!
Go to solution
Highlighted

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

0 Kudos
Message 1 of 3
(158 Views)
Solution
Accepted by karin630

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,

jigg
CTA, CLA
teststandhelp.com
~Will work for kudos and/or BBQ~
Message 2 of 3
(130 Views)
Highlighted

Thanks and I will keep this idea in mind.

0 Kudos
Message 3 of 3
(123 Views)