torque, drag, and acceleration

dirty_d

10 kW
Joined
Jun 16, 2007
Messages
985
Location
Massachusetts
I was just messing around with this graphing program to see how drag and acceleration changes with velocity, its all pretty simple acceleration = force / mass, on a bike forward force is rear wheel torque divided by wheel radius, the equation for calculating drag i found on some NASA site about rockets, i got my body and bikes coefficient of drag from that bike power/speed calculator. the only thing i cant figure out is how to graph speed in relation to time id like to have the second x axis be time and another line to represent speed, i cant think of a single formula to do it. i know i could save the plot data to a file and make a program to iterate through each point on the acceleration curve and do the math for each point since the speed is dependent on all the past values for acceleration, but thats all a pain in the ass. so here it is.
Code:
#motor specific stuff
Vmax = 48.0 #operating voltage
R = .3 #winding resistance
K = .1145 #speed/torque constant(voltage / no-load speed(rad/sec))
Inl = 1.5 #no-load current draw
Imax = 170.0

#bike specific stuff
wheel_radius = .33 #meters
gear_ratio = 10.0
mass = 113.0 #(kg)
CwA = 0.51 #coefficient of drag times frontal area
Nw = 0.95 #motor to wheel power efficiency
P = 1.2 #air density (kg/m^3) 1.1 approx at 20C 1BAR

C = (P * .5) * CwA # this will be constant for all velocities(C * velocity^2 = drag-force)
Wnl = Vmax / K
Rm = R / (K * K)
Is = Vmax / R <Imax> 100 ? Imax : 100 + 10] #to give a little more room
set xrange [0:x1]
set y2range [0:1000] #to give a little more room
set ytics nomirror
set xtics nomirror
set y2tics 0, 100
set ytics 0, 10

Ia(x) = ((Vmax - K * x) / R < Imax ? (Vmax - K * x) / R : Imax) #perfect motor current
I(x) = Ia(x) + (Inl - Ia(x)  / Imax * Inl ) #account for no-load current
V(x) = I(x) * R + K * x 
T(x) = I(x) * K
P(x) = T(x) * x
Tw(x) = T(x) * gear_ratio
Vel(x) = (x / gear_ratio / (2.0 * 3.14159)) * (wheel_radius * 2 * 3.14159) * 3600.0 / 1000.0 #rads/sec to km/h
MS(x) = x * 1000.0 / 3600.0 # km/h to m/sec
N(x) = (1.0 - (Inl / I(x))) * (1.0 - (I(x) / (V(x) / R)))
F(x) = Tw(x) / wheel_radius #force on bike
D(x) = C * (MS(Vel(x)) * MS(Vel(x)))
A(x) = (F(x) - D(x)) / mass

set x2range [0:Vel(x1)]
set x2tics 0, 5
set x2label "Velocity km/h"

plot  \
N(x) * 100 axis x1y1 title "Motor Efficiency", \
F(x) axis x1y2 title "forward Force", \
A(x) * 10 axis x1y1 title "Acceleration", \
D(x) axis x1y1 title "Drag"

it all seems to work almost perfectly as the place where acceleration turns to 0 is very close to my top speed, if i just factor in drive train efficiency it should be right on, its only about 1 or 2 MPH off
 

Attachments

  • accel.jpg
    accel.jpg
    32.7 KB · Views: 2,448
Velocity is the integral of the acceleration vs. time curve. You have already created a chart which gives you the acceleration for any given velocity, so you can start at t = 0 s, v(0 s) = 0 m/s and step through at small time increments and calculate the area under the acceleration-time curve for each time increment. For best results use small time increments.

So lets say we use 0.1s increments. At t=0, a=4.95 m/s^2 so at t=0.1s, v(0.1s) = 0.495 m/s. Use this v to look up the next a = 4.83 m/s^2) so the next increment of velocity is v(0.2s) = 0.495+0.483 = 0.978 m/s. Continue to increment untill you have an accelleration chart built for however many seconds you are interested in.

Obviously I'm making up my numbers, but you have the values from your chart, so you can plug the right numbers in.

I hope the explanation makes sense. Hopefully I'm not shooting below the audience. Forgive me if you already knew all this from your Newtonian physics or calculus class. I don't do Differential Equations, so I'm not about to try to come up with a closed-form solution based on your data.

-Mike.
 
:arrow: The funny thing is that I was a programmer for years and yet I have been using spreadsheets to do all my bike modeling. That graphing program is really nice... the results look fantastic compared to the really lame spreadsheet charts. I'm not sure if I'd jump ship to the "pure" formulaic approach after having refined what have in the spreadsheet format, but it's good to see alternatives.

In the spreadsheet you can deal with many issues by directly linking them together on a cell by cell basis. Often I'll do things like take a calculated result (for maybe watts being consumed in a particular gear on a particular slope) and then apply that elsewhere to get something like the estimated range for those conditions. The spreadsheet is most powerful running quick "what if" scenarios. I can even see how battery pack configurations effect results... so the spreadsheet has it's plusses...
 
