From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Error-Handler Abort Subsequence

Hello,

 

in a measurement-sequence (ms) I'm using an error-handler, which is started in a new thread in the ms. In case of an error, the execution of the ms is set to a loop (using RunState.Caller.RunState.NextStepIndex=0), while the error is fixed. This is working fine.

 

But in the ms there are several subsequences. If an error occurs, while the ms is currently in a subsequence-step, the subsequence stays running. I haven’t found a way to get out of the subsequence to set the ms-execution to the loop. With “RunState.caller.Step.IsSequenceCall” I’ll get the info, that the ms is currently executing a subsequence, but how can I skip all steps of the subsequence and get back into the ms?

0 Kudos
Message 1 of 6
(2,259 Views)

It is difficult to propose a solution if you do not provide any code to show what you are trying to accomplish.

 

In your sub-sequence, you can put a post-action for each step that is: "On fail, go to step <cleanup>". Make sure that you pass the error out of the sub-sequence as a parameter.

 

Good luck

 

Marc Dubois
0 Kudos
Message 2 of 6
(2,199 Views)

Or more simply, you can change the sub-sequence property "On Step Failure :" to "Go to Cleanup".

 

However, you must make sure that the error is passed to your error parameter before the sub-sequence status is changed to failed.

Marc Dubois
0 Kudos
Message 3 of 6
(2,191 Views)

I've created a simple example because the original sequence is used for a testbench- automation and is very complex.
For testing please copy the Testbench_status.vi to C:\Temp and the example should run.
For the "On fail, go to step <cleanup>"-solution I have to put the post-action to each step of the numerous subsequences.
Then in the main-seq you have to check, if there has been an error while the sub-seq was running.

It is possible to check in the error-handler-seq, if the execution is currently running in a subsequence and you can identitfy the sub-seq by name and ID (e.g. RunState.caller.Step.Module.Step.Name). But I found no API-command to leave
the specified sub-seq.

Download All
0 Kudos
Message 4 of 6
(2,182 Views)

Providing a simple example illustrating your problem is exactly the right thing to do.

 

As I mentioned in my previous post, you can set the sub-sequence property "On Step Failure :" to "Go to Cleanup" for the whole sub-sequence at once.

 

You are correct, you have to give some time after the sub-sequence call in case of an error for the error handler to handle the error, but it works. You can put the check in the clean-up group and set the sub-sequence calls post-action to go to the clean-up in case of failure.

 

I have made the modifications to your sequence and it seems to work the way you seem to intend. I don't think there is a TestStand API command to simply jump out of a sub-sequence but I would be happy to learn about it if it exists.

 

I would also suggest that you consider using queues to communicate with your error handler rather than using FileGlobals. Your handler would then be idle when nothing happens and it would make your application easier to maintain and more easily expandable.

Marc Dubois
0 Kudos
Message 5 of 6
(2,175 Views)

Thank you for your support. I will adapt your suggestion to my application and test it.

0 Kudos
Message 6 of 6
(2,153 Views)