- #1
precisionpete
- 3
- 0
I am designing a dynamometer app for a phone and am having trouble with the math.
The goal is to measure acceleration with the built-in accelerometer then calculate velocity, position, horsepower, etc. It's mostly working but I think I am messing up the units. I get plausible values for velocity and position. But power does not look right. I am filtering the acceleration to remove noise.
I need instantaneous values so they can be plotted over time.
I'm using...
accelerationG[n] = measured (Gs)
accelerationMss[n] = accelerationG[n]*9.8 ... in m/s^2
dt = sample time in s
I am numerically integrating values for...
velocity[n] = velocity[n-1] + (accelerationMss[n-1] + (accelerationMss[n] - accelerationMss[n-1])/2)*dt;
position[n] = position[n-1] + (velocity[n-1] + (velocity[n] - velocity[n-1])/2)*dt;
weight = 1500 ... kg
mass = weight/9.8 .. kg
force = mass*accelerationMss[n]
power = force*velocity[n] ... should be in KW?
In a simulation, I get plausible values for velocity and position but the power number seems very very large. I suspect I am messing up the units.
Can anyone please point out where?
Thanks
The goal is to measure acceleration with the built-in accelerometer then calculate velocity, position, horsepower, etc. It's mostly working but I think I am messing up the units. I get plausible values for velocity and position. But power does not look right. I am filtering the acceleration to remove noise.
I need instantaneous values so they can be plotted over time.
I'm using...
accelerationG[n] = measured (Gs)
accelerationMss[n] = accelerationG[n]*9.8 ... in m/s^2
dt = sample time in s
I am numerically integrating values for...
velocity[n] = velocity[n-1] + (accelerationMss[n-1] + (accelerationMss[n] - accelerationMss[n-1])/2)*dt;
position[n] = position[n-1] + (velocity[n-1] + (velocity[n] - velocity[n-1])/2)*dt;
weight = 1500 ... kg
mass = weight/9.8 .. kg
force = mass*accelerationMss[n]
power = force*velocity[n] ... should be in KW?
In a simulation, I get plausible values for velocity and position but the power number seems very very large. I suspect I am messing up the units.
Can anyone please point out where?
Thanks