NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting if a sequence has stopped when sequences running in new threads / Executions

Solved!
Go to solution

I have a master sequence file which launches UUT sequence files in New threads. The same sequence file can be launched multiple times if the UUTs are the same.

 

1984_1-1786539756743.png1984_1-1786539756743.png

 

 

In the MainSequence of the UUT sequence files I launch a subsequence also in a new thread. This subsequence takes the ThisContext of the parent (UUT - MainSequence) and calls a VI with it. Each UUT subsequence calls the same VI which is reentrant. I know for sure that the context I pass is valid because if check local variables of the given contexts then I get the right values. I also know for sure that the reentrancy works fine.

 

The VI supposed to have different functions but what gives me a trouble is that the VI should simply stop if the give UUT - MainSequence stops. I tried to achieve this functionality like this:

1984_2-1786540124680.png1984_2-1786540124680.png

So I get the context which I know for sure referring to the right UUT sequence instance so I can check is runstate. If the Runstate is not Running then I can stop.

 

It does not work. Whats happenning is that the VI only exists from the loop if all the UUT MainSequences finished their last step.

 

Lets say I have 3 UUT sequences, the first runs for 1m, the second for 2 minutes and the third for 3 minutes. I'd thought that the give instance of the VI above will stop earlier for the first sequence than for the second, but thats not the case, they all stop the same. For an experiment I modified the VI above to lets send a Termination command to one of the sequences. As a result all the three sequences were terminate.

 

So while I know that the sequence contexts that VI instances receive are unique (because I can read different local variable values) it seems that the Thread / Execution value is shared.

 

My question is: how can detect from my reentrant VI if the MainSequence of the given context has stopped and how can I terminate a specific sequence without terminating all of them at once.

 

Thanks.

 

 

 

0 Kudos
Message 1 of 2
(512 Views)
Solution
Accepted by topic author 1984

So I figured it out... if the sequences are launched in new threads then the execution points back to the master sequence. If the sequences get launched as new execution then its all good.

 

Kudos to me I guess.

0 Kudos
Message 2 of 2
(483 Views)