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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to update the progress bar output according to the vi execution time at real time

hi all,

 

i am now considering to write a progress bar vi to calculate the vi execution time(like creating the excel report). up to now the progress bar vi is finished using while loop. but i have no idea how to update the vi execution time at real time since i use loop count to 100 by increasing 1 each step.

 

could any1 help me? it will be appreciated if you could give me some advice. thanks

0 Kudos
Message 1 of 19
(3,681 Views)

Hi yuanjieping,

Some time ago I created the piece of code attached to estimate the remaining execution time of a for loop, basing on the previous iterations time. Hope it can help you.

Download All
0 Kudos
Message 2 of 19
(3,664 Views)

my describing might cause some missunderstanding.

i have 1 sub vi which will create excel report. another progress bar vi will monitor the running status of the excel vi. when the excel report successfully set up, the progress bar should display 100%. The procedure of executing excel vi should be synchronized with progress bar. 

0 Kudos
Message 3 of 19
(3,635 Views)

You need to transfer data between VIs executing in parallel then. What about setting up a queue? The VI creating the excel report (producer) could enqueue its progress state in any moment, and it would be received and displayed by the progress bar VI (consumer); as soon as the consumer gets the 100% value it should exit the dequeueing loop in order not to get stuck.

0 Kudos
Message 4 of 19
(3,618 Views)

Make a state machine out of the code and have the progress bar update with each state completed.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 19
(3,616 Views)

hi cente90,

do you means that after the excel report (producer) finished, one state will be enqueued, and then the progress bar VI (consumer) received the queue?  if so, it looks like one time delay function is used after the excel report VI.

 

do i right understand?

0 Kudos
Message 6 of 19
(3,598 Views)

hi bill,

do you means put the the two VI (excel report and progress bar) into the state machine, let them run one after another?

0 Kudos
Message 7 of 19
(3,597 Views)

Actually my solution kind of dovetails with the one above it.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 19
(3,586 Views)

sorry i do not quite undetstand your solution. could you please be a little specific? As i understand your solution is trying to put the vi into 2 different state of the machine and let them run one after another.

0 Kudos
Message 9 of 19
(3,578 Views)

Hello yuanjieping,

 

it´s no problem place the progress bar in another SubVI then the code that creats your excel report. But how does your excel report code tells you his status of execution? Could you post that code please?

0 Kudos
Message 10 of 19
(3,563 Views)