LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it ok to use value property nodes?

Solved!
Go to solution

To remove spaghetti issues, I need to remove lines.

 

Previously, I used local variables, but values written to local variables may not be retrieved in timely manner.

 

So I started using value property nodes instead.

 

Are they safe as substitutes for lines?

0 Kudos
Message 1 of 3
(2,641 Views)
If your code is so badly written that you resort to locals or property nodes, then it probably does matter which you use. Properly used, either is fine but property nodes are much slower. Better would be an architecture that uses wires as much as possible. I guarantee that if you were to post your code, you would get numerous recomendations on to eliminate most or even all of the locals.
Message 2 of 3
(2,629 Views)
Solution
Accepted by iCat

 


@iCat wrote:

To remove spaghetti issues, I need to remove lines.


LabVIEW has wires, not lines. What do you mean by "need to". Wo is forcing you?? 😮

 

Does the program work correctly?

 

So you have nice, clean and narrow 1D elements (wires) and you want to replace them with larger 2D elements (local variables, value property nodes) that overall take up significantly more diagram area?

Because you are now also removing hard data dependencies, you probably need to add sequence structures, to keep race conditions in check. This will clutter the diagram even more! Why do you think this is the solution to your problems??? 😮

 

Basically, you are replacing spaghetti with something even worse, e.g. the contents of the dumpsters behind an italian restaurant after a busy night. 😄


iCat wrote:

Previously, I used local variables, but values written to local variables may not be retrieved in timely manner.


What is your definition of "timely manner"? The use of property nodes and local variables will NOT speed up your code. In fact it will make it slower. As mentioned, race conditions might actually retrieve stale values before they have been updated to current values elsewhere, so "timely" could easily turn into  "too early".

If you have performance problems, you don't want to chop up the code and fragment it even more.


iCat wrote:

So I started using value property nodes instead.


They have exactly the same problem as local variable, but are more demanding on resources. What was possibly your thought process?


@iCat wrote:

Are they safe as substitutes for lines?


Again, LabVIEW does not have "lines", except in the decoration palette. Local variables and property nodes make the code significantly less safe, because they makes it significantly more difficult to find and avoid race conditions. They also make debugging almost impossible.

 

You might want to start from scratch with an established design pattern and well structured, hierarchical code.

 

If you still think there are too many wires, consider using clusters and arrays. A single cluster wire can substitute for dozens of scalar wires. A multidimensional array can carry millions of data points in a single wire. You get the point!

 

It is difficult to give more targeted advice without actually seeing some of your code. Feel free to attach it so we can give much more specific comments. There are many examples here in the forum where we were able to cut code down to 10% of the original size while making it faster and cleaner at the same time while even adding extra features. All without the need of local variables and property nodes. 😄

 

 

 

Message 3 of 3
(2,609 Views)