I forget where I picked this up, but it's what I use on my GPXes. Judging by the preferred units it's American but the important bits are in metric.
Ideally, you would apply this in segments to allow for different road surfaces, changing wind-speed & -direction, and shelter from wind due to buildings, vegetation and slope.
Kinda complex:
Terms
Frl - Force, in newtons, caused by rolling resistance
Prr - Power, in watts, to overcome Frl
Crr - coefficient of rolling resistance - typically 0.004 but can be as high as
0.008 for bad asphalt or as low as 0.001 for a wooden track.
g - acceleration due to gravity - 9.8 m/s2
Wkg - mass of the ride plus bicycle in kg
Vmps - Veloicty in meters/sec
Formulas
Frl = Wkg x g x Crr
Prr = Frl x Vmps
Example
Take a rider and bike combined weight of 165 lbs (75 kg) traveling at traveling at 20
mph ( 8.92 meters per second), using Crr of 0.004 and with g being 9.8 meters/sec/sec.
The force would be:
Frl = 75kg x 9.8 m/s2 x 0.004 = 2.94 newtons.
Prl = 8.92 m/s x 2.94 newtons = 26 watts
Since the power is proportional to speed, the same rider traveling at 5 mph would
require 6.5 watts to overcome rolling resistance.
Air and Wind Resistance:
Terms
Fw - Force on rider and bicycle due to wind drag
Cw - drag coefficient, typically 0.5
Rho - air density in kg/m . Depends on temperature and barometric pressure.
Some typical values are sea level: 1.226, 1500m: 1.056 and 3000m: 0.905
Vmps - Speed in meters/sec
A - effective frontal area of the rider and bicycle in m^2. Typical value is 0.5.
Formulae
Fw = 1/2 x A x Cw x Rho x Vmps^2
Pw = Fw x Vmps
Example
Take a rider and bike combined weight of 165 lbs (75 kg) traveling at traveling at 20
mph ( 8.92 meters per second), with no headwind, using Cw of 0.5, Rho of 1.226 and
front area of 0.5. The force due to wind drag would be:
Fw = 1/2 x 0.5 x 0.5 x 1.226 x 8.92 x 8.92 = 12.19 newtons
Pw = 12.19 newtons x 8.92 m/s = 108 watts.
If you at traveling at 5 mph, instead of 20 mph then:
Pw = (1/2 x 0.5 x 0.5 x 1.226 x 2.23 x 2.23) x 2.23 = 1.7 watts
Gravity:
Terms
Fsl - Force in newtons due to the pull of the rider and bicycle down the slope
Psl - Power in watts required to overcome the force of Fsl
Wkg - Combined weight of the rider and bicycle in kg
g - Acceleration due to gravity, 9.8 m/s^2
GradHill - gradient of the hill, in decimal, the ratio of the rise to the
horizontal run.
Formulas
Fsl = Wkg x g x GradHill
Psl = Fsl x Vmps
Example
Take a rider and bike combined weight of 165 lbs (75 kg) traveling at traveling at 5
mph ( 2.23 meters per second), climbing a hill with a grade of 12% (GradHill = 0.12).
The force due to gravity would be:
Fsl = 75 x 9.8 x 0.12 = 88.2 newtons
Psl = 88.2 x 2.23 = 196 watts.
Combined Forces
Formula
Total Power = Prl + Pw + Psl or Total Power = (Frl + Fw + Fsl) x Vmps