LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combined while loops make loop time too long

So the project I have been working on involves taking two pre-existing VIs, each measuring two components of the experiment I am doing, and combining them into one program so that all the data can be written to the same file simultaneously. I was able to successfully integrate the two programs together and get it functioning but the problem I am having is that in the new program the loop time seems to be the combined loop times of the while loops in the previous programs, even thought there is only one while loop in the new program. This loop time is too long for the purposes of my experiment, can anybody give me suggestions on how to decrease the loop time or make it so that all components are running simultaneously in the loop?

0 Kudos
Message 1 of 6
(2,861 Views)
The execution time should be the longest of the two loops. If there is a data dependency then it will be the combined times. That would happen if you have an output from one loop going to the other loop or if using a sequence structure. Any chance you can post the code or a stripped down version exhibiting this behavior?
=====================
LabVIEW 2012


0 Kudos
Message 2 of 6
(2,857 Views)

Dependacy was my first thought as well but I am pretty sure that the loops are in parallel to each other. Attach is a version of the VI.

0 Kudos
Message 3 of 6
(2,848 Views)

Turn on the execution trace to see what is slowing down.

0 Kudos
Message 4 of 6
(2,845 Views)

 

What you probably did was to make execution of one of the original VI functions dependant on execution of the other function by wiring them together either by error wires or other data. That would mean that the combined execution time of the loop is the sum of the time both functions take.

 

Do you still have the original code? What you could do is to create a file write VI that takes the output of each function. The two functions will be executing in parallel and the file write VI will only execute after they are both done.

 

Something like this

 

Capture.PNG

 

By the way you should probably make each piece of code surrounded by a decoration into a SubVI. Just a suggestion.

=====================
LabVIEW 2012


0 Kudos
Message 5 of 6
(2,805 Views)

Are your VIs calling any shared subVIs? If so you could be encountering an issue where each VI/task running in parallel is sharing a single resource. Therefore only one of the VIs can actually run while the other waits for the shared resource. This can easily extend your execution time. Make sure that your VIs are completely indendent of each other. BTW, if each of these subVIs are writing to the same file that could be your shared resource. You might consider using a third task which handles all of the file processing. This also has the benefit of not having the file I/O inpact your data tasks.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 6 of 6
(2,797 Views)