LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Aquisition using several devices

Hello,

 

I have several devices that I need to read using RS232. The results should be stored in an measurement file. The measurment is around 15 minutes long.

 

I did the following:

 

Several while loops in parallel. Lets say loop 1, loop 2 and loop 3 read the RS232 and generate data.

Loop 4 is reading the data, merge the data (merge signals) and write everything into a measument file.

For the communication between Loop 1,2,3 and loop 4 I use local variables.

 

In that way:

 

- a slow loop gets read several times (same value) which is all right.

- a fast loop gets read and may loose some values. Not nice but acceptable.

 

Has anybody a better idea how to implement something like that? Thanks you so much for reading.

 

Cheers,

 

 

0 Kudos
Message 1 of 8
(4,109 Views)

You should take a look at queues.  They're meant to handle the desired task more than local variables. 

Message 2 of 8
(4,081 Views)

Hi,

 

Don't use local variables. If you don't want to lose data, and don't want to read data twice, the best suggestion I have is to use queues. Look at the Producer/Consumer Design Pattern (Data) from File->New...->VI->From Template->Frameworks->Design Patterns. You can easily have a number of producers as shown in the snippet. You can also get more information here.

 

Good luck,

Danielle

 

 

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
Message 3 of 8
(4,071 Views)

Combining data from multiple loops can be interesting, especially if they all run at different rates.  You should use a single queue to send the data to your file write loop.  The data type of the queue should be a cluster of a string and a number (or array of number).  The string can tell you what the data is and you can react accordingly from there.


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 4 of 8
(4,046 Views)

Sorry for the late reply.

 

Thank you for all your tips. I will look into the queue suggestion.

 

Thanks.

0 Kudos
Message 5 of 8
(4,028 Views)

What crossrulz wrote, would work nice. I would go in this way on:

 

in every data producer loop you can insert the measurement data into a cluster, and a label describing the source for example. Beside, generate a local timestamp, and put it also into the cluster.

In your file write loop where you dequeue your data from all of your parallel loops, use a TDMS file data management. Here you have several options. I would create two channels for each producer loop: first column (you see it this way if you import it to Excel) time stamp1, second column data1, third column time stamp2, fourth data2, and so on...

 

In this way you will have a TDMS file including all your data and every single data value has an exact time stamp. No loss of info... Since TDMS is binary, you can develope pretty fast data evaluator in Labview to do whatever you want with your measurement data...

 

 

0 Kudos
Message 6 of 8
(4,012 Views)

The TDMS file format is an excellent idea.  Just make a different group for each acquisition loop.  Then you don't have to worry about all of the synchronization and what not.


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 7 of 8
(3,977 Views)

@crossrulz wrote:

The TDMS file format is an excellent idea.  Just make a different group for each acquisition loop.  Then you don't have to worry about all of the synchronization and what not.


 

yep, this way better: use a separate group for each DAQ loop, and in each group make two channels: one for the time stamp, the other for the data.

0 Kudos
Message 8 of 8
(3,974 Views)