11-03-2009 10:11 AM
I'm having a bit of an odd issue that I'm hoping someone might have some insight on; I am attempting to post-process a series of 3 or more data files that each have 7 channels of data in them. Initially I was doing so by using a single TDMS read in a for loop and using an index array to break out channels in like groups. The issue was that the fourth channel of data starts to read on the second iteration and then the values drop to zero after about 10 seconds. The next iteration sees the same problem but it stops to read after approximately 5 seconds.The really odd issue is that if I used TDMS viewer the data in this channel is correct but if I probe the channel once I index the output array from the TDMS file the data is erroneous.
This problem is unique to this channel, and when I was using a for loop the graph would essentially merge the results of the previous iteration with the current loop iteration once the data had gone to zero. I've tried breaking it out into individual reads and variations on closing and flushing the tdms file after each iteration to no avail. Similarly, only reading this channel did not alleviate this problem. It occurs on my larger data files (around 25-30 mb) but not on my smaller onces (~2 mb). It's always the same channel and it doesn't matter if I switch the order of file reads, the issue is the same.
Without further ado, some images to show the discrepancy between the TDMS viewer data and the front panel data I need for my reports. I'm running a PC with LabView 8.5, 4 gb of ram on a ~2.1 gHz processor, for what that's worth.
Thanks in advance to anyone that can help me out here!
11-03-2009 10:19 AM
Please show us the code.
I have seen something similar and I learned that the TDMS data is not really writen to disk until the file is closed. If I tried to open a second ref to the file before the first ref was closed the data did not show up.
Don't know if you are doing the same as I but it is at least worth sharing.
Ben
11-03-2009 10:22 AM - edited 11-03-2009 10:28 AM
Since I can only attach 3 things, here are the front panel results corresponding to the first three TDMS viewer images as well as the simplified version of the read VI and the complete write VI (sorry, it's a pretty nasty block diagram).
To clarify, the run-in executable that actually writes the data is run 3 separate times to generate the data that I am attempting to read.
Thanks for the quick reply-let me know what other info might be of benefit.
11-03-2009 11:41 AM
I haven't had a look at your code (no LabVIEW at this computer), but if you read in multiple places you should use multiple open instances as well.
Ton
11-03-2009 11:49 AM
11-03-2009 02:29 PM
Q: Are the files closed prior to the code
executes?
Ben
11-03-2009 02:41 PM
No, they are not. I have tried using TDMS close interchangably with the TDMS flush as shown in that code but with no change in the results. Am I missing the correct implimentation then?
Thanks again for your help.
11-03-2009 02:54 PM
I found the hard way that the data passed to the TDMS file functions does NOT get written to disk unitl the file is closed.
If I open a new reference to a file that I "thought" I wrote too but did not close, the file ref from the new "open" points at a file that has not been written.
In my case I was ONLY able to read data that was "written" before the last time is was closed.
This behaviour makes good sense since it keps the performance up (no need to slow down to write to disk) but is counter to all other file "write" operations I have stumbled across.
Ben
11-03-2009 03:26 PM
I think I follow you and that certainly makes sense, but I guess I'm still trying to figure out how I can get around the issue of the correct data appearing when I use the TDMS viewer but not in the front panel objects. If I am interpreting what you've said correctly, there's not really a way around this issue currently?
Thanks.
11-04-2009 03:01 AM
Sorry, I didn't quite understand the problem. Here are some questions:
1. You said there's a for loop, but I didn't see that in the code. TDMS has such a behavior, if the terminal "group name" is not wired, TDMS will iterator from this group to next group in each iteration of the for loop, can that be a potential reason for this problem?
2. In the code you attached, are you accesing a single file or not?
3. Is that convenient for you to attach the data files? Or would you please make some data files with some not real data values to represent the problem? And then we can try to reproduce it.
Thanks.