Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How Do I Open Unscaled TDMS Data From LabVIEW in DIAdem?

Primary Software: DIAdem
Primary Software Version: 10.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>Professional Development System

Problem:
How do I open unscaled TDMS data, saved from LabVIEW, in DIAdem and get it to scale properly?

Solution:
Unscaled TDMS files from LabVIEW will have two data channels for each physical channel when you open the file in DIAdem.
 


The first channel, Scaling Coefficients, holds the numeric value coefficients for the scaling equations of the channel data.  The second channel, Unscaled Data, holds each data point value.  If you simply put the Unscaled Data channel in a DIAdem VIEW you will see a waveform similar to the data you acquired, but the Y-Axis legend will not be correctly scaled. As showed in the figure below.


In order to get the proper scaling you need to apply the coefficients and scaling equation that are used by your DAQ device to every data point in the channel.  This can be done by writing a simple DIAdem Script.  The script below will pull the 4 coefficients from the Scaling Coefficients channel into temporary variables and then run the appropriate polynomial equation on each data point in the Unscaled Data channel.

Option Explicit  'Forces the explicit declaration of all the variables in a script.

L1 = CNo("[1]/Dev1\ai1")
L2 = CNo("[2]/Dev1\ai1")
R1 = ChDX(1,L1)
R2 = ChDX(2,L1)
R3 = ChDX(3,L1)
R4 = ChDX(4,L1)
Call FormulaCalc("Ch(""New"") := R1 + R2 * Ch(L2) + R3 * Ch(L2)^2 + R4 * Ch(L2)^3")

Note:
This equation is for an M-series device which uses a 4 coefficient polynomial equation, other devices may be different.

This script will create a new channel, called New in the above script, that will contain the scaled data.  This will show up in the Data Portal under the existing Unscaled Data channel.  When you drag this into a DIAdem VIEW it will show the same waveform as before, but with appropriate scaling applied.



The Visual Basic Script file, Unscaled Data Scaling.VBS, of the above code is attached to this KB.  It can be imported into DIAdem and ready for use after a few simple changes.

Related Links:

Attachments:
Data Portal.PNG
Scaled Data VIEW.PNG
Unscaled Data VIEW.PNG
Script.PNG
Data Scaling ScriptUnscaled Data Scaling.VBS




Report Date: 02/13/2008
Last Updated: 02/13/2008
Document ID: 4ICGEPP7

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit