import type { ErrorStateSnapshot } from "./engine/sim-engine.js"; /** * Error controller for the first-order backward-Euler transient integrator. * * A coarse h step is compared with two h/2 steps. For a first-order method, * their difference is the local error estimate (Richardson denominator is 1). * The refined two-half-step state is retained when the estimate is accepted. * * Tolerances intentionally describe observable electrical quantities rather * than matrix coefficients. They are tight enough for breadboard teaching but * loose enough that a noisy nonlinear junction does not pin every circuit to * the 10 ns floor. */ export interface StepErrorEstimate { ratio: number; quantity: string | null; } /** * Compare every committed state that can change a later stamp or state-machine * transition. Continuous memories use physical-unit tolerances; latch/regime * disagreements are rejected exactly because averaging two regimes is invalid. */ export declare function estimateStepError(coarse: ErrorStateSnapshot, refined: ErrorStateSnapshot): StepErrorEstimate; /** * Step-size multiplier with conservative bounds. `order` is the integration * method's order p: local truncation error scales as h^(p+1), so the optimal * growth factor is ratio^(-1/(p+1)) — 1 for backward Euler (the historical * sqrt), 2 for trapezoidal. */ export declare function nextStepFactor(errorRatio: number, order?: number): number;