On Friday 19 May 2006 08:41, Jose Roberto B. de A. Monteiro wrote: > Hi list, > > I have a convergence error im my simulation. Basically, I > have to work with switchmode circuits. I am trying to build > a simple sawtooth generator using a current source, a > capacitor and a voltage controled switch, with a non-zero > RON. > > The circuit is like the following: > > * circ-3 > * Spice netlister for gnetlist > SW1 1 0 1 0 SWITCH1 > C1 1 0 1n > I1 0 1 100u > .model npn npn > .MODEL SWITCH1 SW VT=2.5 VH=2.475 RON=1 ROFF=10MEG > .print tran V(C1) > .tran 0 200e-6 500e-9 UIC >circ-3.dat > .END
Try it on the new version. It handles this circuit well. To see why it is hard ... When the switch is on, time constant is 1 ns. This requires a time step of significantly less than 1 ns. Try 250 ps. That's 800000 steps with fixed stepping. The total time the switch is on is about 5 ns each cycle. When the switch switches, you need finer steps than that. The new automatic control makes a few steps of 2 ps, surrounding the instant of switching. When the switch is off, time constant is .01 second, but the current source makes it charge faster, tricking the step control. It is in this state about 50 ns each cycle, with an almost linear response. Stepping at 10 ns is plenty. The new algorithm actually accomplishes this range. It actually does more steps when the switch is on than it does when it is off. This gives a very good result. It does it without any rejected steps, using the trapezoid rule. There is no "trapezoidal ringing". This circuit took 147 time steps. When I get a chance I will explain it more on the developer list, including the technical details. Also when I get a chance, I will apply the time step control method used in the switch to other devices. It should help convergence a lot. _______________________________________________ Help-gnucap mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gnucap
