NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Howto make ProcessModel calculate TOTAL steps for calling sequence file?

Solved!
Go to solution

I've made a custom Operator Interface and I'd like to support a progress bar to give the user an indication of how far along they are.   I've already setup the call-back infrastructure so that the progress bar will update based on a User Message from the engine.

 

In the process model itself, I've set up a "ProcessModelPostStep" callback (the purple one) so that after every step in the calling sequence file I increment an internal counter and send that data along with the User Message. 

 

The only missing part is knowing how to calculate the TOTAL number of steps in the calling sequence file.  I can get total number of SEQUENCES defined in the calling file but I do not how to recursively loop over each sequence call from the top down counting all the steps in the called sequence.

 

Appreciate any help in getting this last piece in place.

 

Thanks!


0 Kudos
Message 1 of 9
(5,447 Views)

The code below is crashing LabVIEW at the moment, but I think it's close to the solution.  The code is in a recursive VI.  Call it with the sequence file reference (perhaps from SequenceContext) and with MainSequence.  For every step in every group for the sequence, check if it's a sequence call.  If it's a sequence call, get the sequence name and call the recursive VI again.  If it's not a sequence call, increment the counter.get seq call recursive.PNG

 

Hopefully, this will get you started and I'll try to get it running myself at the same time.

 

Pulido Technologies LLC

Message 2 of 9
(5,430 Views)
Solution
Accepted by topic author SeanDonner

I have a better solution in the pictures below.  The code snippet is the code called by TestStand to initiate the recursion.  

 

The attached code is the recursive call.  It's similar to my first post, but fixed a bug with typecasting references.  

 

This should get the total step count.  The code works under a few assumptions:

1. All of the called sequences are in the same sequence file.  (You can add steps to also get the sequence file path and get the sequence from there.)

2. There are no Asynchronous LabVIEW steps in TestStand.  (These are treated as Sequence calls in the API and you would have to add code to sort them out.)

sequence context call.PNG

 

Pulido Technologies LLC

Message 3 of 9
(5,418 Views)

This is awesome, thanks so much! 

Before I saw your 2nd answer with the code I created a new TestStand sequence and started converting your algorithm into TestStand API calls using 'Statement' steps with a Reursive sequence call back to itself.

 

I just ran a test 60 seconds ago and my error was because the sequence call was NOT into the same sequenceFile, its into a different sequence file.  I see you listed that one caveat so now I need to ferret out how to get that info; my guess is from the SequenceCallModule?

Also, I do not have any async calls so I'm good there.


0 Kudos
Message 4 of 9
(5,415 Views)

The SequenceCallModule can also get you the sequence Path.  Your recursive VI will have to change to get the Sequence File Path instead of the sequence file reference.  Good Luck!

 

Pulido Technologies LLC

0 Kudos
Message 5 of 9
(5,412 Views)

@pulidotech wrote:

Your recursive VI will have to change to get the Sequence File Path instead of the sequence file reference.  Good Luck!

 

Pulido Technologies LLC


Is there not a method that takes a Sequence File Path as input and returns a reference to it so I can keep all else the same and just add that extra step?

I've attached my nearly complete sequence.  I just need to figure out what needs to go in the "Get Next Sequence File Ref" step and I should be golden.  Any ideas?

P.S.

I forgot to mention that this ‘CountTotalSteps’ sequence will be called from my ProcessModel in the ‘DoPreUUT’ sequence. 

 

The two parameters into this sequence will be initialized as follows:

sequenceFileRef = #NoValidation,RunState.ProcessModelClient.AsPropertyObjectFile.AsSequenceFile

sequenceName = “MainSequence”


0 Kudos
Message 6 of 9
(5,408 Views)

Dupe


0 Kudos
Message 7 of 9
(5,408 Views)

You can use the GetSequenceFileEx method (for the TestStand Engine) to get the sequence file reference from the path.  I haven't really tried this in a recursive VI (which will also need the Engine as an input), so I'm not certain everything would work perfectly.

 

Pulido Technologies LLC

Message 8 of 9
(5,400 Views)

Thank you for all your help.  Using your LabVIEW algorithm and suggestions I was able to roll everything into a TestStand sequence that supports calling into multiple sequence files.

 

I've attached a sequence file that contains the recursive sequence.  This sequence just needs to be put in the 'DoPreUUT' sequence of the process model with the following initial values:

 

sequenceFileRef = #NoValidation,RunState.ProcessModelClient.AsPropertyObjectFile.AsSequenceFile
sequenceName = "MainSequence"

runningTotal = Locals.runningTotal // Locals.runningTotal is initialized to 0


Message 9 of 9
(5,381 Views)