I'm reading an EE book that references SPICE so to follow along on my linux machine I installed ngspice. I can't output current for any circuits! I've tried passing the file with -r option and multiple circuits. Can never get a current output!
I googled and tried other posts this but nothing seems to work. I'm starting to wonder if this is an install / configuration issue?
Starting with a simple series circuit with the intent to print voltage at each resistor and current at my source I loaded the following netlist:
series circuit
v1 1 0
r1 1 2 3k
r2 2 3 10k
r3 3 0 5k
.dc v1 9 9 1
.print dc v(1,2) v(2,3) v(3,0) i(v1)
.end
and received errors: Warning: v1: has no value, DC 0 assumed Warning: can't parse '0': ignored
My voltage outputs are correct per hand calcs so I know ngspice is calculating the right current.
reducing .print line to just get current::
.print i(v1)
yields error:
Error: .print: no i(v1) analysis found.
I've also tried defining my source different as:
v1 1 0 dc 9
same errors.
I've tried many different circuits and can never get ngspice to output current for my sources (I have created 0 voltage sources near resistances on parallel circuits as well). The voltage outputs are all correct
I also tried a netlist with no .print line (I thought I've seen others with default output):
series circuit
v1 1 0 dc 9
r1 1 2 3k
r2 2 3 10k
r3 3 0 5k
.end
with this error:
Note: No ".plot", ".print", or ".fourier" lines; no simulations run
isn't there a default output without needing a .print line?
More importantly is there a configuration file not setup properly? thoughts?
any direction is greatly appreciate... Thank you