05-16-2017 09:26 AM
I have several numeric values that I want to pass to the main front panel VI but the issue is it is buried within 3 other subVIs. I don't want to pass them between each subVI, especially since in the end I'll have 24 to pass. Is there a nice way to jump straight to the front panel instead of having to go through each subVI?
05-16-2017 09:36 AM
There are several ways to do it, depending on your architecture.
05-16-2017 09:43 AM
You said you have 24 values to pass. Are they all passed together? Grouping them in a Cluster simplifies the "passing" logic.
Another question to ask is if this is a "push" (the data "shows up" on the Top Level VI without the TLVI "asking for it" or a "pull" (the Top Level VI asks "What's the Current Value of this variable?"). If you are "pushing", passing an array of references to the sub-VI lets it "do the work" without the TLVI even noticing. Alternatively, User Events or a Queue (with the TLVI "waiting" for a new Element, which takes no CPU time) are things to consider. If "pulling", I often use the Functional Global (a.k.a. a VIG, VI Global).
Bob Schor
05-16-2017 09:49 AM
In this gallery I have a collection of screen shots that show how I have used what I call a GUI controller.
Clicking on those images will show you a larger version (example can be found here )
Below each image you will find a link to the discussions where those images were originally used.
Those image and discussion may be helpful.
Ben
05-16-2017 01:27 PM
@Bob_Schor wrote:
You said you have 24 values to pass. Are they all passed together? Grouping them in a Cluster simplifies the "passing" logic.
Another question to ask is if this is a "push" (the data "shows up" on the Top Level VI without the TLVI "asking for it" or a "pull" (the Top Level VI asks "What's the Current Value of this variable?"). If you are "pushing", passing an array of references to the sub-VI lets it "do the work" without the TLVI even noticing. Alternatively, User Events or a Queue (with the TLVI "waiting" for a new Element, which takes no CPU time) are things to consider. If "pulling", I often use the Functional Global (a.k.a. a VIG, VI Global).
Bob Schor
They are not passed all at once, but one right after another in a sequential order. I think technically this is pulling in your example. The user pushes a button on the main GUI and that causes some response with an external circuit, then values are read from that circuit and reported back to the front panel. I am thinking about using a functional global, I am just not sure how to actually pass the data from the functional global VI to the main VI. It doesn't update on the front panel.
05-16-2017 01:33 PM
Using the FGV, in order for the front panel to update, you need a separate, parallel loop that is continually checking the FGV. Otherwise the loop that has the subVI in it will be holding waiting for the lower level subVI's to finish executing.
You could also use queues or user events to pass messages to the higher level VI. Of course you'll still need something in parallel to the loop running the subVI.