LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execution timing in LabVIEW

In my application, I monitor 7 sensor values as either on or off and either update internal variables or turn on actuators accordingly. For some reason, LabVIEW is missing some of the sensor values changing and I think its because i'm using flat sequence structures for some of parts as delays are required in some instances. My question is, with several concurrent processes running at the same time, if i enter a sequence structure, does that preempt the other processes. IE, if i'm in a sequence structure and some condition changes outside of the structure, is my system going to be able to detect it?
0 Kudos
Message 1 of 7
(3,311 Views)
Once execution enters a sequence structure it continues in that structure until complete. Consider a State Machine architecture as a much better alternative to the sequence. Look at the examples with LV and search this site for more information. Many experienced LV programmers rarely or never use a sequence structure, especially on complex programs.

Lynn
0 Kudos
Message 2 of 7
(3,304 Views)
Entering the sequence structure will not prevent operation of code outside of the sequence structure which is independent from and in parallel to the sequence structure.

I have some questions which may help to isolate the source of your problem.

1. It appears that the parallel processes in your application are intended to independently monitor your sensors. Is this correct?

2. What are the hardware resources that you are using?

3. Is it possible that you're missing data because two portions of the program are trying to utilize the same resources simultaneously?

I do recommend that you try to steer clear of sequence structures when possible as Lynn suggested. While the flat sequence structure has helped with some of the problems associated with sequence structures it still disrupts the natural LabVIEW dataflow operation.
0 Kudos
Message 3 of 7
(3,287 Views)
The program executes in a while loop that is continuously polling a DIO card which monitors the status of 7 digital sensors. The problem is that when one sensor becomes active and the program perfoms an action based on that occurence, another sensor may become active and the program is unable to capture it.
0 Kudos
Message 4 of 7
(3,285 Views)
If you could post a copy or an image of your code I expect that the problem will be apparent.
0 Kudos
Message 5 of 7
(3,277 Views)
Perform the sensor-data-dependent actions outside the loop that is reading the DIO. Pass the data from the DAQ loop to the processing loop(s) with queues. Then no data is lost and the loops can run independently. Make sure each loop has some kind of wait to allow CPU sharing. Even a zero ms wait will work.

Lynn
0 Kudos
Message 6 of 7
(3,273 Views)
thanks for your help everyone, I'm currently updating the code as per your advice and will post an updated version if this does not fix my problems. I think I just need to get rid of all the sequence structures and tidy up the code some. Thanks again
0 Kudos
Message 7 of 7
(3,270 Views)