Hi,

this is a small example on how to use ngspice to simulate electronic circuits.

As an example, I chose to simulate the 60 MHz anti aliasing filter of the Upgraded Unified Board of the Pierre Auger Observatory.

First of all, here is the circuit we want to simulate:

!Anti aliasing filter with measurement equipment

circuit.cir

AA-Filter
.PARAM  IMPE=50Ohm
V0  in  gnd DC -0.5 ac PULSE(0 1 1ns 1ns 1ns 5ns)
RS  in  2   IMPE
C77 2   gnd 6p
L39 2   3   47n
C78 3   gnd 30p
L40 3   4   100n
C79 4   gnd 47p
L41 4   out 150n
C80 out gnd 100p
RL  out gnd IMPE
.END

Please note that termination resistors are included. Now we can use ngspice to simulate the circuit.

source circuit.cir
listing //shows the loaded circuit
ac dec 100 1 100k // AC simulation, 100 steps per decade, 1 Hz to 100k Hz
display //shows all available variables
plot abs(V(out)/V(in)) xlog //shows transfer function, x axis logarithmic
plot db(abs(V(out)/V(in))) //shows transfer function in db, x axis logarithmic
plot phase(V(out)/V(in)) //plot phase
hardcopy phase.ps phase(V(out)/V(in)) //store plot in file
set filetype=ascii //set filetype for writes
write phase.asc phase(V(out)/V(in))  //write data in ascii format
quit

Here you can see the simulated transfer function:

!Transfer function of the anti aliasing filter


Published

Category

snippets

Tags