09-05-2018 01:56 AM
Hi,
I have always learned that using global variables in software engineering is not the right method. So I am going to do a task where I need to communicate between different VIs. So can you please help me by telling me what is the alternate method to communicate between VIs if using global variables is wrong. Thanking You.
Govind Sankar Nair
Student Master of Science
University of Applied Sciences Darmstadt
Solved! Go to Solution.
09-05-2018 02:41 AM - edited 09-05-2018 02:41 AM
09-05-2018 03:01 AM
I need to share data between VIs. So using notifier, queues, channels etc, I can do that? Please kindly do reply. Thanking You.
09-05-2018 03:23 AM
@govindsankar
Yes. Data can be passed from two different VI's using either notifier, queues, channels etc while still following LV dataflow. You can search for examples to see how those method works.
09-05-2018 04:10 AM
Thank You very much for your kind reply, I will do as you have explained.
09-05-2018 04:50 AM - edited 09-05-2018 04:51 AM
the main problem are race conditions for the read-write-access.
you have also the option of wrapping the global access with a semaphore
or use a data value reference (DVR).
in most cases a queue / channel is the way to go for communicating between loops as the others have suggested.
regards
09-05-2018 06:29 AM
@GerdW wrote:
Notifier, queues, channels, events, ...
Assuming Govind isn't asking about how to get data from 1 VI to Another in the normal circumstance, in which case direct wiring through the connector pane is the answer. 🙂
/Y
09-05-2018 06:36 AM
@govindsankar wrote: I have always learned that using global variables in software engineering is not the right method.
There is a time and place...Are Global Variables Truly Evil?
09-05-2018 08:36 AM - edited 09-05-2018 08:36 AM
No, I am talking about different VIs in a project, one VI acquiring the data and another VI needs to work on it. So the first VI should have data in some kind of memory for the second VI to access. This is where my doubt is, I am currently going through queues to find out how this can be done. If anyone has any access to any material that will help me in doing the same, it would be very helpful. Thanking You.
09-05-2018 09:09 AM
@govindsankar wrote:
No, I am talking about different VIs in a project, one VI acquiring the data and another VI needs to work on it. So the first VI should have data in some kind of memory for the second VI to access. This is where my doubt is, I am currently going through queues to find out how this can be done. If anyone has any access to any material that will help me in doing the same, it would be very helpful. Thanking You.
Yes, depending on how fast collecting and analysing data is, you can either use the easy Connector pane out from data gathering, to Connector pane in of the analysing VI, i.e. normal dataflow.
The 2nd most common option is to look at the "Queue based Producer/Consumer" example and send all data collected to a queue, and have an analysis queue.
/Y