LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel loops or other architecture?

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

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 12
(3,391 Views)

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.



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 2 of 12
(3,377 Views)

@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.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 12
(3,372 Views)

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.



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 4 of 12
(3,370 Views)

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...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 12
(3,365 Views)

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!

0 Kudos
Message 6 of 12
(3,333 Views)

Here is an example application architecture that uses a prodcuer/consumer architecture.

 



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
Message 7 of 12
(3,324 Views)

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!


"I think therefore I am"
0 Kudos
Message 8 of 12
(3,171 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 12
(3,131 Views)
I don't want to use the teststand, I want to develop my owner software structure.

"I think therefore I am"
0 Kudos
Message 10 of 12
(3,127 Views)