I’m trying to get my feet wet with ngspice. But I fail to simulate even a simple circuit:
The error I get is:
warning, can't find model diode
Circuit: KiCad schematic
Error on line 4 :
d1 0 net-_d1-pad2_ diode
Unable to find definition of model diode
Error: circuit not parsed.
I assumed that ngspice comes with a basic definition of diode, NPN, PNP, etc. The examples from http://ngspice.sourceforge.net/ngspice-eeschema.html work, though.
.title KiCad schematic
V1 Net-_R1-Pad2_ 0 dc 1
R1 Net-_D1-Pad2_ Net-_R1-Pad2_ 1k
D1 0 Net-_D1-Pad2_ DIODE
.dc V1 0 5 .1
What’s the issue here?
KiCad 5.1.8+dfsg1-1+b1, Debian sid
ngspice compiled from ngspice revision 33
You use a model
DIODE (ngspice just prints all in lowercase in the error message).
You could add a text line with something like
.model DIODE D to define it.
See @Ste’s tutorial: https://youtu.be/90Z6ffxzDz8
and the examples in
Thanks for the quick reply. Manually setting “.model diode d” works.
I was assuming that using the simulation diode “Diode symbol for simulation only” with the default settings “Symbol Properties → Edit Spice Modlel… → Model: Diode, Type: Diode” would select the default ngspice diode model described in section 7.2 in the ngspice manual. But apparently that’s not the case.
What is the effect of using this SPICE diode model with “Model: Diode, Type: Diode” when no diode model is chosed for this part by default?
This action creates an instance of a diode called “
Diode”, but “
Diode” is not defined unless a “modelcard” line is specified somewhere else on the netlist. That’s what the “
.model Diode D” directive does. For example, if you used a 1N4148 symbol instead of the DIODE symbol (from pspice symbol library), the model field you’re talking about would be pre-filled in with 1N4148 and would require a “
.model 1N4148 D” instead so it matches the symbol. Of course, you can also edit this field to whatever you want and adjust things that way.
Just a heads up to be careful when using default models, since they have many parameters set to zero. Specifically for a diode, the breakdown voltage is set to infinity and there is no junction or diffusion capacitance…among other things. It’s my opinion to never use default models for anything…and you’ll especially get burned if you ignore that advice when using the default MOSFET model.
For a basic model for a small signal diode, I would suggest something like this such that the key parameters are all defined and the user can at least see where the breakdown voltage (BV) is defined. Having the
Cjo defined will help with convergence of the SPICE engine.
.model simple_diode D(Is=1n Rs=100m N=1.5 Cjo=1p BV=50 IBV=1n)
@Ste Thanks. I’ll keep that in mind.
i have get the detailed overview about 1N5408 diode here can see to details so solve problems
(Moderator edit: link deleted, we are waiting for the first time poster to prove not to be a spammer.)