Python Forum
Acceleration to velocity
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Acceleration to velocity
#1
Hi,
I want to ask you if I have correct calculation of velocity fom acceleration. It is for vibration analysis.
I have ADXL1005 and I acquire data to buffer with sampling frequency 30000. Acceleration must be from 10 to 1000Hz.
Now I have array in Python and calculation. But I am not sure if this method correct.

def mm_RMS(self):
        accelerationl[0:30000] = read_adxl[0:30000]
        velocity = 0            
        speed_mm = 0
        time_mm = 0
        velocity_tot = []
        lowcut = 10.0
        highcut = 1000.0
        get_mms = butter_bandpass_filter(acceleration, lowcut, highcut, 30000, order=4)
        for i in range(0, 30000):
            velocity = speed_mm + (acceleration[i] * time_mm)
            speed_mm =  velocity
            time_mm = time_mm + 1/30000
            velocity_tot.append(velocity ** 2)
        tot_mm = sum(velocity_tot) 
        tot_mm = tot_mm / 30000
        tot_mm = math.sqrt(tot_mm)
        print("mm/s: " + str(round(tot_mm,2)))   
I am not sure, maybe is much better method. Thanks for any advice.
Reply
#2
If you just want to know the velocity at the end of your sample:
velocity += sum(acceleration) / 30000
Just like you were doing for displacement.

If you want a velocity for each acceleration point, I would use numpy.trapz()

https://numpy.org/doc/stable/reference/g...trapz.html

You could do this again to get a time history of displacement.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020