LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can TDMS write generate error 4?

Hello all,

 

The attached piece of code generated an error 4 during execution. The first 2 VIs set several properties and the "write graph" VI write a few data channels. Then the VI generating the error is called in a FOR loop an an array of data chunks.

TDMS sample code.PNG

2018-02-12 10:31:05	Section1	ERROR: Error 4 occurred at TDMS Write in AI Raw Data Chunk.lvclass:write Samples To TDMS.vi->Section.lvclass:write Measurements To TDMS.vi:4320001->Section Monitor State Data.lvclass:write Measurements To TDMS.vi->Section Monitor State - Process Train Passing.lvclass:execute.vi:6020001->Section Monitor.lvclass:run.vi:1530002->RTmain.vi Possible reason(s): LabVIEW:  End of file encountered.

I just can't understand how it could happen. Please help me understand.

 

BTW it's coded in LV 2017 (no SP1)

Regards,
André (CLA, CLED)
0 Kudos
Message 1 of 21
(3,938 Views)

In addition: the code is running as executable on an NI9063 linux rt controller.

Regards,
André (CLA, CLED)
0 Kudos
Message 3 of 21
(3,902 Views)

Hi André,

Error 4 indicates that file position pointer has reached the end of file (EOF) and it is not being reset to read the beginning of the file again. 

 

You might find this KB useful, Error 4 After Multiple Calls to Read From Measurement File Express VI

and also this thread End of file encountered error for reading multiple columns from a TDMS file

 

Please let me know if this helps solve your issue!


Best,

Isak

Message 4 of 21
(3,873 Views)

Hello Isak,

 

Thanks for your input, but I do hope that from my attached code snippet it is clear that I only use write TDMS (I don't read anywhere) and I don't use Express VIs.

Kind regards, 

Regards,
André (CLA, CLED)
0 Kudos
Message 5 of 21
(3,863 Views)


Hi André,

Are you still having issues with using TDMS write?

Are you able to get any TDMS write example LabVIEW VIs to work:

You can find several examples in LabVIEW using the NI Example Finder, and search for TDMS.

Here's how you access the NI Example Finder : http://www.ni.com/getting-started/labview-basics/examples

Try to see what you might be doing differently.

Best,



Message 6 of 21
(3,821 Views)

Hello Isakbm,

 

To make it a bit more clear: The code can generate tens/hundreds of TDMS files without a problem, it's just that this error happened once and it is a strange location for this error to happen in the first place (TDMS library should handle EOF automatically when writing new data).

 

I have used it extensively over the last ... years (as long as TDMS is in LV).

 

Kudo for your effort, keep posting answers.

Regards,
André (CLA, CLED)
0 Kudos
Message 7 of 21
(3,812 Views)

Ah,


So you are creating multiple TDMS files, and only one of the files is associated with the error?


In general, could you try to make a copy of your VI or LabVIEW project, and then simplify it, until you're left with only the essentials to reproduce the error? That way troubleshooting is greatly simplified!

Happy to help, happy to be a rubber ducky.

Best,
Isak

0 Kudos
Message 8 of 21
(3,805 Views)

Isak, you might be overthinking this...

 

We're writing 1 TDMS file at the time, almost as simple as a basic example. We do this in a loop (e.g. multiple files, sub-sequentially). Nothing fancy, not fast, not a lot of data, just a simple TDMS Write to a plain TDMS file.

 

At one point during testing, the TDMS Write gave error 4. Now AFAIK, this should not even be possible, but it did happen... Once... We can't reproduce it.

 

So we're looking for an explanation why TDMS Write would give an error 4. We can't have this happening in the wild, even if it happens only once in a million times...

 

 

 

0 Kudos
Message 9 of 21
(3,795 Views)

OK, that clarifies the scenario a lot, thanks!

Are you sure the error is occurring at TDMS Write, and not before?


You could be rigtht that there is a deeper issue here, a potential bug that should be fixed in the TDMW write vi.

 

However, most likely that is not the case, since as you yourself point out the TDMS write should not be able to produce error code 4. The error could be produced elsewhere, but that the debugger is only recognizing it later in the TDMS write vi. If you're able to reproduce the error you can check this by placing probes on the error wires exiting the suspicions VIs, in this case TDMS write and read.

 

In the meantime, unless your application and logging to TDMS is time critical, I suggest that you handle the error internally, and re-try the steps once more, hopefully not getting the error the second time.

Hope this helps!

0 Kudos
Message 10 of 21
(3,791 Views)