Module: CameronPredictor
- Included in:
- Calcpace
- Defined in:
- lib/calcpace/cameron_predictor.rb
Overview
Module for predicting race times using the Cameron formula
An alternative to the Riegel formula (RacePredictor module) that uses an exponential correction to better account for physiological differences across distances. The correction is larger when predicting from shorter races, where anaerobic contribution is greater, and diminishes as the known distance approaches the target distance.
Formula: T2 = T1 × (D2/D1) × [(a + b × e^(-D1/c)) / (a + b × e^(-D2/c))]
Constants (calibrated for distances in km):
a = 0.000495
b = 0.000985
c = 1.4485
Reference: Dave Cameron, “A Critical Examination of Racing Predictions” (1997)
Constant Summary collapse
- CAMERON_A =
Cameron formula constants (calibrated for distances in km)
0.000495- CAMERON_B =
0.000985- CAMERON_C =
1.4485
Instance Method Summary collapse
-
#predict_pace_cameron(from_race, from_time, to_race) ⇒ Float
Predicts pace per kilometer using the Cameron formula.
-
#predict_pace_cameron_clock(from_race, from_time, to_race) ⇒ String
Predicts pace per kilometer using the Cameron formula, returned as a clock time string.
-
#predict_time_cameron(from_race, from_time, to_race) ⇒ Float
Predicts race time using the Cameron formula.
-
#predict_time_cameron_clock(from_race, from_time, to_race) ⇒ String
Predicts race time using the Cameron formula, returned as a clock time string.
Instance Method Details
#predict_pace_cameron(from_race, from_time, to_race) ⇒ Float
Predicts pace per kilometer using the Cameron formula
81 82 83 |
# File 'lib/calcpace/cameron_predictor.rb', line 81 def predict_pace_cameron(from_race, from_time, to_race) predict_time_cameron(from_race, from_time, to_race) / race_distance(to_race) end |
#predict_pace_cameron_clock(from_race, from_time, to_race) ⇒ String
Predicts pace per kilometer using the Cameron formula, returned as a clock time string
95 96 97 |
# File 'lib/calcpace/cameron_predictor.rb', line 95 def predict_pace_cameron_clock(from_race, from_time, to_race) convert_to_clocktime(predict_pace_cameron(from_race, from_time, to_race)) end |
#predict_time_cameron(from_race, from_time, to_race) ⇒ Float
Predicts race time using the Cameron formula
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/calcpace/cameron_predictor.rb', line 40 def predict_time_cameron(from_race, from_time, to_race) from_distance = race_distance(from_race) to_distance = race_distance(to_race) if from_distance == to_distance raise ArgumentError, "From and to races must be different distances (both are #{from_distance}km)" end time_seconds = from_time.is_a?(String) ? convert_to_seconds(from_time) : from_time check_positive(time_seconds, 'Time') # Cameron formula: T2 = T1 × (D2/D1) × [cameron_factor(D1) / cameron_factor(D2)] time_seconds * (to_distance / from_distance) * (cameron_factor(from_distance) / cameron_factor(to_distance)) end |
#predict_time_cameron_clock(from_race, from_time, to_race) ⇒ String
Predicts race time using the Cameron formula, returned as a clock time string
67 68 69 |
# File 'lib/calcpace/cameron_predictor.rb', line 67 def predict_time_cameron_clock(from_race, from_time, to_race) convert_to_clocktime(predict_time_cameron(from_race, from_time, to_race)) end |