Proper TSS calculation
This commit is contained in:
parent
8daecba1ca
commit
2871dae0ff
12
src/index.ts
12
src/index.ts
|
|
@ -1,10 +1,11 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { averageIntensity } from "./average-intensity";
|
import { averageIntensity } from "./averageIntensity";
|
||||||
import { normalizedIntensity } from "./normalized-intensity";
|
import { normalizedIntensity } from "./normalizedIntensity";
|
||||||
import { parse } from "./parser";
|
import { parse } from "./parser";
|
||||||
import { tokenize } from "./tokenizer";
|
import { tokenize } from "./tokenizer";
|
||||||
import { totalDuration } from "./totalDuration";
|
import { totalDuration } from "./totalDuration";
|
||||||
import { tss } from "./tss";
|
import { tss } from "./tss";
|
||||||
|
import { tss2 } from "./tss2";
|
||||||
|
|
||||||
const filename = process.argv[2];
|
const filename = process.argv[2];
|
||||||
|
|
||||||
|
|
@ -33,3 +34,10 @@ console.log(
|
||||||
normalizedIntensity(workout.intervals) * 100
|
normalizedIntensity(workout.intervals) * 100
|
||||||
).toFixed()}%`
|
).toFixed()}%`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`TSS: ${tss2(
|
||||||
|
totalDuration(workout.intervals),
|
||||||
|
normalizedIntensity(workout.intervals)
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Training Stress Score formula from Training and Racing with a Power Meter:
|
||||||
|
//
|
||||||
|
// TSS = (s * W * IF) / (FTP * 3600) * 100
|
||||||
|
//
|
||||||
|
// s - duration in seconds
|
||||||
|
// W - power in watts
|
||||||
|
// IF - intensity factor (power / FTP)
|
||||||
|
//
|
||||||
|
// Derive a formula without power values, using intensities alone:
|
||||||
|
//
|
||||||
|
// TSS = (s * (FTP * IF) * IF) / (FTP * 3600) * 100
|
||||||
|
// TSS = (s * IF * IF) / 3600 * 100
|
||||||
|
|
||||||
|
export const tss2 = (duration: number, intensity: number): number => {
|
||||||
|
return ((duration * intensity * intensity) / 3600) * 100;
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue