12-21-2010 07:51 PM
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?
12-21-2010 08:30 PM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
12-22-2010 08:32 AM
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.
12-22-2010 08:52 AM
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?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
12-22-2010 09:16 AM
here is my simulation, i make a simulated signal for position and acceleration, any help is greatly appreciated
12-22-2010 09:22 AM
OK, I'll take a look, but not sure when.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
12-22-2010 10:00 AM
The sound and vibration toolkit has proven integration functions.
http://www.ni.com/soundandvibration/software.htm
FYI
12-22-2010 11:34 AM
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
12-22-2010 12:47 PM
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?
12-22-2010 01:03 PM
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