apopt.comCBE 493R Data-Driven Athletics

Course / Tutorials / Week 6 / Q-41

Quick tutorial Q-41 · Week 3 and 6 and 11 · about 20 min · Core

Drag and rolling resistance from a cycling-simulator export

Ride an exertion-step scenario in the cycling simulator, export the CSV, and fit the rider's drag area and rolling resistance from power and speed by least squares, then check them against the values the simulator used.

  1. 1Gather (used)
  2. 2Statistics
  3. 3Visualize (used)
  4. 4Cleanse
  5. 5Features (used)
  6. 6Balance
  7. 7Scale
  8. 8Split
  9. 9Deploy
  1. Ask
  2. Collect (this week)
  3. Check (this week)
  4. Interpret (this week)
  5. Coach (this week)
  6. Reassess

Every cell runs in this page; the first run downloads Python (about 30 s). Nothing you load leaves your browser. Helpful first: Q-5 Fit a straight line and read the slope's units, Q-40 Export a run from the running simulator and read it.

The decision

A rider wants to know whether a lower position is worth learning. That needs their drag area, which a power meter and a speed sensor can estimate on a level road. The simulator lets you check the estimate against the value it used.

The raw data

Try it

A road you can ride in a browser

The cycling simulator puts a modeled rider on a road bicycle. You set the exertion; the model answers with crank power, cadence, gear, speed, heart rate, lactate and an anaerobic reserve, once a second. Its Export CSV button writes every logged second to a file.

This file comes from scenario 2 · Exertion steps, and the step that fades: on a level road with no wind, exertion steps to 30, 55, 70 and 85% and back to 30%. It runs for 25 minutes. Every number is simulated.

Section 3.8 says the road and the air take back the power the rider supplies. At the wheel, force = power / speed, and on level ground that force goes to three places:

F = Crr·m·g + ½·ρ·CdA·v² + m·a

rolling resistance (coefficient Crr), air drag (drag area CdA, air density ρ) and speeding up (mass m times acceleration a). Your job: estimate Crr and CdA from power and speed alone, as you would from a real power meter, then compare them with the values the simulator used. The export carries those too, in its param_… columns, which no real ride gives you.

To make the file yourself: open the simulator, choose that scenario, press Run, let it pass 25 minutes, and press Export CSV.

PythonOpen the export and keep the columns the force balance needs

Type a prediction to enable Run.

Show the expected result without running
1501 rows, 134 columns; rider and bicycle 83.5 kg
grade 0 to 0 %, headwind 0 m/s
the truth to check against: CdA 0.32 m2, Crr 0.0045

The road is level and still, so the grade and wind terms drop out. Some numbers the force balance needs are not in the file. The simulator's Show Model dialog lists them on its Parameters tab: the drivetrain passes 97.5% of the crank power to the wheel, air density is 1.20 kg/m³, and the wheels (0.335 m radius, 0.14 kg·m² of rotational inertia) add a little to the mass that has to be sped up. Write such constants down when you export; a file that leaves them out is a common fault in real data too.

PythonPower and speed through the ride

Show the expected result without running
   4-5 min:    89 W,  24.5 km/h
   9-10 min:   164 W,  31.2 km/h
  14-15 min:   206 W,  34.2 km/h
  24-25 min:    85 W,  24.1 km/h
Two stacked panels against minutes, 0 to 25. Top, measured crank power steps to about 89, 164 and 206 watts, spikes to about 465 at 15 minutes and fades to about 215, then drops to about 85 at 19 minutes. Bottom, speed rises in steps to about 24, 31 and 34 km/h, peaks near 44 km/h after the 85% step, eases to about 35 and falls back to about 24.

Speed takes a minute or more to catch up with each change in power, and at 85% power fades while the anaerobic reserve drains, so the bicycle is speeding up or slowing down for a good part of the ride. If you fit only the force at the wheel, the force that went into speeding up would be blamed on drag and rolling. So the acceleration term stays in. With F, v and a in hand, the balance is a straight-line model with two unknowns and no intercept, which least squares solves.

PythonFit Crr and CdA by least squares

Type a prediction to enable Run.

Show the expected result without running
with acceleration     Crr 0.00435, CdA 0.324 m2 (1459 s)
without acceleration  Crr 0.00532, CdA 0.309 m2 (1459 s)
true power, with a    Crr 0.00449, CdA 0.320 m2

With the acceleration term the fit gives CdA 0.324 m² and Crr 0.00435, against the simulator's 0.32 and 0.0045. Without it, CdA comes out 0.309 and Crr 0.00532: rolling resistance is overestimated by 18%, because the force that sped the bicycle up during each step lands on the only constant term in the model. Fitting the model's true power instead of the power meter gives 0.320 and 0.0045 almost exactly, so the small remaining miss is the meter's noise and smoothing, not the method.

What the athlete can use

PythonSpeed at 200 W, and what a lower position is worth

Show the expected result without running
200 W on the hoods (CdA 0.324): 33.8 km/h
200 W in the drops (CdA 0.25):   36.7 km/h, +2.8 km/h
40 km at 200 W: 70.9 min on the hoods, 65.4 min in the drops

At 200 W the fitted rider holds 33.8 km/h on the brake hoods. The simulator's hint for the drops is a CdA of 0.25 m²; at the same 200 W that is 36.7 km/h, 2.8 km/h faster for no extra work, and 40 km takes 5.5 minutes less. The prediction assumes the fitted Crr and that only the position changes. Set the simulator's drag area to 0.25, ride the same scenario, and check it: "With your own data" below says how.

For the athlete: "In the drops you would ride about 2.8 km/h faster at the same 200 W; over 40 km that saves about five and a half minutes without training any harder."

With your own data

Test the prediction. In the cycling simulator choose the same scenario, press Show Model, and on its Parameters tab set Aerodynamic drag area, CdA to 0.25 m² before you press Run. Ride to 25 minutes, export, and run this page on your file. Does the fit find 0.25, and is the rider about 2.8 km/h faster at 200 W? Then try scenario 4 · A climb at constant exertion: the grade is no longer zero, so add the gravity term m·g·sin(θ) to the force balance before you fit.

Check yourself

  1. A rider at a steady 10 m/s has CdA 0.30 m² in air of density 1.2 kg/m³. What is the drag force?

    N

  2. Leaving out the acceleration term raised the fitted Crr from 0.00435 to 0.00532. Why Crr and not CdA?

0 of 2 answered · 0 right the first time

The same method in another field

Road-vehicle engineers fit the same two numbers, a drag area and a rolling coefficient, to a car's coast-down test, where the force is the car's own deceleration times its mass. The same least squares on a physics-based feature set appears in the Dynamic Data Engineering course.

Acknowledgements

Data made with the cycling simulator at apmonitor.com/apps/cycling-rider.

References

Built 2026-12-02 with Python packages numpy 2.5.5, pandas 3.1.1, matplotlib 3.11.2, scipy 1.18.1. In the browser the same code runs on Pyodide, so the last digit can differ.