0
\$\begingroup\$

I tried this code for a simple simulation with ngspice-30:

vcc 3 0 dc=10
vin 4 0 0.8 
vdummy 1 2 
R1 4 5 50k
r3 3 1 1k
Q1 2 5 0 mybjt 
.model mybjt npn(IS=1E-16 VJE=0.7 CJE=2.6734e-11 CJC= 1.4040e-11 BF=200)
.control
op
dc vcc 0 10 1 vin 0.7 0.8 0.02 
run 
plot i(vdummy) 
.endc 
.end

But I always get a blank graph out of it. What could go wrong with my code? output

\$\endgroup\$
  • \$\begingroup\$ Are you sure the simulation is working at all? Do all of the other voltage signals look reasonable? \$\endgroup\$ – Elliot Alderson May 13 at 11:11
1
\$\begingroup\$

You forgot to start the NGspice code with a so called title line with the keyword netlist.
So, the first line should be something like "[your title] netlist".

Without that line, the simulation output shows a:
Fatal error: DCtrCurv: source / resistor vcc not in circuit
which explains there are no (relevant) datapoints for i(vdummy).

Using the following will give the desired result.

testcircuit netlist
vcc 3 0 dc=10
vin 4 0 0.8 
vdummy 1 2 
R1 4 5 50k
r3 3 1 1k
Q1 2 5 0 mybjt 
.model mybjt npn(IS=1E-16 VJE=0.7 CJE=2.6734e-11 CJC= 1.4040e-11 BF=200)
.control
op
dc vcc 0 10 1 vin 0.7 0.8 0.02 
run 
plot i(vdummy) 
.endc 
.end
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.