Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem on myRIO Analog Input for 50kS/s high speed sampling

Solved!
Go to solution

Hi all,

I have a problem when I want to use the +10V Analog input of myRIO1900 to sample a high speed valve displacement signal ( +10V Analog signal).

High speed sampling.jpg

I need the sample rate at least 50kS/s (20us time segment betwee two sample data). According to the myRIO specifications the Analog Input has an Aggregate sample rate at 500kS/s, which means that should be fast enough for me.

 

I used a timed loop in my code and set the timing source 1MHz, period 20us (which I need). However, in my LabVIEW code I can only get aroud 3ms (333kS/s) time segment (delta t) between two sample data, see attached .xls file, which comes from the 'write to measurement file' function. I'm not sure whether this is a problem of the data recording when I use the 'write to measurement file' function, since the time stamp (delta t) of the 'write to measurement file' is different from the time stamp (delta t) of the data which I export from the waveform chart. But I do need to use the 'write to measurement file' function to record the real time data.

 

So how can I figure out what sample rate exactly I get for the data? If not that fast how can I do it? Is the unit of time s or ms for the write to file data?

Attachments are my project file, the write to measurement file(.xls), and the exported data file (.xls) from the waveform chart.

 

I appreciat it very much if someone can give me some suggestion since I'm a beginner to myRIO and not that familiar with LabVIEW code. 

 

Thanks in advance.

 

Huan

0 Kudos
Message 1 of 9
(8,829 Views)

You don't have to abandon using the Write to Measurement File however I don't think it should be in your time critical loop. I would use a producer-consumer architecture (see here: http://www.ni.com/white-paper/3023/en/ ) to use a non-time critical/lower priority loop (or just a regular while loop) to handle the data logging to an .xls file. You can communicate data between loops through various methods however a regular queue should work for your application.

0 Kudos
Message 2 of 9
(8,812 Views)

Hi,

Sorry about my delay reply. Thanks very much for your advise.

 

I've tried the producer-consumer architechture. I used timed loop in the producer loop and tried both the while loop and timed loop for the consumer loop, while the results kept the same. I can still only get 10ms time difference between two sample data points, i.e. 100S/s sample rate. It's still far away from my requirment 50kS/s. And I noticed that the data from 'Write to Measurement File' and that exported from the Waveform Chart have the same sample rate.

High speed sampling-2.jpg

 

A new prolem is that the time column (X_Value) all became 0 in my .xls file from 'Write to Measurement File'. I can tell the time difference because my input analog signal is a periodic signal, which has a cycling period of 100ms. I got 10 points for each cycle so the sample rate is 10Samples/0.1sec=100S/s.

 

I've attached my project with producer-consumer architechture and the data file below. Would you please help to have a look at it and tell me what's the poblem? I appreciate it so much.

 

Thank you!

 

Huan

0 Kudos
Message 3 of 9
(8,785 Views)

Sorry I forgot to attach the project file. I will attach all the files again.

0 Kudos
Message 4 of 9
(8,779 Views)
Solution
Accepted by topic author huanbit

Since you are using a single sample analog input VI, you are essentially software timing your acquisition (which is in timed by your timed loop). This is adequate for lower sample rates, however since you are trying to acheive high sampling rates, you should be using the Analog Input Express VI . See here for more info why: http://zone.ni.com/reference/en-XX/help/373925C-01/myriohelp/myrio_one_sample_n_samples/

Message 5 of 9
(8,759 Views)