LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp error

Hi All,

 

I am trying to read pressure data from NI 9201 DAQ module. When trying read 1000 samples/sec and write the data using Write to measurement file and adding time stamp, few time stamp samples are skipped. Sometimes timestamp reads in descending. Time stamp is not continuous.

Also How to write continuous timestamp and waveform data to csv file using write to delimited spreadsheet?

 

 

0 Kudos
Message 1 of 5
(549 Views)

Hi arpi,

 


@arpitharamesh wrote:

When trying read 1000 samples/sec and write the data using Write to measurement file and adding time stamp, few time stamp samples are skipped. Sometimes timestamp reads in descending. Time stamp is not continuous.


The problem most probably is located in your source code. Unfortunately you forgot to attach code…

 


@arpitharamesh wrote:

How to write continuous timestamp and waveform data to csv file using write to delimited spreadsheet?


By preparing the needed data (as two columns in a 2D array) and writing to a CSV file. You can use WriteDelimitedSpreadsheet or plain WriteText functions…

 

What have you tried and where are you stuck?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(530 Views)

Attached the source code.

Tried writing the WriteDelimitedSpreadsheet  using array functions. Timestamp and data are not in sync

 

Download All
0 Kudos
Message 3 of 5
(523 Views)

Hi arpi,

 


@arpitharamesh wrote:

Attached the source code.

Tried writing the WriteDelimitedSpreadsheet  using array functions. Timestamp and data are not in sync


Many of the longtime users don't use the latest LabVIEW versions, so you better provide your VI for older LabVIEW versions. I prefer LV2019: File->Save for previous…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(510 Views)

@arpitharamesh wrote:

I am trying to read pressure data from NI 9201 DAQ module. When trying read 1000 samples/sec and write the data using Write to measurement file and adding time stamp, few time stamp samples are skipped. Sometimes timestamp reads in descending. Time stamp is not continuous.

Also How to write continuous timestamp and waveform data to csv file using write to delimited spreadsheet?


If you are using DAQmx (and not the Dreaded DAQ Assistant, but actual DAQmx calls, specifically "DAQmx Read" inside a While Loop, with the output being "Waveform"), you should never be reading (or writing to delimited Spreadsheets) a TimeStamp because the Waveform has the TimeStamp "built in".  Of course, you want the While Loop to take less than 1 second to do everything inside, so you might not want to do any processing (like writing to a Chart, or perhaps writing to disk), so you may want to use a Producer/Consumer Design to "export" the data to a "Data-processing/Data-saving" loop that can run in parallel with the DAQ loop.

 

The Hardware should do a better job than your PC does at rigorously sticking to the time values that you give it, so if you say "1000 points at 1 kHz" and take exactly 24 hours worth of data at 1 kHz, you should find that you have 864,000,000 data points (I hope I did the math right -- let me check, nope, decimal point error, 86,400,000 points).  What I would do (and, actually, have done) is to write the first line of the Delimited Spreadsheet as the TimeStamp when the DAQ loop starts, and after that (done only on the first Write) write the 1000 Y (data) values (assuming a 1 channel output array, but it would also work for an N-channel output).  When you later go to Read Delimited Spreadsheet, you need to read one line to get the TimeStamp, then read the rest of the file to get the sampled data.

 

Bob Schor

Message 5 of 5
(493 Views)