LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -201402; how do you programmatically determine 'Samples per file' size

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

 

TDMS snippet.png

CLD, CTD
0 Kudos
Message 1 of 11
(3,798 Views)

Regarding the volume sector size, Get Volume Info is your friend - it'll spit out the sector size in bytes.

 

---
CLA
Message 2 of 11
(3,778 Views)

 

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

 

 

Calc SampPerFile.png

CLD, CTD
0 Kudos
Message 3 of 11
(3,738 Views)

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.

CLD, CTD
0 Kudos
Message 4 of 11
(3,643 Views)

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

0 Kudos
Message 5 of 11
(3,610 Views)

Hi Aran,

 

Could you please repost your code in LV2012, thanks

 

Helen

CLD, CTD
0 Kudos
Message 6 of 11
(3,575 Views)

Here's the 2012 version

 

 

0 Kudos
Message 7 of 11
(3,555 Views)

sorry, but it is still saying its version 13

CLD, CTD
0 Kudos
Message 8 of 11
(3,551 Views)

Ah sorry, I've checked this file in 2012 so hopefully should work okay

 

 

0 Kudos
Message 9 of 11
(3,545 Views)

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

 

CLD, CTD
0 Kudos
Message 10 of 11
(3,537 Views)