LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 4 at TDMS Read VI in Labview 2014

Hi,

 

we recently switched from Labview 2013 32-bit to Labview 2014 64-bit on a Win7 64-bit machine. We now have a problem with part of a program which worked fine over the last years. As the original program is quite complex I changed the Labview example "Concurrent Access to TDMS File.vi" to ressemble our original program. The changes were made only to the Read While Loop so that every 200 ms the read TDMS VI is called. This will throw an Error 4 "end of file encountered" in the read while loop in the first iteration. As I said, this program structure served us well for the last years in which we write data from a sensor to a TDMS file while at the same time we read from it to display that data in chunks. But it is not working anymore and we dont know why. It stopped working when switching to LAbview 2014 64-bit. Here is a snippet and I also attach the vi:

 

Snippet_TDMS_Read_problem.png

 

Even when ignoring error 4 in our original program, the read TDMS VI does not read any data, while the write TDMS VI is working fine (I checked the TDMS file for data). So just ignoring the error 4 doesnt work. I'm not seeing what I am doing wrong or what might have changed between the Labview 2013 and 2014 version. Can anyone help? One post I found mentions that on the second read loop the read position might be out of range, but this does not explain why I get error 4 on the first iteration of the read loop. Also, when ignoring error 4 it should still read all data that is available from the TDMS file when not specifiying any offset or counts to read, correct?

 

Additionally I would like to ask why - in the example "Concurrent Access to TDMS File.vi" - two references are opened to the same TDMS file? In our original program we have only one TDMS Open VI and then pass the reference to the write and the read loop.

I would be most thankfull if anyone could look into this and help, I'm completely stuck.

 

Thank you very much for your time and help,

 

Dhruva88

0 Kudos
Message 1 of 3
(4,027 Views)

Hi,

 

For concurrent processes, the order of reading and writing may change during multiple times of running. On my machine depending on your attached VI, if I just click "Run" arrow, then reading is first executed; if I run the VI with clicking "Highlight Execution" bulb, then writing is first executed. If reading an nonexistent tdms file following open with "open or create" option, error 4 is reported. So it is necessay to ensure not executing reading before writing.

 

The snapshots below is the modification for your attached VI. After updating the VI, it works good on my machine.

cocurrent.jpg

cocurrent1.jpg

0 Kudos
Message 2 of 3
(3,983 Views)

Hi emmazheng,

 

thanks a lot for your reply. I'll try out your code next week when I'm back at my work computer.

So basically your code uses the same structure as the example vi, that is, its using the get property tdms VI before reading from the tdms file. From my naive point of view, it would be much more intuitive, if NI would actually allow reading from the tdms file after running the open TDMS file command. I would think that the tdms file is created by that "open/create tdms file " VI and that one could in principle read from it afterwards no matter if actual data is present. Thats how I implemented it so far without problems before the migration to Labview 2014 64-bit.I guess recompiling could switch things out of the previous luckily working order so that could have happened.

On the same note, the race condition you mentioned makes perfect sense - for the first iteration. But what I see on my computer is that even after multiple TDMS write loops (the data is in the file, I checked) the TDMS read loop does not read any data. I would suspect that in the first iteration given that the read loop is run first and before the first write loop, I would get error 4. But in the second and onwards iteration, when data was written to the file, the read loop should at least get that content in the second run. Am I correct? What I see on my machine does not match this expected behavior - the read loop does not read any data from the tdms file during execution - even when running the clear all error command after every run of the TDMS read vi. It seems to get stuck when it has ever encountered error 4. Do you have an explanation for this?

 

Thanks for your help,

 

Dhruva88

0 Kudos
Message 3 of 3
(3,945 Views)