LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS DLL Import

I recently got the TDM C dll downloaded from NI and tested the sample readfile.c. I tried it with a TDM file and it seemed to work fine. The documentation said that the DLL works for TDM and TDMS format, but when I tried the readfile.c for a TDMS file, it did not work. It gave me the following error.
 
File name property: P step at supply 6k to 26k @300lpm_04182007_1743-(0)
Channelgroup #1 name property: Virtual Inputs
Error: An invalid argument was passed to the library.
End of program, press Enter key to quit
 
Can anybody point me in the right direction to read the TDMS files.
0 Kudos
Message 1 of 10
(5,436 Views)
Hi bads19,
 
I've tried the readfile.c sample program on two files, a TDMS and a TDM file that I created in LabVIEW, and it worked in either case.

Note that I had to change the code a little:
  • The FILE_PATH constant, to point to the TDMS file
  • ddcChk (DDC_OpenFile (FILE_PATH, "TDMS", &file));   //Note that the original program specified "TDM", you have to change it to "TDMS"

If you want to try the program with the measurement files II used, I've attached them as well. They both simulate a sine wave with 10 points.

Let me know if this works for you.



Message Edited by Jervin_J on 02-11-2008 10:56 PM
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 2 of 10
(5,393 Views)

Hello Jervin,

Thanks for your help. I was able to proceed further. Now I am at a point where I need detailed information about the data. I am trying to obtain the sample increment (for sample rate calculation), offset and date & time. I would appreciate your help in this regard.

Bads19

0 Kudos
Message 3 of 10
(5,331 Views)

Hi bads19,

The TDM C dll comes with a help file that lists all the functions that you can access from the dll. The help file also describes each of these functions, what they do and what arguments they expect. I believe that would get you up and running. The help file can be accessed under the doc folder in the zip file.

The functions are listed under:
DIAdem Connectivity Library»DIAdem Connectivity Library Functions

Some of the functions that will probably be useful are:
DDC_GetDataValues
DDC_GetChannelProperty

If you need help with something more specific, let me know and I'll do my best to help you out.

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 4 of 10
(5,302 Views)

Hello Jervin,

Thanks for your reply. I was able to read the basic stuff like "name", "description", "unit_string", "minimum", "maximum" (documented in the DLL header). I am trying to get the sample increment with this code. The DDC_CHANNEL_INCREMENT is defined as "wf_increment".

            nullChk (property = malloc (sizeof(double*)));
            ddcChk (DDC_GetChannelProperty (channels[i], DDC_CHANNEL_INCREMENT,
                property, sizeof(double*)));
            printf("\n DDC_CHANNEL_INCREMENT %lf", property);
            DDC_FreeMemory(property);

This code returns only 0.0. Is there anything wrong with the code. Would you ablso be able to let me know the text that I have to pass for getting the START_OFFSET. I would appreciate your help.

Badri
(309) 578-6709

0 Kudos
Message 5 of 10
(5,282 Views)
Hi bads19,
 
Would you mind posting a copy of the tdms file that you are using? The reason I ask is because at first glance your code looks fine, I just want to see if that particular property is defined in the tdms file.
 
For the start offset, I believe you would pass "wf_start_offset".

Hope this helps.
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 6 of 10
(5,251 Views)

Hello Jervin,

Here is the file you had asked for. Right now the test file that I have is a TDM file and I assume the internal header information between the TDM and TDMS are the same. If it is ok with you, you could contact me on my phone number (309) 578-6709 and help me resolve the problem faster. Thanks for your help.

Regards,

Badri

(309) 578-6709

0 Kudos
Message 7 of 10
(5,243 Views)
Hi bads19,
 
I tried to open the TDM file in DIAdem (our software for managing, analyzing, and reporting technical data) and I get an error because it cannot file a support file (The system cannot find the file specified). Usually this is a TDX file that accompanies the TDM file.
 
I looked at the text of the TDM file in notepad and found the following line:
It looks like I might need the .ssf file as well to open the TDM file in DIAdem.

<file byteOrder="littleEndian" url="Catms_1 SS [130706-162341].ssf">

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 8 of 10
(5,222 Views)

Hello Jervin

Here is the file you had asked for. I would appreciate an early reply in this problem since I am waiting on your response to complete my project.

Thanks

Badri

(309) 578-6709

0 Kudos
Message 9 of 10
(5,218 Views)
Hi bads19,

The problem is taht you are not assigning the memory correctly in your code... This should work:
 
double *nProperty;
nullChk (nProperty = malloc (sizeof(double))); //Not *double because that will allocate enough space for a pointer, not for an actual double
ddcChk (DDC_GetChannelProperty(channels[i], "wf_increment", nProperty, sizeof(double)));  //Again, not sizeof(*double)
printf ("Channel #%d Channel Width property: %f\n", i+1, *nProperty);
free (nProperty);
 
For further reference, if you need immediate assistance, I would point you to:
where you can request phone support as well. A support contract is required for this and let me know if you have any questions about this.
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 10 of 10
(5,208 Views)