01-07-2011 06:24 PM
I have a lab view application I want to convert to event structure. The application has eight tabs and each tab has about 25 controls; overall that will be about 200 events. Can event structure handle this many events? I don't think I can use producer/consumer design pattern. I will appreciate any idea & suggestions out there.
01-07-2011 06:58 PM
You responded to a nearly five year old thread but that's good - it shows you are at least doing a search before asking.
I am sure that you can have 200 events in a structure. But you might want to plan it and reconsider doing that. You could probably group your 25 or so controls into a cluster or two. Then you only need an event for those clusters and you are down to eight or sixteen event cases. It is also possible for a single event case to handle multiple events.
Without knowing more details I can not really give you any advice other than to plan ahead. When you get your plan in place then start by prototyping. Modify your plans based on what you learn from that. Once you have a good architecture in place then throw away your prototype. Yes that's right - ditch all your hard work and start over. It is just a prototype and should be treated as such. You will be working from a solid architectural document and the coding will be very straight forward.
01-07-2011 08:17 PM
You cannot convert a LabVIEW application to an event structure, but you could refactor an existing application so it uses an event structure. I guess that's what you mean. 😉
You don't give enough information to provide specific advice, but most likely you need many fewer event cases than you think. Remember that event cases can be triggerd by more than one control. Often controls don't need to fire an event, because their value will only be relevant when a different control changes.
As has been said already above, a better organization of the controls is a key for code improvement and simplification. Instead of scattering scalar controls everywhere, use higher structures, such as arrays, clusters, or arrays of clusters, etc.
How is the application architected right now?
Why your comment about producer/consumer? That is an entirely different topic. I don't see the relevance with respect to events.
01-08-2011 12:28 PM
Thanks for the response SteveChandler. Please can you show me an example of how to use cluster with event structure?
01-08-2011 12:36 PM
Thanks altenbach. Here is a simplified version of currect architecture. The intent is to start over with a better achitecture, the current one has grown too big and we still have more functionality to add. Since we are already using event structure the thinking is why not do everything based on event structure that way we can convert some repeated tasks into subvi and re-use. I mention producer/consumer because earlier in the thread some one mentioned using it for event structure.
01-08-2011 01:31 PM
Well, there's not much there, but yes, I agree that most user interaction should be handled in the event structure. There is no need to spin the loop just to poll the controls in the case structure.
Most likely you no longer need the case structure and you can leave the tab terminal disconnected. If an even associated to a control fires, the tab must be on that certain page, no need to read the tab terminal.
Do you even need the timeout case? (Does anything need to happen automatically at regular intervals?)
01-09-2011 10:00 AM
I am on my laptop and it doesn't have LabVIEW on it so I can't do an cexample. But it is basically the same as creating an event for any control. When you create your event case you can select an event for all items in the cluster or an element of the cluster.
If you create an event for all items then the value node in the event structure will be a variant data type. But you can just put the cluster terminal in the structure and work with it as normal.
01-11-2011 12:20 AM
Thanks guys, I think have I figure out an architecture that works for my application.