LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using data from Queue in parallel

I have a queue where i save my data. Whit this data i need to make some computation that need some time. I would like to make the computation in parallel way. The increase of the data is faster than the computation.

 

The idea is to send every single data in different part of the code so to make the computation in parallel.

 

I hope that everything is clear.

 

Thanks

0 Kudos
Message 1 of 6
(901 Views)

Each of your processing loops will need a dequeue of their own (and needs to be wired from the creation, not after the 1st loop) and then they'll dequeue an element and do the calculation to the best of their ability. The others will wait if there's no data in the queue.

Though, if one calculation cannot keep up, i doubt having 3 will solve that, but if it's a very serialized computation it might work.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 6
(891 Views)

A truncated picture cannot describe the problem, except that we can tell that you are in need for some basic tutorials about dataflow.

 

You have a toplevel loop and three inner "one iteration" while loop that are just glorified sequence frames where all three must complete their computations before the outer loop can go to the next iteration.

Your green local variable tells us that your boolean control probably has the wrong mechanical action.

 

If the processing is too slow, you cannot save time by complicating the code even more. Maybe you are using an inefficient algorithm implementation. Sometimes things can be rewritten to be orders of magnitude faster (in-placeness, parallelization, etc.). If you would show us your processing and what it is supposed to do, we can take a stab at it.

 

Even the saving can be optimized, depending on what you are currently doing.

 

Maybe you have the fast acquisition loop where you can write to two queues, one for the saving and one for the processing. Of course if the processing cannot keep up, you will eventually run out of memory. These consumer loops must be outside the main loop.

 

So please attach your entire (simplified) VI and explain what processing and timing is involved. A toplevel loop time of 500ms (as currently programmed) is eons for a computer.

 

0 Kudos
Message 3 of 6
(863 Views)

That exatly what i was thinking to do at the start. In this configuration i found that from the queue exit tha same data at the same time. I didn't manage to obtain different data. Only if i put some "Wait Until" I can see different data.

 

I was working at this example. I can't share all the code. In my project I have data from a scanner, this data need some calculation. The time of calculation change according the lenght of the object. After the calculation i send the data to the PLC but i must respect the initial order.

 

0 Kudos
Message 4 of 6
(819 Views)

Thank for the answer.

 

I can't share all the code. I thought I would explain my problem better with that example.

 

In my project I have data from a scanner, this data need some calculation. The time of calculation change according the lenght of the object. After the calculation i send the data to the PLC but i must respect the initial order.

 

We assume that the calculations are already optimized. It's not my job to check that part. 

 

Queue -> Data Calculation -> Send data To PLC.

 

I have to send the data to parallel SubVI that make calculation and send the data result in the same order of arrival.

 

 

 

 

 

 

0 Kudos
Message 5 of 6
(811 Views)

@DAVIDE_95 wrote:

Thank for the answer.

 

I can't share all the code. I thought I would explain my problem better with that example.

 

In my project I have data from a scanner, this data need some calculation. The time of calculation change according the lenght of the object. After the calculation i send the data to the PLC but i must respect the initial order.

 

We assume that the calculations are already optimized. It's not my job to check that part. 

 

Queue -> Data Calculation -> Send data To PLC.

 

I have to send the data to parallel SubVI that make calculation and send the data result in the same order of arrival.


Then you need some way to organize your calculations, right? Add a sequence number to the data as you queue it up and then check that before sending it to the PLC so you send it in order.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(768 Views)