02-12-2014 03:19 PM
Well, thanks to some great suggestions on a few of my other posts, I'm coming close to getting the TDMS file structure I want for logging my control system's behavior. But now, I've run into a roadblock (again) with how clumsy and ridiculously complicated it is to get an actual true-world timestamp into files and charts. Hoping maybe somebody can point me in the right direction.
I have a user interface with multiple charts, showing the end user how their system is operating. These charts are a "stripchart" variety of display, and are always stacked plots with multiple analog values being displayed on each chart. I have created a basic simulation to approximate the general user interface, so that I can test performance and figure out the TDMS writing without having to run my full program and have it connected to an active cRIO for information gathering. Basically just some random number generation, regular pauses in activity, a rough approximation of what can occur during actual operation. That simulation VI is attached.
Here's my problem: I need to write the TDMS file, which I've mostly figured out. The data will also need to be read back into a program (maybe the same one) and displayed in a similarly configured user interface - back into the familiar stacked plots. This allows the operators (or supervisors) to go back and examine operations, see if there were any issues, etc. My problem is, the timestamps in the TDMS file are that crazy default reference (year 1904), and I need true date/time so that the operators can correlate the stored data with timestamped video of the machine operation. I attached a super-basic reading VI as well, that I started to play with and then got lost. I have seen references of writing a separate timestamp into the TDMS file, but I do not know how to pull that reference back out and use it as my time scale on a chart. I have a feeling I'm just missing an easy way to do this...
Any suggestions or guidance you can give me? Once I have a basic understanding on this simplified test, I can adapt it into my real code.
02-12-2014 08:51 PM
If you want read specific timestamp back you have to write them first. I took a look at your VIs. It writes double to it and tried to read them as waveform. Since you haven't record any date time information while writing, TDMS can only use default timestamp when you read as waveform.
In other words, you should write data as waveform with proper timestamp as start time. Your read VI should not be changed.
02-12-2014 09:32 PM
Ah good, I suspected I was missing something along those lines... My original experimentation with making this data into into waveforms did not turn out well, since it was essentially a point-to-point application. I have a feeling it was just an issue with how I was building the data into waveforms, and I had something incorrectly configured. The stacked plot displays did not play very well with my first attempts, and their accurate display is the most critical piece of my puzzle.
Any tips on properly forming those points into usable waveforms for my TDMS file?
02-19-2014 05:26 PM
Bumping this one again...
I just came back to this issue, and need to figure out a solution quickly. So, I looked at the suggestion on writing my data as a waveform, but can't seem to make it work. As in the simplified testing examples I attached at the beginning of this thread, my data is individual data points being read at regular intervals from a controller (the testing example uses random number generators to simulate that point reading action). Waveform creation VIs expect an array of data to be wired in, not an individual point. And now I'm stuck, so close to a solution! Any help?
02-19-2014 05:50 PM
02-19-2014 11:50 PM
So, if I use the Build Array function and do build those data points into waveforms, apparently I then can't display those on my required stacked graph. But, it may write to my TDMS file correctly (need to test tomorrow), with timestamps on each data channel. Then reading them back from the TDMS file, I have the same problem - if I read them out as waveforms, LabVIEW won't let me display the data in the stacked graph format that is required for this user interface... Per the original testing example VIs that I attached initially.
I appear to be missing some huge (but probably obvious) piece in this entire process, because everyone just seems to throw out the "just make them waveforms" solution when I ask about timestamps, but waveforms and my display methods do not seem to play nice together. Doing something as absolutely basic as having an accurate real timestamp on logged data and displayed on a graph, in a data acquisition program, should not be this difficult!
What am I missing? Anyone?
02-20-2014 08:55 AM
Please forgive me if this seems too basic, but I don't want to miss anything.
Under the hood, LabVIEW timestamps are the number of seconds since midnight, Jan 1, 1904 GMT. They are stored as a 128-bit fixed point number with 64 bits each in the integer and fraction parts. So, if it is set to 0, you get January 1, 1904 (could be Dec 31, 1903 if your timezone has a negative offset from Greenwich Mean Time). This is always a good indicator that a timestamp has not been initialized.
So how do you make sure the timestamp is properly initialized? On your block diagram, there are a couple of options:
How do you store this in TDMS? There are two options:
How do you display your data so it shows up correctly at the right time position on the graph?
This depends upon what type of graph you are using. Waveform Charts will automatically display differences in timestamp. Waveform Graphs ignore timestamp by default. Right click on the graph and unselect the ignore timestamp option.
Let us know if you have further questions.