06-20-2011 07:01 AM
Problem vi attached below.
Here's what's currently happening. Each time I call this vi from a higher level vi, data that was previously wrote to the tdms file gets overwritten with the most recent data I'm trying to save to it.
From looking through the tdms functions panel and the forum, I don't see anything to append data. Does the group and/or channel names have to be different each time I call the vi?
What I would like to happen is for each data set to appear under the time/date it was saved at which clearly isn't happening at the moment.
Strokes
06-20-2011 01:00 PM - edited 06-20-2011 01:04 PM
Hi Strokes,
I'd have to get to my other development machine to open your VI because it's in LabVIEW 2010. However, a couple quick notes for you:
Hope this helps!
06-20-2011 01:31 PM
Yes i do use the TDMS open function but can't see where this is causing a problem for me. I understand it is good practice to close the TDMS file after I'm finished writing to it, hence I close it...
Maintaining the file reference isn't an issue. I store it in a shift register in a higher level vi.
While I'm grateful for your post it doesn't really address the problem i'm facing...
06-20-2011 01:42 PM
When you open a TDMS file reference there is an option, indicating what you want to do. I don't know the default value, but you can change this to 'open or create', that will create the file if non-existent or will apend the data to the allready existing data-set.
Ton
06-20-2011 01:50 PM - edited 06-20-2011 01:53 PM
Hi Strokes,
Yep, it sounds like you've covered the bases here. Just in case, and to clarify, I was referring to the "operation" input to the TDMS Open VI being set to "Open" vs another option which may create or replace it. But it sounds like you have that covered.
I have done this many times without issue, which is why I started out with the basics. You definitely want to close the TDMS file when you're done with it, or any other file for that matter 😉
I'm assuming you've done the usual troubleshooting - probing and/or running in highlight execution mode to make sure things are happening as you expect. An error would certainly prevent writes as it propagates the error cluster, but as long as you're handling those gracefully you'll probably have seen that.
Viewing your code may help. If you can save to an old 8.x flavor I can take a look on this machine (coding against it for a few projects requiring an older version currently...). Or even quicker, just post a screenshot or two if things are relatively clean... that might bring something to light as well.
06-20-2011 01:59 PM
@TCPlomp wrote:
When you open a TDMS file reference there is an option, indicating what you want to do. I don't know the default value, but you can change this to 'open or create', that will create the file if non-existent or will apend the data to the allready existing data-set.
Ton
The default value is Open, but I wired an 'Open' constant to it just to be sure. The problem is data is not being appended, it's being overwritten.. and a new file isn't being created each time as far as I can tell.
06-20-2011 02:01 PM
@jls wrote:
Hi Strokes,
Yep, it sounds like you've covered the bases here. Just in case, and to clarify, I was referring to the "operation" input to the TDMS Open VI being set to "Open" vs another option which may create or replace it. But it sounds like you have that covered.
I have done this many times without issue, which is why I started out with the basics. You definitely want to close the TDMS file when you're done with it, or any other file for that matter 😉
I'm assuming you've done the usual troubleshooting - probing and/or running in highlight execution mode to make sure things are happening as you expect. An error would certainly prevent writes as it propagates the error cluster, but as long as you're handling those gracefully you'll probably have seen that.
Viewing your code may help. If you can save to an old 8.x flavor I can take a look on this machine (coding against it for a few projects requiring an older version currently...). Or even quicker, just post a screenshot or two if things are relatively clean... that might bring something to light as well.
It's probably something silly which no doubt will be pointed out to me... I won't be able to upload any more code or even screenshots as I'm not running labVIEW on my laptop and won't have access to my computer until tomorrow. Hopefully someone comes along with a suggestion before then but if not i'll post more info tomorrow.
06-20-2011 02:03 PM
Sounds good - I'll definitely chime in again if something hits me on this. Otherwise we'll look for an update tomorrow.
Hopefully, as you said, it'll get solved in the interim 🙂
06-21-2011 05:59 AM
@jls wrote:
Sounds good - I'll definitely chime in again if something hits me on this. Otherwise we'll look for an update tomorrow.
Hopefully, as you said, it'll get solved in the interim 🙂
Ok here's a bit of an update...
When I leave the vi running and perform numerous write tdms operations, data gets appended to the file fine...
However, when I abort execution of the vi and run it again and try to write to the same file, old data gets overwrote by new data even though I specifically set the tdms open function operation to 'Open'
I'm not sure if posting code would be helpful as I'm using the jki state machine which I presume a lot people don't have installed.
06-21-2011 10:48 AM - edited 06-21-2011 10:54 AM
Hi Stokes,
Another thought came to mind - timestamps. I'm wondering if overlapping (or perhaps using a data structure which doesn't include) timestamps could be a factor here.
If you're taking data straight from the DAQ API in waveform format, for example, the timestamp should take into account the current date/time (i.e. will be different on each run) - we would expect it to append new data even on independent runs of the VI.
However, if you're managing data as DBL arrays or similar, this could be the scent trail to follow as there may not be an explicit timestamp. This could cause a new run (i.e. new file open) to view data at a "default" or without a timestamp and just overwrite previously written data (which was also written the same way).
How does that ring (or not) with your code?
We'll keep trying 🙂