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: 

Labview good practice and computation time

Hi guys!

I have two question for labview users. I'm quite new to this language, I would like to know if design like in the picture attached (extensive use of disable diagram structure) are:

  • a good practice to separate part of code (I like the structure input/computation/output)
  • does not imply extra computation time

exemple_labview.png

Thanks in advance!

Etienne

PS: sorry I had to hide some code not my will...(licensed)

0 Kudos
Message 1 of 9
(3,825 Views)

One of NI's big sales sayings was "Read, Analyze, Present".  It looks like you are just following that paradigm.  There is nothing wrong with that setup at all.

 

Now the diagram disable structures themselves could be disallowing optimizations that the compiler can do.  If you really want to split things up, use subVIs.


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
0 Kudos
Message 2 of 9
(3,810 Views)

A Disable structure is generelly used to _disable_ code, such as testing out versions or optimizing functions without throwing away the old code.

If you just want to mark the code, it'd be better to use a Decoration. Better yet is, as already mentioned, a SubVI, which'll automatically group and mark the code.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 9
(3,806 Views)

Yeah, there was a forum post recently saying that using diagram disable structures are not the same as the code if you removed the disable structure. I would imagine though that it probably won't have a huge impact (i.e. only noticeable if you were to use it in a tight loop etc.) or it might only have an impact if you have debugging turned on.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 9
(3,802 Views)

First, thank you all for theses fast and relevant answer.

Regarding the paradigm, sounds good to me.

For the disable structure, maybe it's not optimized. Since I'm in tight loops I might look for something else to be sure.
Only things is, the advantage of the disable structure is that if I want to move/change/auto-reorganize thing, I'm sure the part, say input for exemple, won't be touch while I change the other thing...
At least that what drove my choice, but again I'm new to it.

For subVI's, I have to say I'm not comfortable with having thousands block, I love modular programming, but here it's application specific with very few times to develop. VI's are time consuming....
Therefore another question:

  • Is there a possibility to fix element to the grid, like lock, thus auto-cleanup won't change evrything ?
0 Kudos
Message 5 of 9
(3,792 Views)

@EtienneHo wrote:

For subVI's, I have to say I'm not comfortable with having thousands block, I love modular programming, but here it's application specific with very few times to develop. VI's are time consuming....


No they aren't.  They are simple to put together and will make up any time it takes to make it when you have to start editing a month or two down the road.  Plus, you would be surprised how much code you could reuse from project to project.


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
0 Kudos
Message 6 of 9
(3,782 Views)

I'm not a labview programmer but I'm a programmer and I definetly know about reusing code.
But the thing here is that, I just use labview for one specific job, anyway, I do not doubt about time consuming, reuse and other eternal programmer question, when you are used to labview.

I was just looking for good advice to make my revision of the code a bit better 🙂


0 Kudos
Message 7 of 9
(3,776 Views)

@EtienneHo wrote:

For subVI's, I have to say I'm not comfortable with having thousands block, I love modular programming, but here it's application specific with very few times to develop. VI's are time consuming....


Nah:

- Select the Input blocks

- Edit menu -> Create SubVI.

- Give it a simple icon (I typically just draw a filled box and then add the name in the text fields if i'm in a hurry).

- Profit. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 9
(3,749 Views)

Ok didn't know about, definetly worth it for some blocks! I was confusing with simple VI for the discussion
But cannot be use for everything, I think the mix between subVI's and block (comment or decoration) sounds good.

I'll try to evaluate the computation time with disable blocks and without, but ain't got much time so meanwhile if someone got ressources don't hesitate to post.

Message 9 of 9
(3,722 Views)