spice simulate
spice_simulateRun a SPICE circuit simulation directly in the worker. Accepts a standard SPICE netlist and performs operating-point (.op), DC sweep (.dc), AC frequency sweep (.ac), or transient (.tran) analysis using a built-in modified-nodal-analysis engine with Newton-Raphson nonlinear solving. Supports R, L, C, V, I sources (DC/AC/SIN/PULSE), diodes, BJTs (Ebers-Moll), MOSFETs (Shichman-Hodges level 1), controlled sources (E/G), .param expressions, .subckt/X hierarchical subcircuits, .measure and .four (Fourier/THD), and a built-in parts library (reference 2n3904/2n2222/1n4148/1n5819/2n7000/tl072/lm358/led_red etc. by name and the model is auto-injected), up to 150 components. Returns voltage vectors for all circuit nodes (magnitude + phase for AC). Use spice_template to generate netlists from parameterized templates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| certify | No | If true, attach an a-posteriori existence certificate for the DC operating point (Newton–Kantorovich: proves a true solution exists within a computed radius, or refuses). Adds ~one extra back-solve. | |
| netlist | Yes | SPICE netlist (ngspice-compatible). Must include at least one analysis command (.ac, .dc, .tran, .op) and end with .end | |
| options | No | Additional ngspice .options (e.g. { reltol: 0.001 }) | |
| analysis | No | Override analysis type (auto-detected from netlist if omitted) | |
| tolerances | No | Component-tolerance box, e.g. {"R1":0.05,"V1":0.02} (fractional). With output_node, returns a certified min/max interval for that node over all component variations. R/V/I elements only. | |
| output_node | No | Node whose voltage is certified over the tolerance box (required with tolerances). | |
| temperature_c | No | Simulation temperature in Celsius |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | Yes | List of circuit node names | |
| fourier | No | Present when the netlist has .four cards: Fourier harmonics + THD per node | |
| vectors | Yes | Named voltage/current vectors keyed by node name | |
| measures | No | Present when the netlist has .measure cards: {name: value} | |
| warnings | Yes | Any ngspice warnings generated during simulation | |
| runtime_ms | Yes | Simulation wall-clock time in milliseconds | |
| certificate | No | Present when certify=true: {certified, rho, eta, h, ...} existence certificate for the DC operating point | |
| analysis_type | Yes | Analysis type that was performed | |
| component_count | Yes | Number of components in the netlist | |
| tolerance_certificate | No | Present when tolerances+output_node given: {certified, interval, nominal, ...} certified output range over the component-tolerance box |