/** * ELECTROMECH-AUDIO device cohort (Wave A4 phase 2): relay, dc_motor, * servo, stepper, hcsr04, uln2003, uln2803, buzzer, speaker, l293d, * tb6612. * * Every handler body below is the engine's old switch-case / if-block body * MOVED VERBATIM, with identifier access adapted through DeviceContext * (this._pinNode -> ctx.pinNode, this._vAt -> ctx.vAt, this._isOpenPin -> * ctx.isOpenPin, this.state.relays -> ctx.state.relays (and motors/servos/ * steppers/hcsr04/icState/arduinos alike), this.simTime -> ctx.simTime(), * this._icPowerInfo -> ctx.icPowerInfo, the _stampAll pass-level `vt` * local -> ctx.junctionVt() — the same pure thermalVoltage(ambient) * computation, so the float is identical — the paired * `mcuEventDrivers ??= this._buildArduinoPinDrivers(true)` + * `mcuEventDrivers.get(node)` calls -> ctx.mcuEventDriverForNode(node) * (the lazy shared-map build now lives inside the context alias, still * built at most once per state pass), and the servo/hcsr04 * `driverMcu.getStepPinEvents()` reads -> ctx.mcuStepPinEvents( * driver.compId) (the consumed-once handout: each MCU step's events reach * these decoders exactly once, split solves included), * this._componentById.get -> * ctx.componentById, this._mcuPowered -> ctx.mcuPowered, * this._mcuBootSimTime.get -> ctx.mcuBootSimTime, * this._hcsr04MicrobitBridge -> ctx.hcsr04MicrobitBridge, * specsForComponent -> ctx.electricalSpecs, out[comp.id] = v -> * ctx.setElementCurrent(comp.id, v), and loop break -> handler return). * Do not simplify, reorder mna.add calls, or rewrite algebra here: float * accumulation order in the matrix is semantics, and the bitwise oracle * suite pins these exact trajectories. * * uln2003/uln2803 share one model exactly as their switch cases shared a * body; the handlers still branch on comp.kind for the channel count. * * Moved WITH this cohort (their only consumers are here now): * - _mcuClockHz (servo/hcsr04 cycle-to-seconds conversion), * - _servoLoadResistance -> the local servoLoadResistance helper, * - _stampClampDiode -> the local stampClampDiode helper (ULN catch * diodes, L293D/TB6612 freewheel paths), * - the advanceServoMotion physics-sidecar call (import moved here). * * Engine-owned machinery deliberately NOT moved: * - HC-SR04 event scheduling: HCSR04_MAX_STEP_H / hcsr04MaxStepH(), * nextScheduledEventTime()'s event-aligned step clamping, and the * takeHcsr04EchoEvents() drain of pendingEchoEvent — they schedule * ENGINE step sizes and worker events, not device physics. * - MICROBIT_EDGE_PIN_TO_SIM + _hcsr04MicrobitBridge (a topology scan * over this.nets), reached via ctx.hcsr04MicrobitBridge. * - _buildArduinoPinDrivers, _mcuPowered, _mcuBootSimTime and the MCU * cores themselves — board machinery shared with the unmigrated MCU * board kinds, reached read-only via ctx. * - defaultServoState/defaultHcsr04State and the load()-time * relays/motors/servos/steppers/hcsr04/icState carry-forward plus * snapshot/rollback. * - The DC operating-point physical-time hold * (DC_OP_PHYSICAL_TIME_HOLD_KINDS), applied BEFORE commitState dispatch. * - The _drivenOutputTargets per-kind cases for uln/l293d/tb6612 (generic * output-sag scan, not a per-kind pass switch — same treatment as lm393 * and the digital-ics cohort). * * Import layering (registry header, decision 7): pure helper FUNCTIONS * and exported consts from sim-engine.ts are safe to import despite the * module cycle because handlers dereference them only at solve time. * Never read sim-engine bindings at module evaluation time from this * file. */ import type { DeviceModel } from "../device-registry.js"; export declare const relayModel: DeviceModel; export declare const dcMotorModel: DeviceModel; export declare const servoModel: DeviceModel; export declare const stepperModel: DeviceModel; export declare const hcsr04Model: DeviceModel; export declare const ulnModel: DeviceModel; export declare const buzzerModel: DeviceModel; export declare const speakerModel: DeviceModel; export declare const l293dModel: DeviceModel; export declare const tb6612Model: DeviceModel;