LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Share data cluster between two loops?

Solved!
Go to solution

I realize it is friday afternoon, head not working so fast anymore.Smiley Frustrated

I have a fairly big data cluster (100k data points altogether) that I use in the main loop, keep it in shift registers, adding/changeing data over time.

 

Now I like to read some of that data also in another loop, but did not find a good solution up front. It feels like it is a schoolbook example, and therefore I thought someone more clever than me might see a good solution directly! Smiley Happy

0 Kudos
Message 1 of 10
(4,483 Views)

If you are running 2016, you might consider using channel wires.

0 Kudos
Message 2 of 10
(4,469 Views)
Solution
Accepted by topic author Ola_A

See here for a nugget I wrote on Action Engines.

 

If you are not familiar with them read that nugget and imagine moving your shift registers into a sub-VI that can be accessed from more than one loop.

 

It will cleanup your diagram a bit as well.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 10
(4,468 Views)

Functional global maybe? 

aputman
0 Kudos
Message 4 of 10
(4,467 Views)

Sorry, I am at labview 2015, and need to compile at LV2012 in the end...

0 Kudos
Message 5 of 10
(4,446 Views)
Solution
Accepted by topic author Ola_A

With the assumption that you are only updating the value in one place and your other processes just need to read the latest value (do not care when it updates), I give you 2 options:

1. Data Value Reference (DVR)

2. Global Variable

 

If you are dealing with a large amount of data (I would put 100k data points in that category), I would go with a Data Value Reference (DVR).


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 6 of 10
(4,417 Views)

Crossrulz, how would I code a Data Value Reference if I like to keep my shift register? The quick tests I just did suggested I need to make a new reference for each round in the main loop, and somehow transfer that reference to the other loop.

Ola

 

2017-05-02 13_51_58-Foton.png

This vi does not work at all...

0 Kudos
Message 7 of 10
(4,372 Views)

You need to create the DVR before both loops and pass the reference into the loops.


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
0 Kudos
Message 8 of 10
(4,366 Views)

I understand the simple example, and is there a way to use a similar approach to read data that is stored in a large shift register?

0 Kudos
Message 9 of 10
(4,358 Views)

@Ola_A wrote:

I understand the simple example, and is there a way to use a similar approach to read data that is stored in a large shift register?


Just make sure the data type of the DVR matches that of the shift register and it will work exactly the same way.


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 10 of 10
(4,341 Views)