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.
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?
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 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.
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.
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.
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