Question about adifference in results between ngspice, LTspice and SIMetrix.

Help
2013-10-31
2014-05-08
  • Andy Fierman

    Andy Fierman - 2013-10-31

    Help on this question would be very gratefully received.

    I have a netlist that if I run it in LTspice or SIMetrix, then to
    about 4 significant figures, I get the same result:

    I(VXBIAS) = 259.5mA

    If I run the same netlist in ngspice release 25, I get:

    I(VXBIAS) = 266.5mA

    i.e. a 7mA dfference.

    I have lightly edited the devices and their associated .model
    statements to remove any unrecognised parameters and to ensure that
    the models in the netlist are being used and that no external models
    are being pulled in.

    That way ngpsice, LTspice and SIMetrix should be using identical
    models and paramater sets.

    All simulations are being run at the same temperature.

    In LTspice I have tried individually adjusting

    GMIN: 1e-012 > 1e-011
    Abstol: 1e-012 > 1e-011
    Reltol: 0.001 > 0.01
    Chgtol: 1e-014 > 1e-013
    Trtol: 7 > 1
    Voltol: 1e-006 > 1e-005
    Sstol: 0.001 > 0.01
    MinDeltaGmin > 0.0001 > 0.001
    

    to see if I can change the value of I(VXBIAS) but have made no
    significant difference (i.e. greater than about 1mA) to the result.

    I have also tried running using different time steps and integration
    methods and have run extended .tran sims with a

    V=15*(1-exp(-1*time/10u))

    ramped supply voltage B source in place of V1 to see if the initial
    conditions could be the root cause of the steady state difference.

    Again, all with no appreciable difference to the value of I(VXBIAS) in
    any of the simulators.

    So my question is:

    Does anyone have any insight as to what ngspice might be doing - or
    doing differently - that could account for the 7mA difference in the
    values for I(VXBIAS)?

    (Oh and I know the amplifier is not very good. It just happens to be
    the circuit in which I spotted this value difference.)

    :)

    Andy.

    signality.co.uk

    Netlist follows:


    * Amplifier sanity check
    
    VXBIAS V1_1 Q4_2 0v
    .SAVE I(VXBIAS)
    V2 V2_1 0  SIN(0 000m 1k)  AC 1 0 ; yes it is supposed to be zero amplitude!
    V1 V1_1 0  15
    R9 R7_2 R9_2  22k
    R8 0 R8_2  470
    R7 R7_1 R7_2  1
    R6 R7_2 R6_2  1
    R4 C1_2 R4_2  27k
    R3 0 C1_2  100k
    R2 R2_1 R9_2  1k
    R13 R8_2 D2_C  1m
    R12 R1_2 R4_2  27k
    R11 V1_1 R1_2  330
    R10 0 VOUT  8
    R1 R1_1 R1_2  15k
    Q4 Q4_2 Q2_3 R6_2 BD139x
    Q3 0 R8_2 R7_1 BD140x
    Q2 Q2_3 R1_1 V1_1 Q2N3906
    Q1 R1_1 C1_2 R9_2 BC109Cx
    D2 D2_A D2_C D1N4148
    D1 Q2_3 D2_A D1N4148
    C6 0 R4_2  470u
    C5 0 R2_1  330u
    C4 0 V1_1  2200u
    C3 R7_2 VOUT  2200U
    C2 0 R1_2  220u
    C1 V2_1 C1_2  10u
    .save V(VOUT)
    
    **************************************
    *       by MODPEX     *
    *Copyright(c) Symmetry Design Systems*
    *         All Rights Reserved        *
    *    UNPUBLISHED LICENSED SOFTWARE   *
    *   Contains Proprietary Information *
    *      Which is The Property of      *
    *     SYMMETRY OR ITS LICENSORS      *
    *Commercial Use or Resale Restricted *
    *   by Symmetry License Agreement    *
    **************************************
    *  on Aug 7, 01
    * : SPICE2
    .MODEL Q2N3906 pnp
    +IS=7.75521e-12 BF=194.093 NF=1.35509 VAF=156.436
    +IKF=0.0660057 ISE=1.88546e-12 NE=1.81673 BR=3.41317
    +NR=1.5 VAR=5.86061 IKR=1.70599 ISC=7.64281e-10
    +NC=1.92376 RB=6.48961 IRB=0.1 RBM=0.1
    +RE=0.0001 RC=2.45044 XTB=0.1 XTI=1
    +EG=1.05 CJE=6.11928e-12 VJE=0.4 MJE=0.248812
    +TF=5.21843e-10 XTF=0.932702 VTF=9.1046 ITF=0.0106472
    +CJC=6.85007e-12 VJC=0.4 MJC=0.279018 XCJC=0.9
    +FC=0.478887 CJS=0 VJS=0.75 MJS=0.5
    +TR=4.30605e-07 PTF=0 KF=0 AF=1
    
    *.model D1n4148 D(IS=1.6f RS=1.0 IKF=22m CJO=3p M=0.3 VJ=0.75 ISR=2.6n
    BV=70 TT=20n)
    .model D1n4148 D(IS=1.6f RS=1.0 IKF=22m CJO=3p M=0.3 VJ=0.75 BV=70 TT=20n)
    
    *.model BC109Cx   NPN(Is=7.049f Xti=3 Eg=1.11 Vaf=28.14 Bf=677
    Ise=7.049f Ne=1.38
    *+               Ikf=96.23 Nk=.5 Xtb=1.5 Br=2.209 Isc=250.3p Nc=2.002 Ikr=10.73
    *+               Rc=1.433 Cjc=5.38p Mjc=.329 Vjc=.6218 Fc=.5 Cje=11.5p Mje=.2717
    *+               Vje=.5 Tr=10n Tf=437.8p Itf=3.097 Xtf=12.85 Vtf=10)
    *                               PHILIPS
    pid=bc108c      case=TO18
    *                               91-08-02 dsq
    
    .model BC109Cx   NPN(Is=7.049f Xti=3 Eg=1.11 Vaf=28.14 Bf=677 Ise=7.049f Ne=1.38
    +               Ikf=96.23 Xtb=1.5 Br=2.209 Isc=250.3p Nc=2.002 Ikr=10.73
    +               Rc=1.433 Cjc=5.38p Mjc=.329 Vjc=.6218 Fc=.5 Cje=11.5p Mje=.2717
    +               Vje=.5 Tr=10n Tf=437.8p Itf=3.097 Xtf=12.85 Vtf=10)
    *                               PHILIPS
    pid=bc108c      case=TO18
    *                               91-08-02 dsq
    
    **************************************
    *      Model Generated by MODPEX     *
    *Copyright(c) Symmetry Design Systems*
    *         All Rights Reserved        *
    *    UNPUBLISHED LICENSED SOFTWARE   *
    *   Contains Proprietary Information *
    *      Which is The Property of      *
    *     SYMMETRY OR ITS LICENSORS      *
    *    Modeling services provided by   *
    * Interface Technologies www.i-t.com *
    **************************************
    .MODEL bd140x pnp
    +IS=1e-09 BF=650.842 NF=0.85 VAF=10
    +IKF=0.0950125 ISE=1e-08 NE=1.54571 BR=56.177
    +NR=1.5 VAR=2.11267 IKR=0.950125 ISC=1e-08
    +NC=3.58527 RB=41.7566 IRB=0.1 RBM=0.108893
    +RE=0.000347052 RC=1.32566 XTB=19.5239 XTI=1
    +EG=1.05 CJE=1e-11 VJE=0.75 MJE=0.33
    +TF=1e-09 XTF=1 VTF=10 ITF=0.01
    +CJC=1e-11 VJC=0.75 MJC=0.33 XCJC=0.9
    +FC=0.5 CJS=0 VJS=0.75 MJS=0.5
    +TR=1e-07 PTF=0 KF=0 AF=1
    * Model generated on Feb 14, 2004
    * Model format: SPICE3
    **************************************
    *      Model Generated by MODPEX     *
    *Copyright(c) Symmetry Design Systems*
    *         All Rights Reserved        *
    *    UNPUBLISHED LICENSED SOFTWARE   *
    *   Contains Proprietary Information *
    *      Which is The Property of      *
    *     SYMMETRY OR ITS LICENSORS      *
    *    Modeling services provided by   *
    * Interface Technologies www.i-t.com *
    **************************************
    .MODEL bd139x npn
    +IS=1e-09 BF=222.664 NF=0.85 VAF=36.4079
    +IKF=0.166126 ISE=5.03418e-09 NE=1.45313 BR=1.35467
    +NR=1.33751 VAR=142.931 IKR=1.66126 ISC=5.02557e-09
    +NC=3.10227 RB=26.9143 IRB=0.1 RBM=0.1
    +RE=0.000472454 RC=1.04109 XTB=0.727762 XTI=1.04311
    +EG=1.05 CJE=1e-11 VJE=0.75 MJE=0.33
    +TF=1e-09 XTF=1 VTF=10 ITF=0.01
    +CJC=1e-11 VJC=0.75 MJC=0.33 XCJC=0.9
    +FC=0.5 CJS=0 VJS=0.75 MJS=0.5
    +TR=1e-07 PTF=0 KF=0 AF=1
    * Model generated on Feb 14, 2004
    * Model format: SPICE3
    
    .tran 20u 2m ; for ngspice
    *.tran 0 2m 0 20u ; for LTspice and SIMetrix
    
    .END
    
     
    • Dietmar Warning

      Dietmar Warning - 2013-11-01

      Hello Andy,
      thanks for your report but I am afraid that nobody of us can help you.
      The circuit is to complex to debug means there are to much elements which have an impact to the bias current.
      BTW, nobody knows what is correct. If I simulate your circuit with hspice I got a third answer with 265.22mA.
      May be ngspice is right ;)
      BR,
      Dietmar

       
  • Andy Fierman

    Andy Fierman - 2013-11-01

    Hi Dietmar,

    Thanks for trying it in another simulator anyway!

    I might try asking this on the gEDA forum.

    Let you know if I find out more.

    Andy.

    signality.co.uk

     
  • Dietmar Warning

    Dietmar Warning - 2013-11-01

    Andy,
    perhaps a schematic w/ node names would be helpful for this kind of asking.

    Dietmar

     
  • marcel hendrix

    marcel hendrix - 2014-05-08

    Andy,
    1) Why would LTSpice use the standard Berkeley/VBIC models? (In NGSPICE we can look in the source to see what it does, and how.)
    2) The default parameters of the simulators may differ (unless you set ALL parameters).

    With .temp 23 NGSPICE gives the same result as LTSpice.

    -marcel

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks