From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time column in tdms file write?

Hi

I have a program with multiple acquistions using a multiplex queue system to record data from the DAQs to one tdms file. Like in the 'Write to file express vi' it is possible to have a time column to indicate the time at which the aquisition occurred? I am sure it is just a simple form of a time stamp to wire into the write file but needs to have a time stamp capable of of 1 x 10^-5 seconds.

 

Many thanks - I have uploaded my program as reference.

 

Notay

vi.PNG

0 Kudos
Message 1 of 8
(5,306 Views)

Hi - Does any one have a solution for me please?

0 Kudos
Message 2 of 8
(5,288 Views)

Hi Notay,

 

I'm afraid you have to explicitly write a timestamp array to the TDMS file. 

Message 3 of 8
(5,275 Views)

Hi YongqingYe - many thanks for your reply.

 

When you say 'timestamp array' are you referring to the timestamp vi and placing this in an array? If so how will this provide me with 1x10^-5 second accuracy that I require since the timestamp vi can only record in seconds?

0 Kudos
Message 4 of 8
(5,266 Views)

Hi Notay,

 

Both yourself and YongqingYe are correct in that in order to add timestamp data to your TDMS file you will need to manually add an additional column into your file. This column can be generated by building up an array of timestamp values.

 

The problem you are going to have is with achieving a 1x10^-5 second accuracy. Since this application is running in Windows (i.e. not a Real Time OS) it uses a millisecond clock. The DAQmx driver that you have used to program your application will use the OS clock to time measurements and the generation of samples so you are essentially limited to this millisecond clock. The Get Date/Time in Seconds function that has been alluded to will provide your times in seconds to three decimal points i.e. to the nearest millisecond.

 

Do you really require 1x10^-5 second accuracy?

 

Regards,

 

Christian Hartshorne

NI|UK

0 Kudos
Message 5 of 8
(5,246 Views)

The timestamp datatype itself has a resolution of about 5X10-20s, and this timestamp should be saved in the TDMS file when you save a waveform (which you are doing).  As mentioned, your issue is attaining this resolution to start with.  Depending on your DAQ hardware (check your manuals), you may be able to attain 10-5s relative resolution if you use the hardware to generate your timing for you.  You are currently taking data separately in two loops, but waiting for data to be available on both loops before storing.  When you take your counter data, you have no timestamp.  It appears you would like to take all the data simultaneously.  If you synchronize the analog and counter/timer acquisitions to use the same internal trigger, they will then have the same timestamp, and you should be able to attain the resolution you need.  You will need to fill in the timestamps of the counter/timer acquisitions from the timestamp of the waveform acquisition before storing, since you are taking single points with no timestamps.  Check the LabVIEW examples for how to synchronize acquisitions.

 

Good luck.  Let us know if you need more help.

0 Kudos
Message 6 of 8
(5,237 Views)

Hi many thanks for your replies.

 

The main reason I asked about the timestamp was because I believe my program was not running in sync as DFGray mentioned (sorry I should have mentioned this earlier).  

 

CJHartshorne - I require this accuracy since the encoder is attached to a reciprocating rig running at high speed (3000rpm)

 

DFGray - So from what you are saying providing I have the loops in sync I do not need a separate time stamp.

For synchronising tasks am I correct in saying that I would require additional counters lines on my hardware for this to work? I only have two counter lines at the moment where one is used a reference point and the other is used as a crank angle position.

 

0 Kudos
Message 7 of 8
(5,216 Views)

Synchronization requires that you share triggers and/or clocks for your different acquisitions.  If all your acquisition is on the same board, this should not be a problem, assuming your board supports such things (what hardware are you using for each acquisition).  It has been a couple of years since I have done this sort of thing, so I am not sure I am competent to give you the details, but there are good examples in the LabVIEW / DAQ help showing how to do this (e.g. Correlated Dig Read With Counter.vi shows synchronizing a digital input with counter input - your case is similar, just substitute analog for digital read).

 

If all your acquisitions are on the same board, synchronization will take place using internal connections.  If on different boards, you will need to use either the PFI or RTSI lines to synchronize.

0 Kudos
Message 8 of 8
(5,211 Views)