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: 

A couple of questions about the Sequencecontext

Solved!
Go to solution

Hi,

 

I'm struggling a bit using the sequence context and the API. If there's something I need I'm not really sure where to look for it, so if anyone knows the answers to my two questions, I would really appreciate if you told me how I could have looked it up my self.

 

Firstly, is there a variable that gets updated when the sequence passed/failed window pops up? I have a thread running in parallel to the main sequence that shows elapsed time, errors etc. that I would like to close automatically when the test is complete. Something like RunState.Report.PassedFailed ?

 

My second question is about the Failure callback. Since my VIs check for both numbers and strings, I had to create a sub sequence that checks the results one by one. If a failure occurs here, and the user hits retry, I have to set RunState.Caller.RunState.Caller.RunState.NextStepIndex = RunState.Caller.RunState.Caller.RunState.PreviousStepIndex and update Parameters.Step.Result.Status to "failed, retrying step". The problem is that the step that is actually re running doesn't get it's status updated because after the Callback, the program jumps to the subsequence, finishes, and THEN returns to where the failure was.

 

So the question here is, is it possible to do something like RunState.Caller.Parameters.Step.Result.Status? Did I just answere my own question?Smiley Embarassed

 

Thanks 

0 Kudos
Message 1 of 4
(3,103 Views)
Solution
Accepted by topic author q-bertsuit

Hi q-bertsuit,

 

First question: I set the advanced option for the subsequence call (I am assuming you are running another sequence in a new thread), "Automatically Wait for the Thread to Complete at the end of the Current Sequence" to disabled. In the subsequence that runs in a new thread, I do all the computation inside a while loop and I set the while loop condition to "RunState.Caller.Execution!=Nothing" which basically means the caller sequence has finished execution. This worked for me.

 

Regarding your second question, I tried out your solution for re-running the step that failed. It worked fine in the sense that the execution of the entire MainSequence callback starts over (since you are resetting the nextstepindex of the Process model) AFTER finishing the remaining steps in MainSequence. The reason you see only the previous results (when the test failed) and not the latest (when it passed) is because only the first element of the result array in the Process Model is used to create the report and the results of the re-try form the second or later elements of the result array.


I also tried changing that statement in the Failure Callback to "RunState.Caller.RunState.NextStepIndex = RunState.Caller.RunState.Stepindex". In this case, only the step index of you client sequence file is reset and it begins executing again at the failed step. You can also restart the execution at any step you want in the client file by changing the right side of the statement to RunState.Caller.RunState.Stepindex-N where N is the number of previous steps to re-try. In this case, the entire execution does not start over from the Mainsequence call and the final report will contain the status of the all the repeating steps for each retry. It will also give you an accurate overall report in the end.

You can use this method if it works better for you.

I have attached a sample sequence where i have put the code for both issues.


Hope this helps.... 🙂


PS: I figured these out mostly by trial and error, so i can't recommend a sure shot method of mastering the API. But it helps to know at a high level what sort of data/variables are available during an execution and what sort of data they contain.

Message 2 of 4
(3,087 Views)

Thanks for your answer TRJ and sorry for the late kudos and reply 🙂

 

I'll give your solution to the first question a shot, although my sub sequence only contains a single VI that runs. There's a while loop inside this VI that I would like to close, but the based on "RunState.Caller.Execution!=Nothing", but I'm guessing it wont be any problems passing this in to the VI via the sequence context.

 

Thanks again for your answer!

0 Kudos
Message 3 of 4
(3,041 Views)

Glad i could help Smiley Happy.

0 Kudos
Message 4 of 4
(2,945 Views)