A project containing functions to analyse a runners training data (from a specific run).
These instructions will get you a copy of the project up and running in your projects.
There are no prerequisites required for this project,
running-calculations can be used in both node.js and in the browser.
Install running-calculations using npm:
npm install running-calculations
Using Running Calculations is incredibly simple. Examples of every function in use can be seen below:
###Â Types
Enumeration of supported measurement types in this system
measurements.miles
measurments.kilometres
Typically used for an array of coordinates. Each object will have a longitude (lng) and latitude (lat) point.
import { coordinate } from 'running-calculations';
const coordinatesArr:coordinate[] = [
{
lat: [latitude coordinate],
lng: [longitude coordinate]
}
]
Converts elevation in metres to feet.
import { calculateElevation, measurements } from 'running-calculations';
const elevation = calculateElevation(1, measurements.miles); // Answer will be 3.2808
Returns speed (in metres per second) from 2 coordinate types
import { speedFromCoordinates, coordinates } from 'running-calculations';
const coords1:coordinates = {lat: [latitude], lng: [longitude]};
const coords2:coordinates = {lat: [latitude], lng: [longitude]};
const speed = speedFromCoordinates(coords1, coords2);
Returns an efficiency factor from a running pace (ideally a graded pace) and a heart rate value. For comparison reasons, this would ideally be used for runs on the same course and conditions (time, weather, etc).
NOTE: Speed value is in metres per second.
import { calculateEfficiencyFactor } from 'running-calculations';
const runningPace = 4.76;
const heartrate = 150;
const speed = calculateEfficiencyFactor(runningPace, heartrate);
Convert a distance in metres to either miles or kilometres
import { convertDistance, measurements } from 'running-calculations';
const distance = 1000;
const speed = convertDistance(distance, measurements.miles);
Converts running pace from metres per second to minute/miles or minute/kilometres
import { calculateAveragePace, measurements } from 'running-calculations';
const pace = 4.76;
const speed = calculateAveragePace(pace, measurements.miles);
Converts running pace from minute/miles or minute/kilometres to metres per second
import { reverseAveragePace, measurements } from 'running-calculations';
const pace = '6:18';
const speed = reverseAveragePace(pace, measurements.miles);
Uses functional threshold pace to calculate training zones for a runner to train in.
import { calculateZonesFromFTP } from 'running-calculations';
const pace = 4.76;
const speed = calculateZonesFromFTP(pace);
Using the finish time for a race, calculate the % of VO2 Max. Calculation from the Jack Daniels Tables
import { calculatePercentageVO2Max } from 'running-calculations';
const raceTime = 5075; // 1:24:35 in seconds
const VO2Max = calculatePercentageVO2Max(raceTime); // 86.4 %
Using the finish time for a race, calculate the VDot score of the race. Calculation from the Jack Daniels Tables
import { calculateVDOT } from 'running-calculations';
const raceTime = 5075; // 1:24:35 in seconds
const VO2Max = calculateVDOT(raceTime); // 54.76 VDot Score
Using funtional threshold pace, average pace (ideally a graded pace), and time (in seconds), calculate the training stress score of a run
import { calculateTrainingStressScore, reverseAveragePace, measurements } from 'running-calculations';
const ngp = reverseAveragePace('6:28', measurements.miles);
const ftp = reverseAveragePace('6:18', measurements.miles);
const time = 5075;
calculateTrainingStressScore(ftp, ngp, time)) // 133.8
Calculate the chronic training load of a runner using their their previous runs TSS over a 42 day period.
import { calculateChronicTrainingLoad } from 'running-calculations';
const tssData = [
50.17, 37.07, 51.68, 68.96,
61.05, 70.57, 91.11, 52.73,
55.37, 43.79, 42.06, 2.02,
7.19, 55.71, 45.72, 36.62,
32.81, 32.56, 39.39, 114.48,
10.05, 49.58, 84.34
];
calculateChronicTrainingLoad(tssData) // 49.35
Calculate the acute training load of a runner using their their previous runs TSS over a 7 day period.
import { calculateAcuteTrainingLoad } from 'running-calculations';
const tssData = [50.17,37.07];
calculateAcuteTrainingLoad(tssData) // 43.62
Calculate the acute training load of a runner using their their previous runs TSS over a 7 day period.
import { calculateChronicTrainingLoad, calculateAcuteTrainingLoad, calculateTrainingStressBalance } from 'running-calculations';
const ctl = calculateChronicTrainingLoad(...);
const atl = calculateAcuteTrainingLoad(...);
calculateTrainingStressBalance(ctl, atl)) // 5.73
Calculate the acute training load of a runner using their their previous runs TSS over a 7 day period.
import { reverseAveragePace, calculateIntensityFactor } from 'running-calculations';
const ngp = reverseAveragePace('6:28', measurements.miles);
const ftp = reverseAveragePace('6:18', measurements.miles);
calculateIntensityFactor(ftp, ngp) // 0.97
npm run test
The below greatly assisted in the research and authoring of the calculations provided in this package.
To contribute on this project, please contact mattncott.
- Matthew Nethercott - Initial work - mattncott
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details