LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data streaming tutorial

Could somebody please suggest a basic tutorial on saving data gathered via a NI-9205 module in a cRIO-9074 chassis or alternatively a simple vi that could be modified.

 

best regards,

nos

0 Kudos
Message 1 of 12
(4,644 Views)

Hi,

 

I have also attached a VI which I wrote which writes to a text file, to use it just replace the random number generators with the modules.

 

I hope this helps.

Mike W
Applications Engineer
National Instruments UK&Ireland
0 Kudos
Message 2 of 12
(4,610 Views)

Mike,

Thank you for your help. When I have gone through the items that you sent I will post a further reply.

 

Best regards,

nos

0 Kudos
Message 3 of 12
(4,587 Views)

Mike,

I have modified save to file.vi , see attached files, to read values from one of the system analog input modules but unfortunately the signal that is displayed and saved is not as it should be. The input signal is a 1 Hz 0.4V pk-pk sinewave and the input module is channel 0 from a 16 bit NI-9205. As shown in the attached file, project explorer & front panel.JPG, the signal displayed is not a 1 Hz sinewave.

 

The displayed signal seems to have roughly four discrete levels whereas it seems to me that it should have ~1300, ie (2 ^ 16 / 20) * 0.4 = 1310 digits.

 

I have also attached the project file and the associated vi.

 

Any suggestions that you may have would be much appreciated.

 

Best regards,

nos

0 Kudos
Message 4 of 12
(4,538 Views)

Hi Nos,

 

 Since you are using a 9205 I'm wondering why you don't change the input range of the module. This module has input ranges from +/- 200mV up to +/- 10V. In your calculation I saw you used the 10V input range? Maybe you could try to use the input range of +/- 1V. This would give you a much higher accuracy:

 

(2 ^ 16 / 2) * 0.4 = 13.107

 

You can adjust the input voltage range via the project window by selecting the 9205, clicking on properties and then select the requested input range.

 

Hope this will give you a hand!

 

Best regards,

 

Peter S

 

0 Kudos
Message 5 of 12
(4,523 Views)

Peter,

Thank you for your response.

 

I have made the change that you suggested but the display remains the same, see the attached file +_- 1 Volt range.jpg.

 

The reason that I left the range at +/- 10V is that when the signal is digitised using 16 bits a relatively small signal of 0.4V pk-pk should still represent ~1300 digits,  ie (2 ^ 16 / 20) * 0.4 = 1310 digits, which is far more than the four levels that are shown on the chart.

 

Best regards,

nos

0 Kudos
Message 6 of 12
(4,511 Views)

I think your problem is your loop rate is effectively lowering your sampling bandwidth.

 

Your loop is set for 1 kHz, but you are reading just one value and a time and writing that immediately to the file.  The file write operations can't run as fast as 1 kHz because you are at the mercy of the operating system.

 

Try reading in larger chunks, and look at producer/consumer architecture to put the file writing in a separate loop.

 

 

0 Kudos
Message 7 of 12
(4,505 Views)

Thank you for your response.

 

When the input signal is reduced to a frequency of 0.1Hz and the sampling rate changed to 10Hz a sinewave is now displayed on the chart, see attached file, which seems to confirm your comments on the loop rate lowering the bandwidth. Is there a convention for establishing the effective bandwidth or can it only be found experimentally?

 

Finally, could you please explain what you mean by "...producer/consumer architecture..."?

 

Best regards,

nos

0 Kudos
Message 8 of 12
(4,475 Views)

Hi Nos,

 

What you're talking about is the Nyquist Theorem, which means you have to sample the signal at least twice as fast as the signal itself to reproduce it. But with twice the frequency you will not get a nice fluent sine, therefore it is recommended to multiply the frequency by 5 (or even better with 10), and use the result as the sample frequency.

 

 

You can find examples of different Design Patterns like the producer/consumer loop in LabVIEW. Just browse to your menu:

file \\ new...

 

Now you open de following path:

VI \\ From Template \\ Frameworks \\ Design Patterns \\

 

In this subfolder you find all kinds of Design Pattern Examples, also for the Producer/Consumer loop. With the Producer/Consumer loop you seperate the signal acquisition/control tasks and the signal processing tasks.

 

A tutorial on Producer/Consumer loops you can find here.

 

Hope this will help you.

 

Best regards,

 

Peter S

0 Kudos
Message 9 of 12
(4,452 Views)

Peter,

Thank you for your response.

 

My query was not directed at the Nyquist Theorum as the initial setup more than met those requirements, ie a 1Hz signal sampled at intervals of 10msecs; the query related to how the overall system bandwidth can be established. Can this only be established experimentally?

 

Best regards,

nos

0 Kudos
Message 10 of 12
(4,427 Views)