LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building XY Graph from TDMS "Timestamp" and "Trend Data" Groups

I'm trying to build graphs using two groups of data in a TDMS file (timestamps and trend data).  I've ran them through loops to cluster the timestamps with the appropriate data point. The first 32 samples in "Trend Data" go with the 1st sample in "Time".  I thought the XY Graph could handle a cluster of data with timestamps and ys, but I'm sending it a 1D Array of a Cluster of Timestamps and Ys.  I've also tried converting the timestamps to DBL and then setting the XY-Graph properties x-axis to time.  Still no luck.Build XY Graph.png

 

TDMS File Viewer - Trend Data.JPG  TDMS File Viewer - Time.JPG

Build XY Graph Array.JPG

0 Kudos
Message 1 of 8
(6,186 Views)

I'll attach my code in case someone is feeling really adventurous..

 

The .txt file is the .TDMS file; I just changed the extension.

 

 

I'm running LabView 2010 SP1

0 Kudos
Message 2 of 8
(6,185 Views)

I've attached my code in case someone is feeling really adventurous...

0 Kudos
Message 3 of 8
(6,184 Views)

Here's what I would do:

Trend Data Plot.png

 

Here I've limited the number of reads, making the code faster, also I don't use build array inside the for loop, just make a 2d array that I resize to a 1d array.

 

This should plot 32 points at the the same x-sample.

 

Ton 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 8
(6,179 Views)

That almost works...

 

Its writing:

t(0) to y(0)->y(95)

t(1) to y(0)->y(95)

t(2) to y(0)->y(95)

 

The final array has a size of 3*96= 288.  We then resize to 96 and we have all 96 ys with t(0) timestamps, instead of

[t(0),y(0)->y(31)]; [t(1), [y(32)->y(63)]; [t(2),y(64)-y(95)].

 

Now, I end up with a 1D array of a cluster of two elements: time stamp and array of ys... and this can't be graphed.  I wish I understood a little better how the auto indexing works...

 

Building XY Graph Snippet.png

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

Why do you want to resize the array to 96 elements?
The 288 elements should have:

[t0, y0]

[t0,y1]

...

[t0,y31]

[t1,y32]

..

[t1,y63]

..

[t2,y287] 

 

You don't need the array inside the cluster.

Each cluster should contain one x-point (time) and one y-point (trend) .

 

Your code doesn't index the inner for loop, you should do that.

Could you upload a sample TDMS file (zipped for instance)..

 

Ton 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 8
(6,143 Views)

I pulled an audible on my code last night.. I found out about writing "interleaved data" rather than what I was doing with just one array that would end up being 32 x #Samples long.  I've got to run into the plant, but this is what I have so far.  I don't think my code is even close yet, but when I found out about the "interleaved" write ability I very quickly realized that was how I needed to organize my TDMS groups.  I think it will make it way easier to build these graphs.

 

Trend - max from each block data.JPG    Timestamp for Trend Data.JPG

 

Write Trend Interleaved Data.pngMost recent code for trending xy with interleaved data.png

0 Kudos
Message 7 of 8
(6,132 Views)

I'm wondering, but have you even tried my code?

 

 Currently you have 4-dimensional array. that's something you cannot plot directly.

 

It's not about how you write your data, you don't need interleaved data to store what you want.

 

Ton 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 8
(6,125 Views)