Overview
KiCad includes integrated SPICE simulation capabilities through ngspice, allowing you to simulate analog and mixed-signal circuits directly from your schematic. The simulation system supports AC, DC, transient, and noise analysis.Architecture
The simulation system consists of several key components:NGSPICE Interface
Defined in/eeschema/sim/ngspice.h:
Simulation Library Manager
Defined in/eeschema/sim/sim_lib_mgr.h:
SPICE Model Types
KiCad supports various SPICE model types:Built-in Primitive Models
- R: Resistor
- C: Capacitor
- L: Inductor
- V: Voltage source (DC, AC, transient)
- I: Current source
- D: Diode
- Q: BJT transistor
- M: MOSFET
- J: JFET
- X: Subcircuit
Assigning Models to Symbols
In the schematic, symbols are assigned simulation models through fields:Running Simulations
DC Operating Point
Analyze DC voltages and currents:DC Sweep
Sweep a voltage or current source:AC Analysis
Frequency domain analysis:dec: Decade sweep (10 points per decade)1: Start frequency (1 Hz)100k: End frequency (100 kHz)
Transient Analysis
Time-domain simulation:1u: Time step (1 microsecond)100u: Total time (100 microseconds)
Noise Analysis
SPICE Netlist Export
KiCad generates SPICE netlists from schematics using/eeschema/netlist_exporters/netlist_exporter_spice.h:
Netlist Structure
Probe Points and Measurements
Voltage Probes
Current Probes
Insert voltage source with 0V to measure current:Power Calculations
Python Scripting Integration
While KiCad’s simulation is primarily GUI-based, you can export and run netlists programmatically:Advanced SPICE Features
Behavioral Sources
Subcircuits
Parameter Sweeps
Temperature Analysis
Model Libraries
Loading External Models
IBIS Models
For signal integrity analysis, KiCad supports IBIS models through/eeschema/sim/kibis/:
Performance Optimization
Convergence Issues
Memory Management
Simulation Results Analysis
Fourier Analysis
Distortion Analysis
Pole-Zero Analysis
Common Simulation Patterns
RC Low-Pass Filter
BJT Amplifier
Troubleshooting
Common Errors
“Singular matrix”- Add small resistor to floating nodes
- Check for loops of voltage sources or capacitors
- Reduce RELTOL
- Add small resistance to capacitors
- Check for unrealistic component values
- Set better initial conditions
- Use
.nodesetto hint at solutions - Reduce circuit complexity
Best Practices
- Start simple: Verify basic operation before adding complexity
- Use realistic values: Avoid extreme component values
- Set appropriate tolerances: Balance speed vs. accuracy
- Include parasitics: Add ESR, ESL for real-world behavior
- Validate with measurements: Compare simulation to hardware
- Document models: Comment model sources and parameters
See Also
- Signal Integrity - High-speed design analysis
- Python Scripting - Automation
- Custom File Formats - Netlist formats