LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS storing analogue and digital data

I have a cDAQ with analogue NI 9215 and digital NI 9403 modules. The analogue side I have working fine, the digital side I am using to capture parallel data, this I have done successfully.

The problem I have is storing the data, I can write the analogue data to a TDMS, the digital is another matter. It will store the data but the datastamp is AWOL, it keeps time stamping it from 00:00:00 01/01/1904 and the timing is off - if I run the VI for 10 seconds the analogue is correct but the digital side is dated 1904 and has captured a 1 minute 40 second time frame??

 

I have attached the VI - it is a mess because I am learning as I go so many blocks have been swapped and switched many times to get it working.

The two inputs are setup, the analogue is then split for seperate displays (currently one signal - will be three), the digital is converted to a number then into an angle and displayed, the stuff at the bottom calculates the RPM. The TDMS stuff is me just trying to work out how to log all the data correctly.

 

Any advise is greatly appericiated.

 

0 Kudos
Message 1 of 9
(3,018 Views)

If you log non-waveform data to TDMS file and tried to display it as waveform, the default start time of the waveform to display will be "00:00:00 01/01/1904". 

If you want to set this value, you should organize your data to waveform before logging to TDMS and set "wf_start_time" by TDMS Set Property node to modify the start time of your waveform.

0 Kudos
Message 2 of 9
(2,996 Views)

Hi deppSu, thanks for your responce. I have managed to convert the data into a waveform and I am now getting the correct time stamp, however it still does not correspond to the correct run time.

I am unable to find the "wf_start_time" you mention, could you advise where I may find it?

0 Kudos
Message 3 of 9
(2,983 Views)

If you want to use the run time of your vi as the start time you can use the "Get date time in seconds" node like below.

starttime.png

Notice that in order to let it work you shoud set thie property on channel and you should log waveform data to it.

0 Kudos
Message 4 of 9
(2,963 Views)

Hi Logictom,

If you are happy to use the same timestamp for both measurements in the loop, then you can take a copy of the analogue waveform data that you are displaying on the front panel and wire that into the top of the build waveform function you are already using. This will allow the new waveform to take the values of dt and t0 from the existing waveform.

I have attached your code with the modification.

 

Hope this helps,

 

Laurence

Message 5 of 9
(2,948 Views)

Hi LaThoS,

 

I have ran the file you edited and I am getting somewhere... I am getting the two waveforms merged in a single trace - is this what you are seeing?

I have tried seperating them out but then I also lose the t0, dt time.

I've attached an image of the captured TDMS.

 

Thanks

0 Kudos
Message 6 of 9
(2,935 Views)

Also to add; deppSu I tried your suggestion and that provides the correct start time but I am still having issues where the runtime is 10 seconds but the recorded data is recorded over >1minute.

 

I have rebuilt the example with a simulated NI 9401 and this example works when using single chanel multiple samples with a sample clock setup but I cannot get it working with the NI 9403 we currently have, is this something to do with the sampling frequency of the 9403?

0 Kudos
Message 7 of 9
(2,896 Views)

You mean the same VI runs differently on NI 9401 and 9403 ? I'm not familiar with NI hardware and it's setting. Can you post your example, I think NI application engineers can see and try to help.

0 Kudos
Message 8 of 9
(2,884 Views)

Could you tell me more about what you are trying to accomplish? I assume, from the fact you are inserting the processed digital data into the second waveform in the array, that you only intend on acquiring one analogue channel of data? If so, then single channel waveform would be the correct option, and would create a single waveform output. You can then take a copy of this and use it with the build array function for the 'digital' waveform (like I posted), and then build an array using both of those waveforms, before writing that to the TDMS file.

 

The issue comes with the dt value. You are sampling the analogue channel with a sample rate that is used in hardware, and the inverse of this will be your dt value for the analogue waveform. Your digital sampling uses the while loop iteration to control it's sample rate, and you use a wait ms multiple function for the loop timing. This means that your acquired data may have a varying sample rate (depending on the jitter of the loop), and the dt you use in the build waveform should actually use a function that measures the loop iteration time.

 

It would be much easier if you specified a sample rate for the digital data, and if it was the same as the analogue, you could copy the dt from it too, and only update the Y values in the build array function (as per my previous post). I have attached a VI demonstrating this. The digital acquisition uses the analogue sample clock which ensures synchronisation, and is started before the analogue task (via error clusters) in order to not miss any samples.

0 Kudos
Message 9 of 9
(2,869 Views)