11-02-2021 12:38 PM
Hello Fancy Folk,
TLDR:
Recently my TDMS files that I write a property to every loop stopped updating even though I was sending the command to log a property on the top level with its value but the property wasn’t updating. I couldn’t force the property to update via a secondary VI and the only way I got my code working correctly was to start logging to a second TDMS. I am wondering if there are any known issues with TDMS files in LV 2015 (yes yes, I know I need to upgrade and we’re hopefully upgrading LV soon) or what could cause the TDMS file to no write properly (EG, say I start writing the property as a U32 but then later write it as an I32 could cause the property to no longer write).
Background:
About a year ago, I wrote some code that will run a durability for some motors to run the motor against a load X times for 4 stations. The code uses preallocated clones for each station so I only need to update the main VI and all 4 station’s code update. When a station is started, the first thing that is checked is if a previous TDMS exists for the station, if so, it loads the completed cycles property and continues on with the code. There are two loops in the main part of the code: a state machine and a logging loop. When a cycle is completed in the state machine, it sends a log message to the logging loop so the logging loop can log the data and update several properties, completed cycles being one of them, on the top level of the TDMS. This way, if I have to stop the durability setup and shutdown LabVIEW, I don’t have to manually enter in the completed cycles every time.
Problem:
I noticed that my cycles completed property has been at a constant value in my log file for the past several days, even though I see the cycles being completed and the message being sent to the log code. I’ve also noticed that any data related to the new cycles in general isn’t being logged. I verified the log code via going into the logging message probing the cycles completed property, its value, TDMS ref, error lines, and the waveform data associated with a cycle to make sure that everything was getting to my log file correct and going to the correct parts of the TDMS. I also added a TDMS flush incase there was any data stored in the TDMS buffers between writes.
What I’ve tried:
After verifying that yes, the TDMS code was sending the log request and no, the TDMS wasn’t updating (the cycles completed property, or any signals related to the newer cycles) I decided to try and manually write the property value via a secondary VI. It was a simple open the TDMS, write the cycles completed property, and close the TDMS. I would then open the TDMS via the TDMS viewer to make sure the cycles completed property updated. However, no matter the different ways I tried to get the property value to update in the TDMS, it always stayed at its original value. By different ways, I mean I was changing the format of the property value (I32) to various other formats (U32, I/U64, double, etc.) to see if the other formats would force the property value to finally be over written. However, nothing happened.
Catch to “What I’ve tried” section:
This problem of writing to the TDMS via a secondary VI “worked” (updated cycles completed) on 2 of my 4 TDMS, but the other 2 TMDS weren’t updating at all. However, all 4 TDMS were not updating when I was using my main code.
What I did to get my code up and running:
When I start up the code and a previous TDMS exists, I give the use the option to load or create a new TDMS. I told my code to create a new TDMS for the 2 stations that weren’t updating and now it appears all 4 seem to be updating correct. All 4 being the 2 new TDMS and the 2 that got force updated via my secondary VI.
What I’m looking for:
Basically, any explanation that could point to the TDMS not logging the data even though I know I was sending data to it. I’m not sure writing different types to the TDMS properties can cause corruption in the TDMS file itself.
Side bar, is there a way to remove properties? I had another thought of deleting the cycles complete and rewriting is, but I couldn't see any way to delete a property.
Additional notes:
As far as I could tell, there were no faults in the log loops when the TDMS weren’t updating. I probed all the TDMS error lines and they were all good.
Also, I copied the TDMS only (the tdms_index wasn’t copied) and when I tried to open the TDMS via TDMS viewer, I received an error message stating that the file wasn’t a standard TDMS file. When I copied the tdms_index as well as the TDMS file, that error went away. I just thought it was weird because I’ve previously been able to load TDMS files without having to use the index.
Thanks for reading,
Matt
11-02-2021 02:33 PM
11-02-2021 03:42 PM
GredW,
Not wrong, but I have no idea how to present the code in any meaningful way. Its part of a large project with all the different things I talked about being subsections. I could pull out the logging subVIs but then I'd also need to build/remove code to get the sub VIs working and then put those subVIs into a different "main VI". By the time I got you guys something that could represent what I am talking about, it isn't going to be accurate to the original.
Additionally, I don't think its a my code thing (yes yes, I know we always say this. Everything we write is perfect, right?). While the code is running, I have verified that the correct TDMS file is opened and the ref is passed to my logging loop. I have verified that when a cycle is complete it is sending the logging command to my logging loop. I have verified that when my logging loop receives the logging command, it is being told to update cycles complete with the new value to the correct TDMS reference. I verified all of this while I was having the problem and after I "fixed it" via creating a new TDMS file. There was literally no code changes between the "old TDMS not logging" and the "new TDMS logging" solution. To me, this points to my TDMS file got corrupted somehow.
Matt
11-02-2021 03:50 PM
Hi Mtat,
@Matt_AM wrote:
There was literally no code changes between the "old TDMS not logging" and the "new TDMS logging" solution. To me, this points to my TDMS file got corrupted somehow.
Maybe. Maybe not. Who knows? (I guess the one with the code available knows!)
I don't think you will get any more answers for your lengthy text message as long as you cannot prove your problem by supplying a code example. Btw. often problems gets solved in the process of creating such a code example…