Help? with basic ngspice syntax and use

Discussion in 'General Electronics Chat' started by keithostertag, Nov 14, 2012.

  1. keithostertag

    Thread Starter Member

    Oct 4, 2012
    48
    2
    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;

    Code ( (Unknown Language)):
    1.  
    2. keith@t520:~/gaf$ gnetlist -g spice-sdb --nomunge -I -o tes1.net test1.sch
    3. Command line passed = gnetlist -g spice-sdb --nomunge -I -o tes1.net test1.sch
    4. Loading schematic [/home/keith/gaf/test1.sch]
    5. Using SPICE backend by SDB -- Version of 4.28.2007
    6. schematic-type = normal schematic
    7. keith@t520:~/gaf$
    8.  
    No apparent problems so far.

    I then run:

    Code ( (Unknown Language)):
    1. keith@t520:~/gaf$ ngspice test1.net
    2. ******
    3. ** ngspice-24 : Circuit level simulation program
    4. ** The U. C. Berkeley CAD Group
    5. ** Copyright 1985-1994, Regents of the University of California.
    6. ** Please get your ngspice manual from http://ngspice.sourceforge.net/docs.html
    7. ** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html
    8. ** Creation Date: Sun Jun 17 07:51:27 UTC 2012
    9. ******
    10.  
    11. Circuit: * gnetlist -g spice-sdb --nomunge -i -o test1.net test1.sch
    12.  
    13. Error on line 14 : u8 1 2 vcc vee 2 tlv27x
    14. Unable to find definition of model vee - default assumed
    15.  
    16.  unknown parameter (tlv27x)
    17. ngspice 2 ->
    18.  
    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:

    Code ( (Unknown Language)):
    1.  
    2. keith@t520:~/gaf$ cat test1.net
    3. * gnetlist -g spice-sdb --nomunge -I -o test1.net test1.sch
    4. *********************************************************
    5. * Spice file generated by gnetlist                      *
    6. * spice-sdb version 4.28.2007 by SDB --                 *
    7. * provides advanced spice netlisting capability.        *
    8. * Documentation at http://www.brorson.com/gEDA/SPICE/   *
    9. *********************************************************
    10. .INCLUDE tlv27x.inc
    11. *==============  Begin SPICE netlist of main design ============
    12. .INCLUDE tlv27x.inc
    13. Vin 3 0 ac 1 pulse( -1 1 1u 100n 100n 50u 100u)
    14. R26 2 0 2K  
    15. R24 3 1 50  
    16. U8 1 2 Vcc Vee 2 tlv27x
    17. Vee 0 Vee DC 1.5V
    18. Vcc Vcc 0 DC 1.5V
    19. .end
    20.  
    And here is the contents of the include file tlv274.inc:

    Code ( (Unknown Language)):
    1.  
    2. *******************************
    3. * Begin .SUBCKT model            *
    4. * This is for one section of the quad TLV274, taken from the datasheet
    5. ********************************
    6. .SUBCKT tlv27x 1 2 3 4 5
    7.  *DEVICE=amp_tlv27x_highVdd,OP AMP,NJF,INT                                  
    8.  * amp_tlv_27x_highVdd operational amplifier ”macromodel”                    
    9.  * subcircuit updated using Model Editor release 9.1 on 05/15/00            
    10.  * at 14:40 Model Editor is an OrCAD product.                                
    11.  *                                                                          
    12.  * connections:             non-inverting input                      
    13.  *                          | inverting input                        
    14.  *                          | | positive power supply                
    15.  *                          | | | negative power supply              
    16.  *                          | | | | output                            
    17.  *                          | | | | |                                
    18.  *subckt amp_tlv27x_highVdd 1 2 3 4 5                                        
    19.  * *** original name above!! *****************************                                                    
    20.                      
    21.             c1        11     12 457.48E−15                                  
    22.             c2        6      7   5.0000E−12                                  
    23.             css       10     99 1.1431E−12                                  
    24.             dc        5      53 dy                                          
    25.             de        54     5   dy                                          
    26.             dlp       90     91 dx                                          
    27.             dln       92     90 dx                                          
    28.             dp        4      3   dx                                          
    29.             egnd      99     0   poly(2) (3,0) (4,0) 0 .5 .5            
    30.             fb        7      99 poly(5) vb vc ve vlp vln 0 176.02E6 −1E3 1E3 180E6 −180E6                    
    31.            
    32.             ga       6         0     11 12 16.272E−6                                        
    33.             gcm      0         6     10 99 6.8698E−9
    34.             iss      10        4     dc 1.3371E−6
    35.             hlim     90        0     vlim 1K
    36.             j1       11        2     10 jx1
    37.             J2       12        1     10 jx2
    38.             r2       6         9     100.00E3
    39.             rd1      3         11    61.456E3
    40.             rd2      3         12    61.456E3
    41.             ro1      8         5     10
    42.             ro2      7         99    10
    43.             rp       3         4     150.51E3
    44.             rss      10        99    149.58E6
    45.             vb       9         0     dc 0
    46.             vc       3         53    dc .78905
    47.             ve       54        4     dc .78905
    48.             vlim     7         8     dc 0
    49.             vlp      91        0     dc 14.200
    50.             vln      0         92    dc 14.200
    51.             .model   dx        D(Is=800.00E−18)
    52.             .model   dy        D(Is=800.00E−18 Rs=1m Cjo=10p)
    53.             .model   jx1       NJF(Is=500.00E−15 Beta=198.03E−6 Vto=−1)
    54.             .model   jx2       NJF(Is=500.00E−15 Beta=198.03E−6 Vto=−1)
    55.             .ends
    56.  
    Can someone please clue me in what I am doing wrong?

    Thanks,
    Keith Ostertag
     
  2. keithostertag

    Thread Starter Member

    Oct 4, 2012
    48
    2
    There's a typo in the gnetlist statement above (tes1 instead of test1) but that isn't causing my problem.
     
  3. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    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.
     
  4. keithostertag

    Thread Starter Member

    Oct 4, 2012
    48
    2
    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
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,646
    2,345
    Hello,

    The ngspice manual is very extensive.
    Did you have a look at it?
    (I have attached the 24plus version).
    Also take a look at the attached presentation about ngspice.

    Bertus
     
  6. keithostertag

    Thread Starter Member

    Oct 4, 2012
    48
    2
    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
     
  7. h_vogt

    New Member

    May 18, 2013
    1
    0
    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
     
  8. andyholmes

    New Member

    Jan 20, 2016
    1
    0
Loading...