05-24-2018 09:11 AM - edited 05-24-2018 09:13 AM
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.
05-24-2018 09:12 AM - edited 05-24-2018 09:16 AM
Without seeing your code there is not much advice beyond using sub-vi's and bundling wires.
05-24-2018 09:18 AM
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.
05-24-2018 10:16 AM - edited 05-24-2018 10:45 AM
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".
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.
Inside other Sub-VI's I use "Unbundle by Name" to get the values I need out of the Test Cluster.
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.
05-24-2018 01:33 PM
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.
05-24-2018 02:13 PM
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.
05-24-2018 04:15 PM
Can you imagine the main wiring harness of a car being separate wires instead of being bundled? Same idea.