gEDA-user: TwoStageAmp example
Stuart Brorson
sdb at cloud9.net
Sun Apr 1 07:36:49 EDT 2007
> Has anybody played with the TwoStageAmp example recently? I looked at
> it tonight in an attempt to start learning something about spice and
> I've run into a couple if issues:
>
> 1) There is no "models" directory in the example, yet the "SPICE
> model" element refers to that directory.
The gEDA project can't distribute any SPICE models. They are
generally vendor proprietary, and the gEDA project will (and can) only
distribute GPLed things. It's up to you to find the model using
Google.
FWIW, the two stage amp example uses a 2N3904, which is pretty easy to
find.
Also I do have a bunch of SPICE models in a tarball on my website
here:
http://www.brorson.com/gEDA/SPICE/
I don't remember if put the 2N3904 into the tarball, however.....
> 2) When I run:
>
> $ ngspice spice.netlist, I get all sorts of errors: (keeping in mind
> the purpose of this exercise was to start learning something about
> spice and/or ngspice -- these seem an awful lot like errors to me):
You are running an older version of the netlist. I did clean things
up a couple of months ago. Try grabbing the gEDA/gaf (Feb '02
version).
I agree the older version was becoming problematic. There was a lot
of bit-rot over the several years that it was left untouched in the
distribution. That's why I finally fixed it!
> So I decided to run gnetlist myself as:
>
> $ gnetlist -g spice-sdb -o spice.netlist.wpd TwoStageAmp.sch
>
> Now, when I invoke ngspice with:
>
> $ ngspice spice.netlist.wpd
>
> I get
>
> Circuit: * gnetlist -g spice-sdb -o spice.netlist.wpd TwoStageAmp.sch.orig
>
> Error on line 13 : q2 vcoll2 vbase2 vem2 2n3904
> unable to find definition of model - default assumed
> Error on line 23 : q1 vcoll1 vbase1 vem1 2n3904
> unable to find definition of model - default assumed
Yup, you need to stick a .model card into the schematic, and make it
point to the file holding the 2N3904 model.
Here's a step-by-step:
1. Find a 2N3904 model via Google.
2. Save it to a sub-directory directory of your project directory,
say ${PROJ_DIR}/models/2N3904.mod
3. Place a spice-model symbol (in the SPICE directory) into your
schematic. Set its file-name attribute to
${PROJ_DIR}/models/2N3904.mod (or "./models/2N3904.mod").
4. Netlist.
5. Ngspice. This should just work at this point.
Good luck!
Stuart
More information about the geda-user
mailing list