LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed loop inside a flat sequence not terminating

Inside a while loop there is an event structure.  Inside that there is a flat sequence.  On one of the frames there is a timed loop that quits after so many iterations.  The timed loop finishes but the flat sequence doesn't execute the next sequence.  What am I not doing right?
0 Kudos
Message 1 of 11
(3,854 Views)

Hi Paul,

 

It will be easier to understand your code and help you if you could post your code.

0 Kudos
Message 2 of 11
(3,852 Views)
It is a rather large application but here it is - look at the bottom right of the block diagram, event 2 "master record"
0 Kudos
Message 3 of 11
(3,845 Views)

Hi Paul,

 

Unfortunately I have LabVIEW 8.5 and the code is in 8.6. Can you save the VI for 8.5 and upload again?

0 Kudos
Message 4 of 11
(3,842 Views)
0 Kudos
Message 5 of 11
(3,837 Views)

Whether it's your problem or not I don't know, but I notice there is no strict data dependency between where you obtain your queue's (and write to your camera # queue globals) and when you try to enqueue inside the sequence structure. This has the potential to produce a race condition where you are trying to enqueue to a queue that hasn't yet been obtained. Without specifying a timeout for your enqueue functions, they could be waiting indefinitely to write to a queue that doesn't exist.

Message Edited by AlexK on 10-23-2008 01:35 PM
0 Kudos
Message 6 of 11
(3,832 Views)
The queues get created when the program first runs and don't get destroyed unless the program is stopped.  The record function works the first time (writes to the files and I can view the files with media player after aborting the program).   Doesn't that indicate the queueing function is working okay?  Pressing the STOP doesn't work and a probe on the the next frame where I am checking for empty queues never gets executed.
0 Kudos
Message 7 of 11
(3,823 Views)

First, you have too many local variables.  This could be leading to race conditions.

 

I think you have a couple problems in the use of event structures.  It is a bad idea to put any long running code inside an event case.  It will prevent the Event Structure from handling any other events in the mean time.  You have several timed loops running that in that one sequence frame.

 

But the bigger problem is the next sequence frame.  You have a while loop that only ends once all the queues are empty.  Can you guarantee that all the queues get emptied?

 

You have laid out the code very neatly, but you have used a lot of odd things in there.  (Number to boolean array, to cluster, to unbundle the cluster to individual indicators.)  Why not just go from Boolean array to and index array function.  No need for the intermediate cluster conversion.  Why not set up the indicators as an indicator array and just write to them directly.

 

The code is so much intertwined between when queues are created, filled, emptied, destroyed, events happen...  And this is all multiplied by at least 4 times for each camera.  And there are 4 major event structures going on.  This is a very ambitious project for an inexperience LabVIEW user.  You need to step back, get one thing working right, and design so that you can scale the architecture upward.  Many of the structures you have essentially duplicated and belong in subVI's.

Message 8 of 11
(3,800 Views)

Thank you for the suggestions.

 

The real problem is that cut and pastes (which doesn't always work well) has put two extra timed loops in the frame.  Doing a "clean up diagram" makes them visible otherwise I can't see them.  Is there someway to make them visble without destroying my "very neat" diagram? Moving the four timed loops around doesn't show the extra ones.

0 Kudos
Message 9 of 11
(3,769 Views)

Paul,

 

I'd like to focus on your copy and paste issue since it seems you have quite a bit of great advice from the previous posts on your general program.  One thing to try that always works for me is to select the items that I would like to copy, hold down the Ctrl key, and drag the selection.  This functionality is exactly the same as the Windows <ctrl> drag and does not always behave the same as a copy paste in LabVIEW.  This is most likely due to the underlying way that LabVIEW copies items to the clipboard. Let me know if <ctrl> drag solves your problem!

Sincerely,

Chris G in AE
0 Kudos
Message 10 of 11
(3,734 Views)