[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: New Poster - Trying to get ngspice up and running with gschem
On Tuesday 03 August 2010, Bill Gray wrote:
> To keep things as simple as possible, I am trying to simulate
> a voltage follower using an LM358 opamp. So far, I have
> been met only with abject failure, and my ability to
> continue investing time at this rate is waning... I have to
> get this project moving forward!!!
>
> I am running gschem, gnetlist, and ngspice on an ubuntu box.
>
> I have attached the relevant files to this email.
>
> As I said, I can get a simple voltage divider to work, but
> not the LM358 voltage follower circuit.
I see a few problems.
The first is "your circuit doesn't work", but I will get to that
later.
The next one is that this particular model is not compatible
with gnucap .. "POLY(5)".
For starters, I prefer to use a simple VCVS model for an opamp.
Then when that works, I switch to a more detailed model. Then
you could try the generic opamp model I posted a while back,
passing the appropriate parameters like slew rate and GBP.
Now back to "your circuit doesn't work" ..... If you want a
voltage follower, tie the output to the inverting input, and
drive the non-inverting input. You have the inputs swapped.
Here's an op-amp. To use this model, you need the development
version of gnucap.
* Generic op-amp behavioral model
.subckt opamp (out+ out- in+ in-)
.param gain=100k sr=1e99 clip=1e99 gbp=1e99
.param cc='1/(6.283185*gbp)'
.param ilim='cc*sr'
G1 (0 1 in+ in-) pwl ('-2*ilim','-ilim','-ilim',
+ '-ilim','ilim','ilim','2*ilim','ilim')
R1 (1 0) 'gain'
Cc (1 0) 'cc'
E1 (out+ out- 1 0) pwl ('-2*clip','-clip','-clip',
+ '-clip','clip','clip','2*clip','clip')
.ends
You can specify:
gain = open loop gain
clip = output clipping voltage
sr = slew rate (volts per second)
gbp = gain bandwidth product
There are default values, in case you don't want to specify.
To call:
X1 (out 0 in+ in-) opamp gain=10k gbp=1meg clip=13 sr='5/1e-6'
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user