LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tips for keeping a large VI clean

I have recently finished the largest VI I have created so far, however over the process of working with on it the wires have become quite a mess. I tried to keep the VI within the screen, but do to the amount of calculations, and icons to change there really isn't a way I can see that to be possible. I already have subVIs created for all of the calculations, it is more just the number of wires that are used to connect everything. Since it is at its current finished state I plan on creating a brand new VI and focus on keeping it organized as I copy it over, but was just hoping to get some pointers before I start to ensure it stays readable. 

0 Kudos
Message 1 of 7
(3,341 Views)

Without seeing your code there is not much advice beyond using sub-vi's and bundling wires.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(3,339 Views)

Typically, the rules are the same as for keeping a small VI clean. 😄

 

If you think you have too many wires, you are probably using scalars. Use higher data structures whenever possible (arrays, clusters, objects, etc.) and things will clear up nicely.

 

 

0 Kudos
Message 3 of 7
(3,332 Views)

Here is an example of using bundles and clusters to reduce the wires

 

In one of my programs I store all of the test parameters in one cluster (Test Cluster) and all of my instrument parameters in another (Instrument Cluster).

 

In this Sub-vi I load test parameters from a file into the Test Cluster using "Bundle by Name".

e1Capture.PNG

Now I can pass the one Test Cluster wire to all of my other Sub-VI's in my main loop instead of 9 individual wires.

 

e2Capture.PNG

Inside other Sub-VI's I use "Unbundle by Name" to get the values I need out of the Test Cluster.

e3Capture.PNG

 Notice these clusters have a black triangle in their upper left corner. This means they are Type-Def clusters. You need to learn how to create and use a Type-Def as it makes your life a lot easier during development. As when you need to add something to a cluster, if it is a type-def you only need to update the type-def and it will update every cluster in every sub-vi and every constant on your block diagram. 

 

This is what my Test Cluster type-def panel looks like to give you an idea of how many individual wires passing the cluster saves.

e5Capture.PNG

========================
=== Engineer Ambiguously ===
========================
Message 4 of 7
(3,303 Views)

Bundle seems to be the correct answer for sure. On the right was the original, and the left is my current progress. I still have a fair amount left, but it is already way better.

0 Kudos
Message 5 of 7
(3,263 Views)

Well that'll learn ya! 

 

It really helps to try to think of clustering things from the start. One of the first things I do now is type-def a cluster.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(3,253 Views)

Can you imagine the main wiring harness of a car being separate wires instead of being bundled?  Same idea.

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 7 of 7
(3,233 Views)