Unexpected current in SPICE

I have a simple circuit with 8VDC applied to a diode and a resistor in series. The diode is a reverse biased BAS40 diode. From the datasheet and the IBV=200n in the .model I expect a current less than 200nA.

In transient analysis i get a stable -6.12uA between 0 and 4 milliseconds. This is at least thirty times greater than what I expect.

Clearly I’m overlooking something, but what? Below is the SPICE netlist from the simulation.

.title KiCad schematic
V1 VCC GND dc 8
R1 /D1R1junction GND 1
D1 /D1R1junction VCC DI_BAS40
.save @v1[i]
.save @r1[i]
.save @d1[id]
.save V(/D1R1junction)
.save V(GND)
.save V(VCC)
.tran 4u 4000u
.MODEL DI_BAS40 D  ( IS=6.12u RS=0.120 BV=40.0 IBV=200n  
+ CJO=5.00p  M=0.333 N=2.61 TT=7.20n )

imageKiCad_ngspice28_YetAnotherTest.zip (3.2 KB)

It is good to see that you are trying to verify your SPICE model!

Who published your model for the BAS40? Does the model claim to accurately reflect the reverse leakage current? (The great majority of SPICE models don’t even tell you what characteristics are modeled.)

While the reverse leakage current is a rather fundamental property of a diode, models tend to concentrate on the forward conduction characteristics. The modeler may ignore reverse behavior - which really means that it falls back to the SPICE default value for diodes. (Somewhere in the NGSPICE documentation you should be able to find the default parameter values assumed for the native SPICE devices when a model doesn’t explicitly specify a value.)

There are also a few subtle considerations to investigate.

  • Data sheets typically specify minimum, nominal, and maximum values for many parameters. Which set of values was the SPICE model developed for? If you are serious about modeling circuit behavior you often have two or more models for a device. One represents the nominal (“typical”, or “design center”) behavior, another shows worst-case, another may correspond to a special corner-case in the operational environment, etc.

  • Does your test circuit replicate the datasheet conditions for measuring reverse leakage current? In particular, what reverse voltage applies to the reverse current specification?

  • What temperature does the simulation assume? I think the default is 25C but this could be changed in SPICE setup or configuration files. Does this temperature agree with the temperature assumed by the datasheet?



While I personally do not use KiCad’s ngspice simulator I have read through a few posts on this forum and I recall something about the pins of diodes needing to be reversed.

Check this post:

I am curious to see how far the Schottky model would apply

Using a more detailed model to assert convergence
i got decent results with this very same model

Looks normal for a reverse biased Schottky

Very simple models or assumptions may prevent convergence

Convergence is a very tricky issue on simulations

1 Like

You are correct about the pins issue on parts from the KiCad library. I have however addressed this, and also tried to run the simulation with the diode biased the opposite of what I described above. The behavior is as expected. High current in the forward direction, low current in the reverse direction.

My problem is that I don’t see the connection between the -ibv parameter and the current in the simulation.

The model is published by Diodes inc. It is not stated if the model are supposed to work both ways.
The model does however have a -ibv 200n parameter. I read this as current at blocking voltage (40V for this particular diode).

In my setup I’m using a voltage of 8V and I’m expecting an even lower current than the -ibv parameter.

The temperatur is the default for ngspice in KiCad. I have not looked into this.

I’m not sure if convergence is a problem. If it is I haven’t noticed it.

If I read your simulation result right, you are getting the same current as me. Approximately 6uA while the datasheet (and the model) suggest 0.2uA.

You are specifiying a saturation current IS=6µA, and you get a current of 6µA.

Please have a look at the ngspice manual chapt. 7.3 for more info on the diode equations.


Yes they match EXACTLY like the model issued data.

But I think that this model is not good.

I had some very strange issues with 1N34A
By hacking the proper model now i have a reasonable accurate model.

And yes you do need to account the convergence depending
on the type of SIM you are running

Comparing the model you provided with 1N5819 you
may see that something is not right at all in this data.

Schottkys have lower forward drop VERY temperature dependent
and some dozen degrees up may increase the reverse current from
uA to mA easily.

VARYING TEMP on this model from 25C to 70C will
take the forward drop beyond 0.9V in the range below 0.5A.

I will not even bother plotting the FORWARD CURRENT drop curves
This model data does not looks right at all.

The temperature forward drop curve on low power Schottkys is still
below a regular PN junction diode, even on 90C

Only POWER SCHOTTKYS have very distinct traces

This 1N5819 model trace looks more accurate with real results


