From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Share Data between Reentrent Vis without using global variables

Dear Community,

I want to share data between Reentrent VIs without using global variables. The reason is, that I have read that the performance of the program getting bad by using global variables. My first Idea was to store the data in the functional global variable, but the data are not available in the clone, when the function calls itself.

 

Is it possible to share data between VIs without using global variables for this specific problem?

 

With kind regards

Sönke

0 Kudos
Message 1 of 11
(3,526 Views)

Notifiers?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 11
(3,524 Views)

I may have misunderstood you.  An example would help.  What I got was:

 

"How do I pass data recursively to each recursive instance?"  At which point, I wonder what is wrong with using the connector pane.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 11
(3,519 Views)

You can use a que to pass vi name and control refs. I use a que to put the references of controls for data I want to exchange data between each reentrant vi.  Just cluster the reentrant  vi name with an array of controls ref to pass data. If you leave data in the variant form it makes it easier when control types vary.

0 Kudos
Message 4 of 11
(3,503 Views)

Soenke wrote:  The reason is, that I have read that the performance of the program getting bad by using global variables.

I have plenty of benchmarks that say otherwise.

A Look At Race Conditions

 

Now the real question: what type of data are you updating?  Tags, in which you only care about the latest value whether or not it has been updated?  Messages, in which you expect whoever is listening to do something with the data when there is a change?  Streams, in which you expect the listener to do something with every single sample?


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 5 of 11
(3,491 Views)

Dear Crossrulz, ich store a Cluster Array where every element is made of a name and their Data. It is important that every VI that use this Data have a up to date Cluster array. I think the idea to call asynchronous a message queue to handle the data and get the data back by a notifier is a good idea.

0 Kudos
Message 6 of 11
(3,458 Views)

You can also use a Data Value Reference and all VI's will work on the same set of data.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 11
(3,455 Views)

@Soenke wrote:

Dear Crossrulz, ich store a Cluster Array where every element is made of a name and their Data. It is important that every VI that use this Data have a up to date Cluster array. I think the idea to call asynchronous a message queue to handle the data and get the data back by a notifier is a good idea.


Who is updating this Cluster Array?  All of the VIs that need the latest?  Just the main VI?  Or a more precise: one location updates the data or many places?

 

If these VIs are already using an Event Structure, I find User Events for useful for sending messages to multiple locations.


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 11
(3,427 Views)

Now every VI is able to Update the Data, but the Data flow is handled by a sequence of textbased script language. So I think only one VI per Time is able to Change the Value

0 Kudos
Message 9 of 11
(3,397 Views)

Dear all, I implement a Consumer Queue for Handling the Variables with creating notifiers to put the data back to the calling VI and start a long time performance test. The result is in the attachment. The performance is quite worse than before. I think one problem is that: first I reentrent call the VIs and second the Commands to my machines in this Application deals with a GPIB Bus. The next try is to avoid reentrent call and paralize processes with consumer queues. Is there another reason I don't see now?

0 Kudos
Message 10 of 11
(3,377 Views)