Analyzing Circuits with SPICE on Linux

All about SPICE: how to get it and what to do with it.
Convergence and Accuracy

If you're going to have trouble with SPICE, most likely it will be with a circuit you can't analyze. The good news is that SPICE3 is improved in this respect, and you have some control over how numerical solutions are determined. When SPICE calculates node voltages and branch currents, it uses thresholds for tolerable errors to determine when a simulation reaches its answer—that is, when it reaches numerical convergence. The three parameters controlling the thresholds can be set on the .options statement and are named ABSTOL, VNTOL and RELTOL. ABSTOL is the smallest current you want SPICE to accept. Increasing ABSTOL from its default value of 12pA can help a simulation to converge. VNTOL is the smallest voltage that you want SPICE to accept. Increasing VNTOL from its default value of 10V can help a simulation to converge. RELTOL is the ratio of the numerical answer found during the present iteration to the numerical answer found during the last iteration. Increasing RELTOL can help a DC analysis to converge, but increasing RELTOL can also cause transient analysis problems. If you get a warning from SPICE saying “timestep too small”, RELTOL is probably set too large.

The parameters ITL1 through ITL6 control the number of iterations to perform before SPICE gives up, and control methods are used to attain convergence.

Obviously the accuracy of the simulation results can be no better than the convergence thresholds used during analysis. If you don't need to relax the thresholds, this won't present a problem since the tolerances on component values and variations in component performance stand to present much more discrepancy between nominal simulated performance and real-world measured performance.

Figure 6: Input and Output Voltage Sine Wave

Summary

This article is far from an exhaustive treatment of what SPICE can do for you and how to use it to its fullest advantage. SPICE is both prevalent and useful to engineers, and has been so for nearly 30 years. If you never use SPICE, I hope you caught at least a glimpse of an engineer's bread and butter. If you use or will use SPICE, I hope this article gave you some insight into its use on Linux machines.

References

Kevin Cosgrove is a design engineer at Tektronix. In his spare time he might be found tinkering with Linux, playing drums, learning the piano, or running the smallest independent record label in town. Comments are welcome at kevinc@doink.com.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

construction of a simple calculator

Anonymous's picture

I'm an electronics student. i am willing to construct a simple calculator of my own. the problem is i don't know the circuit of it. My request to you is that you print the circuit connection of a simple calculator.

SPICE is probably the wrong tool for this

Anonymous's picture

SPICE is probably the wrong tool, unless you mean "analog computer" when you ask for a simple calculator. You can use SPICE to simulate an analog computer nicely. If you aren't familiar with what an analog computer is, it probably won't help much.

SPICE is a pretty low-level simulation tool for analog circuits. Digital circuits are built from analog circuits but a typical NAND gate alone can take up to a dozen transistors to represent, and even a simple calculator likely has thousands of NAND gates.

What you may want to look into is digital logic simulation that uses VHDL or Verilog. Such simulators work at a level that is comfortable for digital hardware such as a calculator. They do ignore many of the analog effects actually seen in real life circuits however. This is why both SPICE and HDL simulators are typically used in complementary fashion.

The other choice is to simulate using software such as C or any other language of choice.

building pspice

ziaa's picture

Can Pspice(linux based) will be enough efficient to support user as in windows??

YOUR WEB PAGE IS ALL SCREWED

Anonymous's picture

YOUR WEB PAGE IS ALL SCREWED UP!!!!

Re: Analyzing Circuits with SPICE on Linux

Anonymous's picture

very good, it realy help me.

thank you for your work.

some help needed

Anonymous's picture

Hi ,
I am trying to install spice on linux .
But every time I try to do so installation stops with error saying "couldnot find the file -ltermcap .
though when i install the termcap on my system it says package is already installed...!
can some one help me figure out what actually is gooing wrong.

BR
Ashish

Re: Analyzing Circuits with SPICE on Linux

Anonymous's picture

Excellent tutorial !!! It's just what I needed to get spice running at home after a brief introduction to pspice on MSDOS at school.

Well done,

B. Liessens

Re: Analyzing Circuits with SPICE on Linux

Anonymous's picture

a very good article for new spice3 users who want to install spice3 sources on linux systems and start using it.

wow, i'm impressed it is

Anonymous's picture

wow,
i'm impressed it is what i was searching for, at my uni theyre using pspice student version ;-) i was fedup with limitations like 50 parts at all and the windowssystem and now i'm here, and the samples are running on ngspice, every thing is fine and the best ! i know what i'm doing
thank you

hi , i am very much in ne

Anonymous's picture

hi ,

i am very much in need of u. i have the same problem as u ,of installing the spice3 on linux. please give me the solution to this problem for which i will be grateful to u.

could you please provide the

Anonymous's picture

could you please provide the basic knowledge of adding the patches for bsim4 or bsimsoi model. or couls u do it and put on some site so that we could be able to do the work on spice with latest models...

help will be appreciated.

anyways this was great tutorial. very helpful.

spice for linux

Anonymous's picture

Hi

This was a useful article in general but after wrestling with Linux
gEDA on RedHat enterprise AS4 I can say that the KDE gui versions
are really well suited for SUSE professional or Fedora not enterprise
version. I think that spice comes with SUSE even. I had to install
the non RPM versions because wxwidget-config, guile-config and many
other config files did not come with the RPMs. I also had to install
GTK+, GTK-devel and many other things and when I was through well
the student version of PSPICE still blew the linux version away. Many
versions of linux are compiler dependent meaning you just can't take
a executible from one version and run it on a later version like
the backward comparability of SunOs. My friends who work professionally with Linux say its a nightmare and have a build engineer just to straighten out executables and libraries. I have
to use Enterprise Linux to run Oracle 10G version 2 because I heard
a lot of problems with SUSE 10.1 professional, therefore gEDA is
not an option.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState