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.
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.
03-23-2017 11:32 AM
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
03-23-2017 11:38 AM
Notifiers?
Ben
03-23-2017 11:58 AM
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.
03-23-2017 12:40 PM - edited 03-23-2017 12:50 PM
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.
03-23-2017 12:56 PM
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.
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?
03-24-2017 02:54 AM
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.
03-24-2017 03:01 AM
You can also use a Data Value Reference and all VI's will work on the same set of data.
/Y
03-24-2017 06:25 AM
@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.
03-27-2017 06:51 AM
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
03-28-2017 05:56 AM
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?