LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Notifiers vs Globals.

I have just upgraded from LabVIEW 6i to 7. I see that the notifiers now support different data types. Is passing data using notifiers more efficient / faster than using global variables?

For example my program uses PID control to test electric motors. It basically has two subVIs running in parallel - a PID control loop and a display loop. The PID control loop contains a for loop that gets data and does the PID control calculations and output. The for loop builds up an array of 30 data points that is written to a global variable and then an occurrence is set.

The data display loop waits on the occurrence before reading the global array, processing, averaging and displaying the data. Thus the display loop only runs when new data is put in the gl
obal array as signaled by the occurrence. The advantage of building the data into an array as that I could update the UI and graphs less frequently, which improved performance.

I could replace the global variables with notifiers easily when I update the program.
0 Kudos
Message 1 of 3
(3,284 Views)
If I understand correctly, you want the first VI to nitify the second one if the data have changed. To realize that efficiently, use Notifiers. With Notifiers, you don't have to inquire and compare the data to see if they have changed. It is somewhat like Events. However if you use Globals, you only solve the problem of sharing data. They just faithfully report the current data without telling you if they have changed.
0 Kudos
Message 2 of 3
(3,284 Views)
To be more precise the global in the PID loop was inside a sequence structure. At the end of the PID for loop I passed the data to the global that is inside a sequence structure. The next part of my diagram to execute is the Set Occurrence function. My data display loop had a Wait on Occurrence that waited until the occurrence was set which is just after the global is written. So this way I did not have to continually read and compare the global to see if it had changed.

The Occurrence function is basically a notifier that transfers no data.

With LabVIEW 6i notifiers could only pass strings. Rather than converting the numeric array to a string and back I used globals. Now with LV7 notifiers can be any datatype, so I could change the globals and occurr
ence to a notifier.

Thanks for your response.
0 Kudos
Message 3 of 3
(3,284 Views)