05-08-2006 01:14 PM
Hi,
I’m using LabView 8.0. I have some software running on a PXI and a GUI running on a PC with Windows XP. The GUI is mainly use for the setup of the real-time application and the display of the results. For example, I have multiple PID loops in the real-time application (these PID are in subVIs called in the critical time loop). On the GUI, one can change the P, the I and the D parameters.
Now, I want to know the more efficient way to manage memory and the speed of the RT application:
1) Using shared variables all the way, including in the critical time loop.
2) Use the shared variables, but put them in local controls on the real-time machine, and pass them to subVIs through control connections.
3) Use the shared variables, but put them in global variables on the real-time machine, and use these global variables in the subVIs.
4) Any other way?
Thank you very much
alex b.
05-09-2006 11:51 AM
Hi Alex,
Check out the following for some ideas on Memory Management in LabVIEW RT. Also check out the Last link on using the LabVIEW Shared Variable. This will give you some good information and benchmarks on using the Shared Variable.
Memory Management in LabVIEW Real-Time
http://zone.ni.com/devzone/conceptd.nsf/webmain/4DB571A3513C859C862568EB0075A635
Managing Memory in LabVIEW
http://zone.ni.com/devzone/devzone.nsf/webcategories/D0A775F79852010F862567AC00583FA7?opendocument
Using the LabVIEW Shared Variable
http://zone.ni.com/devzone/conceptd.nsf/webmain/5b4c3cc1b2ad10ba862570f2007569ef
Regards,
Steven
05-09-2006 01:07 PM
Hi Steven,
Thank you for the information. These were great readings. It appears that I should not use the network-published variables in my time critical loop. And based on the benchmarks, I should transfer them to global variables (better than single process shared variables).
I still have an interrogation about the last option I listed, as I did not find the answer. They stated in the documentation that we should avoid as possible the usage of local or global variables in a time critical loop. If it is not possible (to avoid them), is it better to:
1) use directly a global variable in a subVI called in the loop.
2) add a control input to this subVI and to link a local variable to this new input.
Thank you very much
alex
05-09-2006 01:47 PM
Add to the list....
A "Functional Global" (LV2 global) configured as a sub-routine.
This will give you the option to select "Skip if busy" for the instance inside the TC loop.
Trying to help,
Ben
05-11-2006 01:05 PM
Alex,
Ben is correct. If you can't avoid using Global Variables using a Functional Global will give you better determinism. This is because using global variables in time-critical priority VIs in LabVIEW Real-Time can compromise determinism because a global variable is a shared resource. If one piece of code accesses a global variable, no other piece of code can access the global variable until the first piece releases the global variable. When you block the access of a time-critical VI to a global variable, forcing the time-critical VI to wait, you introduce jitter to the application and compromise the determinism of the application. You can avoid this behavior by using a Functional Global, setting it to subroutine priority, and selecting the Skip Subroutine Call if Busy option for it. With a Functional Global, the time-critical VI does not have to access the global if another section of code is already using the global. You avoid the delays caused by accessing standard global variables.
Hope that helps explain a little better,
Regards,
Steven