1

I'm trying to simulate a simple pulse generator that gets activated by a voltage source vs.

vs starts at 0V and switches to 5V at 10us where it remains at 5V for the duration of the simulation.

When I run the simulation and plot v(in), the voltage remains at 0 for the duration of the simulation.

Below is the netlist:

* Pulse Generator - I
* Section 2.2.2 C
* Figure 2.11

* DC bias
vcc 4 0 5V

* input
vs in 0 pulse(0 5 10u)

* Q1
R1 in 1 10k
R2 4 2 1k
Q1 2 1 0 myq1

C1 2 3 10n

* Q2
R3 4 3 10k
R4 4 out 1k
Q2 out 3 0 myq2

.model myq1 npn (bf=100)
.model myq2 npn (bf=100)

.tran 1ns 500us
.end

I figured out my issue. I sourced a circuit file and assumed I didn't need to source it again after I made edits to the file.

Everytime I make changes to the circuit file, I must source it again for the changes to take effect. There must've been an error when I first sourced it, and I wasn't seeing the changes I made until I resourced the file.

Thanks! :-)

EarthIsHome
  • 265
  • 1
  • 10
  • 1
    If you solve the problem yourself, you should post the solution as an answer (and accept it). Otherwise, the system keeps raising the question to the front page until you mark one of the answers as accepted. – The Photon Apr 17 '16 at 01:54

2 Answers2

1

I figured out what I overlooked: (re)sourcing the modified netlist file.

There must have been errors when I first sourced the file into ngspice. Changes made to the file are not taken into account unless sourced again.

source pulse-generator.cir
run
plot v(in) v(out)
EarthIsHome
  • 265
  • 1
  • 10
0

There are different version of SPICE, and rather than delve deeply in this specific version I can suggest the following.

  • Capitalize the source "V" 's so instead of vcc is should at least be Vcc or even better VCC

Your DC source really should be

VCC 4 0 DC 5V

That may be what was causing the problems.

  • be more explicit in your pulse statement, i.e. define all the terms and experiment.

so your vs source line should/could be

VS in 0 PULSE ( 0 5 10u 1n 1n 1m 2m)

Note I made the PW and PER values longer than your simulation (.TRAN) time.

placeholder
  • 30,170
  • 10
  • 63
  • 110
  • I figured out my problem and added it to the end of my question. I didn't know I had to source the file everytime I made changes to it. – EarthIsHome Apr 17 '16 at 01:42