TrailBuffer help and about

1. What it is

TrailBuffer is an information tool for timed hikes and long-distance walking events with cutoffs. During the hike it shows two things: the time buffer (how far ahead of or behind the cutoff you are) and a km/h pace target (the pace at which you still reach the next checkpoint in time). The calculations run on your phone, also without an internet connection, and the map regions you downloaded also show offline.

The tool calculates from the progress it observes and from the terrain profile of the route. It does not replace your own judgment, the organiser's rules or knowing the route: always check the cutoffs and the conditions of the event against the organiser's instructions.

2. How to use it, in short

3. The models

The models below calculate the buffer and the pace target. The numbers are the ones the app uses. They are models: they describe the progress of an average walker, not yours, so the displayed value is an estimate.

1. Tobler's hiking function

W(s)=6.0·exp(−3.5·|s+0.05|)W(s) = 6.0 \cdot \exp\left(-3.5 \cdot |s + 0.05|\right)
vTobler(s)=W(s)·vflat5.0v_{\text{Tobler}}(s) = W(s) \cdot \frac{v_{\text{flat}}}{ 5.0 }

Here ss is the slope (rise divided by the horizontal distance), which the app limits to [−0.60,+0.60][-0.60 , +0.60], and vflatv_{\text{flat}} is the pace on level ground in km/h. The function is fastest on a gentle downhill and gets slower in both directions as the terrain gets steeper.

2. Slowdown along the route

The app scales the time of a segment by the factor 1+αp¯1 + \alpha \bar{p}, where p¯\bar{p} is the share of the route at the middle of the segment (0 is the start, 1 the finish) and α\alpha defaults to 0.08. α\alpha is a model parameter for the slowdown along the route, not a measure of the walker's condition. The result does not depend on how densely the GPX is sampled.

3. Time buffer

B=(Tlimit−telapsed)−tneededB = (T_{\text{limit}} - t_{\text{elapsed}}) - t_{\text{needed}}

Here TlimitT_{\text{limit}} is the time limit, telapsedt_{\text{elapsed}} the time gone, and tneededt_{\text{needed}} the modelled time of the rest of the route including the planned rests. With no time limit the buffer is unknown: the display shows --, not a number and not a green colour. The app finds the pace target so that the time left is just enough for the rest of the route, terrain included.

4. Adaptive Kalman filter

The state is x=[vflat,α]\mathbf{x} = [v_{\text{flat}}, \alpha], bounded to:

2.5≤vflat≤9.0km/h,0.0≤α≤0.402.5 \le v_{\text{flat}} \le 9.0 \,\text{km/h}, \qquad 0.0 \le \alpha \le 0.40

The filter learns from windows of about 250 m with noise scaled by the window length, rejects input that is not finite, and shows when a bound is reached. The observation is the window time predicted by the Tobler model with the night and terrain multipliers of the window's own segments. From the measured progress the Kalman filter gradually adjusts vflatv_{\text{flat}} and α\alpha.

5. Solar and night pace

The app computes the sun's elevation offline (Meeus, NOAA): sinh=sinφsinδ+cosφcosδcosH\sin h = \sin\varphi \sin\delta + \cos\varphi \cos\delta \cos H, where hh is the sun's elevation above the horizon, φ\varphi the latitude, δ\delta the declination of the sun and HH the hour angle. The night multiplier is below, and it always applies:

6. Manual terrain condition

You state the terrain condition at the start line; the app calls no weather service. Unset means "no mud".

The effects together give the effective speed:

veff=vTobler(s)·11+αp¯·knight·kterrainv_{\text{eff}} = v_{\text{Tobler}}(s) \cdot \frac{1}{1 + \alpha \bar{p}} \cdot k_{\text{night}} \cdot k_{\text{terrain}}

7. Route matching

The app projects a GPS position onto the route with the Haversine formula and cross-track distance: d=2Rarcsinsin2Δφ2+cosφ1cosφ2sin2Δλ2d = 2R \arcsin\sqrt{\sin^2\frac{\Delta\varphi}{2} + \cos\varphi_1 \cos\varphi_2 \sin^2\frac{\Delta\lambda}{2}}, where RR is the radius of the Earth. The match may move only inside the window in which the walker can actually have progressed, and a jump is accepted only after confirmation, so a loop route or a parallel path cannot teleport the position.