LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to log data at max rate, LV2023 Q3

Solved!
Go to solution

Hello,

 

Hoping someone can enlighten me on an issue I've been struggling on for days.  I'm vaguely familiar with LabVIEW and by no means an expert by any stretch of the imagination.    

I've been stumped on attempting to record data as fast as the hardware will allow (~60 Hz I believe).  I'm using 9189 chassis with a cDAQ 9214 thermocouple module.  Just running a simple program that logs data (TC readings and timestamp) onto a TDMS file and plots the data in real time.  Only using one cDAQ module with one TC input as this will lay a foundation as a base program to build upon (will eventually use several cDAQs for data acquisition).  The program uses two loops with the first loop capturing data and the second loop graphing data.  The program executes without errors but I can only capture data at a max rate of ~5 Hz.  Can someone point me in the right direction?  How can I capture data at the maximum rate the hardware will allow?  Thank you.

 

Machine Specs: windows 10 pro 64-bit, 2.9 GHz processor, 32 GB ram

0 Kudos
Message 1 of 6
(647 Views)

Try separating your Acquisition and logging into separate loops connected by a Channel Wire (Producer/Consumer) 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 6
(644 Views)

Why don't you use the built-in DAQmx logging feature?

You can refer to the shipping examples at Help >> Find Examples... >> Hardware Input and Output >> DAQmx >> Analog Input >> Voltage - Continuous Input.vi  and combine it with Thermocouple - Continuous Input.vi

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 3 of 6
(599 Views)
Solution
Accepted by topic author LVenthusiast434

I just did some massive cleaning up of your code.

 

1. Use the DAQmx Timing VI to set the sample rate for the DAQ and set the task to be Continuous Samples.  This allows the DAQ to perform the sampling at the rate (hardware timed) instead of relying on software timing.  With this, I changed the sample rate to a constant of 60.

 

2. With #1, you can get rid of all waits in your code.  For the DAQmx read, change the polymorphic to Analog->Single Channel->Multiple Samples->Waveform (Samples).  I would recommend then reading 6 samples per read.  This would have the read complete every 100ms, a general rule of thumb when dealing with DAQs.

 

3. Before the loop, use the DAQmx Configure Logging.  This tells DAQmx to log the data as it reads.  This is way more efficient than you can possibly make with a Producer/Consumer as it bypasses software layers.

 

4. With #3, you can get rid of the whole second loop.

 

5. Change the graph to a Chart and wire the output of the DAQmx read straight to the terminal.  The chart keeps a history and the timestamp is included with the waveform data type.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 4 of 6
(535 Views)

Thanks everyone for the for the feedback, especially Crossrulz for pointing out the flaws in the labVIEW script.  

The acquisition rate (in real time) was day and night difference on the new script!  It seems I still have a long path in front of me to fully understand data management in LabVIEW.  Very surprised to see an issue that was taking days of research on my end to be resolved in mere seconds while pointing out my deficiencies in the process.  Thank you again!

0 Kudos
Message 5 of 6
(514 Views)

@LVenthusiast434 wrote:

It seems I still have a long path in front of me to fully understand data management in LabVIEW.  Very surprised to see an issue that was taking days of research on my end to be resolved in mere seconds while pointing out my deficiencies in the process.


It took me years to get to this point.  Lucky for you, there is a lot better information out there now than when I was figuring this out.  The first reference we normally point to is Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(506 Views)