Ngspice can't get the right result

Help
lpc2138
2012-11-28
2013-06-12
  • lpc2138

    lpc2138 - 2012-11-28


    AUDIO_AMPLIFIER3

    V3 VIN GND  SIN(0 0.01 1k) AC 1
    V2 M1_2 GND  33
    V1 GND V1_2  33
    RL OUT GND  8
    R8 OUT M1_3  .22
    R24 R24_1 R24_2  220
    R23 R14_2 M1_3  33K
    R22 C6_2 R22_2  150k
    R21 R24_1 R22_2  285
    R20 R22_2 M1_1  220
    R19 Q6_2 R16_1  27
    R18 GND Q7_3  15k
    R17 Q4_2 R16_1  390
    R16 R16_1 M1_2  10
    R15 GND Q5_3  47k
    R14 C5_2 R14_2  470
    R13 R13_1 R13_2  10
    R12 R13_1 V1_2  10
    R111 C4_2 M1_3  8.2
    R11 R13_1 Q10_1  1.5k
    R10 R1_2 C8_2  4.7k
    R1 GND R1_2  47k
    Q9 Q10_1 C8_2 Q4_3 BC560C
    Q8 R13_1 R14_2 Q4_3 BC560C
    Q7 Q7_3 Q6_2 R16_1 BC560C
    Q6 R22_2 Q7_3 Q6_2 BD140
    Q5 Q5_3 Q4_2 R16_1 BC560C
    Q4 Q4_3 Q5_3 Q4_2 BC560C
    Q10 R24_1 Q10_1 R13_2 BD139
    M2 M1_3 R24_2 V1_2 GND VP0104
    M1 M1_2 M1_1 M1_3 GND VN3515L
    C8 GND C8_2  330pF
    C7 R24_1 R22_2  1u
    C6 R14_2 C6_2  10P
    C5 GND C5_2  100U
    C4 GND C4_2  100u
    C1 VIN R1_2  470nF
    .save V(OUT) V(VIN)
    .tran 10u 10m 0
    .MODEL BC560C PNP (BF=505.76 BR=5 CJC=5.58666P CJE=6.98502P IKF=507.201M
    + IKR=990.691 IS=6.03227P ISC=10.4045F ISE=30.8495P ITF=10.1011M MJC=499.603M
    + MJE=334.817M NE=3 NF=1.33997 RE=2 TF=495.739P TR=10N VAF=100 VJC=749.978M
    + VJE=700M VTF=10 XTF=500.033M)
    **************************************
    *       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 BD140 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
    *  on Feb 14, 2004
    * Model format: PSpice
    **************************************
    *       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 BD139 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
    *  on Feb 14, 2004
    * Model format: PSpice
    .MODEL VP0104   PMOS (LEVEL=3   RS=0.43            NSUB=5.0E14
    +DELTA=0.1      KAPPA=0.0411    TPG=-1             CGDO=2.6106E-11
    +RD=4.23        VTO=-2.850      VMAX=3.0E6         ETA=0.12098
    +NFS=3.384E11   TOX=1.10E-7     LD=1.1400E-9       UO=865.45
    +XJ=6.5E-7      THETA=4.063E-5  CGSO=4.2666E-11    L=2.5E-6
    +W=0.9E-2)
    .MODEL VN3515L  NMOS (LEVEL=3   RS=0.205           NSUB=5.0E14
    +DELTA=0.1      KAPPA=0.20      TPG=1              CGDO=3.1716E-10
    +RD=6.5         VTO=1.400       VMAX=1.0E7         ETA=0.0223089
    +NFS=6.6E10     TOX=725E-10     LD=1.698E-9        UO=862.425
    +XJ=6.4666E-7   THETA=1.0E-5    CGSO=2.50E-9       L=2.0E-6
    +W=59E-3        KP=5.5E-6)

    .END

    Ltspice can get the right result . Why ?
    thanks.

     
  • lpc2138

    lpc2138 - 2012-11-28

     
  • marcel hendrix

    marcel hendrix - 2012-11-28

    Confirmed. The NGSPICE output is horribly distorted and very small (16mv), the LTSpice output is a nice sine ~ 600 mVtt.

    -marcel

     
  • Robert Larice

    Robert Larice - 2012-11-28

    it seems to me, ngspice doesn't accept the L and W parameter
    in the model specification.

    If I attach them to the instantiation of the mosfets
      the simulation seems to work.

    that is I used :
      M2 M1_3 R24_2 V1_2 GND VP0104 L=2.5E-6 W=0.9E-2
      M1 M1_2 M1_1 M1_3 GND VN3515L L=2.0E-6 W=59E-3

    I hope the other developers can shed some light
      onto this, and state whether that is feature or a bug.

    Robert

     
  • Holger Vogt

    Holger Vogt - 2012-11-28

    ngspice has its emphasis on integrated circuit simulation. Therefore it does not make sense to put MOS transistor width and length into the .model card, because the geometry is selected by the designer, and may differ from device to device.

    W and L are instance parameters and have to be placed into the instance (device) line.

    Holger

     
  • Dietmar Warning

    Dietmar Warning - 2012-11-28

    Hello Robert,
    L and W in the model specification makes no sense because these values are design variables in circuit design. There are some spice simulators which uses L and W in model spec as a kind of fallback in case the instantiation lacks these values.
    But this behaviour was not implemented in the original spice programs.
    BR
    Dietmar

     
  • marcel hendrix

    marcel hendrix - 2012-11-28

    Adding L and W on the device line indeed fixes it. Both NGSPICE and LTSpice predict -52 dB for the 2nd harmonic at 2 kHz (i.e. the amplifier is not very good).

    I admit that in this case I like the LTSpice/PSpice behavior/syntax better. What is wrong with a default in the .model statement that can be overruled on the device line?

    -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