11-01-2018 04:18 PM
Hello,
In fact, I have a vi that works on labview which consists of acquiring data thanks to a register placed on the big while loop and in the same loop, data is also processed(spectrum, display..). Now I have to separate both (acquisition and processing). I would like to put each one in a while loop and link them by the flow of data that I acquired. The problem is that the second one does need the data from the first while loop to be lunched. I had the idea to add flat sequence or even a cadenced loop but the problems are still not solved. So to sum up, the main problem is that the acquisition should stay in the while loop and the data should be transmitted to the second which retrieve it from lunching. The idea of putting the all in a flat sequence with two steps and put it in a while loop is to be banned because I need to keep.the acquisition in a whil loop.
Can you please give your suggestions. Its too urgent. Thank you.
Yasmine
Solved! Go to Solution.
11-01-2018 04:30 PM
Look at queues, channel wires, and user events to share data among loop. There are examples in the Example Finder. I would recommend channel wires for this task.
mcduff
11-01-2018 06:03 PM
What you are describing has been called the Producer-Consumer Design Pattern. You have two independent loops, running in parallel. One, the Producer, "produces" data at some rate (say, from a continuous DAQ input giving you an array of points every second). The other, the "Consumer", acts on this data and "consumes" it (plots it, writes it to disk, does an FFT, etc.).
You need a method of getting the data from the Producer to the Consumer that "bypasses" the concept of Data Flow, letting the loops run independently. Queues are the classical structure for doing this. If you have LabVIEW 2016 or later, you can also use a Stream Channel Wire (basically a more mnemonic metaphor for a Queue).
If you open LabVIEW, click File, New ..., and choose "From Templates", there are two examples of Producer/Consumer Design Pattern Templates that you can study.
Bob Schor
11-02-2018 08:11 AM
I know I'm a little late, but here is a decent article on the solution you need: Producer/Consumer
11-03-2018 02:46 AM
I thank you all for your suggestions. In fact, I have Labview 2016, so I do have the stream option and I used it. I saw the probs and data is actually transported from the first while to the second as I want but the problem is that my VI is aiming to work continuously which means that the memory should not be full. Now, this is the problem I have. Actually they told me that the memory is full because of the link I made between the loops. May be this is due to the type I used (stream), what type should I choose ? (tag, stream...). If with all those types I will absolutely have this problem what should I do to manage the problem. Then I had a question about how to empty the buffer memory in general because as the system is conceived as a demonstrator ( real time) the flow of data and their processing will absolutely cause this problem. Can you please give me your suggestions.
Yasmine
I do not know how to empty the memory continuously
11-03-2018 02:47 AM
Hello mcduff,
Many thanks.
Yasmine
11-03-2018 02:48 AM
Hello Bob_Schor,
Many thanks. Your response was so complete and detailed.
Yasmine
11-03-2018 04:13 AM
Hello crossrulz,
Many thanks, I posted another problem.
Yasmine
11-03-2018 04:13 AM
Hello,
I posted another problem.
Yasmine
11-03-2018 11:46 AM
@Yasmine13579 wrote:
I posted another problem.
You did? This is the only one showing up in the LabVIEW Forum. Has it been "solved"? You haven't marked any of the responses as the Solution (doing so helps other Forum users who might have a similiar problem/question to know they can "find the solution").
Bob Schor