1
$\begingroup$

I have some signals in csv taken from an accelerometer. These come from vibration data of gearboxes. acceleration data

With scipy I can easily get its frequency (in terms of acceleration) by applying the RFFT to the oscillogram (I am also using a Hanning Window) frequency domain in terms of acceleration

And by dividing each magnitude point by it corresponding omega (Hz*2Pi) I can get its frequency in terms of velocity (also multiplying by 1000 to get mm/s). frequency domain in terms of velocity

I understand that I can't apply this same procedure to get an oscillogram in terms of velocity instead of acceleration.

Does anybody knows how to do this in python?

(Edited question, and thanks for the input)

$\endgroup$
1
  • $\begingroup$ Please edit your question with clarifications on the following points: "I can easily get its frequency" -- do you mean you can get its amplitude at a given frequency, either by filtering or using the FFT? "I need to calculate the velocity..." do you mean that you need to calculate the velocity in the time domain? The question title certainly implies this -- please confirm. $\endgroup$
    – TimWescott
    Jul 17, 2022 at 20:27

1 Answer 1

1
$\begingroup$

In theory you could just integrate the acceleration to get velocity. Numerically this would just be $$v(n) = \sum_{k=1}^n T_s a(n) + v(0)\ \forall\ n\ge 1 \tag 1,$$ where $T_s$ is the sampling interval ($T_s = 1/F_s$).

Practically, unless your accelerometer is absolutely perfect, and you already know the starting velocity, this result will just get swamped out by the accelerometer's zero-g bias.

Unless you do need to know the velocity down to 0Hz, you need to use a "leaky integrator". I.e., run the difference equation $$v(n) = v(n - 1) + T_s a(n) - b v(n - 1). \tag 2$$

Here, $0 \le b \ll 1$ is a forgetting factor chosen to give you the best estimate of the velocity for your purposes. This will work well either if you don't care about the baseline velocity, or if you have a system that exhibits bounded motion (i.e., something is vibrating).

Note that you can get a similar effect by taking the FFT of the acceleration, multiplying each point by $j \omega$, windowing the FFT with some profile that's zero at $\omega = 0$, and then taking the IFFT. Choose the right window, and you'll get exactly the same answer, possibly with less computation, possibly with more.

$\endgroup$
2
  • $\begingroup$ Thanks @TimWescott, I will try to implement this solution. as best as I can. Right now I am working with excel FFT and its IFFT, It's a little tiresome because the whole method has its tricks, and Excel can only process 4096 value points, but as soon as I can get it fully automated on Python I will share the results... perhaps in another post. $\endgroup$
    – Eduardo
    Jul 21, 2022 at 0:39
  • $\begingroup$ So, you're an engineer forced to work in Excel. How did you open the portal from Hell to talk to us up here? Please tell me that only information can travel through! You'll want to use numpy and scipy -- basically, once you figure out the right function calls to use, they'll make it easy for you. $\endgroup$
    – TimWescott
    Jul 21, 2022 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.