function calculateWallaceRace() {
// Get Input Values
var distVal = parseFloat(document.getElementById('raceDistValue').value);
var distUnit = document.getElementById('raceDistUnit').value;
var hrs = parseFloat(document.getElementById('timeHr').value) || 0;
var mins = parseFloat(document.getElementById('timeMin').value) || 0;
var secs = parseFloat(document.getElementById('timeSec').value) || 0;
var targetVal = parseFloat(document.getElementById('targetDistValue').value);
var targetUnit = document.getElementById('targetDistUnit').value;
// Basic Validation
if (isNaN(distVal) && ['5k','10k','hm','fm'].indexOf(distUnit) === -1) {
alert("Please enter a valid race distance.");
return;
}
if (hrs === 0 && mins === 0 && secs === 0) {
alert("Please enter a valid race time.");
return;
}
// Convert Input Distance to Meters
var distanceMeters = 0;
distanceMeters = getMeters(distVal, distUnit);
// Convert Time to Seconds
var totalSeconds = (hrs * 3600) + (mins * 60) + secs;
// Calculate Pace
var secondsPerMeter = totalSeconds / distanceMeters;
var secondsPerKm = secondsPerMeter * 1000;
var secondsPerMile = secondsPerMeter * 1609.34;
var speedKph = (distanceMeters / 1000) / (totalSeconds / 3600);
// Display Pace
document.getElementById('paceKm').innerText = formatTime(secondsPerKm, false) + " /km";
document.getElementById('paceMile').innerText = formatTime(secondsPerMile, false) + " /mi";
document.getElementById('avgSpeed').innerText = speedKph.toFixed(2) + " km/h";
// Prediction Logic (Riegel's Formula: T2 = T1 * (D2/D1)^1.06)
// Handle Target
var targetMeters = 0;
if (targetVal || ['5k','10k','hm','fm'].indexOf(targetUnit) !== -1) {
targetMeters = getMeters(targetVal, targetUnit);
var predictedSeconds = totalSeconds * Math.pow((targetMeters / distanceMeters), 1.06);
document.getElementById('predictedTimeResult').innerText = formatTime(predictedSeconds, true);
var predPaceSec = predictedSeconds / (targetMeters / 1000);
document.getElementById('predictedPaceResult').innerText = formatTime(predPaceSec, false) + " /km";
} else {
document.getElementById('predictedTimeResult').innerText = "–";
document.getElementById('predictedPaceResult').innerText = "–";
}
// Populate Table with Standard Distances
var standards = [
{ name: "5 Kilometers", meters: 5000 },
{ name: "10 Kilometers", meters: 10000 },
{ name: "Half Marathon", meters: 21097.5 },
{ name: "Marathon", meters: 42195 }
];
var tableHtml = "";
for (var i = 0; i < standards.length; i++) {
var d2 = standards[i].meters;
var t2 = totalSeconds * Math.pow((d2 / distanceMeters), 1.06);
tableHtml += "
" + standards[i].name + "
" + formatTime(t2, true) + "
";
}
document.getElementById('splitsTableBody').innerHTML = tableHtml;
// Show Result
document.getElementById('wallace-result').style.display = "block";
}
function getMeters(val, unit) {
var m = 0;
if (unit === 'km') m = val * 1000;
else if (unit === 'mi') m = val * 1609.34;
else if (unit === 'm') m = val;
else if (unit === '5k') m = 5000;
else if (unit === '10k') m = 10000;
else if (unit === 'hm') m = 21097.5;
else if (unit === 'fm') m = 42195;
return m;
}
function formatTime(totalSecs, showHours) {
var h = Math.floor(totalSecs / 3600);
var m = Math.floor((totalSecs % 3600) / 60);
var s = Math.floor(totalSecs % 60);
var hStr = h < 10 ? "0" + h : h;
var mStr = m < 10 ? "0" + m : m;
var sStr = s 0) {
return hStr + ":" + mStr + ":" + sStr;
} else {
return mStr + ":" + sStr;
}
}
Understanding the Wallace Race Calculator
The Wallace Race Calculator is an essential tool for runners and endurance athletes aiming to predict future race performances based on current fitness levels. Whether you are training for your first 5K or attempting to qualify for a major marathon, understanding your potential race time is crucial for setting realistic goals and pacing strategies.
How It Works
This calculator utilizes the concept of performance degradation over distance, commonly modeled using Riegel's formula ($T2 = T1 \times (D2 / D1)^{1.06}$). This mathematical model assumes that a runner's speed slightly decreases as the distance increases due to fatigue.
Recent Race Distance: Input the distance of a race or time trial you have completed recently.
Recent Race Time: Enter the exact duration it took you to complete that distance.
Target Distance: Select the distance of the upcoming race you want to predict.
Why "Wallace" Race Prediction?
In the context of competitive racing, accurate prediction prevents the common mistake of starting too fast. By calculating an equivalent effort for a longer distance, you can determine a sustainable "Wallace Pace" that keeps you within your aerobic threshold.
Factors Affecting Accuracy
While mathematical formulas provide a strong baseline, real-world results depend on several variables:
Training Volume: Higher weekly mileage generally improves fatigue resistance, potentially beating the prediction.
Course Terrain: Hilly courses will result in slower times than flat track predictions.
Weather Conditions: Heat and humidity can significantly increase cardiovascular drift, slowing your pace.
Use the results from the Wallace Race Calculator as a guideline for your training paces and race day strategy.