Electronic – Adding Diode Model to gschem

diodeslinuxspice

I'm looking to use the D1N914 diode in a netlist for use with ngspice. Thankfully I've found the model for free here: http://ppd.fnal.gov/experiments/cdms/old_files/electronics/FLIP/3U/QampDiscrete/proto/schematics_layouts/DIODE.LIB

Problem is, I don't know how I can add such a model to work with gschem or even ngspice. I'm wondering if anyone is familiar as how to use models in ngspice or SPICE in general.

The circuit I'm describing is a just a voltage source connected to a D1N914 (anode to positive, cathode to negative). Nothing special, I'm just doing a small DC analysis.

Best Answer

On the ngspice side of things, you need to include the model in your circuit, using one of various commands.
The simplest is to put the .model into your netlist, and use the name to refer to it, e.g. your model looks like this:

.model D1N914 D(Is=168.1E-21 N=1 Rs=.1 Ikf=0 Xti=3 Eg=1.11 Cjo=4p M=.3333 + Vj=.75 Fc=.5 Isr=100p Nr=2 Bv=100 Ibv=100u Tt=11.54n)

Note ngspice seems to have a problem with a couple of parameters in this model (Isr and Nr), so the simulation may be unrealistic as I removed them just to get things working.
It appears to be a psice model, and (according to LTSpice):
Isr = Recombination current parameter Nr = Isr emission coefficient.
I don't think they will have much effect on the simulation, likely high order Is effects added into the commercial spices.

So here is an example netlist (with Isr and Nr removed, see above):

V1 1 0 5
R1 1 2 1k
D1 2 3 D1N914
Vdummy 3 0 0

.model D1N914 D(Is=168.1E-21 N=1 Rs=.1 Ikf=0 Xti=3 Eg=1.11 Cjo=4p M=.3333 + Vj=.75 Fc=.5 Bv=100 Ibv=100u Tt=11.54n)

*.option noacct .dc V1 0 10 1

*.print i(Vdummy)

.end

If we type plot i(Vdummy), we get this:

ngspice example

The second option would be to do something like add it to a modelcard and do .include\xxxx\xxx\modelcard.diode into your netlist. I have not tested this option though, only the first which works fine. I imagine there is some way of linking the modelcard to the symbol Matt describes in his answer (in LTspice you add the file as one of the symbol parameters)