Bike Power Simulator

Aero · Rolling · Drivetrain power breakdown along a segment

Overview

The simulator computes the instantaneous mechanical power a cyclist must produce at every point along a segment, then splits it into four components: aerodynamic drag, rolling resistance, gravitational resistance, and drivetrain losses.

The simulation proceeds in the time domain with a fixed timestep of dt = 0.2 s (Euler integration). Distance is accumulated from velocity; results are then re-sampled on a uniform distance axis for display.

1. Coordinate system & slope geometry

The road gradient is given as a percentage G (rise over run × 100). The actual slope angle θ satisfies:

tan(θ) = G / 100
sin(θ) = (G/100) / √(1 + (G/100)²)
cos(θ) = 1 / √(1 + (G/100)²)

For small gradients (|G| < 10 %) the difference between sin(θ) and tan(θ) is negligible (< 0.5 %), but the simulator uses the exact expressions.

2. Resistive forces

2.1 Aerodynamic drag Aero

Drag force depends on the apparent wind speed, i.e. the speed of air relative to the rider. Wind is defined as positive for headwind, negative for tailwind.

v_air = v_rider + v_wind // all in m/s
F_aero = ½ · ρ · CdA · v_air · |v_air| // signed: positive = opposing motion
P_aero = F_aero · v_rider // W — power absorbed at the wheel
SymbolNameTypical values
ρAir density1.225 kg/m³ at sea level, 15 °C
CdADrag area (Cd × frontal area)0.20 m² (TT) · 0.30 m² (drops) · 0.35 m² (relax)
v_windWind speed (+ = headwind)0 km/h (calm) to ±40 km/h
Sign convention for tailwind: a tailwind (v_wind < 0) reduces v_air and therefore drag. When v_air is negative (very strong tailwind exceeding rider speed), drag actually pushes the rider forward — the formula handles this correctly via the |v_air| term that preserves the direction.

2.2 Rolling resistance Rolling

Rolling resistance is modelled as a force proportional to the normal load. On a slope, the normal force is the component of gravity perpendicular to the road surface:

F_roll = Crr · m · g · cos(θ)
P_roll = F_roll · v_rider
SymbolNameTypical values
CrrRolling resistance coefficient0.003–0.005 (road) · 0.006–0.012 (gravel)
mTotal mass (rider + bike)70–90 kg for a typical road setup
gGravitational acceleration9.81 m/s²

2.3 Gravitational resistance Gravity

On a slope, the rider must overcome (or is assisted by) the component of gravity along the road:

F_grav = m · g · sin(θ) // positive uphill, negative downhill
P_grav = F_grav · v_rider

On flat terrain (G = 0) this term is zero. Downhill, P_grav is negative — it represents energy recovered from potential energy (no regenerative braking modelled; the simulator simply shows the theoretical power balance).

3. Total power at the wheel

P_wheel = P_aero + P_roll + P_grav

4. Drivetrain losses Drivetrain

Real drivetrains (chain, derailleurs, bearings) are not perfectly efficient. The efficiency η (0 < η ≤ 1) relates power at the crank to power delivered at the rear wheel:

P_crank = P_wheel / η // power the rider must produce
P_loss = P_wheel · (1/η − 1) // heat dissipated in the drivetrain
ηCondition
0.98Clean, well-lubricated chain — default
0.95–0.97Dirty chain or cross-chaining
0.90–0.94Old/worn drivetrain or internal gear hub

5. Speed profiles

The rider speed v(t) is prescribed as a function of time. Three profiles are available, all parametrised by a mean speed v̄, an amplitude A, and a period T:

// Constant
v(t) = v̄

// Sinusoidal — smooth oscillation (e.g. peloton surges)
v(t) = v̄ + A · sin(2π · t / T)

// Triangle — linear acceleration/deceleration (e.g. traffic lights)
φ = (t mod T) / T ∈ [0, 1)
v(t) = v̄ + A · (4φ − 1) if φ < 0.5
v(t) = v̄ + A · (3 − 4φ) if φ ≥ 0.5

Speed is clamped to a minimum of 0.5 m/s to avoid numerical singularities (e.g. the triangle wave dipping to zero).

6. Numerical integration

Time advances in steps of dt = 0.2 s (Euler forward method). At each step:

The 0.2 s timestep introduces a relative distance error < 0.01 % for the profiles tested (the dominant error comes from profile discretisation, not the integration step itself).

The resulting time-series (potentially tens of thousands of points) is downsampled to 500 points for rendering, preserving visual accuracy while keeping the browser responsive.

7. Average power & energy

P̄_component = (1/N) · Σ P_component(tᵢ) // arithmetic mean over sampled steps

E_component = Σ P_component(tᵢ) · dt_eff // cumulative energy in kJ

The percentage split shown in the stats cards is computed relative to the total average crank power P̄_crank.

8. Assumptions & limitations

Total avg power
watts (at crank)
Avg aero power
— % of total
Avg rolling power
— % of total
Avg gravity power
— % of total
Avg drivetrain loss
— % of total
Time on segment
h:mm:ss
Speed Profile
Power Breakdown over Distance
Power Component Distribution
Cumulative Energy (kJ)