LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVIs, globals, and references

Ok, looking for some guidance on this one.  I have a VI that is taking in temperature and vibe data then displaying them in scrolling graphs.  Here's where I need help.  The VI splits out into 4 SubVIs (XYZ axis and temp) and each SubVI contains 12 SubVIs, so 48 SubVIs within 4 SubVIs within a VI.  I want to indicate my sample size once on the front panel, but the data needs to reach each of the 48 SubVIs and I'm avoiding excessive wiring.  I've been looking into using a reference, global variable, or functional global, and right now the global variable is the only one I have working.  I'm worried about what's going on with memory though, and a reference seems preferred, but it's not working yet and I want to be sure the reference can be passed down before I continue to try.  So tell me, which method would be best?  If I use a reference, which functions will be needed?  I should add that it is a single input at the start of running the VI and it does not need to be updated after that.  Thanks for any help I can get.
0 Kudos
Message 1 of 6
(3,193 Views)
Hi cwaz,

you should stick to the wiring method as long as possible. This allows for easy determination of dataflow and thus program order! You should also wire the error cluster...
When you want to avoid many wires you can use a cluster for your settings data.

Question: Are your 48 subvis all unique or are they the same (atleast for some of them)?
When the all take the same input data you should also use the same connector pattern (using 4x2x2x4 as written in StyleGuide)...


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(3,184 Views)

Not a suggested solution to a time critical application, or one where you have extremely limited resources, but:

There is a method in an Invoke node called "Ctrl Val.Get" that can be used when you wire a reference to a VI (your main VI) to it and giving the EXACT name of the control. In my experience this is a fast and easy method.... but moderately advanced.

0 Kudos
Message 3 of 6
(3,176 Views)
Thanks for the advice.  I knew the wiring solution was the obvious one, and I was trying to avoid it, but I'll take your advice.  Every sub-subvi (guess that's a good name for them) is exactly identical in structure, but they each receive a different element from an array that is indexed just prior.  I would love to just process the array, but it has caused issues with the graph display (it's a special smooth scrolling graph logic I received from another programmer, and I can't afford to lose its functionality). 
 
If I had been smart and included the needed wiring ahead of time, it could have been replicated with little effort (woops).  It is for that reason and my focus on simplifying the VI that I wanted to reduce wiring.  I am actually simplifying a previous VI development.  The previous one tooks many hours to adapt to different aircraft.  This new version will allow me to edit the VI in a matter of minutes, plus it's easier for a coworker to pick it up and understand/edit it.  
 
Anyway, thanks for the advice.  And I did use the same connector pane for each sub-subvi, and there are open spots for additional inputs.
0 Kudos
Message 4 of 6
(3,169 Views)
Hmm, maybe I'll look into the invoke node method briefly before I start.  Couldn't hurt to look.  Thanks.
0 Kudos
Message 5 of 6
(3,164 Views)
Could you post your code, there might be a better way to structure the overall analysis that would make things easier.

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