05-31-2013 04:41 AM
Hi, i'm working on project. We are doing acquisition during very long time (can be 60 days). I need to log on harddrive the last 2 hours .
In normal condition i need to save 5 minutes every 2 hours . In case of failure i need to save the last 2 hours. (Frequency of acquisition is low 20HZ)
Is it possible to use tdms recording to achieve this . At first i'm thinking to limit sample by file, then extract data from tdms to create new one.
Regards
05-31-2013 05:44 AM
Hello, it seems to me that what you need is some sort of circular buffer 72000 elements long (3600 sec * 2 * 20Hz). TDMS is not the proper instrument to achieve this, since you cannot delete elements from the file once written; I suggest you to keep all data in memory instead, and dump the whole set of data to disk only in case of failure, with a format at your choice.
A good and simple way of storing data in memory for this purpose is to have an 72000-elements array with proper initialization at program start; when you need to record a measure, you can shift all elements by one to the right and store actual measure in element 0: that way your data will be always stored in the array sorted from the most recent backwards with increasing index.