03-21-2016 04:37 AM
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:
Thanks in advance!
Etienne
PS: sorry I had to hide some code not my will...(licensed)
03-21-2016 05:13 AM
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.
03-21-2016 05:17 AM
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
03-21-2016 05:24 AM
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.
03-21-2016 05:35 AM - edited 03-21-2016 05:41 AM
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:
03-21-2016 05:45 AM
@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.
03-21-2016 05:52 AM
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 🙂
03-21-2016 06:28 AM
@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
03-21-2016 07:57 AM
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.