Sei sulla pagina 1di 17

ni.

com 1
ni.com
Brian Hoover
TDMS File Format Usage In LabVIEW
Samsung SDI
Test Software Architect
LabVIEW Champion, CLA
(aka Hooovahh)
http://www.linkedin.com/in/hooovahh
https://twitter.com/hooovahh

ni.com
TDMS Overview
• Format on disk - Mostly binary data blobs
with some human readable sections
• Three Levels of data storage
• Similar to Excel spreadsheets
• Each level can contain properties, while
Channels can contain properties and
data
• Two files on disk, TDMS and the Index
• Index isn’t required but improves
performance
How data is organized is ultimately up to the developer. Knowing
what parts of the data are important may change the layout, or what
is stored to make looking up data easier.
ni.com 4
TDMS Usage
• Introduced on the Palette in LabVIEW 8.20 (earlier support for 7.1)
• Stability, performance improvements, and new functions with
each version
• Polymorphic Read/Write accept most common data types

• Write/Read from Measurement Express VIs for simple data


with little control
• Publicly documented API
• DLL for MATLAB and other languages

• Excel and OpenOffice add-in


• Free add-in to import TDMS data into Excel and OpenOffice
Calc
• NI DIAdem and DataFinder Toolkit
• Indexes TDMS properties for quick search

• DIAdem report generation

• File format is open and public. Writing a custom parser in any


language can be done if none of these options will work
ni.com 5
Demo – Create a Simple TDMS File

ni.com 6
TDMS Properties
• Properties contain a single data point for a File, Group, or Channel
• Useful for storing data that doesn’t change over the life of the test

MyFile.tdms • How was this test run?


Author • Who ran this test?
Description • Where was it run?
Cell Phone 1
UUT • What attribute or setting is shared between
Test Fixture
all channels under this group?
Procedure
LCD Brightness
Sensor Info • Signal information
Unit
• Scaling information
ni.com
• Calibration
7 information
Demo – Write TDMS Properties

ni.com 8
Reading TDMS Data
• Reading from a TDMS file is done
using named Groups and Channels
• Column index doesn’t matter
• Less error prone then a text file
• Read subset of channel data
with Length, and Offset control
• Only read part of a file by
reading a single channel. Or a
subset of a single channel

ni.com 9
TDMS Excel Conversion

• Programmatically calling the


Excel Add-in to import TDMS
files
• Perform ActiveX calls to
modify the workbook

Demo TDMS to
XLSX conversion

ni.com 1
0
DataFinder Toolkit
• Toolkit included with Developer Suite for
indexing and searching for files (not just
TDMS)
– Deployment license cost
– Indexes directories caching the file,
group, and channel properties
– Queries can be made on the properties
of the data only, not the sampled
values
– Several useful demos in the Example
Finder
Demo DataFinder
• DIAdem uses this indexing technology for
data finding and report generation
ni.com 1
1
Other TDMS Tricks
• Combine TDMS Files (command line)
• copy /b File1.tdms + File2.tdms
Output.tdms
• This can be used to
reorder channels and groups
• DAQmx Logging
• DMA streaming from DAQ to hard disk
• Not much control but very fast NI has
claimed over 1.2 GB/s
• Signal.X Scout TDMS Viewer and Editor
• Freeware
• Heavily modified version of the
TDMS viewer found on the
ni.compalette. 1
2
More TDMS Tricks
• Write multiple channels, and/or multiple samples at once, to avoid calling the
Write TDMS function too often
• This can cause fragmented data, and takes up unnecessary space

• If you have an index file that is more than 10% of the TDMS file, then your
data is likely fragmented. Index files should be small, generally less than 1MB.
• Check for Fragmentation in the Example Finder can be used

• Defrag TDMS has a progress bar in 2015 (and is faster)


• Search the Example Finder to see how to get a progress on a large file being
defragged.
• Asynchronous Writing can perform a write but then not wait for the write to
complete. Useful for taking data and logging in the same loop.
• Delete Added in 2015
• In memory references added in 2015
• Manipulate TDMS data without having to write it to disk

• Other Advanced TDMS Tips and Tricks Whitepaper


ni.com 1
3
Other Demos
Combining/merging files

Rearranging order in
TDMS files

(I really like demos)

ni.com 1
4
Reasons to Not Use TDMS
• TDMS should not be used to replace a database
• TDMS does not have advanced query options, and the DataFinder Toolkit
only queries properties not channel values.
• Queries like “Find all passing channels, where the data is between two
values” is something that can be done but is custom and likely less
efficient than a database.
• The best approach is to write properties for query results you expect you
may want.
• TDMS should not be used to replace a configuration file (.INI)
• Quick manipulation cannot be done using a simple text editor like notepad.
• TDMS is not human readable.
• Does the file need to be able to be edited by someone?
• Editing TDMS files can be done, with deleted added in 2015 but is
generally difficult.
ni.com 1
5
Before you go,
take the
survey.
Also checkout
Xnodes: Room 15
Wednesday 3:30
ni.com 1
6
ni.com 1
7

Potrebbero piacerti anche