01-29-2014 05:58 AM - edited 01-29-2014 06:02 AM
Error -201402 - The samples per file is not divisible by the file write size. The error also give a suggested value to use, which is helpful, and i have amended by code to suit this value.
I am writting to a tdms file in chunks, such as the first 2.5-5 seconds save the data (sampled at 1M samples per second per channel) to tdms files named initial.tdms, initial_0001.tdms (need to be able to split the files due large data size) then capture the remainder, such as 150 seconds of data (sampled at 1000 samples per second per channel) into a single file, remainder.tdms
Example Inputs to the vi will be:
Initial sampling rate = 1M
Initial acquire time = 2.5 seconds
Remainder sampling rate = 1000
Remainder acquire time = 150 seconds
What I want is to be able to programmatically set Logging.SampPerFile and maybe Logging.FileWriteSize to improve maintainablility and code reuse (I have a number of difference sequence patterns to generate/ capture.)
I am also developing this code on a debug system which may have a different hard drive volume sector size so need to be able to derive the FileWriteSize based on this value, but don't know how to get/view this hard drive info.
How do I go about this?
Cheers,
Helen
01-29-2014 06:55 AM
Regarding the volume sector size, Get Volume Info is your friend - it'll spit out the sector size in bytes.
01-30-2014 08:26 AM
Thank you for your help.
The Get Volume Info does indeed give me the Sector Size, however i still had problems with working out what multiple of the sector size to use.
Based on "Samples per file - must be EVENLY divisible by the file write size" and "File write size - must be EVENLY divisible by the sector size" I have derived te following code snippet which ensures that the calculated SampPerFile is divisible by 4 (2 lots of evenly divisble by).
Whilst this appears to work I wonder if anyone could comment/ suggest any pitfalls etc.
Regards,
Helen
04-07-2014 08:42 AM
Um, code fell over, I got the same error : requested SampsPerFile 3833856; suggested SampsPerFile 4376064 for Sampling Rate of 1M and AcquireTime of 45.
Do I also need to specify Logging.FileWriteSize and if so what are suitable values to use (other than being divisible by the file sector size)?
Hoping that someone can help me here, thanks.
04-08-2014 02:22 PM
Hi Helen,
I've had a go at creating an example for DAQmx file writes to TDMS
In the code you can configure the rate and duration you want to measure for and how many files you want to divide your information into.
I haven't tested it thoroughly, but running it with a simulated device at 1M for 45seconds seems to work
04-13-2014 02:21 AM
Hi Aran,
Could you please repost your code in LV2012, thanks
Helen
04-14-2014 02:41 AM
Here's the 2012 version
04-14-2014 03:03 AM
sorry, but it is still saying its version 13
04-14-2014 03:41 AM
Ah sorry, I've checked this file in 2012 so hopefully should work okay
04-14-2014 05:10 AM
Hi Aran,
The file opened in LV2012 fine, however it fell over with: Acquisition of 8 seconds, No if files = 2, Acq rate 1M with the
error -201383,
Possible reason(s):
The file write size specified is too large. Performance can suffer if the file write size is larger than one-fourth the size of the buffer length.
Task Name: _unnamedTask<4>
Input buffer increased to 16001000 with File Write at 4000260.
I noticed a bug in my original code and fixed this, so my code is working for the inputs that i currently need, however i think that i need to change the maximum samples per file permissible from 4M. Do you know what the maximum size is? I only want to split into more than one file if the data per channel is over this maximum limit.
Cheers,
Helen