LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to move data between parallel loops with different update frequency?

Solved!
Go to solution

Dear Labview users,

 

Hello. I am now working on transferring data between parallel loops.

 

The transfer is one-way direction, and the parallel loops have a different update frequency.

 

The data is transferred from loop with higher frequency to loop with lower frequency.

 

What is the best way to achieve it, with highest operation speed?

 

I really appreciate so much for your help.

 

Best regards

0 Kudos
Message 1 of 9
(5,149 Views)

Hi hkpark,

 

please define your "best" requirement…

 

Standard ways to transfer data between loops are queues and notifiers. Recently we got channels. For long time we have variables (local, global, network/shared). Some use functional globals aka action engines.

Pick your choice!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(5,145 Views)

 

Thank you so much for your reply.

 

I do not know about the following ways, but I've heard that the way through local variables is slow. So, I would like to ask about the way to use queue and notifiers.

0 Kudos
Message 3 of 9
(5,127 Views)

Hi hkpark,

 

I've heard that the way through local variables is slow.

Who said so? Any evidence?

Local variables are rather fast…

 

So, I would like to ask about the way to use queue and notifiers.

LabVIEW comes with a huge example library. There you will find example VIs explaining the usage of queues and notfiers!

Did you notice that "Training" section in the header of the LabVIEW board?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(5,121 Views)

Get Set (global functional is another way to go.

Benoit

Message 5 of 9
(5,115 Views)
Solution
Accepted by topic author hkpark93

Well, it depends. Do you want to keep all the values? In that case the queue is the best choice. Isn't it important? Just grab the last value which could be done with a Local/AE or similar.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 9
(5,113 Views)

@hkpark93 wrote:

The data is transferred from loop with higher frequency to loop with lower frequency.


Based on this statement, I am left to assume you only care about the latest value.  If that is the case, then I would just use a Global Variable.

And a shameless plug: Are Global Variables Truly Evil?


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 7 of 9
(5,072 Views)

As others have indicated, you have many options.  I like to use queues because of their scalability.  Even if I'm only interested in tag based communication (i.e. latest value), by implementing that as a queue with a value of 1 wired to the max queue size input, it becomes an easy edit later to switch to lossless / buffered data transfer if need be.  In your situation, where you have your data source executing faster than your data sink, you have the opportunity to reduce apparent noise in the data by enqueuing all of the data points, and then averaging or performing some other signal processing on the dequeued array of values in the slower loop to obtain a single representative value, as opposed to simply previewing or dequeuing the latest value.  This, of course, is only applicable if the additional latency doesn't matter.

 

For values that you are certain will only ever need to be tags, I like functional global variables, or a CVT.

 

Message 8 of 9
(5,058 Views)

Thank all of you for your kind answers. Based on what you have said, and through examples from LabVIEW, I was able to implement the desired function. Again, thank you so much.

Message 9 of 9
(5,025 Views)