Jump to content
  • 0

MCC172. Continuous scan with python for two channels. Problem for the starting phase


axn

Question

Hello, I use MCC172 along with an accelerometer for data collection. For my problem I use continous_scan.py and save data into .csv files using np.savetxt function. Since I need a sampling rate of 51200, the generated files take lots of space. Thats why I use an external drive as a destination for saving the files. Since it takes time for saving data to an external drive, I pretty often run into a buffer overrun error. I modified the code the way that if this happens, the program starts itself again:

 

        elif read_result.buffer_overrun:
            
            print('\n\nBuffer overrun happened\n')
            
            hat.a_in_scan_stop()
            hat.a_in_scan_cleanup()

            # Turn off IEPE supply
            for channel_number in range(0,num_channels,1):
                hat.iepe_config_write(channel_number, 0)

            
            time.sleep(0.1)
            os.execv(sys.executable,['python'] + sys.argv)

 

The generated data for one channel looks pretty ok, but in the future I will need to use two sensors. For this reason I've decided to test data saving, when data from both channels is read. I tested it on the machine, which can generate the vibration of required amplitude and frequency. My expectations: one channel shows the generated signals from the machine, another one shows randon noise, cause no sensor is attached to it. Basically, after splitting the channels data and looking at it, it seems to be true. However, there is an unusual curve at the starting phases for the channel, to which my sensor is attached. But after around 50000 samples the signal 'converges' and shows true values. What could be the reason for this? Below you can find the screenshot of the case described above. The curve is present at the beginning of every file

 

image.png

image.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello,

The initial high level reading could be a settling time issue caused by turning on IEPE current source. It's best to turn it on at the beginning of your program and leave it on. It's good to add a delay after turning it on so that the input & accelerometer can settle. This should be listed in the accelerometer specifications. 

Best regards,

John

 

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...