Buck Converter: CCM

The buck converter given below is operating in continuous conduction mode with a switching frequency of $10\,$kHz. The converter has the following specifications: $V_{in}=100\,V$ , $V_{out}=25\,V$, $R=2.5\,\Omega$. The peak-to-peak ripple in inductor current is $20\,\%$ of the average current through it and the peak-to-peak ripple in output capacitor voltage is $0.1\,$V. Determine
  1. duty cycle
  2. $L$ and $C$
  3. peak and average inductor current
  4. RMS current through switch, diode, inductor, and capacitor
  5. average current through switch, diode, inductor, and capacitor
In [1]:
from IPython.display import Image
Image(filename =r'buck_ccm_1_fig_1.png', width=320)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat buck_ccm_1_orig.in

We now replace the strings \$Vin, \$L, \$C, \$R, \$D, \$f_hz with the values of our choice by running the python script given below. It takes an existing circuit file buck_ccm_1_orig.in and produces a new circuit file buck_ccm_1.in, after replacing \$L, \$C, \$R, \$D, \$f_hz with the values of our choice.

In [3]:
import gseim_calc as calc
s_Vin = '100'
s_L = '0.6e-3' # to be changed by user
s_C = '50e-6' # to be changed by user
s_R = '2.5'
s_D = '0.4' # to be changed by user
s_f_hz = '10e3'
l = [
  ('$Vin', s_Vin),
  ('$L', s_L),
  ('$C', s_C),
  ('$R', s_R),
  ('$D', s_D),
  ('$f_hz', s_f_hz)
]
calc.replace_strings_1("buck_ccm_1_orig.in", "buck_ccm_1.in", l)
print('buck_ccm_1.in is ready for execution')
buck_ccm_1.in is ready for execution
Execute the following cell to run GSEIM on buck_ccm_1.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("buck_ccm_1.in")
os.system('run_gseim buck_ccm_1.in')
Circuit: filename = buck_ccm_1.in
main: calling solve_sss
solve_sss starting: sss_n_st: 2
solve_sss_ex: sss_iter_newton=0, rhs_sss_norm=7.4823e+00, sss_period_1_compute=2.0000e-04
solve_sss_ex: sss_iter_newton=1, rhs_sss_norm=1.1415e-09, sss_period_1_compute=2.0000e-04
solve_sss_ex: sss_iter_newton=2, rhs_sss_norm=2.5121e-15, sss_period_1_compute=2.0000e-04
solve_sss_ex: calling sss_solve_trns_ex for one more trns step
Transient simulation starts...
i=0
i=1000
GSEIM: Program completed.
Out[4]:
0

The circuit file (buck_ccm_1.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on buck_ccm_1.in) creates a data file buck_ccm_1.dat in the same directory. We can now use the python code below to view the inductor current as a function of time.

In [5]:
plot_1 = calc.gseim_plot_single(2)

plot_1.l_plots[0].i_slv = 0
plot_1.l_plots[0].i_out = 0
plot_1.l_plots[0].var_name = "IL"
plot_1.l_plots[0].plot_type = "X-time"
plot_1.l_plots[0].label = "$I_L$"
plot_1.l_plots[0].color = "dodgerblue"
plot_1.l_plots[0].linewidth = 1.0
plot_1.l_plots[0].linestyle = "solid"

plot_1.l_plots[1].i_slv = 0
plot_1.l_plots[1].i_out = 0
plot_1.l_plots[1].var_name = "IL"
plot_1.l_plots[1].plot_type = "AVG"
plot_1.l_plots[1].label = "$I_L^{avg}$"
plot_1.l_plots[1].color = "dodgerblue"
plot_1.l_plots[1].linewidth = 1.0
plot_1.l_plots[1].linestyle = "dashed"
plot_1.l_plots[1].line_tuple = (3,2)

plot_1.y_label = ""
plot_1.legend_flag = True
plot_1.legend_position = 'upper right'

calc.plot_single_time(
   infile='buck_ccm_1.in',
   t_mult=1e6,
   x_size=4.0,
   y_size=2.5,
   x_label='time (' + r'$\mu$' + 'sec)',
   label_font_size=11,
   legend_fontsize=10,
   t_start=0.0,
   t_end=200.0e-6,
   t_offset=0.0,
   plot_1=plot_1)
filename: buck_ccm_1.dat
No description has been provided for this image

On the output file produced by GSEIM (in this case, buck_ccm_1.dat), we can do some post-processing to obtain average and rms values, for example. For this purpose, a python module gseim_calc.py has been included in the directory from which you launched Jupyter. Run the following python script to obtain the quantities of interest listed in the question.

In [6]:
calc.print_ptop(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="IL", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="IL_ptop:", s2="Amp")

calc.print_max(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="IL", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="IL_max:", s2="Amp")

calc.print_ptop(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="v_out", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="VC_ptop:", s2="V")

calc.print_rms(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="IL", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="IL_rms:", s2="Amp")

calc.print_rms(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="IS", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="IS_rms:", s2="Amp")

calc.print_rms(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="ID", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="ID_rms:", s2="Amp")

calc.print_rms(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="IC", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="IC_rms:", s2="Amp")

calc.print_avg(
   infile='buck_ccm_1.in', i_slv=0, i_out=0,
   var_name="v_out", t_start=0.0, t_end=200.0e-6,
   s_format="%11.4E", s1="VC_avg:", s2="V")
IL_ptop:  4.0264E+00 Amp
IL_max:  1.8007E+01 Amp
VC_ptop:  1.0010E+00 V
IL_rms:  1.6036E+01 Amp
IS_rms:  1.0143E+01 Amp
ID_rms:  1.2420E+01 Amp
IC_rms:  1.1541E+00 Amp
VC_avg:  3.9984E+01 V

This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.

In [ ]: