LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acceleration data to dispalcement data

Solved!
Go to solution

Hi,
I have a data set of acceleration gathered from a triaxial accelerometer and was wondering if it is possible to convert it into displacement data. I have attached the acceleration data and some different codes to convert acceleration from a sensor into displacement. I need to combine the two ideas into one that can read the separate acceleration data and output displacement in each axis. 

Thanks in advance,
Wes

0 Kudos
Message 1 of 25
(7,575 Views)

Hi Wes,

 

Yes it is possible, acceleration is the second derivative of position. Integrate once and you get the velocity, the constant term will be the initial velocity which you must know beforehand. Integrate again and you will get position, the constant term will be the initial position, which you can set to zero since you are only interested in displacement; the current position minus the initial position.

0 Kudos
Message 2 of 25
(7,551 Views)

In order to get real values, ie, ones that make sense let's make some assumptions.

 

  1. You have an accelerometer mounted to a piece of equipment.
  2. The equipment is NOT moving away/towards you with a constant velocity.
  3. For your integration not to blow up, do the following:
    1. You can remove the mean from the acceleration data, such that Mean[data] =0
    2. In addition, low-pass filter your data with a cutoff of 5-10Hz
  4. You may need to repeat these steps in between each integration.

Why. A constant/offset in your data will blow up in the integration, same applies for a low frequency drift.

 

mcduff

Message 3 of 25
(7,549 Views)

Hi mcduff,


For your assumptions:

1. The accelerometer is mounted to a piece of equipment and the excel file I attached to the first post is an example of a set retrieved from it. (the accelerometers are used to collect the acceleration of the vibrating machine).

2. The equipment is NOT moving at a constant velocity.
 and 3. and 4. I will add those to the calculations.

My main question is how to transfer the excel column data into labview and then integrate each column data point and record the output data as a txt file with the same 3 column layout? If you have any ideas for this it would help greatly.
Thanks,
Wes

0 Kudos
Message 4 of 25
(7,542 Views)

Two ways to get your data:

 

  1. Do you have the Report Generation Toolkit? I believe there are VIs in there to import data from Excel. (Do not recommend)
  2. Export your data from Excel to a CSV text file, there is a Read Delimited Spreadsheet VI that you can use to read your data. (Recommend)

Read Delimited Spreadsheet VIRead Delimited Spreadsheet VI

Try it yourself first and post back what problems you are having.

 

mcduff

0 Kudos
Message 5 of 25
(7,538 Views)

I have been able to get the acceleration data from the txt file to be plotted but my integration parts are not correct. I have attached the code so far and an example dataset with time, x, y, z. If you know how to help with the integration of each that would help. 

Thanks,
Wes

Download All
0 Kudos
Message 6 of 25
(7,515 Views)

Try Subtracting the mean from your data.

 

Look at you acceleration data, it is offset from 0. What does that imply? If your reading is correct that means your device has a constant acceleration in one direction. Is this measurement in a vehicle that is constantly accelerating? If not, remove the offset from your data by subtracting the mean. You may also need to low pass filter your data. Since your data has a 0.5Hz Bandwidth, you may need to set you low-pass filter to .2Hz or something along those lines. I did not see those added calculations to you data, as you said you add in an earlier post.

Snap1.png

 

mcduff

0 Kudos
Message 7 of 25
(7,497 Views)

I have added subtracting the mean from the data and low pass filtering. The acc. and vel. graphs look like they are correct but the displacement graph does not. Do you have any idea how to correct this?

Thanks for the help,
Wes

Download All
0 Kudos
Message 8 of 25
(7,485 Views)

Reread my reply in Message 3. You may have to rinse and repeat in-between an  integration.

 

I used the original text file along with your new VI to generate the following:

Snap2.png

 

 

Look at the FFTs above. After filtering, subtracting the mean, your DC is gone. Look at the FFT after the first integration, notice a peak at 0 Hz, try to remove it as you did previously.

 

mcduff

0 Kudos
Message 9 of 25
(7,477 Views)

I've added the filter and mean subtraction to each pass and the results are similar to before.

Do you have any other recommendations to help fix this?

Thanks,
Wes 

0 Kudos
Message 10 of 25
(7,468 Views)