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.
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.
01-21-2019 03:14 AM
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
Solved! Go to Solution.
01-21-2019 03:39 AM - edited 01-21-2019 03:40 AM
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.
01-21-2019 06:01 AM
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.