I am still learning labview and read through the previous posts and did not see an appropriate solution, so your recommendations would be appreciated.
I am trying to design a .vi that tracks the results of a race for a 5/10k. Once the .vi is started, the elapsed time function begins and is displayed on the front panel. This would continue until the program is stopped with with "Stop" button on the front panel. While this timer is going, if the "Bib Number" control value is changed, it records the new bib number and the elapsed time of the event. I have this much working, but I have a few issues.
First, I have read that it is usually bad practice to use an auto-indexing tunnel with a while loop, which I am currently doing. Instead, should I be manually indexing the array, "Race Time by Bib number" array within the event structure or array? Would this allow me to see the "Race time by bib number" array update while the program is running?
Second, since I do not want anything recorded if the "Bib Number" is not changed, I have not wired anything to the output tunnel in the timeout event. Obviously, this will send the default zero to my array and store useless data points. If I use the default -1 input to the timeout event and put the "Elapsed time" outside of the event structure, the "Elapsed Time" does not show up on the front panel. How do I change this to avoid storing many rows that are only zeroes?
The .vi is attached to help you understand my question.
Thank you in advance for your assistance.
Solved! Go to Solution.
This is one of those rare occasions where a local variable or two won't hurt too much.
Too be fair. A Producer Consumer (Events) design pattern would be preferable for scaleability but the consumer State machine in this application is really a rock simple stupid Elapsed Time Express vi .
That works, thank you. How can I see the "Race times by bib number" array updating as the .vi is running and new bib numbers are enetered?
You have the indicator for "Race times by bib number" outside the while loop. It is going to update the value when the loop stops. If you need to update it while the vi is running you should build the array and display the indicator inside the while loop.
fromm8, thank you.
In case someone searches for this solution in the future, I have attached my final .vi.