Adds 44 SPICE mappers, 58 custom metadata entries, and 12 visual Web Components covering logic gates, transistors, op-amps, regulators, sources, electromechanical parts and integrated-circuit packaging. Fase 9 — component catalog expansion ------------------------------------ - 7 logic gates (AND/OR/NAND/NOR/XOR/XNOR + NOT) as SPICE B-sources - 8 multi-input gates (AND/OR/NAND/NOR with 3 and 4 inputs) - 9 transistors: 5 BJTs (incl. PNP 2N3906/BC557) + 4 MOSFETs (incl. P-channel IRF9540/FQP27P06). NMOS refactored from Level=3 W=0.1 (hangs ngspice) to Level=1 with sane W/L - 5 op-amps: LM358, LM741, TL072, LM324 with per-chip saturation rails + opamp-ideal - 4 linear regulators (7805, 7812, 7905, LM317) with dropout - 3 batteries (9V, AA, coin-cell) with realistic ESR - Signal generator (sine / square / DC) - 2 Schottky diodes (1N5817, 1N5819) + photodiode (lux-driven current source) Fase 10 — electromechanical + ICs --------------------------------- - Relay (SPDT): coil + L + S-switch with native hysteresis + flyback diode, inverted-control trick for the NC contact - Optocouplers 4N25 and PC817 (LED + CCCS with CTR=0.5 / 1.0) - 7 74HC ICs as DIP-14 packages emitting 4 or 6 B-sources per component (first mapper pattern emitting multiple device cards) - 3 flip-flops (D, T, JK) — digital-sim only (edge detection is not representable in ngspice .op) - L293D dual H-bridge motor driver Infrastructure -------------- - scripts/component-overrides.json gains a _customComponents[] array that lets new Velxio-only parts survive metadata regeneration (previously applyOverrides() could only patch wokwi-elements components that had already been scanned) - scripts/generate-component-metadata.ts injects custom entries before the patch loop - New ComponentCategory values: 'logic', 'analog', 'electromech' - frontend/src/components/DynamicComponent.tsx PASSIVE tracing extended from just ['resistor','resistor-us'] to 9 two-terminal passives with per-part pin name maps - New CI workflow test-circuit.yml runs the sandbox on push/PR - frontend-tests.yml regenerates metadata and fails if committed JSON is stale - Documented 2 new ngspice gotchas in circuit-emulation-gotchas.md: unicode in netlist titles silently hangs the parser, and MOSFET Level=3 + W=0.1m causes .op to hang - 164/164 sandbox tests passing in ~9 s (was 88 pre-fase-9) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| autosearch | ||
| fixtures | ||
| plan | ||
| src | ||
| test | ||
| README.md | ||
| package-lock.json | ||
| package.json | ||
README.md
test_circuit — sandbox de emulación de circuitos
Sandbox para validar la emulación de circuitos analógicos + digitales + Arduino en JS puro antes de tocar Velxio.
Estructura
test_circuit/
├── plan/ # Documentos de planificación (fases 0–7)
├── src/
│ ├── solver/ # MNA hand-rolled (legacy, baseline)
│ ├── components/ # Modelos JS (legacy, baseline)
│ ├── avr/ # AVRHarness (avr8js estilo Velxio)
│ └── spice/ # SpiceEngine (ngspice-WASM) + AVRSpiceBridge
├── test/ # Vitest tests
│ ├── passive.test.js # baseline JS
│ ├── transient_rc.test.js # baseline JS
│ ├── diodes.test.js # baseline JS
│ ├── avr_blink.test.js # avr8js con blink.hex
│ ├── e2e_pot_pwm_led.test.js # baseline JS + avr8js
│ ├── e2e_thermistor.test.js # baseline JS + avr8js
│ ├── ngspice_smoke.test.js # ngspice boot
│ ├── spice_passive.test.js # ngspice DC
│ ├── spice_transient.test.js # ngspice .tran
│ ├── spice_ac.test.js # ngspice .ac Bode
│ ├── spice_active.test.js # diodo, BJT, MOSFET, op-amp
│ ├── spice_digital.test.js # lógica behavioral
│ ├── spice_555_astable.test.js # oscilador relajación
│ └── spice_avr_mixed.test.js # co-simulación avr8js ↔ ngspice
├── fixtures/ # .hex pre-compilados / ensamblados a mano
├── autosearch/ # Hallazgos, métricas, propuestas
└── package.json
Correr las pruebas
cd test/test_circuit
npm install
npm test
Por fase:
npm run test:phase3 # pasivos
npm run test:phase4 # activos (diodos)
npm run test:avr # integración avr8js
npm run test:e2e # end-to-end Arduino + circuito