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.
- 1Gather (used)
- 2Statistics
- 3Visualize (used)
- 4Cleanse
- 5Features (used)
- 6Balance
- 7Scale
- 8Split
- 9Deploy
- Ask
- Collect (this week)
- Check (this week)
- Interpret (this week)
- Coach (this week)
- Reassess
Download notebook ·Python file ·Read as Markdown ·Data folder ·Chapter 3 (sections 3.8, 11.4)
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
raw/cycling-rider_20261202_221900.csv: SIMULATED: the cycling simulator's CSV export of scenario 2 (Exertion steps, and the step that fades), one row a second for 25 minutes, 134 columns, exactly as the Export CSV button writes it. Cycling simulator, recreational preset, scenario 2 · Exertion steps, and the step that fades (seeded, so every run of the scenario gives the same file).
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.
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.
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

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.
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
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
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?
Leaving out the acceleration term raised the fitted Crr from 0.00435 to 0.00532. Why Crr and not CdA?
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
- Chapter 3 of Data-Driven Athletics: Science of the Sports (cycling power).
- Chapter 11 of Data-Driven Athletics: Regression.
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.