View Full Version : How to display output values with ngspice?
mahela007
November 7th, 2010, 03:36 AM
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.
stchman
March 3rd, 2011, 10:06 PM
I too would be very interested in this.
mahela007
March 5th, 2011, 09:27 AM
Unfortunately I never found the answer...
stchman
March 5th, 2011, 06:55 PM
I have a lot of old PSpice .cir files that I would like to analyze and current through components would be very nice.
hal8000
March 21st, 2011, 09:56 PM
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.
ngspice
July 3rd, 2012, 05:10 PM
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.
overdrank
July 3rd, 2012, 09:29 PM
http://img147.imageshack.us/img147/5451/necromancing.jpg
From the Ubuntu Forums Code of Conduct (http://ubuntuforums.org/index.php?page=policy).
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.