Discussion about this page on: Wiki page discuss: Intro to opamps with ngspice/gEDA - Ubuntu Forums

Introduction

Going back to simulation with gEDA tools and ngspice is not always necessarily straightforward, especially in the case of operational amplifiers. To adress that, instead of an in-depth tutorial - here is a bash script, ngspice-opamp-test.sh:

... which will use (from the script):

The setup consists of a piece-wise linear (PWL) source, which first makes a sweep from -1V to 1V; and then a sweep from -5V to 5V. That signal is used as input for four opamp voltage followers, based on four operational amplifier models - from:

Discussion/Notes

The schematic looks something like this:

http://sdaaubckp.sf.net/post/ngspice/ngspice_opamp_test_gschem_00.png

Since gschem does not have an option / attribute to show the actual symbol file (which is the source of a given graphic in the schematic), I simply "invented my own" - added a new attribute, arbitrarily named symname (which is not previously used), simply to show which symbol files are used on the screenshot above. (the schematic was created in gschem, and then the .sch file contents were pasted in the script). This is useful, since when you use the find facility in the 'add component', these filenames are searched against. A few notes:

See the bash script for actual order of execution of commands, and their format.

When the simulation finishes, the simulated waveforms look something like this:

http://sdaaubckp.sf.net/post/ngspice/ngspice_opamp_test_sim_00.png

If you'd like to "split" and "stack" the signals one over another graphically, you'd have to resort to gnuplot - and that part in the example script results with this diagram:

http://sdaaubckp.sf.net/post/ngspice/ngspice_opamp_test_gp_00.png

We can see that E_LIMIT behaves as a comparator and nothing else; NGopamp behaves like an ideal opamp follower; while OP07 and AD8009 behave more like realistic opamps (the input signal is overlaid as a thin line on each graph).

See the comments in the script to see what to change in order to get a single-supply simulation setup. In that case, the following results are rendered:

http://sdaaubckp.sf.net/post/ngspice/ngspice_opamp_test_gp_01.png

... where it is even more clear that OP07 and AD8009 show a realistic behavior of typical opamps (low input voltages barely cross the turn-on voltages in single supply mode).

Intro_to_opamps_with_ngspice-gEDA (last edited 2011-11-28 01:49:12 by x1-6-00-0e-a6-3f-d7-8d)