11-21-2011 03:17 PM - edited 11-21-2011 03:23 PM
I have a basic but yet not so basic architecture question. I have a program that right now has three parallel loops running each has a state machine inside. Two of the loops are pretty much just taking measurements with very little decision making. The third loop is a semicomplex test program that runs units through a series of functional tests.
What I have run into is the block diagram has become rather large and I can't help but think that there must be a better way to do this. The biggest problem I am having is I am using a tab control and I need the current operating conditions "tab" to be constantly updated while other tests are being run and their output is charted on other tabs. I am a fan of functional global and have been using them a lot lately. I use them in this program extensively
I attached a very simplified example of what my program architecture looks like
11-21-2011 03:35 PM
Consider separting teh UI from the processing tasks. Make your processing/data collection tasks into subVIs which do not have any links to the user interface. Rather use queues/notifiers/user events to send updates to a separate task that manages the user interface. This offers a clean, maintainable architecture that allows you to change the look and feel of the user interfaces without having to modify your processing tasks. Once you put direct updates into your processing tasks you have reduced your ability to reuse code and limit yourself since the UI and processing components are tightly coupled.
11-21-2011 03:43 PM
@Mark Yedinak wrote:
Consider separting teh UI from the processing tasks. Make your processing/data collection tasks into subVIs which do not have any links to the user interface. Rather use queues/notifiers/user events to send updates to a separate task that manages the user interface. This offers a clean, maintainable architecture that allows you to change the look and feel of the user interfaces without having to modify your processing tasks. Once you put direct updates into your processing tasks you have reduced your ability to reuse code and limit yourself since the UI and processing components are tightly coupled.
Your suggestion makes sense but I do not understand how to implement it. I have thought of putting the data collection in to a sub-vi but I do not know how to continually update the user interface from a sub-vi.
11-21-2011 03:47 PM
As I mentioned your UI task will wait on a queue, notifier or user event to get the update from the data collection task. When data is read it will get posted to the UI task for updating. It is also possible that your UI does not need to update the display with every piece of data. A user will not be able to see difference of 10000 updates per second versus 1000 updates per second. Remember, a HD movie is generally only running about 30 frames per second.
11-21-2011 03:56 PM
Okay, can you point me to some examples please?
I have only used queues to the extent of the queued state machine.
I looked at the producer consumer architecture several times but do not understand how it works or how to implement that architecture into a real world program.
As for events, I know even less about events as I do queues...
11-22-2011 04:05 PM
Hi RTSLVU,
Perhaps this article may be of use to you. Although it covers the queued state machine architecture which you have used before, Figure 3 introduces the queued state machine producer consumer loop architecture, which should be helpful for your particular application. Also, if you have not already seen this NI community post regarding queued state machines with user input, it may be of some use as well. Hope this information helps you in getting started!
11-22-2011 04:19 PM
Here is an example application architecture that uses a prodcuer/consumer architecture.
08-20-2014 09:52 PM
it is really a good example and it is helpful.
I am working on a project that will using parallel test structure, it will include instrument control, error handle, database, device control, and of course with a UI. Do you have any suggestion about how to implement this sofeware architecture for multi-device test and UI display?
your response is highly appreciated!
08-21-2014 06:34 AM
@ELI2011 wrote:
it is really a good example and it is helpful.
I am working on a project that will using parallel test structure, it will include instrument control, error handle, database, device control, and of course with a UI. Do you have any suggestion about how to implement this sofeware architecture for multi-device test and UI display?
your response is highly appreciated!
Sounds like a job for TestStand.
08-21-2014 06:39 AM