05-02-2022 12:27 PM
Hi,
I'm using daqmx logging VIs and was curious when the write actually happens. I have a system that I tested to see what would happen if there were a power failure, I was hoping to see a partial data file. All that is there is the header info. No data at all. I was under the assumption that daqmx streamed the data to file appending with each read. What actually goes on?
05-02-2022 03:01 PM
Below is the help for "DAQmx Start New File". It looks like it logs to file once you collect a number of samples equal to the "Logging.FileWriteSize" property if only logging. Or when you read the data if you have reading enabled.
The DAQmx Start New File function/VI starts a new TDMS file with the specified file name the next time data is written to disk. If the logging mode is set to Log, data is written to disk on multiples of the Logging.FileWriteSize attribute/property. For example, if Logging.FileWriteSize is set to 150 when you use this function/VI, a new TDMS file is created at the next 150 sample interval. If the logging mode is set to Log and Read, data is written to disk when you call the DAQmx Read function/VI.
The Logging.SampsPerFile attribute/property specifies the number of samples to log to a TDMS file before creating a new file. New files are named with the convention of <filename>_####.tdms, where #### starts at 0001 and increments automatically with each new file.
You can set the Logging.FilePath attribute/property while the task is running to change the file path. The change takes place with the next file created. If you change the log name, the numbering of the files resets to 0001. You can also change the directory to save log files to by specifying a name ending in a back slash (for example, D:\). If you specify a directory, the log file name remains the same and file numbering continues off of the old directory. For example, if you change the directory from C:\ to D:\ while logging to testlog_0003.tdms, testlog_0003.tdms is written to C:\, and testlog_0004.tdms is written to D:\.
To change a file immediately, you can also use the DAQmx Start New File function/VI while the Logging.SampsPerFile attribute/property is active.