LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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
0 Kudos
Message 1 of 7
(2,394 Views)
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 Kudos
Message 2 of 7
(2,391 Views)
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 Kudos
Message 3 of 7
(2,380 Views)
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:
  1. Your loop cannot read changes in the stop button, because the terminal is outside the loop.
  2. 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.
  3. The 10second wait runs in parallel to the event structure so the wait times will interact possibly in an unpredictable way.
  4. 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.
  5. Event structures don't react to programmatic value changes, so your even will never fire!
  6. 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 Kudos
Message 4 of 7
(2,375 Views)


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 Kudos
Message 5 of 7
(2,371 Views)
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 Kudos
Message 6 of 7
(2,365 Views)

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 Kudos
Message 7 of 7
(2,337 Views)