LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple copies of functional global using vi references

Solved!
Go to solution

I have several producers aquiring data into a functional global (one functional global per producer). These functional globals are identical except for the name. Would it work to have only one functional global VI and obtain a separate reference for each producer? The matching consumer would also use the proper reference to consume the data.

 

The functional global contains an array of the data which must be parsed by the consumer. It is possible that the array of data may not contain a complete set of data on a single "store" operation by the producer. The consumer, of course is written to check for a complete data record before completing processing on the record.

 

0 Kudos
Message 1 of 6
(2,930 Views)

That sounds like your architecture needs some help.  How does the consumer know to look at the FGV?  Why not just send the array of data with the queue?  Then you might not need the FGVs.  They could just be simple subVIs that your producers use.


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 2 of 6
(2,923 Views)

Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.


___________________
Try to take over the world!
0 Kudos
Message 3 of 6
(2,909 Views)

@tst wrote:

Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.


I thought a reentrant vi would not maintain the state of the uninitialized shift register from one call to the next.

 

I do agree that queueing the data would be better.

0 Kudos
Message 4 of 6
(2,899 Views)
Solution
Accepted by topic author Les__Bartel

@Les__Bartel wrote:

@tst wrote:

Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.


I thought a reentrant vi would not maintain the state of the uninitialized shift register from one call to the next.

 


A reentrant VI will maintain the state of its uninitialized shift registers.  However, you need to be really careful how you do this.  First of all, you need to make sure it is set to Preallocate Clones.  What will happen in this situation is that each different place you call that subVI will each be a different clone.  This means that each call will have its own data.  The problem with this is that you can't share the data across multiple instances and therefore multiple loops.  If you don't believe me, go play with the Mean Point By Point VI.

 

So what happens if you set it to shared clones?  A big freakin' mess.  You will have no control over which clone will be called where and there will be some major data corruption.

 

This is why FGVs are almost always non-reentrant.


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 6
(2,895 Views)

 


tst wrote:

Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.


This came up in a past conversation.  The use of references looks like this:

 

Reentrant+Action+Engine+v3.png

 

0 Kudos
Message 6 of 6
(2,876 Views)