NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I automate the display of the progress percent bar?

I am customizing an operator interface in CVI and modifying the TestStand process model to accomodate some specific requirements. One of these requirements is to show the progress percent of any test sequence in the operator interface (or in the sequence editor) in a progress bar.

I've made some sequences examples, where I included steps using the ActiveX adapter, which post a UIMessage with the progress percent value. However, this is a step that I need to include in each test sequence that I want to display in the progress bar, and I need to calculate the progress percent.

I was wondering if there is a way to use a sequence callback so I can automate this process and for any test sequence that I write and ru
n using the same process model, the UIMessage could be sent automatically with the right progress percent value, without having to include a step for this purpose in each sequence.

I've been trying to solve this, and I implemented a sequence callback in the process model, the ProcessModelPostStep sequence callback, which is called after the execution of any step of any sequence that is run with the specified process model. However, I've been having problems trying to calculate the right percentage value, since I need to take into account the different stack depths if my sequence has several subsequences call levels.

I am not interested in a highly precise value, but at least, a percentage of the progress of the main sequence would be a good solution for me.

Thanks in advance for your comments.
Message 1 of 9
(7,400 Views)
Hello,

You are on the right track, in the sense that you have to modify the callback of the process model. However, if you only want the progess bar to be updated for steps in the MainSequence then you need to add some conditions on the step responsible for updating the progress percent bar. Here is what I suggest:

1. Add the ProcessModelPostStepCallback to your model file.
2. Inside of this callback add a Action step that uses the ActiveX Automation Adapter. This step will call PostUIMessageEx and post the UIMessage ProgressPercent.
3. Add a precondition on this step that states: RunState.Caller.RunState.CallStackDepth == 1. This way the step will not execute for subsequences of the MainSequence.
4. You will need to add a statement step befo
re the MainSequence callback in your execution entry point that will get the Start Time in seconds (i.e. Seconds(False)).
5. In the pre-expression of the ActiveX step in the callback, do the following: Locals.Progress = ((Seconds(False) - RunState.Root.Locals.StartTimeMain)/20) *100. This will give you the percentage of the total time the execution has been running which is estimated to be 20 seconds. Note that in order for this to work correctly, you need to know how long the test will run for. Since we cannot determine this until the MainSequence has finished execution, we need to estimate. The local variable Progress will store the percentage that you can then post along with the UIMessage (numeric data).

I hope this helps.
Message 2 of 9
(7,398 Views)
Thanks for your ideas, Bob.

However, I don't think this approach would help me. I cannot estimate the execution time of my tests. My idea was more on updating the progress whenever a step gets completely finished. This is because a lot of my sequence steps are asynchronous and could take different amount of time to complete in each execution.

Going back to my original question, the main problem is that I don't find an easy way to calculate the right progress percent value so I can display it in the progress bar.

What I would like is a way to retrieve the value of the total number of steps of the main sequence, and the index value of the current step inside the main sequence, so I can calculate the relationship and display it as a percent.

Thanks a
gain.
0 Kudos
Message 3 of 9
(7,397 Views)
Hello,

you might use the following TestStand expression to calculate the percent value of the steps already executed (from the total number of steps) in the MainSequence:

(RunState.Main.RunState.StepIndex+1) * 100 / GetNumElements(RunState.Main.RunState.Sequence.Main)

Hope this helps.
0 Kudos
Message 4 of 9
(7,397 Views)
This is the expression I wasn't being able to figure out (I wasn't seeing that under RunState.Main there was the RunState of the client sequence being run). I tried the expression and it works fine.

Thanks for your help.
0 Kudos
Message 5 of 9
(7,397 Views)
Hi,
 
I used your idea in my program.It worked fine. thanks a lot. But i need some more help.
I need two progress bars in my application. One has to show the main sequence's status.The other one has to show the currently executing subsequence's status.How can i implement it? 
Thanks in advance.
 
Regards,
Radha
0 Kudos
Message 6 of 9
(7,028 Views)
Hi,
 
Do the same as for your top level except send it to the other Progess Bar.
 
IF 'MainSequence' THEN
      Use Main Sequence Progess Bar
ELSE
      Use the other progress bar.
ENDIF
 
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 7 of 9
(7,024 Views)

Hi,

I tried using the method to update with the OI in Update UI Progress inside the Process Model and it worked. The problem now when I try to load my sequence file dynamically (Using Execution.SetClient) inside the process model my ProcessModelPostStep is not executed anymore. Is there any other way to update the main sequence progress without using the ProcessModelPostStep? Or this there anyway so I can make the ProcessModelPostStep to be executed back? I'm using TestStand 3.5 with Windows XP

Thanks

   

 

0 Kudos
Message 8 of 9
(6,706 Views)

Check out these Developer Zone Examples for using UIMessages to implement a progress bar. These examples include the code/concepts that we recommend using to modify an Operator Interface to include modifications such as progress bars and can easily be modified to add support for multiple progress bars.

 

Developer Zone Example: Launching a Floating LabVIEW Panel in TestStand

Developer Zone Example: Launching a Floating .NET Form in TestStand

Developer Zone Example: Launching a Floating CVI User Interface in TestStand 

 

In these examples, since the OI code asynchronously responds to UserMessages, you could simply define different UserMessages for different progress bars.



Evan Prothro
RF Systems Engineer | NI

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