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

Re: gEDA-user: Gspiceui build trouble



On Tue, 30 Oct 2007 22:23:46 +0100, Richard Rasker wrote:

> (And if anyone knows of another reliable GUI circuit simulation
> application -- audio filters mostly -- it's much appreciated as well
> ...)

Two days ago, I also had a basic gspiceui question (not related to 
install). Al Davis responded with a little tutorial on how to get started 
with pure gnucap and abstain from gspiceui. 

/=====================cite Al Davis===========================
You are better off without gspiceui.  It obscures what is going 
on.  GUI's make simple things simple and complex things 
impossible.

Here's what I would do ...

First, you need to generate a netlist.  Gnucap cannot yet read 
gschem files, so you need to convert:
============
$$ gnetlist -g spice-sdb lowpass.sch
============

That generates a file "output.net".  Look at it to see if it 
makes sense.
============
$$ cat output.net 
* gnetlist -g spice-sdb lowpass.sch
*********************************************************
* Spice file generated by gnetlist                      *
* spice-sdb version 4.28.2007 by SDB --                 *
* provides advanced spice netlisting capability.        *
* Documentation at http://www.brorson.com/gEDA/SPICE/   *
*********************************************************
*==============  Begin SPICE netlist of main design ============
V1 in 0 pulse 0 1 1000n 1000n 10000n 100u 200u
R1 in out 1M  
C1 0 out 100n  
.end
============

Looks good.  Assuming you want to run gnucap interactively, it's 
ready.  Let's go...

=========
$$ gnucap output.net
>> (signs on)
>> see what we have
gnucap> list

********************************************************* 
* Spice file generated by gnetlist                      * 
* spice-sdb version 4.28.2007 by SDB --                 * 
* provides advanced spice netlisting capability.        * 
* Documentation at http://www.brorson.com/gEDA/SPICE/   * 
********************************************************* 
*==============  Begin SPICE netlist of main design ============ 
V1 ( in 0 ) PULSE iv= 0. pv= 1. delay= 1.u rise= 1.u fall= 10.u width= 
100.u period= 200.u
R1 ( in out )  0.001
C1 ( 0 out )  100.n
gnucap>
>> looks good.  Gnucap lists the parameters with names,  You can
>> put it in the netlist that way too,  I cannot remember the order.
>> You need to specify the "probes" .. what do you want to look at.
>> wait ...  The resistor is .001 ohms?????
>> That's what you asked for.  "1M" is 1 milli-ohm.
gnucap>  print tran v(nodes)
gnucap>
>> You could list all the stuff you want to look at.  For now,
>> I just want the voltage at all nodes.
>> Now lets run a transient analysis.
>> Spice has its own order for the arguments, different for
>> every command.  I can not remember what the order is,
>> so gnucap also takes the order start, stop, step, 
>> like good old Fortran.  It takes the Spice order too, so'
>> you can use either.
gnucap> tran 0 400u 10u
#Time       v(in)      v(out)    
 0.         0.         0.        
 10.u       1.         0.99994   
 20.u       1.         1.0001    
 30.u       1.         0.99994   
 40.u       1.         1.0001    
 50.u       1.         0.99994   
.....
>> Nice table, but I want a graph.
>> I recommend "gwave" as the viewer.
>> Run it again, this time save the results in a file.
gnucap> tran 0 400u 10u >z
>> Now run gwave on that file
gnucap> !gwave z &
gnucap>
>> You play with it there.
>> The time stepping is coarse, because it printed with the
>> steps I asked for.  I want them all, even the internal ones.
gnucap> tran 0 400u 10u trace all >z
gnucap> !gwave z &
gnucap>
>> Now it has all the steps, so the waveform is better.

Here's a start.  You can play from here.

The time stepping I specified is obviously bad, because 
the pulse has a rise time of 1us, and I asked for 10us steps.
It used reasonable steps internally, but didn't print them all.
"trace all" makes it print all of the steps.  If you are plotting, 
this is usually what you want.

There is also some numerical jitter  (.99994 .. 1.0001 ..)
hinting that you need to tighten the tolerance if you care.
You have a time constant of 100 ps.

OH!!!  you really wanted 1 MEGohm!!

gnucap> modify r1=1meg
gnucap> tran 0 400u 10u trace all >z
gnucap> !gwave z &

When you specify component values in Spice, M means milli.
If you want meg, as in megohms, you need to say "meg".
Don't blame me for this.  It's Spice compatible.

\=============cite Al Davis===================


This is lowpass.sch, my little test circuit, Al refers to:
=========================
v 20070902 1
C 44300 46700 1 0 0 resistor-1.sym
{
T 44600 47100 5 10 0 0 0 0 1
device=RESISTOR
T 44500 47200 5 10 1 1 0 0 1
refdes=R1
T 44500 47000 5 10 1 1 0 0 1
value=1M
}
C 45600 45600 1 90 0 capacitor-1.sym
{
T 44900 45800 5 10 0 0 90 0 1
device=CAPACITOR
T 45700 46100 5 10 1 1 0 0 1
refdes=C1
T 44700 45800 5 10 0 0 90 0 1
symversion=0.1
T 45700 45900 5 10 1 1 0 0 1
value=100n
}
N 43800 46800 44300 46800 4
{
T 43900 46900 5 10 1 1 0 1 1
netname=in
}
N 45200 46800 46100 46800 4
{
T 45600 46900 5 10 1 1 0 1 1
netname=out
}
N 45400 46800 45400 46500 4
C 45300 45100 1 0 0 gnd-1.sym
N 45400 45400 45400 45600 4
C 43700 45100 1 0 0 gnd-1.sym
N 43800 45400 43800 45500 4
N 43800 46800 43800 46700 4
C 43500 45500 1 0 0 vpulse-1.sym
{
T 44200 46150 5 10 1 1 0 0 1
refdes=V1
T 44200 46350 5 10 0 0 0 0 1
device=vpulse
T 44200 46550 5 10 0 0 0 0 1
footprint=none
T 42900 44750 5 10 1 1 0 0 1
value=pulse 0 1 1000n 1000n 10000n 100u 200u
}
T 42900 44500 9 10 1 0 0 0 1
syntax: pulse v1 v2 td tr tf pw per
========================================
-- 
Kai-Martin Knaak
http://lilalaser.de/blog

-- 
Kai-Martin Knaak                                  tel: +49-511-762-2895
Universität Hannover, Inst. für Quantenoptik      fax: +49-511-762-2211	
Welfengarten 1, 30167 Hannover           http://www.iqo.uni-hannover.de
GPG key:    http://pgp.mit.edu:11371/pks/lookup?search=Knaak+kmk&op=get



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