01-20-2011 02:08 PM
I am building an application that has an Engine and a GUI. I chose to use JKI's states machine for the Engine's architecture, there are many functions built into this Engine and it consists of over 100 states, possibly closer to 150. Previously this state machine just resided on the block diagram of the GUI and this worked out great because there are many controls on the front panel that I created events for. This application is used for many projects. I started running into major headaches and tedious editing when I would branch off from the main Application development and tweak both the GUI and maybe add some states to the Engine to meet the specific projects needs (these changes were only applicable to the specific projects). Now all this is good and fine so far, but then maybe I discovered a great feature to add to the application that I knew would be beneficial to all the projects going forward and maybe beneficial even for some projects that have already been branched off but are still being used in parallel. So now this is where the trouble starts: I add the beneficial features to the Engine of the project that I am currently working on (by adding states to the state machine). But now I want to get these enhancements to the main Application trunk development and possibly to other projects that have already been branched off. Now this is a major project, because I can't just copy the Engine in it's entirety because it has an Event structure that is tied to controls on the GUI's front panel. So I have to create the same cases in each and every projects Engine, copy the code to each and every one. But sometimes this enhancement may consist of 10 cases! Thats not all, sometimes there are controls from the front panel that need to be added too. Maybe this new feature involves adding events to handle as well. And of course I need to update the data structure that is used to initialize all of the state machines data.... You can probably begin to understand my frustration. So I have realized that I need to keep the common code separate from the project specific code. I am planning on making the Engine a subVI, and it can access all of the controls it needs via references and can register for events that will be common to all projects via references as well. So I will place this Engine subVI on the block diagram of the GUI vi. So there will be an event case inside of the Engine that will handle events that are integral to the application no matter what project it is used for, and then I will also have an event case on the block diagram of the GUI vi to handle events that can be specific to the particular project. Is there some "common practice" way to have the GUI and the Engine running separately and in parallel instead of always having to come up out of the Engine VI to see if there are any project specific events generated in the GUI VI? I will also have to be able to transfer data between the two VIs. I am sure I can build something to make it work but I am just not sure if there is some proven method for doing this type of thing.. Thanks for any help
01-20-2011 02:27 PM
I'd use VI Server to start the engine as a separate parallell process. Data can be transferred through an Action Engine, queue or events. Make sure it listens to some Exit event so it'll close nicely whan you stop the main program (and dont forget to generate the event).
It's a good challenge ahead of you, but fun when it works. 🙂
/Y
01-20-2011 02:42 PM
@amaglio wrote:
I am building an application that has an Engine and a GUI. I chose to use JKI's states machine for the Engine's architecture, there are many functions built into this Engine and it consists of over 100 states, possibly closer to 150. Previously this state machine just resided on the block diagram of the GUI and this worked out great because there are many controls on the front panel that I created events for. This application is used for many projects. I started running into major headaches and tedious editing when I would branch off from the main Application development and tweak both the GUI and maybe add some states to the Engine to meet the specific projects needs (these changes were only applicable to the specific projects). Now all this is good and fine so far, but then maybe I discovered a great feature to add to the application that I knew would be beneficial to all the projects going forward and maybe beneficial even for some projects that have already been branched off but are still being used in parallel. So now this is where the trouble starts: I add the beneficial features to the Engine of the project that I am currently working on (by adding states to the state machine). But now I want to get these enhancements to the main Application trunk development and possibly to other projects that have already been branched off. Now this is a major project, because I can't just copy the Engine in it's entirety because it has an Event structure that is tied to controls on the GUI's front panel. So I have to create the same cases in each and every projects Engine, copy the code to each and every one. But sometimes this enhancement may consist of 10 cases! Thats not all, sometimes there are controls from the front panel that need to be added too. Maybe this new feature involves adding events to handle as well. And of course I need to update the data structure that is used to initialize all of the state machines data.... You can probably begin to understand my frustration. So I have realized that I need to keep the common code separate from the project specific code. I am planning on making the Engine a subVI, and it can access all of the controls it needs via references and can register for events that will be common to all projects via references as well. So I will place this Engine subVI on the block diagram of the GUI vi. So there will be an event case inside of the Engine that will handle events that are integral to the application no matter what project it is used for, and then I will also have an event case on the block diagram of the GUI vi to handle events that can be specific to the particular project. Is there some "common practice" way to have the GUI and the Engine running separately and in parallel instead of always having to come up out of the Engine VI to see if there are any project specific events generated in the GUI VI? I will also have to be able to transfer data between the two VIs. I am sure I can build something to make it work but I am just not sure if there is some proven method for doing this type of thing.. Thanks for any help
That pretty well describes what I found when attempting to help a customers "fix" an applcation developed using that type of architecture.
What should be sub-VIs (hint: sub-VI are re-usable ) are implemented as cases that don't easily transport to another app.
I will not boar you with a bunch of images but I invite you to browse through the images in my Image Gallery to see images of how I put together large apps.
You may also want to serach for "Ton Nugget dynamic event" to learn how to register and un-register for events. I use those to keep my sub-VI claen and only looking at what is active.
Ben
01-20-2011 03:34 PM - edited 01-20-2011 03:35 PM
@Ben wrote:
...I will not boar you...
Ben
01-22-2011 08:46 AM
Hey Ben, thanks for you input. Where are you pics located? Are they just the pics that can be navigated to by checking out your profile?
01-22-2011 09:19 AM
Yes, if you click on Bens name you can see his image gallery of his profile.
/Y