Menu

Diode circuit I-V characteristic

Fahim
2015-10-26
2017-11-18
  • Fahim

    Fahim - 2015-10-26

    Hi,

    I am just trying to simulate simple diode circuit. I am not getting any error but the output is not coming as expected.

    The code is

    * eeschema netlist version 1.1 (spice format) creation date: monday 26 october 2015 03:08:36 pm ist
    
    .include D.lib
    
    v1 1 0  dc 5
    r1  1 2 1k
    d1 2 0 D1N750
    
    .dc v1 -15e-00 15e-00 0.1e-00
    
    * Control Statements
    .control
    run
    *print allv > plot_data_v.txt
    *print alli > plot_data_i.txt
    
    plot i(v1) vs v(1)
    .endc
    .end
    

    The D.lib content is

    .MODEL D1N750 D(Vj=.75 Cjo=175p Rs=.25 Eg=1.11 M=.5516 Nbv=1.6989 N=1 Bv=8.1 Fc=.5 Ikf=0 Ibv=20.245m Is=880.5E-18  Xti=3)
    

    The plot I-V is not coming properly. The output curve should come in first and third quadrant but it is coming in second and fourth. Is there any issue with anode/cathode of my diode?

    -Fahim

     
  • marcel hendrix

    marcel hendrix - 2015-10-26

    You have BV = 8V, looks like a zener.

     
  • Fahim

    Fahim - 2015-10-26

    I change the model to

    .model 1n4148 D (is=2.495E-09 rs=4.755E-01 n=1.679E+00
    +tt=3.030E-09 cjo=1.700E-12 vj=1 m=1.959E-01
    +bv=1.000E+02 ibv=1.000E-04)

    as given in the ngspice doc I am getting complete zero on left to x-axis and rising towards negative y-axis on right of x-axis. It should actually be in the first quadrant instead of 4th quadrant.

    Any idea what may went wrong in my netlist.

    -Fahim

     
  • marcel hendrix

    marcel hendrix - 2015-10-26

    The current is negative for positive diode voltage because you are measuring the SOURCE current, not
    the diode current (I initially made the same error as you :-)

    -marcel

     
  • Fahim

    Fahim - 2015-10-26

    Thanks it solve my problem.

    Now I am plotting as 'plot -i(v1) vs v(1)' And it is giving me the expected output.

    Is there anyway to direct find out the current though diode instead of via some voltage source? Something like i(d1).

    Thanks once again.

     
  • marcel hendrix

    marcel hendrix - 2015-10-26

    Is there anyway to direct find out the
    current though diode instead of via some
    voltage source? Something like i(d1).

    You can access all characteristics of all devices
    with @device[param]. It is not practical to
    have separate commands for all of these.

    Here is your example. (Note that 'plot' allows
    functions of vectors).

    -marcel

    .TITLE DIODE test
    
    v1 1 0  dc=5
    r1 1 2  1k
    d1 2 0  D1N750
    .model d1n750 D(Vj=.75 Cjo=175p Rs=.25 Eg=1.11 M=.5516 Nbv=1.6989 N=1 Bv=8.1 Fc=.5 Ikf=0 Ibv=20.245m Is=880.5E-18  Xti=3)
    .save all @d1[id] @R1[p]
    
    .dc v1 -5 2 0.05
    
    * Control Statements
    .control
      run
      plot '-i(v1)' vs v(1)
      plot @d1[id] vs v(1)
      settype power @r1[p]
      plot @r1[p] vs v(1)
    .endc
    
    .end
    
     
  • Fahim

    Fahim - 2015-10-27

    Thanks. This will help a lot.

     
  • Clyde

    Clyde - 2016-10-18

    Hi, Marcel,

    Is there documenation in the manual which oultines the various parameters which may be accessed like this? such as [id], [p] etc?

    Clyde

     
    • Justin Fisher

      Justin Fisher - 2016-10-18

      Chapter 31 of the manual.

      Anything that says OUT in the tables can be accessed.

      --
      Kind regards,
      Justin Fisher.

      Sent from my phone.

       
  • Clyde

    Clyde - 2016-10-19

    Thank you. I saw the tables, but dismissed them the first read through. This is a big help.

    Clyde

     

Log in to post a comment.