Skip to content

Instantly share code, notes, and snippets.

@hungerburg
Created February 17, 2023 11:38
Show Gist options
  • Save hungerburg/4936fa430552d625a0c8677f46492d1e to your computer and use it in GitHub Desktop.
Save hungerburg/4936fa430552d625a0c8677f46492d1e to your computer and use it in GitHub Desktop.
Walking speed modifiers depending on incline
#!/usr/bin/env python3
# make a table of speed modifiers depending on slope
# based on the DIN 33466 formula
# output reverse value, for use in a router costing function
# estimates are quite high, an interesting tweak would be setting
# ascent=400 and descent=600 thereby adapting to fitter persons
# bonus: print modifier based on research by the Mountain Tactical Institute
# https://mtntactical.com/research/walking-uphill-10-grade-cuts-speed-13not-12/
import math
distance = 1000 # m
velocity = 4000 # m/h flat
ascent = 300 # m/h elevation up
descent = 500 # m/h elevation down
slopes = [
-30,
-20,
-15,
-10,
-8,
-6.5,
-5,
-3,
-1.5,
0,
1.5,
3,
5,
6.5,
8,
10,
11.5,
13,
15,
20,
30
]
df = distance/velocity # duration flat
print('# Slope: DIN, MTNT')
for slope in slopes:
# change in altitude
h = abs(slope * distance/100)
# duration change in altitude
dh = h/descent if slope < 0 else h/ascent
# speed modifier Mountain Tactical Institute
mtnt = math.exp(-0.04*slope)
# speed modifier DIN
if (dh >= df):
print('>%6.1f: %2.2f, %2.2f' % (slope, 1/(df/(df/2 + dh)), 1/mtnt))
else:
print('<%6.1f: %2.2f, %2.2f' % (slope, 1/(df/(df + dh/2)), 1/mtnt))
@hungerburg
Copy link
Author

Output:

# Slope:  DIN, MTNT
> -30.0: 2.90, 0.30
> -20.0: 2.10, 0.45
> -15.0: 1.70, 0.55
< -10.0: 1.40, 0.67
<  -8.0: 1.32, 0.73
<  -6.5: 1.26, 0.77
<  -5.0: 1.20, 0.82
<  -3.0: 1.12, 0.89
<  -1.5: 1.06, 0.94
<   0.0: 1.00, 1.00
<   1.5: 1.10, 1.06
<   3.0: 1.20, 1.13
<   5.0: 1.33, 1.22
<   6.5: 1.43, 1.30
>   8.0: 1.57, 1.38
>  10.0: 1.83, 1.49
>  11.5: 2.03, 1.58
>  13.0: 2.23, 1.68
>  15.0: 2.50, 1.82
>  20.0: 3.17, 2.23
>  30.0: 4.50, 3.32

@hungerburg
Copy link
Author

Output @ 400/800 m/h ascent/descent:

# Slope:  DIN, MTNT
> -30.0: 2.00, 0.30
> -20.0: 1.50, 0.45
< -15.0: 1.38, 0.55
< -10.0: 1.25, 0.67
<  -8.0: 1.20, 0.73
<  -6.5: 1.16, 0.77
<  -5.0: 1.12, 0.82
<  -3.0: 1.07, 0.89
<  -1.5: 1.04, 0.94
<   0.0: 1.00, 1.00
<   1.5: 1.07, 1.06
<   3.0: 1.15, 1.13
<   5.0: 1.25, 1.22
<   6.5: 1.32, 1.30
<   8.0: 1.40, 1.38
>  10.0: 1.50, 1.49
>  11.5: 1.65, 1.58
>  13.0: 1.80, 1.68
>  15.0: 2.00, 1.82
>  20.0: 2.50, 2.23
>  30.0: 3.50, 3.32
# A=400, D=800, V=4000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment