Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Read a TDMS with c#?

Hi

It is possible to read a TDMS File with c#. How can i do this?

Thanks
Achim
0 Kudos
Message 1 of 7
(11,632 Views)
Achim,

NI does currently not provide a C# API for TDMS file access. We are considering doing this, but right now we do not have a timeline for when that might happen.

Your best bet would probably be to create a DLL in either LabVIEW 8.20 or LabWindows/CVI 8.1, both of which provide APIs for TDMS. That DLL could then be used in your C# application.

We are also in the process of publishing the binary layout for TDMS on ni.com. The document should go live within several days from now. Technically, you could write your own TDMS reader based on that description. If you own the application that writes the files you want to read (so you can control their complexity), that is a reasonable option. If you want to be able to read any TDMS file written by any NI application (including all the optimization mechanisms that these applications support), this would be a non-trivial thing to do.

Hope that helps,
Herbert


0 Kudos
Message 2 of 7
(11,621 Views)
Just an FYI, this is now possible with Measurement Studio:

Developer Zone Tutorial: Introduction to the Measurement Studio TDM Streaming .NET Class Library
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 3 of 7
(11,120 Views)

Hi ,

I write TDMS files using DIADEM ( Ver. 11 ) , and I read it using the TDMS .NET library of new relese 8.6 .

 

All names , description and Unit of Measure fields are correcttly filled inside DIADEM , but when I try get Name field from inside a C# application , the field is empty .The description filed and Unit of measure field work correctly .

 

someone know a workaround to solve this problem ?

 

Note : I would't like to create custom property .

 

Thanks

0 Kudos
Message 4 of 7
(10,853 Views)

Hello Mectronik,

 

Unfortunately, there is a known incompatibility between the way that DIAdem handles channel and group names, and the way that our .NET API handles these properties.  As a result of this, if you create or save a TDMS file in DIAdem, you will not be able to retrieve the channel or group name in .NET.  This was a major oversight on the part of both groups and is currently being addressed.  At this time, I am not aware of any workaround for the situation besides creating Name Properties for the channels and groups in DIAdem.  

 

Once again, I apologize for the inconvenience,

 

NickB

National Instruments  

0 Kudos
Message 5 of 7
(10,826 Views)

Hi mectronik,

 

Here is a LabVIEW VI which will attach an explicit property called "name" with the same value you wrote in DIAdem.  Both DIAdem and LabVIEW use implicit naming-- relying on the TDMS buffer header IDs rather than an explicit "name" property.  Unfortunately, CVI and MeasurementStudio ignore the buffer header IDs and rely on an explicit "name" property.  This is being ironed out finally in the upcoming TDMS 2.0 version, which will also support built in polynomial channel scaling as well as other features designed to boost the streaming speed several times faster.

 

If you don't have LabVIEW available, you can use the LVRuntime object in DIAdem to start this VI from a DIAdem VBScript.  Let me know if you need help with that.

 

Sorry for the hassle,

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 7
(10,822 Views)

How to get channel.Properties["wf_start_time"] with 6 decimal instead of 3 (10-10-2023 01:01:01.123456) because SuperViewer shows all 6 ?

 

Thanks

Branko

0 Kudos
Message 7 of 7
(3,320 Views)