Spice is a powerful tool for circuit analysis. But it often surprises users with
. holes in its abilities and strange definitions
. lack of industry-wide standards
. the need for the user to model the physics of their circuit, not just draw the schematic

I hope this blog will educate users and promote discussion in these areas.

Speeding up Spice Simulation

Today let's look at two different areas that can speed up Spice simulation significantly: Windows' restrictions on processor speed and Spice's RELTOL setting.

Processor Speed limit

Surprise, Windows limits the clock speed of your processor! Which directly limits Spice simulation speed. This is especially true for laptops but also true for some desktop computers.

To see how your computer is set
In Vista and newer, go to Control Panel > System > Power Options. Is the choice set for "High Performance", "Balanced", or "Power Saver" maximizing battery life? Note: some of the plans may be hidden when you first reach this page.

To see the damage for the current choice, go to Advanced Settings and look at "Processor Power Management". If the "Maximum processor state" is less then 100%, then your processor never runs at full speed. Either select a higher performance option or change the advanced setting to 100%.

Also look at "Minimum processor state". This is often set at 5%. Fine for ordinary use but Windows delays before switching processor speed, and probably switches speed up in steps (10%, 25%, 50%, 100%). A setting of 50% to 100% will be better for Spice simulation. And will chew up more battery power in a laptop.

Processor choice for a new computer

If you are thinking about a new computer, the processor makes a huge difference in simulation speed. There can be much more than a 3:1 speed difference between a 3.4 GHz mid-level desktop and an entry level laptop.

Even a mid-level laptop prioritizes graphics performance and battery life.

Look for 2 or more cores with the highest possible clock speed. Don’t be impressed by a processor with more than 4 cores - it may have only one floating point math unit (FPU). Low and mid-level laptop processors often have only one FPU. Spice programs that can use more than one core will bottleneck if there is only one FPU.

Because it is very hard to efficiently partition the algorithm Spice uses to solve the non-linear circuit matrix, few PC based Spice programs use more than 2 or 3 cores. 5Spice, for example, uses two cores (ideally each has its own FPU).

Finally, don't buy the low cost processor option. Intel and AMD have low cost processors that have respectable clock speeds but less efficient internal architectures. They are cheap but run real world apps slower.


Setting RELTOL for faster, more robust Transient simulation

Let's look at one of Spice's internal settings, the one that controls how precisely Spice converges to the solution at a time point in the Transient simulation. We are setting how careful/precise Spice is in reaching the local solution, not whether the local solution is accurate or not.
(Note: setting the accuracy of the local solution would involve setting TRTOL and the max time step size. A topic for another day.)

The standard setting for RELTOL (relative tolerance) is 0.001 and usually we don't change this. But you can speed up Transient simulation, sometimes very significantly, by relaxing RETOL to 0.01. This can also allow some simulations to run that fail with the standard setting. Try this with switch mode power supply simulations. Zoom….

The tradeoff is that your solution points may not be as accurate because Spice didn't bother to get as close. There is no way to put a number on this that I know of. And it varies with each circuit. So if accuracy is critical, compare results with both settings.

 Consult your Spice program documentation for how to change the RELTOL setting. In 5Spice this is a checkable option in the user interface (the "try harder" check box) .

No comments:

Post a Comment