02-15-2019 04:17 AM
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?
02-24-2019 06:29 AM - edited 02-24-2019 06:44 AM
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
02-24-2019 07:57 AM - edited 02-24-2019 07:57 AM
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.
02-25-2019 06:12 AM
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.
02-25-2019 08:53 AM - edited 02-25-2019 08:55 AM
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.
02-28-2019 03:45 AM
Thank you for your support. I will adapt your suggestion to my application and test it.