LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How many loops can labview execute simultaneously?

Hello,

 

 

I'm in the final stages of debugging a fairly large and complex labview application. Everything is going great, except for one thing: My program, which needs to execute many parellel loops, pathologically fails. I can force it to fail by adding anything (EG a delay of zero, or a while loop that does nothing) to this one particular spot.

 

This leads me to believe that the LabVIEW execution engine has some finite limit (probably tied to my hardware) of things it can pay attention to / execute at the same time. Is this true and what is this number?

 

This is a hard question to even phrase correctly, and probably a harder one to answer. Attached is my code for anyone who feels like wading through a giant application.

0 Kudos
Message 1 of 6
(3,931 Views)

Which VI is your top level VI?  I saw manualcontrol.vi.  It seems like it could be a top level.  It doesn't look like it has that many loops.

 

When you say adding something causes it to fail, what does "fail" mean?  Error message, crash, PC explodes?  What particular spot?  Of course a while loop that does nothing or does not have a minimal delay will cause your PC to consume 100% of the CPU resources.

 

There is no particular limit to the number of loops you can have.  It is all dependent on CPU cycles and memory usage.

 

 

Message 2 of 6
(3,927 Views)

see below... duplicate post

Message Edited by Astrophysics on 03-10-2010 03:57 PM
0 Kudos
Message 3 of 6
(3,900 Views)

 

Thanks for responding so quickly!

 

So yes I should have been more clear about what we're dealing with here. First, I should explain that this software is being used to fabricate something called a multilayer coating on the surface of an optic for the eventual use in a space-based x-ray observatory. I have three top level VI's that are designed to be used in concert with one another to accomplish a coating. These are status.vi (displays positioning indicators and updates position data of some stepper motors), manualcontrol.vi (which is used for aligning and manually controlling some other steppers / equipment... this gets disabled during a run) and RandDalg.vi (which is the program that actually 'does' the coating).

 

It will be easy to see the interdependence of the applications if you open up the project file, then open up manualcontrol.vi, status.vi, and RandDalg.vi and then look at the vi hierarchy.

 

Currently, the pathological failure occurs during a run in the main automation control loop (/control/new control loop.vi -- the VI's icon is yellow with a big black C in the center). If you open it up, you'll see that the VI is essentially a flat sequence structure with a while loop outside it. In a correct run of the software, there are two loops that will execute simultaneously to move equipment. One of the pieces of equipment, the mandrel, which is in the flat sequence structure, has finite, defined movements (and is therefore controlled by a for loop in the flat sequence structure). The platen (the thing in the while loop) needs to be moving while the mandrel is moving, no matter how long it takes, therefore this is in the while loop outside the sequence structure. I have a flag that controls the monitoring of the platen (loop on variable in the control loop), and then another global flag to actually enable / disable the sweeping of the platen.

 

The problem is that pathologically my flags do not actually trip anything!!! and i'm thinking that since during a run, those three top level VI's that need to be running... and subsequently everything under them, is clogging up labview and making it pathologically miss my flags.

 

So to answer your question -- I am defining 'failure' as when that while loop does not get executed... and subsequently my platen does not move. There is no error message thrown or anything like that. Fortunately it does not explode 🙂

 

Is this a fair statement? I apologize for my long windedness but I really appreciate all the good work being done by you guys on the forums. 

 

0 Kudos
Message 4 of 6
(3,897 Views)

Ravens Fan wrote:

 

When you say adding something causes it to fail, what does "fail" mean?  Error message, crash, PC explodes


Lets hope not!

0 Kudos
Message 5 of 6
(3,894 Views)

What is your CPU usage according to task manager?

 

One concern I would have is that you have a lot of shared variables and could have a race condition.  But the few I checked seemed like you had one writer and multiple readers, so that may not be a problem.  But I'm not goint to look to see if all your variables are behaving themselves.

 

You had a few loops where all you were doing was polling a status.  Like in New control loop, you have a while loop that is reading shared variable platen velocity to see if it is zero and looking at the local variable actually stopped?  That one is running with no delay in the loop, so that could be eating up CPU cycles preventing other code from getting its share of the time to run.

 

I would recommend looking at Tools >> Profile >> Performance and memory while you are running to see it shows any particular VI's taking a long time, or executing more times then they should.  Then investigate those VI's and see why.

0 Kudos
Message 6 of 6
(3,889 Views)