And one more comment I think it is proper to mention:

  • Datasheets specify these parameters on a “pulse” basis evaluation
  • I think that their pivot criteria is the ENERGY (in Joules) (transient)
  • e.g the amount of energy provided by the pulse duration
  • e.g. the specification parameter IS NOT steady state POWER
  • they specify a TRANSIENT PULSE ENERGY value

It means that we have to “convert” that ENERGY in POWER
according to the situation (frequency, impedance matching etc)

so to have a valid model or hacked model to apply
that explains why I have used the AC feed to test BAS40
and we can easily sweep that frequency to check

Please BEFORE any folk rant that I invented a model…


I have just crafted some old models to a matched new one
with REAL PARAMETERS from BAS40 some manufact.

Try this modification with a more suitable reverse bias
and other parms.

.model BAS40 D(Is=8n Rs=.120 Cjo=4p N=1.04 Bv=40 Ibv=200n M=0.3333 Vj=.5 Fc=.5 Eg=1.11 Ikf=0 Xti=2 TT=7.20n)

BAS40 is the GREEN trace
The adjusts does not put it even close 1N5819
but seems good enough to play

The AC feed now looks more proper

Now it sweeps to 70C more properly either


I collected several SPICE models for BAS40 diodes from various manufacturers. As is typical for manufacturers’ SPICE models, there is no explanation of what characteristics are modeled, or under what operating conditions. Nor are we told whether the models reflect a “typical” manufactured device, a datasheet worst-case device, or a marketing department fantasy. I placed each of them in your test circuit and used a different SPICE-based simulator (not NGSPICE) to investigate the models’ behaviors under reverse biased conditions.

Here’s a listing of the models, and the test circuit. The diode models are driven by a ramp voltage, from zero to -40V over 5 mSec.

Here are the simulation results.

As you can see, one model (from Diodes Inc) shows a reverse current of about 6uA. A second model (from Rohm ) has reverse current around 300nA and the remaining three models have reverse currents of less than 50nA. Removing the Diodes Inc model from the plot and re-scaling the current axis gives the following plot:

If a person owns a watch, he always knows EXACTLY what the time is. But a person who owns TWO watches is never quite sure. A simulation program with the most efficient algorithms and the most ergonomic, color-coordinated, GUI; running on the Phastest Komputer in the Galaxy; cannot compensate for the shortcomings of a device model. Which of these five models is “best”? Do ANY of them accurately reflect the behavior of the components sold by the manufacturer who published the model? Does each model apply ONLY to components produced by the manufacturer who published it? Do the people who developed these models have their feces amalgamated when it comes to modeling Schottky diodes?

I will leave those questions in the hands of Gentle Readers, to ponder over the weekend.


P.S. - Here are the source files for my simulations.
BAS40_Irev.asc (3.4 KB)
BAS40_Irev.plt (741 Bytes)


Heeee… I am trying to find answers more or less since mid 80’s…

Thing is:

  • THEY DON’T provide models or specs for us or others
  • they just drop some BONE to the wilds.

Each one tries to sell their own SIMULATOR and EDA stuff
and that dance plays as long as I can remember.

More or less like you I have collected a crazy pile of stuff
which I try to manage with more or less decent results.

I doubt there will be any reasonable understanding among FABs
and EDA sellers…

They don’t agree even on the exporting formats …
Models are ENCRYPTED in vast amounts.

We are hopeless.

1 Like

The diode model in SPICE (LTSPICE, ngspice, HSPICE and probably others) consists of a set of equations relating current and voltage of the diode, including temperature dependencies.

All of these models (the equations) are made to describe pn-junction diodes.

Schottky diodes (metal-semiconductor contacts) have basically different mechanisms concerning conduction and temperature behavior, with different equations.

Modeling a Schottky diode with model parameters and equations made for pn diodes is always a compromise. I guess it will not be possible to cover all aspects of a Schottky diode at the same time with these models (low on voltage, temperature behavior different to pn diodes, increasing reverse current with increasing reverse bias (not beig constant IS), relatively low breakdown voltage). You would need a Schottky diode model (a set of equations describing the I=f(U, T) behavior hard-coded into the simulator) and suitable model parameters (to be extracted for each specific Schottky diode).

Why is it not available? I guess one reason is that there are no Schottkys in CMOS, and simulators (maybe except PSPICE and LTSPICE) have been made for IC simulation.

Nevertheless …

I collected more than 10 different BAS40 models…

Honestly I have no clue what model goes in what simulator.
PSPICE being the most rich on models provided by most FABS
but that turns to be another problem with virtually too much
choices - and all different…

I just adjust some stuff when results are far beyond normal.
and try to manage that pile of stuff I have been collecting