f



loops in loops

In the attached vi, the one second loop runs at one second and can't be touched.  In the ten second loop, the ten second clock is a stand in for a process that generates a finished signal. The problem is once the process is complete, to start it again, leave the one second loop running, and start an additional process that will take less time than 10 seconds. thanks


internal loops.vi:
http://forums.ni.com/attachments/ni/170/319512/1/internal loops.vi
0
x9561 (148438)
4/28/2008 3:10:06 PM
comp.lang.labview 35210 articles. 1 followers. vasusachin24 (1) is leader. Post Follow

6 Replies
4432 Views

Similar Articles

[PageSpeed] 46

Hi exo,
what do you try there? If you start your vi, the value from your stop button will be read and after that, both loops "one" second and "ten" second won�t notice the state change of the stop button. Can you please explain, what you try to do??
Mike
0
x9561 (148438)
4/28/2008 3:10:08 PM
Okay, let me try again.  I need three loops. Two loops start at the same time one runs fast one runs slow. The slow one is probably independent to the problem. When the second loop is done, it needs to restart and start a third loop that takes less than the second.
0
x9561 (148438)
4/28/2008 3:40:08 PM
You have a very basic dataflow problems. Unfortunately, I don't understand your description.
 
I would recommend starting with some basic LabVIEW tutorials.
 
Here are some obvious mistakes:

- Your loop cannot read changes in the stop button, because the terminal is outside the loop.

- You reset "internal loop" to zero in parallel to the loops. You cannot guarantee that this will happen before the locals are read so you might have a race condition.

- The 10second wait runs in parallel to the event structure so the wait times will interact possibly in an unpredictable way.

- Your "internal loop" indicator has the sole purpose to act as a local variable. A shift register is more appropriate, eliminating all the locals. Just hook the indicator to the inner shift wire to see the progress.

- Event structures don't react to programmatic value changes, so your even will never fire!

- Your event structure is completely meaningless, because the "ten second loop" changes with each iteration automatically and since you seem to want to trigger it in this case, NO even structure is needed!
0
x9561 (148438)
4/28/2008 3:40:09 PM
exo wrote:Okay, let me try again. I need three loops. Two loops start at the same time one runs fast one runs slow. The slow one is probably independent to the problem. When the second loop is done, it needs to restart and start a third loop that takes less than the second.


This is all still very vague. You are omitting crucial information.

- Which one is the "second loop". Slow or fast?

- What is the meaning or "probably" in this context?

- Should the first loop continue forever?

- What determines if the second loop is done?

- What does the third loop do during that one second? Is it actually looping many times or is it just executing some code once?

- What should happen after the third loop is done?

It might be much easier if you could describe your problem from a real-world perspective instead of programming terms.
What is it suppused to do? What is is controlling? What behavior should the user see?Message Edited by altenbach on 04-28-2008  08:32 AM
0
x9561 (148438)
4/28/2008 3:40:09 PM
I'm acquiring data for a fixed length of time.  During that time, I have to monitor, at a faster rate, my position. Once the data has been acquired I have to start acquiring more data. At the same time so as not to interrupt the data collection, I have to down load the previously acquired data to a file and update the file's header.
0
x9561 (148438)
4/28/2008 4:10:04 PM
How time critical is the acquisition?  Is it 1000 samples/sec? 100's? 10's? 
Multiple loops is not always the solution.  You need to define the sampling rate, intervals between samples (first set stops / second begins).
Also how is the data acquired?  Is it a DAQ board?  is it buffered?  What is the target PC / OS?  Single / multicore (additional tricks ;) )...
It is important to understall all constraints in order to suggest a better architecture.
RayR
0
x9561 (148438)
4/28/2008 5:10:10 PM
Reply: