import type { EngineRuntime, LoadedRuntime } from './simulateRuntime'; import type { VehicleIssue } from './validate'; import { type KeyboardLaunchReport } from './keyboardLaunch'; type Json = Record; /** The fraction a figure may miss its target by when a spec leaf carries no tolerance. */ export declare const DEFAULT_SPEC_TOLERANCE = 0.1; /** Degrees. A car resting tilted more than this in the instrument is a defect (the harness rule). */ export declare const REST_TILT_LIMIT_DEG = 3; export interface FigureDef { key: string; label: string; unit: string; } /** Every figure a target can name. Keys are the package `targets` keys (the runtime's own, plus three this adds). */ export declare const FIGURES: readonly FigureDef[]; export interface Target { /** A FIGURES key, or `brakingFrom(Kph|Mph)ToZeroM` for a spec-requested stop. */ key: string; value: number; /** Fraction: 0.08 = ±8 %. */ tolerance: number; source: 'package' | 'spec'; /** Where the target came from (`targets.zeroToHundredKphS`, `perf.0_100_kmh_s`). */ path: string; /** Set when the source gave no tolerance and the default was applied. */ defaultedTolerance?: boolean; /** For braking stops: the entry speed in m/s. */ fromMps?: number; } /** A braking target's entry speed (m/s), for the keys that are stops. */ export declare function brakingEntryMps(key: string): number | undefined; /** The package's own `targets`, for the keys this instrument measures. Unknown keys are ignored (not every target is a drive figure). */ export declare function targetsFromPackage(pkg: unknown): Target[]; /** Reference-spec paths (the harness `reference/-spec.json` shape) → figure keys. */ export declare const SPEC_ALIASES: ReadonlyArray<[string, string[]]>; /** * Targets from a `--spec` file. Three shapes are accepted: * - a vehicle package, or `{ "targets": { … } }` — package-style `{ value, tolerance }` (a fraction); * - a reference spec — `perf.0_100_kmh_s`, `perf.braking_100_0_m` (from 100 km/h), `perf.braking_70mph_0_m` * (from 70 mph) … with `{ value, tol_pct }` (a percent) or a bare number (tolerance 10 %); * - a flat map of package-style target keys. */ export declare function targetsFromSpec(spec: unknown, file?: string): Target[]; export interface Comparison { key: string; figure: string; unit: string; measured: number | null; target: number; tolerance: number; /** (measured − target) / target; null when nothing was measured. */ error: number | null; pass: boolean; source: 'package' | 'spec'; path: string; note?: string; } /** The runtime's `compareToTargets` rule, one figure at a time. A figure that could not be measured FAILS. */ export declare function compareFigure(measured: number | null | undefined, target: Pick): { error: number | null; pass: boolean; }; export declare function figureLabel(key: string): { label: string; unit: string; }; export interface TurboLag { /** Seconds from full throttle to 90 % of the pull's peak acceleration; null when the roll-on could not be set up. */ lagS: number | null; gear: number; transmission: 'manual' | 'automatic'; startRpm: number; startSpeedKph: number; rpmAt90: number | null; peakAccelG: number; startAccelG: number; reason?: string; } export interface CurveShape { points: number; peakTorqueNm: number; peakTorqueRpm: number; torqueAtLagStartRpm: number | null; /** Torque at the roll-on start rpm as a fraction of peak torque. */ lagStartFractionOfPeak: number | null; rpmAt50PctPeak: number | null; rpmAt90PctPeak: number | null; /** Midpoint rpm of the steepest rising segment, and its slope. */ steepestRiseRpm: number | null; steepestRiseNmPer1000Rpm: number | null; boost: { boostTorqueCoef: number | null; curveBoostBar: number | null; turbine: boolean; induction: string | null; modelsBoostTorque: boolean; }; } export interface SimulationFigures { zeroToHundredKphS: number | null; zeroToSixtyMphS: number | null; quarterMileS: number | null; topSpeedKph: number | null; topSpeedConverged: boolean; ungovernedTopSpeedKph: number | null; brakingHundredToZeroM: number | null; brakingSixtyToZeroM: number | null; lateralG: number | null; turboLagS: number | null; peakAccelG: number | null; gearsUsed: number | null; rpmAtSixtyMph: number | null; /** Spec-requested extra stops, by key (`brakingFrom70MphToZeroM`). */ extraBraking: Record; } export interface RestPose { allGrounded: boolean; chassisClearanceM: number | null; rideHeightM: number | null; pitchDeg: number | null; rollDeg: number | null; } export interface SimulationReport { ok: boolean; package: { id: string | null; displayName: string | null; }; runtime: LoadedRuntime['info']; figures: SimulationFigures; rest: RestPose; turboLag: TurboLag; curve: CurveShape | null; comparisons: Comparison[]; /** Rest-pose failures (not grounded, tilted). */ restFailures: string[]; failures: number; notes: string[]; /** How the gearbox shifts: is it auto, and does the live drive's manual layer apply. */ shift: ShiftPolicy; /** Loud shift-policy caveats (a manual box the live drive will pin in 1st unless shifted, or auto-shift unverified live). */ shiftWarnings: string[]; /** * The full-throttle DIGITAL launch a keyboard player makes (see `keyboardLaunch.ts`): null when skipped. Its FAIL * (not drivable on a keyboard) counts as a failure; its WARN does not. */ keyboardLaunch: KeyboardLaunchReport | null; /** * The package's `simulation.land.tractionControl`, as the runtime that ran it treats it. `modelled` is false when the * block is authored but the runtime predates it (it is then ignored here AND live, by the same runtime). */ tractionControl: TractionControlReport; /** * Engine-policy warnings (`enginePolicy.ts`): a speed limiter far below the ungoverned top speed (the platform car runs * ungoverned) and a torque curve above the declared crank figures. Printed with the report; `validate` surfaces them. */ policy: VehicleIssue[]; } export interface TractionControlReport { authored: boolean; enabled: boolean; modelled: boolean; spec: Json | null; } /** First engine version whose land solver honours `simulation.land.tractionControl`. */ export declare const TRACTION_CONTROL_MIN_ENGINE = "0.3.204"; /** Read the authored traction-control block and whether this runtime models it (it exports the default block). */ export declare function tractionControlOf(p: Json, hc: EngineRuntime): TractionControlReport; export interface ShiftPolicy { /** `gearbox.kind` from the v2 driveline (manual | sequential | automatic | dct | …), null when absent. */ kind: string | null; /** `gearbox.auto.enabled` — whether the box shifts itself in the default (automatic) drive mode. */ automatic: boolean; /** `kind === 'manual' || 'sequential'` — the live drive then exposes a manual shift layer. */ supportsManual: boolean; } /** Torque-curve onset shape. `points` are [rpm, Nm] pairs (any order). */ export declare function curveShape(points: Array<[number, number]>, lagStartRpm: number | null, engine: Json, turbine: boolean, induction: string | null): CurveShape | null; /** The roll-on start rpm for a driveline (see the header). */ export declare function lagStartRpm(driveline: { engine: { idleRpm: number; limiterRpm: number; }; clutch?: { launchStartRpm?: number; }; gearbox?: { kind?: string; auto?: { enabled?: boolean; downRpm?: number; }; }; }, automatic: boolean): number; /** The fixed-gear roll-on. Exported for the smoke test; needs a loaded runtime. */ export declare function measureTurboLag(hc: EngineRuntime, tuning: Json): Promise; /** Read a vehicle package from a directory or a JSON file. */ export declare function readVehiclePackageArg(arg: string): { file: string; dir: string; pkg: unknown; }; export interface SimulateOptions { /** Extra targets (a `--spec` file's). */ specTargets?: Target[]; /** Skip the turbo-lag roll-on (validate does not need it unless a target names it). */ skipTurboLag?: boolean; /** Skip the keyboard launch and its hands-off yaw probe. */ skipKeyboardLaunch?: boolean; } /** Measure the package with a loaded runtime and compare every figure. Throws only when the engine cannot run it. */ export declare function simulateVehicle(pkg: unknown, runtime: LoadedRuntime, opts?: SimulateOptions): Promise; export declare function formatTractionControl(tc: TractionControlReport | undefined): string; /** `withPolicy: false` omits the engine-policy lines (`validate` already lists them as issues above the report). */ export declare function formatSimulationReport(r: SimulationReport, opts?: { withPolicy?: boolean; }): string; export {};