[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: SPICE newbie -- was: Re: Simulation troubles ...



Op woensdag 07-11-2007 om 14:20 uur [tijdzone +0100], schreef Richard
Rasker:
> Op maandag 05-11-2007 om 19:48 uur [tijdzone -0500], schreef KURT
> PETERS:

[snip some SPICE knowledge required]

> So at least I have something that works, and that is a great help
> already. And as soon as I have a few days to spare, I'll dive into SPICE
> more in-depth.

OK, I spent several more hours than I actually planned to on checking
out how SPICE, and it doesn't seem all that difficult.

So I built a very simple schematic by the name of opamp.sch using
gschem, taking care to define the opamp's model-name (OP07), with a
proper reference to the SPICE model, as supplied by Stuart Brorson (see
http://archives.seul.org/geda/user/Mar-2005/msg00243.html). I checked
all the pin definitions, made sure that the model (OP07) could be found,
and found no problems, with the following final gschem result:

v 20070216 1
N 45300 51600 45300 50600 4
N 45300 50600 46500 50600 4
N 46500 51800 46300 51800 4
C 45700 51100 1 0 0 gnd-1.sym
C 43200 50800 1 0 0 vsin-1.sym
{
T 42900 51550 5 10 1 1 0 0 1
refdes=V1
T 43900 51650 5 10 0 0 0 0 1
device=vsin
T 43900 51850 5 10 0 0 0 0 1
footprint=none
T 42300 52450 5 10 0 1 0 0 1
value=sin 0 1 1 dc 1 ac 1
}
C 43400 50500 1 0 0 gnd-1.sym
C 53300 52300 1 0 0 vdc-1.sym
{
T 54000 52950 5 10 1 1 0 0 1
refdes=V2
T 54000 53150 5 10 0 0 0 0 1
device=VOLTAGE_SOURCE
T 54000 53350 5 10 0 0 0 0 1
footprint=none
T 54000 52750 5 10 1 1 0 0 1
value=DC 12V
}
C 53500 52000 1 0 0 gnd-1.sym
N 45800 52200 45800 53500 4
N 45800 53500 53600 53500 4
C 45300 51400 1 0 0 spice-opamp-1.sym
{
T 46125 51550 5 8 0 0 0 0 1
device=OP177
T 45500 52300 5 10 1 1 0 0 1
refdes=U1
T 45900 52300 5 10 1 1 0 0 1
model-name=OP07
}
C 42000 38500 0 0 0 title-A2.sym
N 46500 50600 46500 51800 4
N 43500 52000 45300 52000 4
C 46500 50500 1 0 0 resistor-2.sym
{
T 46900 50850 5 10 0 0 0 0 1
device=RESISTOR
T 46700 50800 5 10 1 1 0 0 1
refdes=R1
T 46600 50300 5 10 1 1 0 0 1
value=100k
}
C 47300 49400 1 0 0 gnd-1.sym
C 47600 49700 1 90 0 capacitor-1.sym
{
T 46900 49900 5 10 0 0 90 0 1
device=CAPACITOR
T 47100 50100 5 10 1 1 180 0 1
refdes=C1
T 46700 49900 5 10 0 1 90 0 1
symversion=0.1
T 47600 49900 5 10 1 1 0 0 1
value=100nF
}


Then I converted this to a netlist:

$ gnetlist -g spice-sdb opamp.sch -o opamp.net

Result:

* gnetlist -g spice-sdb -o opamp.net opamp.sch
*********************************************************
* Spice file generated by gnetlist                      *
* spice-sdb version 2.10.2007 by SDB --                 *
* provides advanced spice netlisting capability.        *
* Documentation at http://www.brorson.com/gEDA/SPICE/   *
*********************************************************
*==============  Begin SPICE netlist of main design ============
V2 2 0 DC 12V
V1 1 0 sin 0 1 1 dc 1 ac 1KJ-WavesRAW.OUT
R1 3 4 100k  
C1 0 4 100nF  
U1 1 3 2 0 3 OP07
.end

Then I loaded this netlist into KJWaves, defined node 1 as an input, and
node 4 as an output. And sure enough, it doesn't work. This is the
KJWaves circuit definition:

  * gnetlist -g spice-sdb -o opamp.net opamp.sch
  .TF V(4) V(1)
  .AC DEC 100 1.0  100 
  .SAVE V(4)
  .OPT NOPAGE NOMOD
  .WIDTH OUT=133
  *********************************************************
  * Spice file generated by gnetlist                      *
  * spice-sdb version 2.10.2007 by SDB --                 *
  * provides advanced spice netlisting capability.        *
  * Documentation at http://www.brorson.com/gEDA/SPICE/   *
  *********************************************************
  *==============  Begin SPICE netlist of main design ============
  V2 2 0 DC 12V
  V1 1 0 sin 0 1 1 dc 1 ac 1
  R1 3 4 100k  
  C1 0 4 100nF  
  U1 1 3 2 0 3 OP07
  .end

And this is what the Console window shows:

  Opening: /home/rr/opamp.net.
  Successfully saved: /home/rr/KJ-opamp.NET.
  Running command: ngspice -b /home/rr/KJ-opamp.NET -r /home/rr/KJ-WavesRAW.OUT.
  ngspice -b /home/rr/KJ-opamp.NET -r /home/rr/KJ-WavesRAW.OUT .
  ERROR>No. of Data Columns : 2  
  ERROR>
  ERROR>No. of Data Rows : 201
  ERROR>Warning: Transfer function source v not in circuit
  ERROR>doAnalyses: not found
  ERROR>
  ERROR>run simulation(s) aborted
  Opening: /home/rr/KJ-WavesRAW.OUT.
  File Opened Successfully.

Apparently, there's a problem with "Transfer function source v not in
circuit". Or perhaps the number of Data Columns being 2? Or maybe the
number of Data Rows? It's a bit of an embarrassment, but even after
several hours of trying and searching I can't figure out what's wrong.
KJWaves doesn't give any useful clues. Google doesn't give any clues.
The SPICE manuals don't give any clues. And neither does the gschem
manual, the gnetlist manual, or any other itsy bitty tool I can think
of. And, of course, there are no working examples to be found.

Can someone please tell me not just what I did wrong, but also how I can
do things right in the future? Yes, I *did* read the SPICE manuals, and
I think I understood most of it, but I somehow fail to make the
connection between what I read in the manuals and what I'm supposed to
enter in gschem. Or in the netlist. Or something.
And since apparently so many people successfully use these tools, could
these people please put some simple examples of circuits up on the Web
somewhere, so that not every newbie has to invent the wheel again and
again and again ...

TIA,

Richard Rasker



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user