LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help understanding TDMS usage

LV2013, Win7

 

My app handles 300+ channels of data, all at 10 Hz, recording to a private datalog/binary hybrid format.

 

We want to move to TDMS, for compatibility with DataFinder, and DiaDem, so the client can do database things.

 

In addition, we need to move to multirate data recording (some channels at 1 Hz, some at 5 Hz, some at 100 Hz, etc).

 

So, I'm playing with how to do that, in a little test program.

 

The code opens/creates a TDMS file.

 

Then it sets two PROPERTIES for each of three groups ("1 Hz", "5 Hz", "20 Hz").

It sets the "wf_start_time" property to the current time, and the "wf_increment" property to 1.0, 0.2, or 0.05, on each group.

Those names taken from the HELP file for SET PROPERTY.

 

Then there are three loops generating (random) data for 10 seconds.  The loops run at 1, 5, and 20 Hz.  Each loop makes two samples and writes them to the file.

 

After 10 seconds, the file is closed and opened in the TDMS FILE VIEWER.

 

In the viewer, the propertes ("wf_start_time",  "wf_increment") are seen correctly attached to the groups, but they are ignored by the graph tab in the viewer.

Q1.PNG

 

 

 

But here the time on the X-axis is starting at T0, over 100 years ago:

Q2.PNG

 

 

 

Another channel shows the same X-axis:

Q3.PNG

 

 

Here's the code in question.  At this point, I added the line in yellow.  I think this means that the property gets attached to a single CHANNEL (the above attaches it to the GROUP, which is what I was intending, but is apparently incorrect).

 

Q4.PNG

 

 

Here you can see that it does attach to the CHANNEL:

Q5.PNG

 

 

So, here it looks like it works : the channel I attached it to has the correct X-axis:

Q6.PNG

 

 

But. but.. but... So does a channel in ANOTHER group:

Q7.PNG

 

 

Notice that the INCREMENT is wrong on the last one - that is 50 samples in 10 seconds, but it incorrectly labels it as 50 seconds - it's using the INCREMENT from the OTHER group, as well.

 

If I remove the wire in yellow, wait 5 minutes, and run it again, I would expect the X-axis to go back to T0, in 1903.  But no - the X-axis on the graph STILL carries the time from 5 minutes ago!  

 

QUESTION:  When I set a property to CHANNEL A in GROUP 1, why does it apply to other channels in that group, and to other channels in OTHER groups?

 

QUESTION: When I change back to assigning the property to the GROUP, why does the X-axis STILL remember the previous time?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 25
(3,466 Views)

Hmmm.  If I attach the properties to a single CHANNEL in each group, then it works out.

All three START times are correct, and each individual INCREMENT is correct.

 

It looks like my thinking is incorrect when I say that I am "attaching" the property to a specific "channel".

 

If I feed the property to a non-existent channel name, it does NOT apply to the other channels in that group.

 

If I feed the property to ANY existent channel name, it DOES apply to the other channels in that group.

 

It's not "attached" to the channel, but it's on the "shelf" labeled "channel properties" and can be used by any channel in the group, or by any channel in any group, if there is not a specific property assigned there.

 

Anybody have experience in multirate recording to TDMS?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 25
(3,450 Views)

So... if I assign a different "wf_increment" to each channel in a group, the TDMS VIEWER thing shows it correctly !

 

Does that mean I don't need to separate them into groups?  My thinking was that I would put them into groups by sample rate, but maybe I don't need to?

 

 

I can't figure out how to get Diadem to give me a proper X-axis - all it gives me is an index.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 25
(3,429 Views)

New Info.

 

Looks like the TDMS VIEWER uses the last-known INCREMENT and START TIME properties, not the ones in the same group.

 

i.e....

 

If GROUP 1, has channel A with START TIME = T1 and channel B with no START TIME.

If GROUP 2, has channel C with START TIME = T1 + 5 and channel D with no START TIME.

 

Then selecting channel B or D does not change the graphed START TIME.  Clicking on A will set the START TIME to T1, and you can click on channel B or D and it won't change.  Click on C and it changes to T1+5, and you can click on channel B or D and it won't change.

 

So, it's NOT true that the property of the nearest channel in the group will apply.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 25
(3,422 Views)

I usually use something like this before each channel in my TDMS file. I may have different dt, etc, but they are all in the same group. Hope this helps.

 

Regards,

mcduff

 

PS I am using relative time here; you can change the flag if you want.

 

TDMSChannelSet.png

0 Kudos
Message 5 of 25
(3,399 Views)

@CoastalMaineBird wrote:

So... if I assign a different "wf_increment" to each channel in a group, the TDMS VIEWER thing shows it correctly !

 

Does that mean I don't need to separate them into groups?  My thinking was that I would put them into groups by sample rate, but maybe I don't need to?

 

 

I can't figure out how to get Diadem to give me a proper X-axis - all it gives me is an index.


Do you have a Time (or any other X-axis) channel that you can select?  If so, then select it first, then Ctrl-click on the other channels that you want to graph and drag them all into the View Pane.

 

Diadem.PNG

 

 

 

 

0 Kudos
Message 6 of 25
(3,383 Views)

Hi,

 

If I understand your description correctly, then It is a bug of TDMS File Viewer. We have found it and will fixed it in the next release. When reading a channel to waveform to show in the graph tap. we will initialize the t0 and dt  with the value of wf_start_time and wf_increment properties And it shows correctly. But If the channel doesn't have these properties, we left the t0 and dt as they were. And it is wrong. 

0 Kudos
Message 7 of 25
(3,369 Views)

Hi,

 

If I understand your description correctly, then It is a bug of TDMS File Viewer. We have found it and will fixed it in the next release. When reading a channel to waveform to show in the graph tap. we will initialize the t0 and dt  with the value of wf_start_time and wf_increment properties And it shows correctly. But If the channel doesn't have these properties, we left the t0 and dt as they were. And it is wrong. 

0 Kudos
Message 8 of 25
(3,369 Views)

Do you have a Time (or any other X-axis) channel that you can select?

 

 

No. I have a T0 and a dT.  That should be enough to generate an X axis, I would think.  Do I have to generate an X-axis channel myself?

 

If what I was thinking were true, then groups would be unnecessary:  A T0 and dT for each channel would suffice.  I could attach those to each channel and be done.

 

But it doesn't seem to work that way, since Diadem is not smart enough to use the info that I give it. 

 

Since it doesn't work that way, I suppose that I *-DO-* have to generate an X-axis myself, and to avoid generating one for every single channel, I would generate one for each GROUP..

 

 Even when I generate WAVEFORMS, and set the T0 and dT of the WAVEFORM when recording, it shows up in Diadem as a waveform, but it disregards the T0 and plots the index anyway.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 25
(3,354 Views)

But If the channel doesn't have these properties, we left the t0 and dt as they were. And it is wrong. 

 

 

That's exactly what I saw.  The T0 and dT were left as they were.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 25
(3,353 Views)