LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to make the wires disappear?

My program has grown pretty big and now there are wires everywere. I remember that I had that same problem when I used Logic Works and the way to fix it was to give names to the notes and then the whole thing would be "wireless". Is there anything like that in LabVIEW?
0 Kudos
Message 1 of 38
(5,642 Views)
Yes. They're called local variables and you shouldn't use them. (Veterans will get the joke.)
0 Kudos
Message 2 of 38
(5,620 Views)
The idea is that if you have to resort to things like hiding or removing wires, you have bigger problems than the wires. And shame on Logic Works for supporting you in maintaining bad habits!

Any programming language will let you create "spaghetti code" the difference is that with LV it really looks like spaghetti! The solution is to write code that is easy to read even with all the wires in place. There are a number of techniques that are supportive of this end - modularization, structured design, hierarchical organization of code, conformance with coding guidelines, etc - but the real key is to put the same level of professional effort into it that you would when performing your primary responsibilities (a.k.a. "your real job"). It's this level of care that separates software engineering from hacking.

Obviously this could very well mean that you have to learn some new skills. Well, so be it. This is a great place to learn the right way to create LV code, you have literally centuries of man-years of experience at your disposal.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 38
(5,614 Views)
Mike said

you have literally centuries of man-years of experience

Oh, sure, make us feel as old as we really are. Smiley Very Happy

0 Kudos
Message 4 of 38
(5,610 Views)
I once got a VI with a block diagram where the developer
(1) selected all block diagram objects
(2) aligned left
(3) aligned top
Result: No wire was visible.  (Almost as good as a password protection.)
Guenter
Message 5 of 38
(5,602 Views)
So where can I find more information about these techniques?
0 Kudos
Message 6 of 38
(5,589 Views)
Don't try to get rid of the wires.  That is bad programming.  Instead, make your vi shorter and simpler by using subvi's.  If your block diagram cannot be shown on one screen, it is too large.  Make it smaller by breaking it up into several subvi's, then call those subvi's in your block diagram.  There is no limit to the amount of levels of subvi's you can all.  The idea is to make each subvi as simple as possible.  Then use those simple subvi's as building blocks to create more complex programming.  This makes is far easier to troubleshoot and maintain.  Hiding wires will just make it worse when it comes time to debug.  Think about if someone else inherits your code, or if you have to come back and change it 2 years from now.  You don't want to open a mess of wires, and you don't want to open a vi that has its code hidden.
- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 38
(5,585 Views)
So what about if I want to make a sub VI with a feedback inside of it, how am I supposed to set an initializer?
0 Kudos
Message 8 of 38
(5,579 Views)
By feedback do you mean you need to retain values from a previous run to include in the present calculations? The way to do that in LV is with an uninitialized shift register. In terms of how to initialize that value the first time the code is run, there are many ways of doing that depending on what the code is doing and what the value is. There is a function that returns a boolean true the very first time the VI containing it runs. Sometimes you can look at the value itself and tell that it needs initialization. It all depends on the application.

To learn more, here is a link to a message where another contributor lists some good places to start learning. In addition you can spend some time googling some of the terms I listed earlier (functional decomposition and information hiding are a couple other good one). In particular look for papers written by a man named Dr David L Parnas, to get you started see the attached document.

The thing to remember is to come up with a good design first, because a good design is a good design regardless of what language you use to implement it. Good software - like a good bridge - is designed.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 38
(5,551 Views)

Hi,

Another way to reduce wires spread all over the place is to bundle groups of them into clusters. Use the Bundle block to wrap several wires into one and then use the Unbundle block to separate wires again. Bundle and Unbundle by name blocks make this easier.

As they said, using variables is not recommended if it is just to replace wires. Using variables consumes more memory and they can't be used to determine data flow or execution sequence like wires do.

Have a nice day,

Pablo Bernal

AE Mexico

Message Edited by Pablo Bernal on 07-24-2007 10:36 AM

0 Kudos
Message 10 of 38
(5,517 Views)