Help? with basic ngspice syntax and use

Thread Starter

keithostertag

Joined Oct 4, 2012
55
I've been struggling with learning ngspice and could use some help. It's a bit different than the more popular LTSpice (which I don't use). I am using gschem for schematic capture, and gnetlist to generate the netlist.

Attached is a test circuit, just to learn how to create a model and generate a proper netlist for use with ngspice.

I 'include' a file named tlv27x.inc, which is a subcircuit taken from the TI datasheet, using a Spice include directive in the schematic . I'm using one opamp from the quad-opamp TLV274.

I generate the netlist with this statement;

Rich (BB code):
keith@t520:~/gaf$ gnetlist -g spice-sdb --nomunge -I -o tes1.net test1.sch
Command line passed = gnetlist -g spice-sdb --nomunge -I -o tes1.net test1.sch 
Loading schematic [/home/keith/gaf/test1.sch]
Using SPICE backend by SDB -- Version of 4.28.2007
schematic-type = normal schematic
keith@t520:~/gaf$
No apparent problems so far.

I then run:

Rich (BB code):
keith@t520:~/gaf$ ngspice test1.net
******
** ngspice-24 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please get your ngspice manual from http://ngspice.sourceforge.net/docs.html
** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html
** Creation Date: Sun Jun 17 07:51:27 UTC 2012
******

Circuit: * gnetlist -g spice-sdb --nomunge -i -o test1.net test1.sch

Error on line 14 : u8 1 2 vcc vee 2 tlv27x
Unable to find definition of model vee - default assumed 

 unknown parameter (tlv27x) 
ngspice 2 ->
I can't figure out why vee isn't being recognized.

Then, why is it telling me tlv27x is an "unknown parameter"?.

In this partifcular case, the --nomunge option does not seem to make any difference - tried it both ways.

Here is test1.net:

Rich (BB code):
keith@t520:~/gaf$ cat test1.net
* gnetlist -g spice-sdb --nomunge -I -o test1.net test1.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/   *
*********************************************************
.INCLUDE tlv27x.inc
*==============  Begin SPICE netlist of main design ============
.INCLUDE tlv27x.inc
Vin 3 0 ac 1 pulse( -1 1 1u 100n 100n 50u 100u)
R26 2 0 2K  
R24 3 1 50  
U8 1 2 Vcc Vee 2 tlv27x
Vee 0 Vee DC 1.5V
Vcc Vcc 0 DC 1.5V
.end
And here is the contents of the include file tlv274.inc:

Rich (BB code):
*******************************
* Begin .SUBCKT model            *
* This is for one section of the quad TLV274, taken from the datasheet
********************************
.SUBCKT tlv27x 1 2 3 4 5
 *DEVICE=amp_tlv27x_highVdd,OP AMP,NJF,INT                                   
 * amp_tlv_27x_highVdd operational amplifier ”macromodel”                    
 * subcircuit updated using Model Editor release 9.1 on 05/15/00             
 * at 14:40 Model Editor is an OrCAD product.                                
 *                                                                           
 * connections:             non-inverting input                       
 *                          | inverting input                         
 *                          | | positive power supply                 
 *                          | | | negative power supply               
 *                          | | | | output                            
 *                          | | | | |                                 
 *subckt amp_tlv27x_highVdd 1 2 3 4 5                                        
 * *** original name above!! *****************************                                                    
                      
            c1        11     12 457.48E−15                                   
            c2        6      7   5.0000E−12                                  
            css       10     99 1.1431E−12                                   
            dc        5      53 dy                                           
            de        54     5   dy                                          
            dlp       90     91 dx                                           
            dln       92     90 dx                                           
            dp        4      3   dx                                          
            egnd      99     0   poly(2) (3,0) (4,0) 0 .5 .5            
            fb        7      99 poly(5) vb vc ve vlp vln 0 176.02E6 −1E3 1E3 180E6 −180E6                     
           
            ga       6         0     11 12 16.272E−6                                         
            gcm      0         6     10 99 6.8698E−9
            iss      10        4     dc 1.3371E−6
            hlim     90        0     vlim 1K
            j1       11        2     10 jx1
            J2       12        1     10 jx2
            r2       6         9     100.00E3
            rd1      3         11    61.456E3
            rd2      3         12    61.456E3
            ro1      8         5     10
            ro2      7         99    10
            rp       3         4     150.51E3
            rss      10        99    149.58E6
            vb       9         0     dc 0
            vc       3         53    dc .78905
            ve       54        4     dc .78905
            vlim     7         8     dc 0
            vlp      91        0     dc 14.200
            vln      0         92    dc 14.200
            .model   dx        D(Is=800.00E−18)
            .model   dy        D(Is=800.00E−18 Rs=1m Cjo=10p)
            .model   jx1       NJF(Is=500.00E−15 Beta=198.03E−6 Vto=−1)
            .model   jx2       NJF(Is=500.00E−15 Beta=198.03E−6 Vto=−1)
            .ends
Can someone please clue me in what I am doing wrong?

Thanks,
Keith Ostertag
 

Attachments

Ron H

Joined Apr 14, 2005
7,063
I'll be surprised if you find someone here who uses/knows ngspice.
What's wrong with LTspice? There are a lot of guys here and at ETO who can help with it.
 

Thread Starter

keithostertag

Joined Oct 4, 2012
55
Yea. I only run Linux, and at this time don't want to have to run WINE just in order to use LTSpice, since I have no other need for WINE. Might do it in the future though. Thanks for responding Ron.

Keith
 

Thread Starter

keithostertag

Joined Oct 4, 2012
55
Hi Bertus-

Yes, I have spent many hours with the manual, and with several tutorials online.

I was just hoping there might be someone on this board familiar with gschem, ngspice, and the other gEDA tools.

Thans,
Keith
 

h_vogt

Joined May 18, 2013
2
line
U8 1 2 Vcc Vee 2 tlv27x

must read
X8 1 2 Vcc Vee 2 tlv27x

because you are invoking a subcircuit (starting with X...), but not a transmission line (starting with U...)

Holger
 

andyholmes

Joined Jan 20, 2016
1
Top