Menu

#568 Diode current is M times larger than it should be

v1.0 (example)
closed-invalid
None
5
2021-12-17
2021-12-16
simpletk
No

I am trying to calculate current passing through diode the same way ngspice is calculating it. I have this circuit:

  • first line is ignored
    .model DTEST D(is=1e-8 n=1.7 rs=0 vj=0.5 m=0.345)
    VU1 1 0 DC 9
    RR1 1 2 300
    DD1 2 0 DTEST
    .op
    .end

Output will contain:

V(2)        6.524710e-01 (this is diode voltage 0.652V)
vu1#branch      -2.78251e-02 (this is diode current 0.027mA)

In PDF documentation current through diode is

var VT = k * T / q = 0.02586; // Thermal voltage
var AREAeff = AREA * M = 1 * 0.345 = 0.345; // Effective area
var PJeff = PJ * M; // not important as JSW=0 will cancel it out in next step
var ISeff = IS * AREAeff + JSW * PJeff = 1e-8 * 0.345 + 0 * PJeff = 1e-8 * 0.345 = 3.45e-9
var ID = ISeff * (Math.pow(e, VD / (N * VT)) - 1) = 3.45e-9 * (Math.pow(2.71828, 0.652 / (1.7 * 0.02586)) - 1) = 15.8mA;

So 15.8mA instead of 27.8mA, if I ignore ISeff and only use IS then it is:

var ID = IS * (Math.pow(e, VD / (N * VT)) - 1) = 1e-8 * (Math.pow(2.71828, 0.652 / (1.7 * 0.02586)) - 1) = 27.6mA

Exactly same as ngspice shows. So I think ngspice is not using ISeff but IS which is M times larger.

Discussion

  • Holger Vogt

    Holger Vogt - 2021-12-17

    Thanks for your report.

    Unfortunately there are some issues with this report.

    How do you obtain 15.8mA? Just entering a factor of 0.345 into the equation will yield a different result. How did you obtain the value of VD?

    From your findings I would not draw the conclusion that the current is M times larger, but that ngspice is ignoring M.

    A simple reason is that parameter m in a .model line of a diode is not the area factor, but the Area junction grading coefficient (see page 127 in chapter '7.2 Diode Model (D)' of the ngspice manual), which has no influence on the dc operation.

    The area factor has to be entered on the instance line:

    DD2 12 0 DTEST m=20
    

    Another point is: The assumption that in your circuit the current changes proportionally to the area facor is simply wrong. Why?
    A larger current will yield a larger voltage drop on the resistor RR1, thus reducing the voltage on the diode. The current in the diode depends exponentially on the voltage, so much stronger than on the area (which varies linearily). So the larger area is compensated by a smaller voltage, and the current nearly stays constant.

    See this:

    * diode m test
    .model DTEST D(is=1e-8 n=1.7 rs=0 vj=0.5 m=0.345)
    VU1 1 0 DC 9
    RR1 1 2 300
    DD1 2 0 DTEST
    
    VU2 11 0 DC 9
    RR2 11 12 300
    DD2 12 0 DTEST m=20
    .op
    
    .control
    run
    print all
    .endc
    
    .end
    

    with the result:

    v(1) = 9.000000e+00
    v(2) = 6.524710e-01
    v(11) = 9.000000e+00
    v(12) = 5.214324e-01
    vu1#branch = -2.78251e-02
    vu2#branch = -2.82619e-02
    

    So there is no bug in ngspice.

    To calculate this results manually, you will need an iterative approch, because the diode is highly non-lienar.

     
  • Holger Vogt

    Holger Vogt - 2021-12-17
    • assigned_to: Holger Vogt
     
  • simpletk

    simpletk - 2021-12-17

    Ok, thanks for explanation.

     
  • Holger Vogt

    Holger Vogt - 2021-12-17
    • status: open --> closed-invalid
     

Log in to post a comment.