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,238 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,221 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,194 Views)

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

0 Kudos
Message 4 of 9
(8,188 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,168 Views)

Hi Johnnyg17,

 

Thank you very much for your suggestion. Somehow I didn't install the myRIO High Throughput Add-on Toolkit when I first received the myRIO and installed the LabVIEW myRIO 2015 software package. Now I install that toolkit and the problem is solved.

But now there comes another problem for my application. I hope I can get some information if someone has ever met this kind of problem before.

 

I noticed that there is only one high speed analog input(n sample) channel on myRIO: A/AI0(N Samples)(Pin 3). It's for 0-5V analog input. While my laser sensor output signal is -10V—+10V or 4-20mA. I tried to purchase an Analog signal Transmitter/Converter which can convert it into 0-5V but I found most suppliers don't have a converter with such high sample rate (50kS/s) or say low response time (20us). Most of them can only reach 10ms response time.

So did anyone ever use this kind of  high speed Analog signal Transmitter/Converter products from NI or other suppliers  which can deal with that problem?

Or is there a way to configure the Analog input(n sample) of myRIO to make it available for +-10V input (0-10V is also OK), for example can we do something to make it possible to assign the high speed Analog input(n sample) channel onto the ±10V AI channels on the MSP Connector C of myRIO?

 

Thanks.

0 Kudos
Message 6 of 9
(8,140 Views)

Good to hear!

0 Kudos
Message 7 of 9
(8,136 Views)

I would use the MSP Connector C. The only difference in wiring is that it is for a differential input and not single ended. Here's a good article on analog wiring considerations which may shed some light on how to wire the differential input: http://www.ni.com/white-paper/3344/en/

Message 8 of 9
(8,106 Views)

Hi Johnnyg17,

 

Thank you for your explanation about the differential input and single ended input. That's helpful.

 

Actually my problem is that for Analog input in N Sample mode, the myRIO can only allow us to assign the input on AI0 channel on connector A, while AI0 can only take 0-5V analog input. I can not use Analog input in N Sample mode on the ±10V AI  channels on MSP Connector C. Only 1 sample mode can be used on them. Which is to say I will lose the high sample rate if I use the ±10V AI  channels.

 

However, luckly yesterday I found there is a current channel of my sensor which can give a 4-20mA current signal. So right now I'm trying using a 250om load resister to get a 1-5V signal, and thus I can use the AI0 channel for N Sample mode on the connector A of myRIO I think.

 

Thank you so much for your continuous support, it really helped me a lot.

 

Huan

 

0 Kudos
Message 9 of 9
(8,101 Views)