import { CoursePhysics } from '../../../types/course'; import { Path } from '../../../types/path'; import { CyclistPowerProvider } from './CyclistPowerProvider'; /** * Abstract base class for cyclist power providers with advanced power modeling. * * This base class provides: * - **Harmonic power variations**: Simulates natural power output fluctuations * - **Speed-based power adjustment**: Adapts power based on current vs optimal speed * - **Tolerance-based control**: ±5% speed tolerance around optimal * - **Power scaling**: Up to 3x power when too slow, reduced power when too fast * * Subclasses must implement `getOptimalPower()` to define the baseline power * output strategy (constant, variable, data-driven, etc.). * * ## Harmonic Variations * * When harmonics are enabled (`course.cyclist.harmonics = true`), the power * output includes sinusoidal variations: * * ``` * P'(t) = P + Σ(amp_i × P × cos(freq_i × t - phase_i)) * ``` * * This creates realistic power fluctuations mimicking: * - Pedal stroke asymmetries * - Breathing patterns * - Micro-adjustments in cycling position * - Natural physiological rhythms * * ## Speed-Based Power Adjustment * * The actual power output is adjusted based on how current speed compares * to the optimal speed for the given power and terrain: * * - **Within tolerance (±5%)**: Full optimal power * - **Too slow (< 95% optimal)**: Linear increase up to 3x power * - **Too fast (> 105% optimal)**: Linear decrease down to 0 * * This models: * - Increased effort when speed drops (climbing, headwind) * - Reduced effort when speed exceeds target (coasting, tailwind) * * @see CyclistPowerProvider */ export declare abstract class CyclistPowerProviderBase implements CyclistPowerProvider { readonly useHarmonics: boolean; private static readonly TOLERANCE; private static readonly MAX_MULTIPLIER; private readonly harmonics; /** * Constructs the base provider with randomly generated harmonics. * * Generates 20 harmonic components with: * - Frequency: 1.0 to 10.0 rad/s * - Phase: 0 to π radians * - Amplitude: 0 to 0.01 (1% max variation) * * Uses crypto.getRandomValues() for secure random generation * (compatible with both browser and Node.js environments). */ constructor(useHarmonics: boolean); /** * Abstract method to get the optimal power for current conditions. * * Subclasses implement this to define their power strategy: * - PowerProviderConstant: Returns fixed power from cyclist config * - PowerProviderConstantWithTiring: Applies fatigue factor * - PowerProviderFromData: Returns power from point data * * @param course Course configuration * @param path Path containing point data * @param pointIndex Index of current point * @returns Optimal power output in watts */ protected abstract getOptimalPower(course: CoursePhysics, path: Path, pointIndex: number): number; /** * Calculates the cyclist's power output with harmonics and speed adjustments. * * Process: * 1. Get optimal power from subclass * 2. Apply harmonic variations (if enabled) * 3. Calculate optimal speed for this power * 4. Adjust power based on current vs optimal speed * * @param course Course configuration * @param path Path containing point data * @param pointIndex Index of current point * @returns Adjusted cyclist power in watts */ getPowerW(course: CoursePhysics, path: Path, pointIndex: number): number; protected getRealOptimalPower(course: CoursePhysics, path: Path, pointIndex: number, optimalPower: number): number; } //# sourceMappingURL=CyclistPowerProviderBase.d.ts.map