LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issues using control references in Analog control loop?

My main vi of a tensile tester control application calls a number of sub-vi's, including a analog control loop which controls the test. The control loop must update some boolean and digital indicators and respond to user input on the front panel of the main vi during a test.

To simplify my main vi, I moved the control loop code into a sub-vi, and used control references to access the controls and indicators on the front panel. However, this has dramatically affected my loop performance, and the loop can no longer keep up with the acquisition speed.

Do control references always cause such a slowdown? Is there anything that I can do besides moving the code back into the main vi?


Thank You,
David Creech
0 Kudos
Message 1 of 5
(2,859 Views)
I have had the same problem. I have discovered other funny things about references also; some kind of memory management (or mismamagement?) is taking place behind the scenes.

Regardless, you can often do away with the references by passing the initial state of a control or indicator into the subvi, changing it inside, and passing the altered state back to the caller. Once back in the caller you update the front panel control or indicator by using a local variable.

One thing to watch out for if using this scenario is the dreaded race condition; this can be avoided using a state machine. Check out

http://www.advmeas.com/goodies/statemachine.html

for a good example. It is a shame that references behave in this way; it limits thier usefulness.

Perhaps someo
ne else will point out a way to utilize them more sucessfully?
0 Kudos
Message 2 of 5
(2,859 Views)
I too have seen the mismanagement of references too! I developed a small program using the GOOP model to try to understand and implement it. The GOOP model uses a lot of references and during development I was often stopping the program before its natural end (as we all do in development) and after a while Windows informed me I had no more memory left. This did not bother me as much as the fact that just closing the development enviroment did not take care of the problem. I had to re-boot to really free up the memory. It makes me uncomfortable, I would like to know more about references and how Labview handles them.

NI, any input?

Jared
0 Kudos
Message 3 of 5
(2,859 Views)
From NI Technical Support:

"Thank you for contacting National Instruments. We are aware of the decrease in performance with control references to the value property. There is significant overhead behind the scenes for control references and the only way to avoid the performance hit is not to use the references in this manner. The feature was added to add functionality for front panel controls and unfortunately the developers didn't expect that everyone would want to use the value property. I apologize for the inconvenience."
0 Kudos
Message 4 of 5
(2,859 Views)
Right now in one of my GOOP objects I pass a control reference. Is it more efficient to have the UI set a data memeber through a method call and use the Get Data method in my loop?
0 Kudos
Message 5 of 5
(2,859 Views)