OneEye, no theres no drive train efficiency factored in yet, i figured id just get everything working first, i know how to calculate the velocity in relation to time, jut not with this graphing program it doesn't really have a way to use loops like in traditional programming languages.
 
Fair enough, I figured I might have missed the audience.
It seems like you would have to add a user defined function that can loop to perform a step-wise integral. Otherwise, spit the data somewhere you can let a different program do something a little more useful with it (safe suggests a spreadsheet).

Sorry to have wasted your time. I hope you find something that works for you.
 
Your acceleration curve appears to be almost liner. If you simply curve fit a straight line, you could then solve a 1st order differential equation for velocity you could plot.
 
dirty_d said:
whats that mean in English :?:

Math is a language that simply doesn't translate into any other very well.
 
oops, typo: L-I-N-E-A-R, not liner.

So the acceleration vs. velocity is almost a straight line. Calculate the linear approximation of acceleration as a function of velocity. Use this in a first-order, non-homogeneous differential equation and solve for velocity in terms of time.

http://www.physics.ohio-state.edu/~physedu/mapletutorial/tutorials/diff_eqs/non_homo.htm

The MIT online lectures might also be a good place to learn this stuff.

I want to say you solve the homogeneous version of the equation first, and then add something to the solution to get the non-homogeneous part, but that might be from second-order equations. I forget.

Differential Equations is usually one of the gatekeeper (weeder) courses for math/physics/engineering majors. It makes many sophomores or juniors choose a different direction in life. I almost had to cheat to pass my DiffEq's course, and I still don't remember a lick of it, so unfortunately I cannot offer any more assistance. Before that class I thought I was pretty good at math; DiffEq's was my ceiling.

Good luck!
 
It might be easier to just go here:

http://www.ajdesigner.com/index_physics.php

You should be able to solve for just about anything based on those equations. I know that in a spreadsheet it was a little difficult to figure out things like acceleration and velocity until I looked at the Impulse Momentum Equations and it became really easy all of a sudden. (since you can solve problems in discrete units using "impulses") Sometimes a simple reminder is all it takes to remember what to do.

K.I.S.S... as they say... :roll:
 
Alright, lets continue with the (somewhat inaccurate) assumption that the curve in your chart showing acceleration vs. speed is a linear (straight-line) relationship.

Two points define any line. For convenience, simply take the maximum acceleration (at v = 0) and call it a_max, and the maximum velocity (at a=0) and call it v_max.

Using the classic slope/intercept formulation of a line, your velocity / acceleration equation takes the form:

a(t) = mv(t) + c

where c = a_max, and m = - a_max / v_max

From Newton, we know:
a(t) = v'(t)

Rearrange the terms and substitute with arbitrary constants, you get:

v'(t) + A v(t) + B = 0

This is a classical first-order non-homogeneous differential equation, with a simple solution.

After some manipulation, you can find the following solution which satisfies the original equation and has v(0) = 0 and a(0) = a_max

v(t) = -v_max * e^(-a_max/v_max * t) + v_max
a(t) = a_max * e^(-a_max/v_max * t)

This SHOULD lead to a slightly conservative estimate of your velocity at any given time during the acceleration, as the actual acceleration/velocity curve is slightly convex, so the acceleration is always _slightly_ higher than the predicted straight-line relationship.

Please be careful and use consistent units for v_max and a_max (m/s and m/s^2 are consistent, km/h and m/s^2 are not.)

Use at your own risk. Any errors in the preceding math that accelerate you beyond the speed of light and obliterate you from existence are par for the course in my math derivations (I always manage to get a factor of -1 out of place somewhere).

-Mike
 
I suspect dirty_d figured it out already and no longer needs advice... but in general the equations that are required to describe motion are pretty simple and really don't require a lot of math.

The most difficult math that I've needed in all the study I've done here on electric bikes was when I solved the formula for a standard BCL (battery current limited) controller. To do that it required that I was able to get it in terms of duty cycle (something I wanted) and that meant having to solve a quadratic equation. Other than that I've modeled everything using simple math. Probably the majority of it could be understood in high school by an average student... well... a "bright student" maybe, but still he wouldn't have to be a genius... :wink:
 
Whether he wants it or not I posted to satisfy my own curiosity. The problem was bugging me because I knew it had a fairly simple closed-form solution. I took from dirty_d's "in English?" post he might still be interested in a simple formula. The final v(t) and a(t) equations are not complicated, the rest can simply be ignored.

The biggest problem with this closed-form solution is it doesn't model the more complex relationship between acceleration and velocity that is a result of the interaction between the efficiency and drag curves. An iterative solution would be the simplest if one wanted to model the relationship better. With all the simplifications already inherent in the charts I figured one more wouldn't hurt.

-Mike
 
Back
Top