larsen / rando-planner

Clerk viewers and utils to plan bikepacking trips
https://rando-planner.stefanorodighiero.net/
4 stars 0 forks source link

Non-linear km progress function #51

Open larsen opened 3 months ago

larsen commented 3 months ago

At the moment kilometers in a day calculation is solely based on the average speed parameter provided by the user. For example:

(defn kilometers-in-a-day [day-plan average-speed]
  (reduce + (map #(* (:length %) average-speed)
                 (filter #(= (:type %) :ride)
                         (:activities day-plan)))))

I should switch to a different structure that allows more flexibility. For example, a generator of couples (hour, speed) instead of a constant average speed. This way, one can produce different generator functions according to different models. One model would be the existing constant average speed. Another model could take into account the elevation to apply a <1 multiplier to the provided average speed. Another model could use another parameter like the Watt expressed by the cyclist, to combine it with other parameters (some suggested "bumpiness")