Script to estimate the minimal number of calories burned while cycling. The assumptions are chosen conservatively, meaning that the actual number of calories burned is likely greater than the estimate.
Clone the repository and set your current working directory to the root of the
repository, e.g., where the pyproject.toml
file is located. Then, run the
following command:
pip install .
No dependencies except the python standard library are required.
The script must be executed from the command line. It is available as:
cycling
. To get more information, run:
cycling --help
The following assumptions are made:
- Wind speed is 0 m/s
- A constant speed is maintained throughout the ride.
- The reduction in drag resistance due to drafting is estimated with a constant (default: 0.3, 30% reduction in drag resistance). The percentage of time you you were drafting can be set (default: 0% of the time) such that the overall reduction in drag resistance can be calculated.
A rough check to demonstrate the validity is by comparing it to the following site:
where the same parameters are used as in this script. For a 80 kg cyclist + bike that cycles 30 km in 1 hour, you get: "If you want to ride at groundspeed velocity 30 km/h, you must apply 169.13 watts of power." So, in 1 hour, with an efficiency of 0.25, the energy consumption per hour is:
(169.13 W * 3600 s) / 0.25 = 2435472 J = 2435 kJ
where 2435 kJ is equal to 581 kcal.
If we run the following command:
cycling 80 30 1
results is:
Energy consumption human:
- Total: 2432 kJ / 581 kcal
Average power on the pedals:
- Total: 169 W
which is the same as the website.