NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine when a sub-sequence in the MainSequence Main group was just called?

Solved!
Go to solution

I want to implement a custom progress bar for my Operator Interface and I've seen some NI tutorials how to do this but IMHO the solution is quite ugly in that the MainSequence has hard-coded UI message events to statically send the percent done.

 

What I think would be a better method would be to have the SequenceFilePostStep callback increment a FileGlobal counter only when a sub-sequence in the MainSequence Main group has been called.  I've already figured out how to get the total number of MainSequence sub-sequences in the Main group via the expression:

 

 RunState.SequenceFile.AsSequenceFile.GetSequenceByName("MainSequence").GetNumSteps(StepGroup_Main).  

 

It's the part in bold above that I'm not sure how to do and would appreciate some help in this regard.  Once I have both of these values I can just divide the two and send a UserMessage to the Operator Interface with the percentage done.

 

Thanks! 


0 Kudos
Message 1 of 4
(3,627 Views)

Hi Sean,

 

In your SequenceFilePostStep callback, you could have a Statement Step that increments the FileGlobal Counter, with the following pre-expression:

 

(RunState.Caller.Step.AsPropertyObject.Type.TypeName == "SequenceCall") &&

(RunState.Caller.Sequence.Name == "MainSequence") &&

(RunState.Caller.StepGroup == 1)

 

This will increment the counter when a sequence is called from the MainSequence MainGroup.

 

I hope this helps,

 

Charlie

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 2 of 4
(3,616 Views)

This is awesome and exactly what I was looking for, thanks!

 

Before I mark it as accepted, is there a not-so-difficult way to move both the expression that figures out the number of MainSequence steps and your expression that tracks how many have been executed into my process model?  I'd like to have this functionality for every sequence file I run and would be nice to capture this in the process model since they will all use the same Operator Interface.

 

I noticed you recommended putting your statement in the pre-expression field.  Are there any advantages to using the pre-expression field rather than surrounding a step in an IF/END block or is it merely style & preference?  I'm fairly new to TestStand so I want to make sure I'm using best practices early on.

 

Thanks again,

-Sean


0 Kudos
Message 3 of 4
(3,600 Views)
Solution
Accepted by topic author SeanDonner

Hi Sean,

 

Instead of having the SequenceFilePostStep in your client sequence file, you can put the Statement Step into the Process Model using a ProcessModelPostStep callback.

 

Previously when I said pre-expression, I meant pre-condition, but I think you understood what I meant...

 

It's a style and readability thing - a pre-condition will make your sequence look nice and compact, whereas an IF/END block improves readability etc.

 

I'm currently writing sequences to use Flow Control steps (IF/END, SELECT/CASE, FOR, DO WHILE) for UUT test-related logic, where decision making or looping is part of the customer requirements, and pre-conditions for TestStand-related logic such as this.

 

Cheers,

 

Charlie

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 4 of 4
(3,580 Views)