LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to exchange data between loops?

why can't I exchange data between loops? it is esiest explained by looking at the attached example......... hope you can help me out!
0 Kudos
Message 1 of 14
(4,193 Views)

You forgot to attach your example!

The easiest way to exchange data between loops is to simply wire the data going in.  You can also use local variables.

0 Kudos
Message 2 of 14
(4,184 Views)

Many ways to do this.

1.  Locals : beware race conditions unless you use a one writer one (or many) readers. Also potential lost data due to no buffering.

2. Globals: Same issues as the Locals.

 

3. Queues - my prefered method.  solves many of the concurrency issues.

4.  Shared variables- newer technique, I hear this is a great method but I have not used it extensively.  Not avaliable in older LV versions.

 

5.  Other communication protocols- TCPIP, other message protocols ...

 

This should give you a quick list of where to start.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 3 of 14
(4,175 Views)
Falkpl covered all bases for parallel loops that both run at the same time. This was probably the spirit of the original question even without seeing the diagram. 🙂

@Steve.Briggs wrote:
The easiest way to exchange data between loops is to simply wire the data going in. 

A wire creates a data dependency between the two loops. Dataflow dictates that a diagram object will (1) start executing once all inputs contain data and (2) will only produce data on the outputs once the entire object has finished.

This means in practical terms that if there is a wire going from loop A (output tunnel) to loop B (input tunnel), Loop B must wait until loop A has finished. If you have wires going from loop A to B AND back from loop B to A you create a deadlock and broken code. You cannot "exchange" data between two parallel loops using wires.

Message 4 of 14
(4,152 Views)

He never really specified what he'd like. 

In essence, what is being transferred from loop A to loop B is still data.  It's the same principle of a local variable.  You can't just jump to loop B if the variable isn't defined.  Rather than including a variable which is defined in loop A into loop B, you can just wire the output from loop A into the input of loop B.  In most cases one can assume that what is inside of loop A would usually come before what is needed inside loop B or that the calculations/programming being done inside loop B contains information from loop A, not vice versa.

Message 5 of 14
(4,143 Views)


@Steve.Briggs wrote:
In essence, what is being transferred from loop A to loop B is still data

There is a fine line between "transfer" and "exchange". In my book, the word "exchange" would imply bidirectionality. 🙂 Transfer is typically unidirectional.

 

Message 6 of 14
(4,135 Views)
I'm in agreeance with your interpretation.  I intertwine my ways of "exchanging" and "transferring". I always tend to work unidirectionally, foward that is Smiley Wink
Message 7 of 14
(4,131 Views)
Thanks for you replies.... here is the original diagram...
0 Kudos
Message 8 of 14
(4,099 Views)
Hi Viller,

this is what you probably wanted to achieve 🙂
Please read the manual on the other mentioned ways of transferring/exchanging data between loops!

Message Edited by GerdW on 02-13-2007 10:16 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 14
(4,095 Views)
Thank you for all your answers! it has saved me a lot of time........
0 Kudos
Message 10 of 14
(4,084 Views)