Re: [ng-spice-devel] Re: snapshot/resimulate
On Wed, 04 Apr 2001, Ed Hudson wrote:
., and, i think that the speed of 'spice' is
> a function of ckt activity, after initial convergence).
Sort of. ACS is more so, and will become even more than it is if I
can get some time to finish the multi-rate algorithms.
In Spice, a step of transient analysis really is equivalent to a
whole DC analysis again. It solves the whole thing every iteration,
except for bypassing a few model eveluations. The method of checking
for whether it is ok to bypass is not very reliable and not very
complete.
There are a few ways that the speed of Spice is dependent on activity
...
On any time step, either the previous results or the results of a
predictor step are used as a starting point for iteration. This
means usually it is close enough to converge in a few iterations. If
there is no change, it will be immediately converged. Contrast this
to the initial DC, where it may have a very poor starting point and
so require many iterations.
Also, the internal step size is automatically determined considering
such factors as truncation error in numerical differentiation. It
estimates this error by a divided difference formula, and chooses a
next step based on this. If there is no activity it could let the
time step grow. It also considers iteration count.
The internal time steps are usually not related to the printed time
steps. There is no attempt to keep a uniform step size, but also
nothing to upset it too drastically. The printed values are
generated by interpolation.
ACS uses a similar method of estimating and using truncation error,
and it also adjusts based on iteration count. There are other
differences.
ACS also tries to maintain a locally uniform step size, because the
first iteration after a step size change is a lot slower than the
first iteration when the step size is the same as before. Spice
always does a full solution, as if all values could change.
ACS tries to synchronize the internal steps with the external steps,
eliminating the final interpolation. Sometimes this makes it slower,
but it is more accurate. As an example, suppose according to the
error check, a good step size to use is .9 ns. Suppose the user
requested a step of 1.0 ns. Spice will use internal steps something
like 0, 0.9, 1.8, 2.7, 3.6, and so on. Actually, they will not be
evenly spaced. ACS will try to match the 1.0, and also not exceed
0.9, and try to keep them all the same, resulting in 0, 0.5, 1.0,
1.5, 2.0, 2.5, 3.0 and so on. Both CAN change step size at any time.
Spice will fine-tune the step size. ACS will give priority to
synchnonization and consistency. Both will respond appropriately to
a busy period that suddenly requires tiny steps.
ACS only solves the portions of the circuit that change. In effect,
it means that linear portions of the circuit are pre-solved once,
then omitted from later calculations. When the step size changes,
linear capacitors and inductors and their portion of the matrix must
be fully evaluated again. Otherwise, only the history data (initial
conditions) are changed and calculations are minimized.
As part of work in progress, I intend to actually expolit multi-rate
behavior, where different parts of the circuit use different time
steps. Most of the code is in place, but it actually runs
synchronized because it is not complete yet, and there is an
interesting way the errors show that I want to study further. The
magnitude of the errors is reasonable and predictable. The nature of
the errors can be misleading to a circuit designer. There are errors
like leakage of one sampling frequency, at a level that strictly is
acceptable according to the tolerances, but seeing a superimposed
sine wave is more disturbing than a similar consistent error. Fast
circuit driving slow circuit works well. Slow circuit driving fast
circuit shows the artifacts. So, as of now, multi-rate isn't there.
Partial thread listing: