LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exchange data between main VI and SubVI's

Solved!
Go to solution

 

   This is my first attempt at building a large program, and hope you can help me.

   The idea is to load a data set and perform several operations and calculations on them, ending up in building a report file.

   What i'm trying to accomplish is build a main VI that has the data, and several sub-vi's to do the calculation, dinamically loaded into a sub-panel (to keep the UI simple). I thought of this architecture because I'm pretty sure I'll have to evolve the calculation VI's, and I don't know how many I'll need, so I can just add another calc VI to the plugin dir and load it. The thing is, I have to keep moving data back and forth from the main VI to the sub-VI's, and maybe even between sub-vi's. Is there an easy (or not that hard) way to do it? I thought of queues, but sometimes data has to be sent to more than one sub-vi, and I can't have one queue for each. The idea I get is like a CAN network producer-consumer mode: the main VI produce some data and all the ones interested in that data consumes it. Then they send the results back (as a "producer") and all interested in the response consumes it.

 

   Attached is a "skeleton" of what I intend to do.  

0 Kudos
Message 1 of 8
(3,301 Views)

Hi Thiago,

 

You're along the right lines with the VI you have written, I found when first developing using subpanels that the NI example (which I have attached) provided the answers to some of the more challenging aspects of using subpanels. I am currently developing an application using subpanels for a customer which uses a state machine event structure combination which loads all the VI's using in the application into memory and just loads and unloads the UI into the subpanel. Have a look at the example attached and if your interested in seeing the other model I talked about let me know.

Regards

Andy
_______________________________________

"To 'G' and not to 'C', this is not a question!"
0 Kudos
Message 2 of 8
(3,274 Views)

Hi Thiago,

 

I think this architecture may be help you,

 

Queue State Machine - Producer Consumer

0 Kudos
Message 3 of 8
(3,264 Views)

 

    

   Taov,

   I'm used to the Queued state machines, and have already made a lot of programs using that architecture. The point that worries me is that the state machine "concentrates" the processing from several sources, and my program will not work like that - I'll have several points of processing, as well as the main VI, and have to control how the data is processed (I don't know, maybe several state machines? On the main VI and in some subvi's?)

 

   Andy,

   I've been through that example too. It helped me get to that skeleton I've shown, but I'm still stuck on how to control the multiple processing loops. If you may, I'd be really interested to see that model you talked about.

 

   My thanks!!

 

 

0 Kudos
Message 4 of 8
(3,228 Views)

Have you had a look at the blog regarding plugin architectures?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 8
(3,222 Views)

  I didn't knew that blog. Going through it, I found, some examples that used labview classes (and I don't know LVOOP yet). In further searches I found An Event based messageing framework for larger applications, working the same way I was thinking.   

 

  The only think now is that, in this code, it passes the event to the sub-vi's (so it can be registered) by wiring it to the sub-vi. Is there a way to register the event in the sub-vi without the wiring (so I can dynamically call it, without need to insert it in the main code)?

 

0 Kudos
Message 6 of 8
(3,190 Views)
Solution
Accepted by topic author Thiago_Caparelli

There are a few ways you can accomplish that. First, you can use the Start Asychronous Call which will provide a connector pane for you. Therefore it is easy to wire the reference to it. You could also implement a Functional Global (also known as an action engine) to access the event reference. This is the approach we use for our shared events. If you will have queues between the main VI and ths subVI you could format a specific message to pass the reference. HOwever I don't think this approach would fit what you are doing.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 8
(3,177 Views)

 The functional global worked like a charm. My thanks.

0 Kudos
Message 8 of 8
(3,155 Views)