LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have a for loop with 15000 iterations, and i'd like to keep track of it using a microsoft progress bar. If i update the progress back at each iteration, it takes too much time. What's the best solution?

I have a for loop with 15000 iterations, and i'd like to keep track of it using a microsoft progress bar. If i update the progress back at each iteration, it takes too much time. And if i update it every say 500 iteration, the case box used to check that "i" is a multiple of 500 uses as much time (i'm talking about 14 seconds compared to a few milliseconds if no progress bar is used at all). Any clue?
Thanks.
0 Kudos
Message 1 of 12
(4,018 Views)
Hi.
I mentioned this briefly in the previous response. You might want to try using the "Horizontal Graduated Bar" or the "Horizontal Progress Bar" both in the third row of the numeric subpalette of the controls palette. Since they are LabVIEW indicators, as opposed to activeX controls for which you have to interact with a server, I think execution must be much faster.
0 Kudos
Message 2 of 12
(4,018 Views)
Yes but suppose i have 2 separate For loops, and i want the progress bar to keep track of the 1rst loop until half the progress bar, and then keep track of the 2nd loop until 100% of the progress bar. The problem is, i cannot connect 2 wires to the horizontal progress bar indicator to be able to update the value of the progress bar. Can i? And thank you for your quick answer previously (the files wouldn't open, i have labview 5.1.1)
0 Kudos
Message 3 of 12
(4,021 Views)
Hello.
You can connect 2 wires into one slider, if you right click on it and select "Add slider". I am not sure if that is available in your version of LabVIEW, but I think it is. Even if it is, I don't think it is what you need.
I am assuming that one loop executes after the other. If this is the case, I have created a small sample VI that has a slider that uses its first half to track the progress of the first loop and the second half for the second loop. I cannot save the VI in LV 5.1 version, so I will also attach an image. Perhaps someone will be kind enough to save it in LV 5.1 version for you.
Download All
0 Kudos
Message 4 of 12
(4,021 Views)
I reasd the other posts where you mention that the progress may come from seperate loops.

You can create a reference and a property node (write value) to pass the value to the progress bar. This allows you to send values from different locations to a single progress bar.

For instance.

Right-click the progress bar (Microsoft bar??) and select Create Reference.
In your loops, use the property node to obtain the value and send it to the progress bar. You can even use this in sub-vi's.

JLV
Message 5 of 12
(4,021 Views)
hummm....

You're using LV5.1. I can't remember if what I suggested would work in that version. Hopefully it does.
Message 6 of 12
(4,021 Views)
OK, first to the question about slowdowns due to the constant update operation. If the entire progress takes only a few milliseconds, you don't need a progress bar! In general, You definitely don't need to update faster than the eye can follow. Also, if your progress bar is e.g. 150 pixels wide, you won't see a difference unless at least 100 iterations have passed. All intermediate iterations don't need to be written, right? They are just wasting computing resources.
The solution: Simply put the progress indicator in a case that is mostly not active. Two possible suggestions (see attached image):
- update only every n'th iteration (top panel), the other case is the default case and is empty.
- wait at least x milliseconds between updates (bottom panel
).

To your second questions about two loops:
It makes logically no sense to switch between showing the progress of two different loops, if both loops run in paralell (The definition of "progress" would need a politician). Either use two progress bars, one for each loop, or arrange it that loop 2 starts after loop 1 has finished. In this case, you can use e.g. a local variable. (even here you could run the progress bar to 100% in each loop, but show a text indicator on the current code section ("Executing loop 1" 0%...100%, "Executing loop 2" 0%...100%).
0 Kudos
Message 7 of 12
(4,021 Views)
Thank you Joe but I was already using the microsoft progress bar in different loops by updating its value in its property node. It takes a long time though for large iterations (it adds at least 14 seconds for the loop time for 15000 iterations), not to mention that i'm using a poor pentium II processor... The labview slider bar is much much faster as suggested by my previous replier but i can't seem to update its value sequencially... . Thank you.
0 Kudos
Message 8 of 12
(4,021 Views)
Greetings, Naddad:

What's wrong with using one of the several available Labview progress bars? That way you won't have to keep dipping into the windows application, which should speed things up considerably. (Besides, the Labview bars are a lot better looking than Windows bars, IMHO. 🙂

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 9 of 12
(4,021 Views)
Hello Eric,

The problem with the Labview progress bar is that I cannot update the bar from two different source. For example, if there are 2 for loops, and say that i want the first to update the progress bar till 50%, and the second (which starts after the first had finished) updates the bar from 50 to 100%. I'm using Labview 5.1.1 and I cannot wire the bar indicator to 2 different sources. It appears that it's possible with later versions of Labview... Thanks.
0 Kudos
Message 10 of 12
(4,021 Views)