LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

choice of design pattern for data acquisition system

Solved!
Go to solution

Hello all

 

I have a trouble about selecting the suitable design pattern / architecture for a data acquisition system. 

Here is the details of the desired system:

 

There is data acquisition hardware and I need to use it by observing parameters on User interface. 

the data acquisiton period, channel list to scan should be chosen on User interface. Besides, there are many user interface interactions. e.g. if user selects a channel to add scanlist, then I need to enable and make visible some other parts on user interface. 

When user completes the channel selection, then he will press the button to start data acquisition. Then I also need to show the scanned values on a graph in real time and log them in txt file.

 

I know that I cannot use producer consumer pattern here. because the data acquisition loop should wait for parameters to scan channels. and it works in a given period by user. so the user interface loop performs higher rate then consumer loop (data acquisition loop). it means queue will be bigger bigger. if I use notifier it will loss some data come from user interface. 

 

is there any idea about that ? is there any suitable design pattern for this case ? 

 

Thanks in advance

best regards 

Veli BAYAR

Embedded Systems Software and Hardware Engineer 

"You live in a graphical world. Why not program in one?"
0 Kudos
Message 1 of 4
(4,287 Views)
Solution
Accepted by topic author VeliBayar

Veli,

 

I recommend the Producer/Consumer model with some modifications.

 

You might need three loops.  I cannot tell for sure from your brief description.

 

The User Interface loop responds to the user inputs for configuration and start/stop of acquisition.  The parameters and commands are passed to the Data Acquisition loop via a queue. In this loop is a state machine which has Idle, Configuration, Acquisition, and Shutdown states (and perhaps others). The data is sent to the Processing loop via a different queue. The Processing loop performs any data processing, displays the data to the user, and saves it to file. A notifier can be used to send the Stop or shutdown command from the User Interface loop to the other loops.  If the amount of processing is minimal and the file write times are not too long, the Processing loop functions might be able to occur in the Timeout case of the UI loop Event structure.  This simplifies things somewhat but is not as flexible when changes need to be made.

 

I am not sure that a Design Pattern for this exact setup exists but it is basically a combination of the Producer/Consumer (Events) and Producer/Consumer (Data) Design Patterns.

 

Lynn

0 Kudos
Message 2 of 4
(4,260 Views)

Thanks for sharing your idea. 

"You live in a graphical world. Why not program in one?"
0 Kudos
Message 3 of 4
(4,228 Views)

@johnsold wrote:

Veli,

 

I recommend the Producer/Consumer model with some modifications.

 

You might need three loops.  I cannot tell for sure from your brief description.

 

The User Interface loop responds to the user inputs for configuration and start/stop of acquisition.  The parameters and commands are passed to the Data Acquisition loop via a queue. In this loop is a state machine which has Idle, Configuration, Acquisition, and Shutdown states (and perhaps others). The data is sent to the Processing loop via a different queue. The Processing loop performs any data processing, displays the data to the user, and saves it to file. A notifier can be used to send the Stop or shutdown command from the User Interface loop to the other loops.  If the amount of processing is minimal and the file write times are not too long, the Processing loop functions might be able to occur in the Timeout case of the UI loop Event structure.  This simplifies things somewhat but is not as flexible when changes need to be made.

 

I am not sure that a Design Pattern for this exact setup exists but it is basically a combination of the Producer/Consumer (Events) and Producer/Consumer (Data) Design Patterns.

 

Lynn


 

Check out this thread: http://forums.ni.com/t5/LabVIEW/Multiple-poll-case-structures-to-event-help/td-p/2551309

 

There are discussions there about a 3-loop architecture that may help you.

 

Jeff

Jeffrey Zola
0 Kudos
Message 4 of 4
(4,214 Views)