Convergence in op-amp circuit
Telford Tendys <[email protected]>
| Newsgroups | gmane.comp.gnu.gnucap.devel |
|---|---|
| Message-ID | <20041228064706.GB275@ikkyu> |
I have been playing with an op-amp circuit (I pasted it at the end of this message, hope it isn't too long). The LM358 model is cut-and-pasted from National Semicunductor's website http://www.national.com/models/spice/LM/LM358.MOD (actually I loaded it into gnucap and saved again...) I feel it is a typical industrial grade model that I would expect gnucap to try and deal with. The circuit as a whole is a pretty simple bridge circuit and everything is linear so there should be no nasty surprises there. My results are: TEST CIRCUIT FOR SIMPLE OP-AMP FILTER # 300.15 very backward time step convergence failure (itl4) newtime=5.000061e-08 rejectedtime=5.000122e-08 oldtime=5.000000e-08 using=5.000100e-08 zero time step newtime=5.000100e-08 rejectedtime=5.000122e-08 oldtime=5.000000e-08 internal error: step control (adt=1e-12,rdt=-6.10352e-13) time0=5.00022e-08 time1=5.00012e-08 rtime=5.00006e-08 I'll admit that I haven't dug into this too deeply but the LM358 model looks honest enough, there isn't much in it... I have played around a bit with mindamp and maxdamp and they do have an effect but not enough to get more than one output step. My specific questions are: [A] can someone explain the theory behind those error messages? I don't understand how the timestep could be "very backward" judging from the numbers given. [B] is there a switch that explains which components are involved in the non-convergence and maybe outputs the last few iterations of those components? ----------------------------- example.ckt -------------------------------- TEST CIRCUIT FOR SIMPLE OP-AMP FILTER *////////////////////////////////////////////////////////////////////// * (C) National Semiconductor, Inc. * Models developed and under copyright by: * National Semiconductor, Inc. *///////////////////////////////////////////////////////////////////// * Legal Notice: This material is intended for free software support. * The file may be copied, and distributed; however, reselling the * material is illegal *//////////////////////////////////////////////////////////////////// * For ordering or technical information on these models, contact: * National Semiconductor's Customer Response Center * 7:00 A.M.--7:00 P.M. U.S. Central Time * (800) 272-9959 * For Applications support, contact the Internet address: * [email protected] *////////////////////////////////////////////////////////// *LM358 DUAL OPERATIONAL AMPLIFIER MACRO-MODEL *////////////////////////////////////////////////////////// * * connections: non-inverting input * | inverting input * | | positive power supply * | | | negative power supply * | | | | output * | | | | | * | | | | | .subckt LM358/NS 1 2 99 50 28 * *Features: *Eliminates need for dual supplies *Large DC voltage gain = 100dB *High bandwidth = 1MHz *Low input offset voltage = 2mV *Wide supply range = +-1.5V to +-16V * *NOTE: Model is for single device only and simulated * supply current is 1/2 of total device current. * Output crossover distortion with dual supplies * is not modeled. * ****************INPUT STAGE************** * IOS 2 1 DC 5.n *^Input offset current R1 1 3 500.K R2 3 2 500.K I1 99 4 DC 100.u R3 5 50 517. R4 6 50 517. Q1 5 2 4 QX area= 1. Q2 6 7 4 QX area= 1. *Fp2=1.2 MHz C4 5 6 128.27p * ***********COMMON MODE EFFECT*********** * I2 99 50 DC 75.u *^Quiescent supply current EOS 7 1 16 49 POLY( 0.002 1.) *Input offset voltage.^ R8 99 49 60.K R9 49 50 60.K * *********OUTPUT VOLTAGE LIMITING******** V2 99 8 DC 1.63 D1 9 8 DX area= 1. D2 10 9 DX area= 1. V3 10 50 DC 0.635 * **************SECOND STAGE************** * EH 99 98 99 49 1. G1 98 9 5 6 POLY( 0. 987.72u 0. 0.3459) *Fp1=7.86 Hz R5 98 9 101.2433Meg C3 98 9 200.p * ***************POLE STAGE*************** * *Fp=2 MHz G3 98 15 9 49 1.u R12 98 15 1.Meg C5 98 15 79.577f * *********COMMON-MODE ZERO STAGE********* * *Fpcm=10 KHz G4 98 16 3 49 56.234n L2 98 17 0.0159 R13 17 16 1.K * **************OUTPUT STAGE************** * F6 50 99 V6 POLY( 300.u 1.) E1 99 23 99 15 1. R16 24 23 17.5 D5 26 24 DX area= 1. V6 26 22 DC 0.63 R17 23 25 17.5 D6 25 27 DX area= 1. V7 22 27 DC 0.63 V5 22 21 DC 0.27 D4 21 15 DX area= 1. V4 20 22 DC 0.27 D3 15 20 DX area= 1. L3 22 28 500.p RL3 22 28 100.K * ***************MODELS USED************** * .model DX d ( tnom= 27. is= 1.f rs= 0. n= 1. tt= 0. cjo= 0. pb= 1. mj= 0.5 egap= 1.11 xti= 3. fc= 0.5) *+() .model QX pnp ( kf= 0. af= 1. bf= 1.111K br= 1. is= 100.E-18 nf= 1. nr= 1. isc= 0. c4= 0. nc= 2. ise= 0. c2= 0. ne= 1.5 rb= 0. rbm= 0. re= 0. rc= 0. cjc= 0. cje= 0. cjs= 0. fc= 0.5 mjc= 0.33 mje= 0.33 mjs= 0. vjc= 0.75 vje= 0.75 vjs= 0.75 xcjc= 1. itf= 0. ptf= 0. tf= 0. tr= 0. xtf= 0. xtb= 0. xti= 3. eg= 1.11) *+() * .ENDS *+ends LM358/NS *$ .subckt LM358 1 2 3 4 5 6 7 8 XgateA 3 2 8 4 1 LM358/NS XgateB 5 6 8 4 7 LM358/NS .ENDS *+ends LM358 C1 2 0 100.n C2 1 0 100.n R1 3 8 220.K R2 0 3 180.K R3 8 2 220.K R4 2 0 150.K R5 5 6 2.K R6 6 7 180.K R7 2 7 180.K R8 1 2 47.K R9 4 1 47.K VCC 8 0 DC 5. VIN 4 0 DC GENERATOR(1). XU1 5 5 2 0 3 7 6 8 LM358 .option dampmax=0.95 dampmin=0.8 itl4=50 .op .print tran V(4) V(2) V(5) V(6) V(7) .generator amplitude=1 offset=2 frequency=50 .tran 0 0.04 1u > output.dat ----------------------------------------------------------------------