Jump to content
  • 0

How to avoid Buffer Overun


Samuel Alpha Gian

Question

Hello everyone

I am currently using a setup that includes two MCC 172 boards and one MCC 128 board. The MCC 128 is set to differential mode with a scan rate of 5,000, and the MCC 172 boards are configured with a scan rate of 50,000. Despite this configuration, I am experiencing frequent buffer overruns.

Could you please provide guidance on how to effectively manage and configure these boards to prevent buffer overruns? I am particularly interested in any recommended settings or adjustments that would allow continuous data recording and storage on an SD card without losing data integrity due to these overruns.

Thank you for your assistance.

Samuel Alpha Gian
 

code :
 

   ch = [1, 2, 3, 4, 5, 6, 7, 8]

    channels = [0, 1]

    channel_mask = chan_list_to_mask(channels)

    channels_128 = [0, 1, 2, 3]

    channel_mask_128 = chan_list_to_mask(channels_128)

    samples_per_channel = 0

    options = OptionFlags.CONTINUOUS

 

    #Einstellung

    scan_rate_172 = 50000.0

    scan_rate_128 = 5000.0

    read_request_size_172 = int(scan_rate_172 * 0.01)  # Increase this value to read more data in each call

    read_request_size_128 = int(scan_rate_128 * 0.01)  # Increase this value to read more data in each call

    sensitivity_ch1 = 10.99 * sqrt(2) #board 0 ch 0 in mV/ms^-2

    sensitivity_ch2 = 10.75 * sqrt(2) #board 0 ch 1 in mV/ms^-2

    sensitivity_ch3 = 10.55 * sqrt(2) #board 1 ch 0 in mV/ms^-2

    sensitivity_ch4 = 37.0  * sqrt(2) #board 1 ch 1 in mV/ms^-2

    duration = 600 #in seconds (maximum 600 seconds for 1 GB file size)

    iepe_enable = 1

   

    #Einstellung MCC_128

    input_mode = AnalogInputMode.SE

    input_range = AnalogInputRange.BIP_10V

 

hat0.a_in_scan_start(channel_mask, samples_per_channel, options)

        hat1.a_in_scan_start(channel_mask, samples_per_channel, options)

        hat_128.a_in_scan_start(channel_mask_128, samples_per_channel, scan_rate_128, options)  

        start_time = time.time()

       

        while time.time() - start_time <= duration:

            read_result0 = hat0.a_in_scan_read_numpy(read_request_size_172, timeout)

            read_result1 = hat1.a_in_scan_read_numpy(read_request_size_172, timeout)

            read_result_128 = hat_128.a_in_scan_read_numpy(read_request_size_128, timeout)

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Make samples_per_channel so that the buffer can hold at least one second of data. For a scan rate of 50,000 Hz, size it for two seconds of data. 

samples_per_channel_172 = scan_rate_172 * 2

samples_per_channel_128 = scan_rate_128 * 2

use a_in_clock_config_write to set the sample rate. Use a_in_scan_actual_rate to get the closest achievable rate. For example, 2000 Hz is not valid for the 172, but 2048 is.

https://mccdaq.github.io/daqhats/python.html#daqhats.mcc172.a_in_scan_actual_rate

https://mccdaq.github.io/daqhats/python.html#daqhats.mcc128.a_in_scan_actual_rate

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...