LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice ... structured programming in LabVIEW?

Solved!
Go to solution

In structured programming, it is suggested to put the things that get changed a lot but don't transform the fundamental process of the software, the dials and gas pedals of the code, in a particular location with good annotation.

 

I'm not sure how to think about that with data-flow in LabVIEW.

 

Is it best to put the control adjacent to the code that consumes it, or to put it all on the left side in a box with annotation.  Aesthetically the latter might be more appealing, but it interferes with data-flow.  Is this thought of more like an electric circuit diagram where there are tabs to "ground" or "power" wherever it makes sense? 

 

What is the current best practice?

What motivates that as the best practice?

0 Kudos
Message 1 of 12
(3,826 Views)

Most of my VIs are pretty small, so I tend to have all of my control terminals all the way on the left and indicator terminals all the way on the right.  When the VI complexity gets large enough, I find it better to have the controls closer to the parts that actually use it.


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 2 of 12
(3,814 Views)

@crossrulz wrote:

Most of my VIs are pretty small, so I tend to have all of my control terminals all the way on the left and indicator terminals all the way on the right.  When the VI complexity gets large enough, I find it better to have the controls closer to the parts that actually use it.


Occasionally my VIs get "wide" and I have to do what you mentioned above.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 12
(3,809 Views)

Disclaimer: All imho, based on experience.

Data flow, readability including documentation, structure in first place, aesthetic - on the last, but it is dependent variable. If the program works and reads nice, it automatically looks nice. Example: abscense of spagetti wiring is good readability, it looks nice. 

 

In the calculation subVI it is fine to put all controls with wires on the left, all outputs on the right, data flow is not disturbed.

All controls in one box and property nodes / local variables in the program, it does not look good because it disturbs readability and performance.

0 Kudos
Message 4 of 12
(3,805 Views)
Solution
Accepted by topic author EngrStudent

For a great first swipe at good LabVIEW coding practices, the LabVIEW Style Book never goes out of style!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 12
(3,803 Views)

@bilko - can you provide reference for that book?  I have never heard of it.

0 Kudos
Message 6 of 12
(3,796 Views)

Alexander,

 

I have, previously, put all the variables into a cluster to un-spaghetti the code.  There is memory overhead, and you have to understand the cluster when working with variables.  It makes the code less maintainable.

 

-EngrStudent

0 Kudos
Message 7 of 12
(3,791 Views)
Solution
Accepted by topic author EngrStudent

@EngrStudent wrote:

@Bilko - can you provide reference for that book?  I have never heard of it.



I have it in a macro

 

You may find the style guide a useful resource to improve your code http://www.ni.com/pdf/manuals/321393d.pdf#labview_style_guide

 

 


"Should be" isn't "Is" -Jay
Message 8 of 12
(3,782 Views)

@JÞB wrote:
I have it in a macro

Jaw drops. Now I looked into settings and found macros.

 

If only I had anything useful to put there... hmm


GCentral
Message 9 of 12
(3,754 Views)

"The LabVIEW Style Book", by Peter Blume.  I recently saw Peter, who asked me how many time I'd read his book (at last count, it was 4, but since then, I've re-read it at least once more).  A wonderful book!

 

Bob Schor

Message 10 of 12
(3,742 Views)