1. 跨平台
2. 支持pyspice
3. 自带终端,可独立运行
4. 丰富的案例
issue:
器件的spice模型获取方式?
资源:
1. 官方链接
Ngspice, the open source Spice circuit simulator - Intro
官方描述看起来模型是很丰富的:
ngspice offers a wealth of device models for active, passive, analog, and digital elements. Model parameters are provided by our collections, by the semiconductor device manufacturers, or from semiconductor foundries. The user adds her circuits as a netlist, and the output is one or more graphs of currents, voltages and other electrical quantities or is saved in a data file.
spice3的官方文档链接:
并行处理提高处理大电路的能力时可以考虑CUSPICE
在KICAD里通过原理图调用ngspice
KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation
一些模型来源搜集:
Spice models and model parameters for ngspice circuit simulator
常规模型
研究机构
再有就是各大半导体厂商了。
上面是器件的,如果是IC设计层面的,其实PDK(PROCESS DESIGN KIT)大多由FAB提供
HSPICE模型,ngspice可以大部分兼容(largely compatible). 其中有个著名的开源库,就是google/skywater提供的开源PDK, 针对130nm制程
Ngspice, the open source Spice circuit simulator - Applications
针对KiCAD的一些例子,实测可以运行
Simulation examples for KiCad/Eeschema/ngspice - Simulation (Ngspice) - KiCad.info Forums
2. github
3. ngspice工作原理的四要素:
device model parameters器件模型
netlist连接关系
simulation command仿真指令
out command 输出指令
4 跨平台的安装配置
5. ngspice的基本文件格式
ngspice使用的模型数据有三类: PDKs, ngspice内置模型,其他的子电路模型
1)内置模型的通用表示方式
.model mname type ( pname1=pval1 pname2=pval2 ... )
where mname is the model name, type is the ngspice model type, and pnamxx are the model parameters with their values pvalxx. The parameters are prescribed by the model type, the values are used to achieve best correlation between model and measured device reality. Please note that sometimes the .model is split into several lines, where consecutive lines start with a '+' in the first column. This is regarded as a single line. A typical example is:
*SRC=BC546;BC546;BJTs NPN;Gen. Purpose;65V 100mA
.MODEL BC546 NPN (IS=50.7F NF=1 BF=318 VAF=145 IKF=.3
+ ISE=15.9P NE=2 BR=4 NR=1 VAR=24 IKR=.45 RE=1.54 RB=6.17
+ RC=.617 XTB=1.5 CJE=20.8P CJC=8.33P TF=611P TR=138N)
* National 65 Volt .5 Amp 260 MHz SiNPN Transistor 01-26-1991
*PINOUT TO-92 3 2 1
*号打头的是注释行
2)子电路模型
.subckt sname node1 node2 node3
...
.ends
样例
where sname is the model's name, and nodexx are the nodes connecting the subcircuit to the outside world. An example (a power MOS transistor FDS86252) is this:
.SUBCKT FDS86252 2 1 3
******************************************************************
** Fairchild Discrete Modeling Group **
******************************************************************
** Website www.fairchildsemi.com\models **
******************************************************************
** (C) Copyright 2009 Fairchild Semiconductor Corporation **
** All rights reserved **
** **
** FDS86252 Spice model **
** Revision RevA, 28 Apr 2011 **
******************************************************************
*Nom Temp 25 deg C
Dbody 7 5 DbodyMOD
Dbreak 5 11 DbreakMOD
Lgate 1 9 5.108e-9
Ldrain 2 5 0.1e-9
Lsource 3 7 2.295e-9
RLgate 1 9 51.08
RLdrain 2 5 1
RLsource 3 7 22.95
Rgate 9 6 0.47
* Shielded Gate
D1 100 5 D_SG_cap
D2 100 101 D_SG_cap
R1 101 7 0.876
C1 6 101 87e-12
.MODEL D_SG_cap D (IS=1e-9 n=1 RS=4e-3 CJO=0.994e-9 M=0.711 t_abs=25)
It 7 17 1
Ebreak 11 7 17 7 158.5
Rbreak 17 7 RbreakMOD 1
.MODEL RbreakMOD RES (TC1=0.75e-3 TC2=-0.9e-6)
.MODEL DbodyMOD D (IS=2.5e-12 n=1.05 RS=7e-3 TRS1=7.5e-3 TRS2=1e-6
+ CJO=0.252e-9 M=0.565 TT=1e-9 XTI=9.5)
.MODEL DbreakMOD D (TRS1=0 TRS2=1e-6 )
Rsource 7a 7 0.715e-3
Rdrain 5 16 RdrainMOD 36e-3
.MODEL RdrainMOD RES (TC1=7.25e-3 TC2=21e-6)
M_BSIM3 16 6 7a 7a Bsim3 W=1.1544 L=1.1e-6 NRS=0 NRD=0
.MODEL Bsim3 NMOS (LEVEL=7 VERSION=3.1 MOBMOD=3 CAPMOD=2 paramchk=1 NQSMOD=0
*Process Parameters
+ TOX=1000e-10 ;Oxide thickness
+ XJ=0.54e-6 ;Channel depth
+ NCH=0.83e17 ;Channel concentration
*Channel Current
+ U0=670 VSAT=500000 DROUT=1.8
+ DELTA=0.03 PSCBE2=0 RSH=0.715e-3
*Threshold voltage
+ VTH0=3.85
*Sub-threshold characteristics
+ VOFF=-0.13 NFACTOR=1.85
*Junction diodes and Capacitance
+ LINT=0.19e-6 DLC=0.19e-6
+ CGSO=300e-12 CGSL=0 CGDO=1e-12 CGDL=150e-12
+ CJ=0 CF=0 CKAPPA=1
* Temperature parameters
+ KT1=-2.85 KT2=0 UA1=17.5e-9
+ NJ=10)
.ENDS
6. ngspice的运行逻辑
开放的两个模型集models_ugr.7z , MicroCap-LIBRARY.7z 都可以放到模型目录下使用models/MicroCap-LIBRARY-for-ngspice and models/modelos_subckt.
添加库
Include mymodels.lib into your netlist, e.g. by (check for the correct path)
.include model/mymodels.lib
添加了库以后就可以在文件里调用模型
You may now access the model data from within your netlist by calling the devices with
Q2 c1 b1 e1 BC546
XPowerMOS d1 g1 s1 FDS86252
调用厂商提供的官方模型
If you are looking for a model from TI, e.g. the OpAmp OPA1641, you will find a PSPICE compatible, zipped model file assembly sbom627b.zip on the TI web pages. If you unzip it, the ngspice compatible device model is contained in the file OPA1641.lib. To check its eligibility, open the file in a text editor. After the introduction (comment lines), you will find the characteristic line
.subckt OPA1641 IN+ IN- VCC VEE OUT
as the begin of the main subcircuit. So copy this file OPA1641.lib to your model folder and invoke it by:
.include model/OPA1641.lib
Xopamp inp inm vc ve opout OPA1641
And because this OpAmp model is a PSPICE model, don't forget to set
set ngbehavior=ltpsa
in file .spiceinit.
7. 工作流程设计:
kicad设计电路, 并配置参数/模型,
ngspice仿真结果确认netlist及仿真类型正确,参数范围,
输出网表文件, 调入pyspice进行命令行调用处理(固定模型,根据命令和参数配置提供API交互式仿真)
8.各大厂商的资源
ADI
digi-key的在线设计平台,可以导入KiCAD
Scheme-it | 免费在线原理图绘制工具 | DigiKey Electronics
台湾半导体设计资源
Reference Designs-Taiwan Semiconductor
见下一篇。。。。。