dirty_d
10 kW
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.
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
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