LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recording data from multiple instruments

Hello! 

 

At work we have a computer that inferfaces to an experimentation apparatus containing multiple instruments. There is a pressure transmitter (analog 4-20ma signal), 2 channel quadrature encoder, 6 axis force transducer with anolog differential voltages out and a digital flow controller instrument that is interfaced via an RS-232 serial adapter. 

 

There is an NI PCI express DAQ card that interfaces to each instrument except for the digital flow controller, which is connected via an RS-232 serial converter. We use LabVIEW to interface and record data from all these instruments. We run experiments and record data to a single text file, with each line containing a numerical value of each instrument seperated by spaces. At the beginning of the line we have the time in milliseconds. Heres an example of a line (actual line has numbers and no apostrophes):

 

'Time in MS' 'Value of Instrument A' 'Value of Instrument B' 'Value of Instrument C' 

 

The issue we had was getting the data from multiple instruments, particular instruments interfaced via the NI DAQ card and digital instrument running at its own sampling rate, to be sampled with under a common time base. 

 

The way we do it now is somewhat crude. We have a program that has all the data stored in variables that get updated in while loops with 1 ms delays. We then have another loop that iterates 100 times a second (100Hz sampling rate) and takes the current data from every instrument and the current time in milliseconds, and creates a string in the proper format and injects into a bigger string variable containing all the previous lines of data.

 

This means that all the timing is done via software, and we are limited to 100Hz. If we try to go faster than 100Hz the sampling breaks down, and the queues that we are using to pass the data through the loops get backed up. 

 

I'm currently trying to re-design the system to use a more proper way of sampling using general LabVIEW DAQ recording techniques. My question is how should is how should we incorportate the data recorded from the digital flow sensor? I'm at a loss as to finding a good way of injected the flow sensor data into the data sampled from the other instruments. The flow sensor only samples at around 60Hz or so, but it would be ok if we have lots of repetative data from the sensor appearing in each line. This whole deal with multiple sensors with different time-bases is making me scratch my head. 

 

Anyone have any ideas or suggestions of how I should go about this? In the end I still need to have the program output a text file with line by line of data each under a common time (the time doesn't have any kind of actual 'time'. Milliseconds from start is fine). I'm thinking of having multiple recording loops that record the data of the different instruments and in the do a sort of 'collation' of the data to massage into a common time-base. 

 

Thanks for any help!

-Paul

0 Kudos
Message 1 of 5
(2,453 Views)

So., you just want to be able to synchronize the data from 4 different cards? You have 3 devices that are sampled at the same rate (100 Hz) and one sampled at 60Hz. I dealt with sort of same problem, and I wrote my own data synchronisation routine. in your case though, I am not sure how critical the time stamp is. One way to do it would be, just resampling the higher frequency signal using 'Resample Waveforms' to match the rate of 60Hz by other sensor.

       



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 2 of 5
(2,442 Views)

@odessy27 wrote:

So., you just want to be able to synchronize the data from 4 different cards?


 

There are 4 instruments. 3 of the instruments are hooked up to 1 NI DAQ card and the other instrument is hooked up through serial. The serial instrument only samples at 60Hz, but the other instruments can be sampled as fast as I want. I want to sample at 200Hz or faster and just have lots of repeat data on the slow serial instrument, all with a synchronized time base.

0 Kudos
Message 3 of 5
(2,431 Views)

You can sample those three channels at 240 Samples/s and keep that one channel at 60Hz. Basically, you sampled other three channels 4 times as much as the last one. So you can retain your milisecond count and just write a small routine to repeat each sample form the 4th channel to repeat 4 times. (1 1 1 1 2 2 2 2 3 3 3 3)  you would ultimately match the number of samples and roughtly matching the timing event.

   I don't think you can synchronize the data very precisely unless you use one timing source and some king of common trigger. Having said that, the above method dhould work just fine.

 

-Nilesh



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
Message 4 of 5
(2,421 Views)

@odessy27 wrote:

You can sample those three channels at 240 Samples/s and keep that one channel at 60Hz. Basically, you sampled other three channels 4 times as much as the last one. So you can retain your milisecond count and just write a small routine to repeat each sample form the 4th channel to repeat 4 times. (1 1 1 1 2 2 2 2 3 3 3 3)  you would ultimately match the number of samples and roughtly matching the timing event.

   I don't think you can synchronize the data very precisely unless you use one timing source and some king of common trigger. Having said that, the above method dhould work just fine.

 

-Nilesh


Valid approach.

 

Another method would just save the data to sepearte temp files and after the test runs consolidate the files by inspecting the time stamps and repeating the sloower reading in the final output file.

 

While tests are running, if you use a Waveform Datat type, charts will handle the mixed sample rates automatically.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 5
(2,402 Views)