Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

ni 9213 multichannel slow sampling rate

I try to collect 10TC temperature using NI9213

 

my code is attached which is generated from DAQ assistant

The problems is sampling rate is pretty slow (7 s per sample)

 

I do not know what is wrong with my code.

Is there anybody helping me out?

 

Download All
0 Kudos
Message 1 of 13
(4,891 Views)

Hello,

 

In your SubVI, the AutoZero Mode array is set to "Every Sample" for every channel but the first.  This can be a time consuming operation to complete every iteration.  You may try changing them all to "once" to see if you get an increase in read performance.

 

More importantly though, the "Rate" input to the DAQmx Timing VI is set to 1 sample per second per channel.  If you  change each element to say 10, you will see a marked increase in speed.

 

Regards,

National Instruments
0 Kudos
Message 2 of 13
(4,869 Views)

Thank you. Let me try 

 

0 Kudos
Message 3 of 13
(4,867 Views)

I tried the method you told, It did work, Thanks

Right now I have new questions, 1. How can I write 10 channel waveform date with time information (first column) in the txt file?

I knew if I split waveform data array then get Y component from each waveform data, and create one additional time column, and then build array to write to file. Because I have many channels, I am not sure if I have other simple methods. I directly write waveform data array to txt. Unfortunately, data does not include time information.

 

2. I hope the x axis of waveform chart which is used to display 10 channel Temperature data , can start from time=0s to record data, I have no idea how to get it.

 

Thanks for your help 

0 Kudos
Message 4 of 13
(4,855 Views)

Here is one option that is simple to program and uses a binary file format (TDMS) which can me imported in Microsoft Excel.  This will also include timestamp information along with your data.

 

http://digital.ni.com/public.nsf/allkb/68806B93A21355E98625726F0064822B?OpenDocument

National Instruments
0 Kudos
Message 5 of 13
(4,836 Views)

I will try, Right now I work out the solution , the code is like this . The question is why t0 is always 0. But I checked the data file, which show the time value , 3431730243.592s...I am confused...

 

Could you give me some advice for my code?

If I want to log data for long time, is it good using this code?

Thanks

 

N 9213.png

0 Kudos
Message 6 of 13
(4,829 Views)

Hello

I used write to measurement file, It showed me error 2515(I used NI 9213, continuous mode , 1channel N sample)

 

0 Kudos
Message 7 of 13
(4,823 Views)

Finally I got it. Write to file works.

 

0 Kudos
Message 8 of 13
(4,800 Views)

Hello dragon-long,

 

In regards to the Error 2515, check out this resource on that error.  The document states that the error is thrown when you try to write different data types to a TDMS channel.  You can fix this problem by using multiple TDMS Write VIs that are individually properly configured.  You could also switch to a Write Waveforms to File VI, which will allow you to write entire waveforms to a file type of your choosing.

 

You also asked how well this code would handle extended operation.  Because you placed your DAQmx Read and write to file operations in the same loop, your data will only be read as fast as you can write to file.  This will slow your data acquisition due to all the commands included in the loop.  You might consider breaking your tasks into two separate loops; one to read data into a buffer and one to write data to file.  This architecture is commonly referred to as a Producer-Consumer loop.  Check out this example: Producer/Consumer Architecture for DAQmx Read and Write to File.  The first While loop reads in data, adds it to the queue, and determines whether to write to file or not.  The second loop dequeues data and writes it to file.  I would recommend this type of architecture for a long-term data acquisition application.  For more information on producer-consumer architecture, here is a link with more general information: Application Design Patterns: Producer/Consumer.

 

I hope you find this information useful.  Good luck working on your code.

 

Regards

Patrick
CLA
0 Kudos
Message 9 of 13
(4,798 Views)

Hello dragon-long,

 

i have got the same problem at the moment.

 

Can you please upload your last vi where you have implemented the write to file section?

 

 

Thanks a lot.

 

 

 

0 Kudos
Message 10 of 13
(4,544 Views)