spice netlists don't include .model line for non-diode devices
Description
b4a75cd1 added .model
lines for diodes, but all other devices need them too (JFETs, MOSFETs, BJTs, etc).
The model line also sometimes needs to include level=N
and/or version=V
, which specifies which type of device model to use for devices that can be modeled in several ways (e.g. simple quadratic MOSFET models (MOS1) vs. various BSIM models).
Steps to reproduce
- Open attached project, or add a JFET symbol and make it use a built-in N-channel JFET model.
- Generate a spice netlist, see that it doesn't have a
.model
line. - Try to simulate, ngspice gives error that it can't find model __Q1
- Add text to the schematic:
.model __Q1 NJF level=1
- Simulation passes
KiCad Version
Application: KiCad Schematic Editor arm64 on arm64
Version: (7.0.0-rc2-187-g9b9ebebb2d), release build
Libraries:
wxWidgets 3.2.1
FreeType 2.12.1
HarfBuzz 5.3.1
FontConfig 2.14.0
Platform: macOS Monterey Version 12.2.1 (Build 21D62), 64 bit, Little endian, wxMac
wxWidgets: 3.2.1 (wchar_t,wx containers)
Boost: 1.80.0
OCC: 7.6.3
Curl: 7.77.0
ngspice: 38
Compiler: Clang 13.0.0 with C++ ABI 1002
Build settings:
KICAD_SPICE=ON