LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Execution of VIs in LabVIEW

Solved!
Go to solution

Hi,

     I want to parallely execute 3 VIs simultaneously.  I have used a global variable to trigger event in 3 VIs. But the input from 1st VI is used as the ouput for 2nd one. So the 2nd VI is waiting for 1st VI to complete. How to overcome this problem? The input is an array variable. I want ot execute the 2nd VI for each row updation of array from 1st VI.

Please give a solution

0 Kudos
Message 1 of 20
(4,839 Views)

Hi rakesh,

 

But the input from 1st VI is used as the ouput for 2nd one. So the 2nd VI is waiting for 1st VI to complete. How to overcome this problem? The input is an array variable. I want ot execute the 2nd VI for each row updation of array from 1st VI.

To let the 2nd VI execute AFTER the 1st VI you should use DATAFLOW by wires!

When you really want to execute them in parallel but still have 2nd wait for 1st you should use a queue (producer-consumer scheme)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 20
(4,836 Views)

I want to run three VIs in parallel. One VI will generate a set of data (say 1 row of 2D array in each iteration). The 2nd VI will do some processing  in the first row and calculate result and update the data structure.. The third VI has to display this and log to a text file. 3rd VI will then wait for 2nd row to update. The three VIs has to run parallel. 

Please tell a solution for the above problem ?? . Also which data structure I have to use for sharing data between VIs?Thanks in advance

0 Kudos
Message 3 of 20
(4,822 Views)

Hi rakesh,

 

what's your reason to start a new thread for the same topic - after you got an answer?

 

Please tell a solution for the above problem ??

Use a producer-consumer scheme.

 

The three VIs has to run parallel. 

Why do they need to run in parallel when they have to wait for each other???

 

Also which data structure I have to use for sharing data between VIs?

Data structure depends on your data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 20
(4,817 Views)

rakesh@labview wrote:

Please tell a solution for the above problem ??


Definitely look at the Producer/Consumer.  The idea is to use queues to send the data from one loop to the next.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 20
(4,786 Views)

Ok. thanks.

How can I share data between two VIs other than global variable?.

Producer consumer means through queue message handler?

 

 

0 Kudos
Message 6 of 20
(4,783 Views)

My data generation is in one VI and processing is in another VI. So how can I exchange data using message queues?

0 Kudos
Message 7 of 20
(4,780 Views)

did you have a look at the link for the producer-consumer pattern?

did it answer your question?

have you tried to implement the pattern in your own VI?

do you have problems? do you have code to show your problem?


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 8 of 20
(4,775 Views)

Thanks for the reply.Yes I have.

But the problem is I have to use two VIs. One will generate data in loop and another Vi has to get this data and do some processing and display to the main GUI. For the literature and NI template I got a single VI for production nad consumption. How to implement it in two VIs. Please help

 

0 Kudos
Message 9 of 20
(4,767 Views)

Hi rakesh,

 

implement a producer-consumer scheme.

LabVIEW comes with ready-to-use example projects, (atleast) one of them shows a typical producer-consumer setup!

 

What have you tried? Where are you stuck? What is your problem?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 20
(4,762 Views)