11-27-2012 11:12 AM
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.
Solved! Go to Solution.
11-28-2012 03:05 AM
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.
11-28-2012 03:51 AM
11-29-2012 03:28 PM
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!!
11-29-2012 04:04 PM
Have you had a look at the blog regarding plugin architectures?
12-03-2012 12:10 PM
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)?
12-03-2012 02:01 PM
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.
12-04-2012 04:51 PM
The functional global worked like a charm. My thanks.