Pages

Friday, 22 March 2013

Ngspice, RLC resonator

Today, I want to show another Spice example upon AC simulation. The circuit is a parallel RLC resonator, and we are going to figure out some important parameter of the resonators, that are the same of a pass-band filter. These are the resonator frequency, bandwidth and quality factor.


Before start the spice simulation, can be useful have a look at what is a RLC resonator. Some of the more important equation are:
$$f_0 = \frac{1}{2\pi\sqrt{LC}};\qquad \Delta f = f_2 - f_1; \qquad Q=\frac{f_0}{\Delta f}.$$
Where $f_0$ is the resonance frequency, $f_2$ and $f_1$, the two frequencies where the impedance of the resonator is half of the maximum, or even $-3\,dB$ in the decibel graph.

If we use  these component values: $R=2.2\,k\Omega$, $C=220\,nF$ and $L=100\,\mu H$, the above equations should lead to:
$$f_0 = 33.9\,kH;\qquad Q=103.18; \qquad \Delta f = 328\,Hz$$
Let's begin the spice simulation!
The description of the circuit is trivial, there are just four elementary devices, but the important things are within the control statement:


* RLC Resonator

Iin 0 n1 DC 0 AC 1
R n1 0 2.2k
L n1 0 100u
C n1 0 220n


.control
ac lin 1000 30k 40k
let Zn=v(n1)/2.2k
meas ac f_res max_at Zn
meas ac BW TRIG Zn val=0.5 RISE=1
+ TARG Zn val=0.5 FALL=1
let Q=f_res/BW
echo "The quality factor of this RLS resonator is $&Q" 
write sig_plot.raw db(Zn) ph(Zn)
quit
.endc

As always to execute the script and have a log.txt file:
ngspice RLC_resonator.sp -o log.txt
Once done the ac simulation, it's defined Zn, that is the impedance of the resonator normalized with the resistance of the circuit. After that are measured the three parameters:

  • $f_{res}$ or $f_0$, that is the central frequency where the response has its maximum,
  • $\Delta f$, the bandwidth of the resonator, calculated between the point where Zn is half of its maximum, that in such case is one because it is normalized),
  • $Q$, the quality factor of the resonator.

And that's it! Comparing the simulation results and the results given by the equations, can be noticed that are very close!

spice file, raw file, output file.

No comments:

Post a Comment