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

2007-11-08 Thread Peter Baxendale
Richard, I don't see a file attribute anywhere in your schematic to say
where your spice model is. You can add a file attribute to each opamp
symbol or add a spice directive symbol with the file attribute set
to your spice model file. You should see the opamp subcircuit model
included in the spice netlist.
Also make sure the pinseq attributes of each pin in your opamp symbol
match the order of the parameters to your spice model. In my
experience the gschem opamp symbols usually need changing.

-- 
Peter Baxendale [EMAIL PROTECTED]



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


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

2007-11-08 Thread Richard Rasker
Op donderdag 08-11-2007 om 11:43 uur [tijdzone +], schreef Peter
Baxendale:
 Richard, I don't see a file attribute anywhere in your schematic to say
 where your spice model is. You can add a file attribute to each opamp
 symbol or add a spice directive symbol with the file attribute set
 to your spice model file. You should see the opamp subcircuit model
 included in the spice netlist.
 Also make sure the pinseq attributes of each pin in your opamp symbol
 match the order of the parameters to your spice model. In my
 experience the gschem opamp symbols usually need changing.

Ah, yes, that did the trick ... I did put both .sym files where gschem
could find them, in gEDA's spice symbol subdirectory (otherwise I
couldn't have selected the opamp in gschem in the first place) and
assumed that this would be enough. Which isn't the case, obviously.
And, of course, this *is* mentioned in the manual (albeit in a more
general manner).

But I think I'll compile all the good advice I got here into a sort
manual of my own, together with several step-by-step examples, and also
the mistakes I made and the points I had trouble with -- I'm pretty
certain that in a few months, I'll have forgotten one or more essential
steps. For me, the best way to learn new things is by means of clear and
detailed examples, with a manual to explain what exactly is happening
and why. Just a manual simply isn't enough for me, especially when there
are so many things that I can do wrong.

And perhaps if this manual of mine seems useful, I could post it online,
and/or offer it as an addition to the rest of the gEDA documentation.

 Also make sure the pinseq attributes of each pin in your opamp symbol
 match the order of the parameters to your spice model. In my
 experience the gschem opamp symbols usually need changing.

I literally copied Stuart Brorson's .sym files he posted on the mailing
list, and already double-checked the pinseq attributes; these were fine.

Anyway, I finally succeeded in simulating several filter configurations,
and these simulations indeed closely match the real-world results I got
from the circuits on my workbench :-)

Thanks again for the help, and I think I can manage on my own from here.

Best regards,

Richard Rasker



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


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

2007-11-07 Thread Richard Rasker
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 .
  ERRORNo. of Data Columns : 2  
  ERROR
  ERRORNo. of Data Rows : 201
  ERRORWarning: Transfer function source v not in circuit
  ERRORdoAnalyses: not found
  ERROR
  ERRORrun 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