LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stuff a Waveform Chart data into TDMS file

I just realized the waveform chart i.e. parameters Xo, deltaX and 1D/2D Array is not an accepted parameter in the TDMS Write VI.  I want to store the waveform chart information so that freq (X-axis) and amplitude (Y-axis) is plotted in the viewer.

 

I not sure if this is possible from some post I've come across.

0 Kudos
Message 1 of 10
(227 Views)

Hi richjoh,

 


@richjoh wrote:

I just realized the waveform chart i.e. parameters Xo, deltaX and 1D/2D Array is not an accepted parameter in the TDMS Write VI.  I want to store the waveform chart information so that freq (X-axis) and amplitude (Y-axis) is plotted in the viewer.


You don't store "charts" inside TDMS file, but the "data" you show in your charts. Quite a difference…

 

Which kind of data (aka datatype) do you want to store in TDMS files? AFAIK they accept waveforms!

(Maybe you should attach an example VI to explain which kind of data you want to save.)

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 10
(216 Views)

frequency vs amplitude chart. As you know bundle the Xo, deltaX, 1D/2DArray you can plot using a Chart.  I simply want to save the frequency/amplitude data using TDMS. When I go back to view the TDMS file it should show me frequency vs amplitude (instead of separate plot of the axis).

 

In other words, TDMS should show me x-axis (frequency) and y-axis (amplitude).  

0 Kudos
Message 3 of 10
(171 Views)

Sound and Vibration Toolkit has TDMS VIs to Write and Read frequency spectra with correct units saved as channel and group properties. You can download the eval and see how those VIs manage the spectrum data.

 

From the help:

sv_tdms_write_spectrum_1_ch.gif

The complementary Read function will pull the spectrum data out of the file in the expected format ready to be graphed. You will still have to overwrite the x- and y-axis labels.

 

Doug
NI Sound and Vibration
0 Kudos
Message 4 of 10
(159 Views)

OK, I downloaded and looked at the Sound&Vib toolkit LabVIEW 2016. 

 

So if I have a Waveform Graph, i.e. Xo, deltaX, 2DArray, they basically cast it to a Variant to store into a TDMS file.  And now that I see the Labview, I wouldn't want to use the toolkit.  Just to put the Graph into a TDMS file it's alot of bloat.  I may convert the Waveform Graph to Variant on my own to get it into TDMS file.

 

I appreciate your help on issue.

0 Kudos
Message 5 of 10
(133 Views)

Hi richjoh,

 


@richjoh wrote:

So if I have a Waveform Graph, i.e. Xo, deltaX, 2DArray, they basically cast it to a Variant to store into a TDMS file.  … Just to put the Graph into a TDMS file it's alot of bloat.


As said before: you don't put "a graph" into a TDMS file, you write data to your TDMS file!

You are responsile of providing the data in a way which the TDMS functions can handle!

 

I would not convert to variant, I would save the 2D array, with X0/dX added as properties…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 6 of 10
(126 Views)

The spectrum data is not cast to a variant. The array data is written directly to TDMS, and the spectrum attributes (x0, dx, all elements of spectrum info, and additional attributes) are written as TDMS group and channel properties.

 

1 and N Ch VIs attached (for LV 2020). If you don't want to write spectrum info, make a copy of the VI and rip that part of the code out.

 

I agree with Gerd, don't convert the spectrum to a variant.

Doug
NI Sound and Vibration
0 Kudos
Message 7 of 10
(114 Views)

I looked at something in the SV toolkit, I think I saw the WF attributes being written with Variants which led me to the data being written as a variant. Thanks guys for clearing that up. 

 

Ultimately, the TDMS properties are written using Variants.  It looks like I pass parameters for the WF (x, dx, Array) and Spectrum Info parameters and it should do it.  My WFs are Single precision (not a big deal to cast to double).  

 

I didn't see a setting for Multi-plot WF Graph, plotting 1.Amplitude, 2.Lowlimit, 3.HiLimit vs Freq.   This is a 2D array where each row is a plot.  I did find Multi WF where it is Arrays of WF, i.e. [WF1], [WF2]...[WFX].   Not a show stopper but would be nice to have Multi-plot WF . 

0 Kudos
Message 8 of 10
(92 Views)

Hi richjoh,

 


@richjoh wrote:

Not a show stopper but would be nice to have Multi-plot WF . 


No showstopper at all: a "multi-plot waveform" is an array of waveforms!

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 9 of 10
(82 Views)

Ultimately, the TDMS properties are written using Variants.  It looks like I pass parameters for the WF (x, dx, Array) and Spectrum Info parameters and it should do it.  My WFs are Single precision (not a big deal to cast to double).  

You can convert to DBL or you can create your own instance of a TDMS Write to save SGL data. 

 


I didn't see a setting for Multi-plot WF Graph, plotting 1.Amplitude, 2.Lowlimit, 3.HiLimit vs Freq.   This is a 2D array where each row is a plot.  I did find Multi WF where it is Arrays of WF, i.e. [WF1], [WF2]...[WFX].   Not a show stopper but would be nice to have Multi-plot WF . 

As long as you are comfortable converting between them, the data types are interchangeable to the graph. There are a number of measurement-analysis APIs that operate on waveforms and array of waveforms, so that may be something to consider if you are saving data for some later post processing. Specifically, the SV Toolkit reflects group preference for operating on 1D array of waveform rather than 2D array of data - we prefer for code to be very clear whether it is indexing through channels versus indexing through time/samples.

Doug
NI Sound and Vibration
0 Kudos
Message 10 of 10
(69 Views)