> In LabVIEW 6 you can set a property node to Value, then read or write it.
> It seems to function like a local variable. Is there any real difference?
There are some subtle differences.
The property node allows the reading and writing of a single control within
a cluster whereas a local variable and terminal will always refer to the
entire cluster. A property node can update the value from a remote
location, not on the diagram associated with the panel. If you are using
a non-strict control reference, then the datatype of the value may be a
variant rather than the actual datatype of the control.
Because of these differences, there are also performance differences, some
good, and some bad.
If updating something like a graph, you would sometimes need to position
two cursors, change some colors, and write the data to the graph. In the
past this would require two nodes, one for attributes, and another (terminal
or local) for the value. This resulted in two graph redraws. Adding
the value
property to the existing node and not using the terminal or local will result
in one less graph redraw, which may or may not be important for your app.
On the otherhand, because they can update a subset of the data, property nodes
do not implement the same shortcuts that the locals and terminals do. When
updated with the same value over and over, a local and terminal will not redraw
the control, but the value property will. Additionally, for controls
that are
updated very quickly, more than 50 times a second, terminals and locals
have the
option to amortize the redisplays and save CPU cycles that would
otherwise be
spent redrawing things you wouldn't see anyway. There is the option to synchronize
the display with the diagram updates, and the value property is
basically stuck
using this synchronized version each time. This is identical to how controls
and indicators updated before LV5, and it is still how the displays are done
on single threaded systems like the Mac.
To see this, drop a for loop, wire i to an indicator and have the loop execute
1,000,000 times. Initially, update the indicator with the terminal.
Run the
program and it will take a fraction of a second. The indicator will
display 0,
a few numbers in between, then 999,999. Move the terminal out of the
loop and
update with a local. You will see the same. Now popup on the indicator and
choose synchronous display -- it is in the Advanced option in LV6. Now
you will
probably need to abort the VI because it will take several minutes to
run because
it is drawing every single number to the screen making a nice blur of
digits for
you to look at. Now delete the local and use a property node instead. Regardless
of the setting of the synchronous display, you will see the display is showing
each and every one of the updates.
One last difference. The fact that the value can be set from subVIs is
a cool
feature, but it will make your diagrams way more difficult to debug if
you make
a mistake. When a string or other indicator has the wrong value being displayed,
you need to find the code that did the update. If only using the
terminal, there
is only one place the indicator is updated, and you can work backwards
from the
terminal. If using locals, then you have a list of places to work
backwards from.
If you are passing the control reference to the indicator to some number
of subVIs,
then you can have many potential updaters, even dynamic ones to worry
about. So,
while this is a cool feature for modularizing code and separating it
from the display,
be careful or it will have debugging expenses that you may not want.
Greg McKaskle