ngspice documentation problem/correction

  • Keith Ostertag
    Keith Ostertag

    I'm a noob, reading the current ngspice pdf manual (Jan 2012) for version 24.

    Chap 20.1, in presenting a short intro, suggests that xspice_c1.cir is included in the ngspice install and proceeds to walk the user through a session using that file (page 336). That file is not part of the ngspice install. AFAIK, there are no *.cir files in the ngspice install. It's also is confusing, as it suggests that xspice is required to use ngspice.

    Although I can manually create the listing, I'm left not knowing whether I have installed all the necessary components.

    In addition, the first line of the listing is missing the initial "*" in order to make it a comment, so produces an error.

    I'm using the Debian repository ngspice install package, 24-1, for amd64 (wheezy).

    Keith Ostertag

  • Holger Vogt
    Holger Vogt


    thanks for your input.
    I have added xspice_c1.cir to the ngspice git repository, where we already have xspice_c2.cir and xspice_c3.cir. I have added a small sentence to the manual that XSPICE option is not required to run this file.

    xspice_c2.cir and xspice_c3.cir are part of our distribution, to be found in directory ngspice/examples/xspice. We have no control of what the debian ngspice maintainer will do with individual files, but I guess you will find them.

    The very first line of an input file (and only this one) is always taken as a title line, * is not needed. Therefore you should not use the first line for any other input.


  • Keith Ostertag
    Keith Ostertag

    Thanks Holger-

    I will attempt to contact the Debian maintainer to alert them they did not include the examples directory in their distribution.

    Yes, I now see the first line does not need the asterisk.

    There is one additional problem with this file, maybe you have time to look at? I have created the file exactly as posted, and I can run the file using all the steps in the manual with no problems, except one. Step 8 (page 340) gives me an error:

    ngsice 2 -> plot db(coll) ph(coll) vs log(frequency)
    Error: X values must be > 0 for log scale

    All other steps work as they should, so it would appear the problem is not due to a bad install. I have done all the steps in the proper sequence, several times, with the same result.

    I don't intend to involve you in a tutorial, only to help determine if the manual is correct. I also notice that the number for the collector is different, but that may be due to differences in processor, etc (Manual says 7.003393e+00, my session gives 7.003464e+00.

    I have included a session log to help. You can also access it at this URL:

    Keith Ostertag

    ** 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
    ** Please file your bug-reports at
    ** Creation Date: Sun Jun 17 07:51:27 UTC 2012

    Circuit: a berkeley spice3 compatible circuit

    ngspice 2 -> listing
    a berkeley spice3 compatible circuit

         1 : a berkeley spice3 compatible circuit
         2 : .global gnd
         8 : .tran 1e-5 2e-3
        10 : vcc vcc 0 12.0
        11 : vin 1 0 0.0 ac 1.0 sin(0 1 1k)
        12 : ccouple 1 base 10uf
        13 : rbias1 vcc base 100k
        14 : rbias2 base 0 24k
        15 : ql coll base emit generic
        16 : rcollector vcc coll 3.9k
        17 : remitter emit 0 1k
        19 : .model generic npn
        22 : .end
    ngspice 2 -> run
    Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

    Initial Transient Solution

    Node                                   Voltage
    ---                                   -----
    vcc                                         12
    1                                            0
    base                                   2.07461
    coll                                   7.00346
    emit                                   1.29397
    vin#branch                                   0
    vcc#branch                         -0.00138042

    No. of Data Rows : 208
    ngspice 2 -> plot v(1) base
    ngspice 2 -> plot vcc coll emit
    ngspice 2 -> op

    Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

    No. of Data Rows : 1
    ngspice 2 -> print emit base coll
    emit = 1.293975e+00
    base = 2.074614e+00
    coll = 7.003464e+00
    ngspice 2 -> ac dec 10 0.01 100

    Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

    No. of Data Rows : 41
    ngspice 2 -> plot coll
    ngspice 2 -> ploy
    ngspice 2 -> plot db(coll) ph(coll) vs log(frequency)
    Error: X values must be > 0 for log scale
    ngspice 2 -> dc vcc 0 15 0.1

    Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

    No. of Data Rows : 151
    ngspice 2 -> plot emit coll base
    ngspice 2 -> quit
    ngspice-24 done

  • Holger Vogt
    Holger Vogt


    the correct way is to write
    ngspice 2 -> plot db(coll) ph(coll)

    I will update the manual.


  • Keith Ostertag
    Keith Ostertag

    Thanks Holger! Correct documentation is very important! Many people will benefit from your concientious maintenance/updates.