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_adjusted(from_race, from_time, to_race) ⇒ Hash
Predicts race time adjusted for environmental conditions using 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
80 81 82 |
# File 'lib/calcpace/cameron_predictor.rb', line 80 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
94 95 96 |
# File 'lib/calcpace/cameron_predictor.rb', line 94 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
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/calcpace/cameron_predictor.rb', line 42 def predict_time_cameron(from_race, from_time, to_race) from_distance = race_distance(from_race) to_distance = race_distance(to_race) ensure_different_distances!(from_distance, to_distance) 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_adjusted(from_race, from_time, to_race) ⇒ Hash
Predicts race time adjusted for environmental conditions using Cameron formula
105 106 107 108 |
# File 'lib/calcpace/cameron_predictor.rb', line 105 def predict_time_cameron_adjusted(from_race, from_time, to_race, **) predicted_seconds = predict_time_cameron(from_race, from_time, to_race) adjust_time(predicted_seconds, **) 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
66 67 68 |
# File 'lib/calcpace/cameron_predictor.rb', line 66 def predict_time_cameron_clock(from_race, from_time, to_race) convert_to_clocktime(predict_time_cameron(from_race, from_time, to_race)) end |