LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove data from a loop while loop is still processing

we are looking to have data continue to stream out of a loop while the loop is still continuing before it is stoped.
0 Kudos
Message 1 of 5
(3,274 Views)
This would be contradictory to dataflow.
 
If you need loop data elsewhere in the code while the loop is running, you have many possible solutions (queues, functional globals, locals variables, etc.). Please explain in a bit more details what you want to do. 🙂 Do you have processes running in parallel? Where should the loop data "flow" exactly?
0 Kudos
Message 2 of 5
(3,271 Views)

I have a DAQ gathering data.  We are aquiring voltage and desire all data above 2 volts.  We have our loop set up to continue to gather data until voltage drops below 2 volts.  Once voltage drops below 2 volts we want the program to stop.  All voltages above 2 volts durring this while loop need to be transfered out in order to be analized by other parts of our program such as a case structure to handle if between 2.1 and 2.2 to do Task A and if between 2.3 and 2.4 to do Task B.

currently we have tried to run just a wire out with numerical indicator however this data will collect but not release from the while loop until the loop is stoped.  upon which only 1 set of data is released.

we want continuous set of data released from the while loop begining at start point and until stop of loop.

0 Kudos
Message 3 of 5
(3,265 Views)
You are most likely getting unexpected results in your application due to the fact that you have wired the data out of your While loop. The way that dataflow works in LabVIEW is that no outputs are generated until the node has completed execution. Thus, the output tunnels of the While loop will not pass any data until the loop finishes its execution.

If you'd like to analyze or process your data while you are still acquiring, I would recommend using a queue in a producer / consumer design pattern. You will find a VI template in the File >> New menu that starts you off with a basic producer / consumer architecture. With this architecture you can pass the data from your data acquisition loop to either of your two processing tasks. I hope this information is useful for you. Good luck with your application!

Mike D.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 5
(3,236 Views)

Try using a state machine, with the "default" state constanly reading DAQ analog input.  In that same state, you write voltage sensing logic to take the program to other states that perform other tasks A and B.

Joey
-CLD

0 Kudos
Message 5 of 5
(3,233 Views)