I try in real time to estimate CdA (= the coefficient of air resistance times the reference area) and the coefficient of rollign resistance, when driving a bicycle straight ahead on an asphalt road in calm weather, and not pedalling.
There is an Arduino microprocessor connected to a magnetic pulse sensor (reed switch) in the front wheel of the bicycle, giving the time, when the front edge of the magnet passes the sensor. Once for each revolution of the wheel. The time resolution is in e.g. one microsecond or better.
In a test drive I have got an ascending series of time measurements in consequtive wheel revolutions, expressed in seconds, with the resolution of one microsecond, e.g.:
t0, t1, t2, t3 (time measurements 1)
The time intervals are differences of the above measurements.
The travelling distance sr during one wheel revolution is assumed to be known, in meters, with sufficient accuracy:
sr (distance measurement of one revolution 2)
Assume that the forces to be considered are described with the equation:
F = m * a = -(my +sin(alpha)) * m * g - CdA * rho * (v ^2) /2 (equation 1)
where
F = total force affecting the rider and the bicycle (in newtons)
m = total mass of the rider and the bicycle (in kilograms, eg. 100.0 kg)
a = acceleration (in meters per second ^2)
my = UNKNOWN coefficient of rolling resistance (dimensionless , e.g. 0.01)
alpha = the angle of the road, going up is positive (in radians)
g = acceleration of the gravity at the location (e.g. 9.81 m/s^2)
CdA = UNKNOWN coefficient (in square meters)
rho = density of the air (in kg/m^3, e.g. 1.23 kg/m^3)
v = velocity of the bicycle (in m/s)
Divide the equation (1) by m and for simplicity's sake introduce UNKNOWN variables A and B:
A = -(my + sin(alpha)) * g (equation 2)
The unit of A is m/s^2
B = -CdA * rho / (2 * m) (equation 3)
The unit of B is 1/meter
a = A + B * v^2 (equation 4)
dv/dt = A + B * v^2
dt = (1/ ( A + B * v^2)) dv (equation 5)
Let us consider only the case where A and B are both strictly negative, the bicycle is decelerating on a level or uphill road. The equation 5 can be integrated symbolically.
So we get time t as a function of v, A and B, and integration constant Ct :
t = (-1/sqrt(A*B)) * atan(sqrt(B/A) * v) + Ct (equation 6)
Set v = v0 at time t = 0 and solve Ct:
Ct = (1/sqrt(A*B)) * atan(sqrt(B/A) * v0) (equation 7)
Ct gives the time in seconds to a complete stop from the initial speed of v0. Ct >=0.
From the above equations 6 and 7 we calculate velocity v as a function of time t and parameters A and B:
v = sqrt(A/B) * tan(sqrt(A*B) *( Ct - t)) (equation 8)
Assume s is the distance travelled (not speed!). Then
ds/dt = v
Integrating both sides we get:
s + Cs = (1/B) * ln(cos (sqrt(A*B)* (Ct - t))) (equation 9)
Set s= 0 at t=0 above to calculatae Cs:
Cs = (1/B) * ln(cos (sqrt(A*B) * Ct )) (equation 10)
Cs is the distance in meters travelled from the initial speed of v0 to the complete stop. Cs >= 0, because B <0.
From the above we can get the formulas for all 12 the functions between time t, distance s, velocity v, acceleration a. The formulas have A and B as unknown parameters. They contain also the initial speed v0.
Now finally my question:
How to calculate accurately A and B, when few (3 or 4) time and distance measurement pairs (t0, 0*sr), (t1,1*sr),(t2, 2*sr), ... are known?
When I substitute each of the measurement pairs to the equations 9 and 10 in turn, the nonlinear equation group with unknown variables A and B seems too difficult for me to solve symbolically. Or can you give a hint how to solve it?
Newton's gradient method ("the steepest ascent") is an option to solve the problem numerically, but that might be an awkward method and overkill, if there is a more elegant method. Is there? If yes, where to find it?
---
I have compared this to a simpler problem:
acceleration = dv/dt = A = constant (equation 11)
(compare that with equation 4, if assuming B = 0)
which leads to:
a * t^2 /2 + v0 * t + s0 = s (equation 12)
One can substitute 3 time and distance measurement pairs to equation 12 and solve the resulting linear equations with Gauss method accurately to get acceleration a and velocity v at the measured points in time t0, t1, t2.
Input data (t0, 0*sr), (t1, 1*sr), (t2, 2*sr) were generated programmatically with microsecond and micrometer precision using the equation 12. Then parameter A was
solved with Gauss method. The numerical results were satisfactory.
---
When I approximate momentaneous speed and acceleration at t0, t1, t2 using the average speed and acceleration during time intervals [t0, t1], [t1, t2] or [t0, t2] I get too much error in A and B. Therefore, I am searching a symbolical or otherwise accurate method to calculate A and B.
If a method to calculate parameters A and B from a short sample set of time values is found, the method is applied to new sample sets in the microprocessor to continuously filter and update those parameters during bicycle riding and show them on the display.
I hava a feeling that there might be a simple and elegant approach to solve this common problem, but in spite of ample searching I could not find such.
If more information is needed I am happy to try to provide it promptly. Thanks in advance.
There is an Arduino microprocessor connected to a magnetic pulse sensor (reed switch) in the front wheel of the bicycle, giving the time, when the front edge of the magnet passes the sensor. Once for each revolution of the wheel. The time resolution is in e.g. one microsecond or better.
In a test drive I have got an ascending series of time measurements in consequtive wheel revolutions, expressed in seconds, with the resolution of one microsecond, e.g.:
t0, t1, t2, t3 (time measurements 1)
The time intervals are differences of the above measurements.
The travelling distance sr during one wheel revolution is assumed to be known, in meters, with sufficient accuracy:
sr (distance measurement of one revolution 2)
Assume that the forces to be considered are described with the equation:
F = m * a = -(my +sin(alpha)) * m * g - CdA * rho * (v ^2) /2 (equation 1)
where
F = total force affecting the rider and the bicycle (in newtons)
m = total mass of the rider and the bicycle (in kilograms, eg. 100.0 kg)
a = acceleration (in meters per second ^2)
my = UNKNOWN coefficient of rolling resistance (dimensionless , e.g. 0.01)
alpha = the angle of the road, going up is positive (in radians)
g = acceleration of the gravity at the location (e.g. 9.81 m/s^2)
CdA = UNKNOWN coefficient (in square meters)
rho = density of the air (in kg/m^3, e.g. 1.23 kg/m^3)
v = velocity of the bicycle (in m/s)
Divide the equation (1) by m and for simplicity's sake introduce UNKNOWN variables A and B:
A = -(my + sin(alpha)) * g (equation 2)
The unit of A is m/s^2
B = -CdA * rho / (2 * m) (equation 3)
The unit of B is 1/meter
a = A + B * v^2 (equation 4)
dv/dt = A + B * v^2
dt = (1/ ( A + B * v^2)) dv (equation 5)
Let us consider only the case where A and B are both strictly negative, the bicycle is decelerating on a level or uphill road. The equation 5 can be integrated symbolically.
So we get time t as a function of v, A and B, and integration constant Ct :
t = (-1/sqrt(A*B)) * atan(sqrt(B/A) * v) + Ct (equation 6)
Set v = v0 at time t = 0 and solve Ct:
Ct = (1/sqrt(A*B)) * atan(sqrt(B/A) * v0) (equation 7)
Ct gives the time in seconds to a complete stop from the initial speed of v0. Ct >=0.
From the above equations 6 and 7 we calculate velocity v as a function of time t and parameters A and B:
v = sqrt(A/B) * tan(sqrt(A*B) *( Ct - t)) (equation 8)
Assume s is the distance travelled (not speed!). Then
ds/dt = v
Integrating both sides we get:
s + Cs = (1/B) * ln(cos (sqrt(A*B)* (Ct - t))) (equation 9)
Set s= 0 at t=0 above to calculatae Cs:
Cs = (1/B) * ln(cos (sqrt(A*B) * Ct )) (equation 10)
Cs is the distance in meters travelled from the initial speed of v0 to the complete stop. Cs >= 0, because B <0.
From the above we can get the formulas for all 12 the functions between time t, distance s, velocity v, acceleration a. The formulas have A and B as unknown parameters. They contain also the initial speed v0.
Now finally my question:
How to calculate accurately A and B, when few (3 or 4) time and distance measurement pairs (t0, 0*sr), (t1,1*sr),(t2, 2*sr), ... are known?
When I substitute each of the measurement pairs to the equations 9 and 10 in turn, the nonlinear equation group with unknown variables A and B seems too difficult for me to solve symbolically. Or can you give a hint how to solve it?
Newton's gradient method ("the steepest ascent") is an option to solve the problem numerically, but that might be an awkward method and overkill, if there is a more elegant method. Is there? If yes, where to find it?
---
I have compared this to a simpler problem:
acceleration = dv/dt = A = constant (equation 11)
(compare that with equation 4, if assuming B = 0)
which leads to:
a * t^2 /2 + v0 * t + s0 = s (equation 12)
One can substitute 3 time and distance measurement pairs to equation 12 and solve the resulting linear equations with Gauss method accurately to get acceleration a and velocity v at the measured points in time t0, t1, t2.
Input data (t0, 0*sr), (t1, 1*sr), (t2, 2*sr) were generated programmatically with microsecond and micrometer precision using the equation 12. Then parameter A was
solved with Gauss method. The numerical results were satisfactory.
---
When I approximate momentaneous speed and acceleration at t0, t1, t2 using the average speed and acceleration during time intervals [t0, t1], [t1, t2] or [t0, t2] I get too much error in A and B. Therefore, I am searching a symbolical or otherwise accurate method to calculate A and B.
If a method to calculate parameters A and B from a short sample set of time values is found, the method is applied to new sample sets in the microprocessor to continuously filter and update those parameters during bicycle riding and show them on the display.
I hava a feeling that there might be a simple and elegant approach to solve this common problem, but in spite of ample searching I could not find such.
If more information is needed I am happy to try to provide it promptly. Thanks in advance.
Last edited: