09-24-2018 01:47 PM
You need to subtract the mean of your integral, not the original mean. See below
mcduff
09-24-2018 04:59 PM
I forgot to add the integral in the last snippet.
There is another way to do this.
If you do the inverse FFT you will still blow up due to a DC signal or low frequency signal, but maybe you can just examine your signal in frequency space.
mcduff
03-10-2021 02:21 PM
I'm intrigued with the FFT path to determine displacement since it should eliminate the issues of DAQ zero drift, and low frequency interference, but I'm not sure how to do it.
I found an article from Liu Qihe (https://iopscience.iop.org/article/10.1088/1742-6596/1345/4/042067/pdf) that describes this but the symbolic math is fairly deep and it's late in the day...I can't focus and convert it to LabVIEW.
mcduff, assuming I have the RMS FFT done (I do; FFT of the raw accelerator voltage, based on examples I found), how can I convert this into displacement? See attached screen shot (note: no scaling done yet...accel data is simulated).
03-10-2021 03:47 PM
@labviewman wrote:
I'm intrigued with the FFT path to determine displacement since it should eliminate the issues of DAQ zero drift, and low frequency interference, but I'm not sure how to do it.
I found an article from Liu Qihe (https://iopscience.iop.org/article/10.1088/1742-6596/1345/4/042067/pdf) that describes this but the symbolic math is fairly deep and it's late in the day...I can't focus and convert it to LabVIEW.
mcduff, assuming I have the RMS FFT done (I do; FFT of the raw accelerator voltage, based on examples I found), how can I convert this into displacement? See attached screen shot (note: no scaling done yet...accel data is simulated).
So, if you have the FFT of the acceleration data point at 1kHz, divide that point by (2 pi 1000)^2, you get the displacement at 1kHz. Do the same for all you other points changing the frequency. When you do the fft you get a "frequency axis". Take these points, multiply each by 2 pi, then square each point; after that divide your FFT amplitude point-by-point with the values you just calculated.
Note this method works well is you a stationary signal at a dominant frequency. If you have many frequencies, then this method may not give you what you want. To get the overall displacement you would need to add all those displacements at specific frequencies together and account for the phases between the frequencies.
Look at the photo. I make my acceleration (Accel) the sum of two sine waves. The only difference between the two cases is a phase difference. Look at the displacement curve (disp). The plot of the FFT magnitude is the same for both cases; that is both cases have the same displacements at their respective frequencies, the phase difference is not accounted for.
mcduff
03-11-2021 02:03 PM
Thanks, that helped!
Took a while for me to realize I needed to work in the correct units. I still have to calculate the overall displacement based on the individual contributions of each frequency considering their phases.
See attached code and screenshots.
03-11-2021 02:20 PM
Need to go to a meeting, so don't have time to look at the code, but think of what you need.
Assume my motor is vibrating at 60Hz; most likely there are odd overtones also at 180, 300 Hz, ...
Using the FFT method at 60 Hz I can say the rms displacement at 60Hz is 0.01mm. The other overtones are so small that I don't care much about them.
Now if I was monitoring a strut on a bridge, the displacement as a function of time may be interesting; that way I can get how much the struct is moving in response to load, wind, etc. The average value is less interesting.
Doing a double integral is not too hard in LabVIEW.
mcduff
03-11-2021 02:39 PM
I used the double-integral method, at least with a clean sine wave, I get the same results as the FFT method. Will see with the actual accel values soon to determine the best method.
03-11-2021 06:16 PM
Your math looks okay to me, you can make the following substitution to simply things a bit
Another trick I like to use is the Power Spectrum VI. No complex numbers, but you need to scale the output for the correct units, like below. (Think I did it right) You still need to only use "half" of the array like in your VI.
mcduff
03-12-2021 12:31 PM
Yep, both suggestions work great 👍
To get overall displacement, how do I sum all the bins together and account for their phases? I've tired several methods but none give an expected result.
03-12-2021 02:19 PM
@labviewman wrote:
Yep, both suggestions work great 👍
To get overall displacement, how do I sum all the bins together and account for their phases? I've tired several methods but none give an expected result.
This is where you need to be careful in defining what you want.
Assume your acceleration is a perfect sine wave, sin[2 pi t].
If you integrate it twice, you get - sin[2 pi t]/(4 pi^2).
At t=0.5 or 1, the instantaneous displacement is 0. The RMS value is 1/(sqrt(2) * 4 pi^2 ). When you take the FFT you essentially "average" over the time period. So how do you convert an average to an instantaneous value? Not easy.
If you want to know the "RMS" over the whole frequency span, no need to do a FFT, just take the rms of the time series, see (https://en.wikipedia.org/wiki/Root_mean_square)
The RMS of the frequency spectrum should give the same answer due to energy conservation, but since we zero out the DC component, it will not match. (Not sure what to do about the DC component.)
So do you want an instantaneous displacement or an average displacement value; that will drive your analysis.
mcduff