From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Local variable vs property node.

Solved!
Go to solution

Dear all,

I want a clarification regarding Local variable and property node. Which one is better to use in VIs and in what cases. 

In the following link it is mentioned that local variables are faster than property nodes.
So whether I have to use property nodes instead of local variable? Please clarify

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LXrSAM&l=en-IN

 

I have attached a sample VI.

 

If sequence is used proprty node loop takes some milliseconds. But  if I am wiring error through the cases, property node used loop also executes in 0 milliseconds. Please give a clarification.

 

Regards

Rakesh G

0 Kudos
Message 1 of 3
(3,628 Views)

If you can NOT use local variable, don't use it.
If you can use local variable instead of property node, use local variable.
PN can be used inside of subVI or when you work with references. Also PN helpful for "Value(signaling)" property.
I can't open your vi (LV18), but if PN works normally, it works, and if you wire error into (any) function, this function do nothing, in this case ti need zero-time for execute.

Message 2 of 3
(3,620 Views)
Solution
Accepted by topic author rakesh@labview

1. Most of the times I see Local Variables and/or Property Nodes used, they can be replaced with a Shift Register.  In other words, USE A WIRE WHENEVER POSSIBLE.  That will give you the best performance.

 

2. If you must set the control/indicator via another loop, you might want to consider using an User Event to tell the primary GUI loop to update the value (with the terminal).  This makes things a lot more extendable and reusable.  I use this method instead of the Value(signaling) property.

 

3. My one time I have found the using of a Property Node to set a value is better than a Local Variable is when I am already messing around with other properties of said control/indicator.  You can drag the PN so that you can get/set multiple properties.  And since you are already getting the thread swap penalty, you might as well just add the Value to the list instead of making yet another node.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 3
(3,588 Views)