Results 1 to 7 of 7

Thread: How to display output values with ngspice?

  1. #1
    Join Date
    Mar 2008
    Location
    Sri lanka
    Beans
    764
    Distro
    Ubuntu 10.04 Lucid Lynx

    How to display output values with ngspice?

    I've looked everywhere but there just don't seem to be any decent ngspice tutorials. I've figured out how to create a netlist, load in into ngspice and run it but I'm having trouble displaying the results. I would like to know how to display the magnitude of the current in a simple circuit like a battery and two resistors in series.
    thanks.

  2. #2
    Join Date
    Feb 2007
    Location
    St. Louis, MO
    Beans
    4,930
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How to display output values with ngspice?

    I too would be very interested in this.
    Windows, only good for gaming.

  3. #3
    Join Date
    Mar 2008
    Location
    Sri lanka
    Beans
    764
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to display output values with ngspice?

    Unfortunately I never found the answer...

  4. #4
    Join Date
    Feb 2007
    Location
    St. Louis, MO
    Beans
    4,930
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How to display output values with ngspice?

    I have a lot of old PSpice .cir files that I would like to analyze and current through components would be very nice.
    Windows, only good for gaming.

  5. #5
    Join Date
    Mar 2005
    Location
    UK
    Beans
    562

    Re: How to display output values with ngspice?

    NGspice supports all commands of spice 3, but with speed improvements etc.

    The command to display your netlist is:
    listing
    run (to run simulations as defined in netlist)
    print or plot to display variables.

    The DC analyasis computes the bias point of the circuit, voltages at ALL circuit nodes, and currents through voltage sources only.

    Remember that current in a series circuit is the same at all points, so any series resistor, has same current as voltage source.
    If however you have series and parallel branches, then add a 0 Volt voltage source in series with the branch.
    Hopefully this simple example will demonstrate

    ngspice 5 -> listing
    * series dc test

    2 : .global gnd
    3 : v1 1 0 dc 10
    4 : r1 1 2 10k
    5 : v2 2 3 dc 0
    6 : r2 3 0 40k
    7 : .op
    9 : .end
    ngspice 6 -> print all
    v(1) = 1.000000e+01
    v(2) = 8.000000e+00
    v(3) = 8.000000e+00
    v1#branch = -2.00000e-04
    v2#branch = 2.000000e-04


    The netlist called seriesrc.cir is below:
    * Series DC test
    V1 1 0 DC 10
    R1 1 2 10k
    v2 2 3 DC 0
    R2 3 0 40k
    .op
    .END

    The command print all prints all node voltages, just to prove kirchoffs current law, V2 is a 0V voltage source in series with R1. The current through v1# branch is same as v2# branch.

    You also have to remember that spice calaculates current flow from positive node of a voltage source to negative node, which is why the v2#branch is shown as negative.

    http://zone.ni.com/devzone/cda/tut/p/id/5416

    The above link has some basic info and a good description of voltage sources.

  6. #6
    Join Date
    Jul 2012
    Beans
    1

    Re: How to display output values with ngspice?

    There is an online version of ngspice available at www.ngspice.com. Examples circuits are available on the site that show you exactly how to simulate and plot results for some simple circuits. And if you have additional questions, the forum on that site may be more helpful.

  7. #7
    Join Date
    Feb 2007
    Beans
    24,961
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How to display output values with ngspice?


    From the Ubuntu Forums Code of Conduct.
    If a post is older than a year or so and hasn't had a new reply in that time, instead of replying to it, create a new thread. In the software world, a lot can change in a very short time, and doing things this way makes it more likely that you will find the best information. You may link to the original discussion in the new thread if you think it may be helpful.
    Thread closed.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •