LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determining position and velocity using an accelerometer

I have a test subject (elevator), and I'd like to use an accelerometer and graph out position v time, velocity v time, acceleration v time. Has anyone ever done this? I am getting stuck on how to obtain my velocity and position when the elevator is at a constant velocity. I tried to use statistical analysis and determine the velocity based on the length of time during acceleration but the timer for max value seemed to keep increasing even when velocity was at zero. Can anyone give me insight on this project?

0 Kudos
Message 1 of 10
(7,191 Views)

Basically, you have to integrate.

 

Acceleration is the derivative of velocity:  dV/dT

 

Velocity is the derivative of position:  dP/dT

 

If what you have is acceleration, you integrate it ONCE to give you velocity, and integrate that result AGAIN to give you position.

 

To make that work, you have to be VERY careful about removing any DC bias in the signal.  integrating any such DC twice will give you very bad errors.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 10
(7,185 Views)

But don't I get an issue with needing to know the integration constants? I set up a test that used an array stating I had a constant acceleration for a given period of time, then 0 acceleration for a given period, and then a negative acceleration. This was so simulate the elevator moving from the ground level to the top floor. 

0 Kudos
Message 3 of 10
(7,161 Views)

Zero acceleration is NOT the same as zero velocity.

 

Zero acceleration just means your velocity is not changing.

 

I set up a test that used an array stating I had a constant acceleration for a given period of time, then 0 acceleration for a given period, and then a negative acceleration. This was so simulate the elevator moving from the ground level to the top floor. 

 

In a simulation, if your +accel is the same magnitude as your - accel, and the +accel time is the same as the -accel time, and if you start from a velocity of 0 and a position of 0, then it seems like your simulation would be correct: the elevator is at rest, it takes off at a certain accel rate until it reaches "cruising speed",it cruises for some time, then decelerates to where velocity = 0, and remains there.  Position is somewhere other than zero.

 

Maybe you can post your simulation code?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 10
(7,153 Views)

here is my simulation, i make a simulated signal for position and acceleration, any help is greatly appreciated 

0 Kudos
Message 5 of 10
(7,147 Views)

OK, I'll take a look, but not sure when.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 10
(7,141 Views)

The sound and vibration toolkit has proven integration functions.

http://www.ni.com/soundandvibration/software.htm

FYI

 

Preston Johnson
Solutions Manager, Industrial IoT: Condition Monitoring and Predictive Analytics
cbt
512 431 2371
preston.johnson@cbtechinc
0 Kudos
Message 7 of 10
(7,132 Views)

Eli,

 

I think a major problem with your integration is that you are only integrating one point at a time!  The conversion of dynamic data to an array results in an array with only one element.  Integrating a single point is rather meaningless, although it is interesting that the Integral VI does not return an error.

 

If LV 8.2 has them, you might try the integral Point-by-Point VI.  If that was not available in your version, you will need to accumulate points in an array by using a shift register.  Initializing an array to the final size and then using Replace Array Element is much more efficient than using Build Array because of the frequent memory reallocations required by the latter approach.

 

Lynn

0 Kudos
Message 8 of 10
(7,121 Views)

So i got the integration to work once, but when i double integrate I get a constant, which I know is incorrect. How come when its running, the xscale on velocity keeps increasing, shouldnt it stop at the same time as my initial signal?

0 Kudos
Message 9 of 10
(7,107 Views)

You have a chart for the velocity.  A chart has an internal buffer which accumulates points (up to the Chart Length).  If you put a probe or an indicator (array of numeric) on the DBL Array line coming out of the Dynamic Data Type to Array converter, you will see that it contains only one element on each iteration.

 

Running with Highlight Execution (the Light bulb on the block diagram toolbar) turned on will also show you how much data is present on those lines.

 

Lynn

0 Kudos
Message 10 of 10
(7,103 Views)