Boost Converter: DCM
The boost converter given below has an input voltage of $V_i = 5\,V$. The average output voltage is $V_o = 10\,V$, and the load resistance is $5\,\Omega$. The switching frequency is $25\,$kHz, and $C = 220\,\mu$F. Determine the value of $L$ if $I_L\,$(peak-to-peak) is $3\times I_L^{\mathrm{avg}}$.Evaluate the following quantities:
- duty ratio
- peak-to-peak ripple voltage across the capacitor
- rms current through switch, diode, inductor, and capacitor
from IPython.display import Image
Image(filename =r'boost_dcm_1_fig_1.png', width=320)
# run this cell to view the circuit file.
%pycat boost_dcm_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 boost_ccm_1_orig.in and produces a new circuit file boost_ccm_1.in, after replacing \$L, \$C, \$R, \$D, \$f_hz with the values of our choice.
import gseim_calc as calc
s_Vin = '5'
s_L = '5.55u'
s_C = '220u'
s_R = '5'
s_D = '0.5' # to be changed by user
s_f_hz = '25e3'
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("boost_dcm_1_orig.in", "boost_dcm_1.in", l)
print('boost_dcm_1.in is ready for execution')
boost_dcm_1.in is ready for execution
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_dcm_1.in")
os.system('run_gseim boost_dcm_1.in')
get_lib_elements: filename gseim_aux/xbe.aux get_lib_elements: filename gseim_aux/ebe.aux Circuit: filename = boost_dcm_1.in main: i_solve = 0 main: calling solve_trns mat_ssw_1_ex: n_statevar: 3 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=2.9439e+01 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=4.9606e+01 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=2, rhs_ssw_norm=7.4163e-05 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=3, rhs_ssw_norm=9.7353e-06 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=4, rhs_ssw_norm=1.4858e-07 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=5, rhs_ssw_norm=1.4164e-18 solve_ssw_ex: calling solve_ssw_1_ex for one more trns step Transient simulation starts... i=0 solve_ssw_1_ex over (after trns step for output) solve_ssw_ex ends, slv.ssw_iter_newton=5 GSEIM: Program completed.
0
The circuit file (boost_dcm_1.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_dcm_1.in) creates a data file boost_dcm_1.dat in the same directory. We can now use the python code below to view the inductor current as a function of time.
import numpy as np
import matplotlib.pyplot as plt
from setsize import set_size
slv = calc.slv("boost_dcm_1.in")
i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u = np.loadtxt(filename)
t1 = u[:, 0]
t = t1*1e6 # convert time to micro-seconds
col_IL = slv.get_index(i_slv,i_out,"IL")
col_IS = slv.get_index(i_slv,i_out,"IS")
col_ID = slv.get_index(i_slv,i_out,"ID")
col_IC = slv.get_index(i_slv,i_out,"IC")
col_v_in = slv.get_index(i_slv,i_out,"v_in")
col_v_out = slv.get_index(i_slv,i_out,"v_out")
col_clock = slv.get_index(i_slv,i_out,"clock")
color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'
fig, ax = plt.subplots()
plt.subplots_adjust(wspace=0, hspace=0.0)
set_size(5, 3.0, ax)
plt.grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax.plot(t, u[:,col_IL], color=color1, linewidth=1.0, label="$I_L$")
ax.plot(t, u[:,col_IS], color=color2, linewidth=1.0, label="$I_S$")
plt.xlabel('time (' + r'$\mu$' + 'sec)', fontsize=11)
ax.legend(loc = 'lower right',frameon = True, fontsize = 10, title = None,
markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
prop = {'size' : 12},)
plt.tight_layout()
plt.show()
filename: boost_dcm_1.dat
import numpy as np
import matplotlib.pyplot as plt
from setsize import set_size
slv = calc.slv("boost_dcm_1.in")
i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u = np.loadtxt(filename)
t1 = u[:, 0]
t = t1*1e6 # convert time to micro-seconds
col_IL = slv.get_index(i_slv,i_out,"IL")
col_IS = slv.get_index(i_slv,i_out,"IS")
col_ID = slv.get_index(i_slv,i_out,"ID")
col_IC = slv.get_index(i_slv,i_out,"IC")
col_v_in = slv.get_index(i_slv,i_out,"v_in")
col_v_out = slv.get_index(i_slv,i_out,"v_out")
col_clock = slv.get_index(i_slv,i_out,"clock")
color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'
fig, ax = plt.subplots()
plt.subplots_adjust(wspace=0, hspace=0.0)
set_size(5, 3.0, ax)
plt.grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax.plot(t, u[:,col_v_in], color=color1, linewidth=1.0, label="Vin")
ax.plot(t, u[:,col_v_out], color=color2, linewidth=1.0, label="Vout")
plt.xlabel('time (' + r'$\mu$' + 'sec)', fontsize=11)
ax.legend(loc = 'lower right',frameon = True, fontsize = 10, title = None,
markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
prop = {'size' : 12},)
plt.tight_layout()
plt.show()
filename: boost_dcm_1.dat
On the output file produced by GSEIM (in this case, boost_dcm_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.
import gseim_calc as calc
import numpy as np
slv = calc.slv("boost_dcm_1.in")
i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u = np.loadtxt(filename)
t = u[:, 0]
col_IL = slv.get_index(i_slv,i_out,"IL")
col_IS = slv.get_index(i_slv,i_out,"IS")
col_ID = slv.get_index(i_slv,i_out,"ID")
col_IC = slv.get_index(i_slv,i_out,"IC")
col_v_in = slv.get_index(i_slv,i_out,"v_in")
col_v_out = slv.get_index(i_slv,i_out,"v_out")
col_clock = slv.get_index(i_slv,i_out,"clock")
# since we have stored two cycles, we need to divide the last time point
# by 2 to get the period:
T = t[-1]/2
l_IL = calc.avg_rms_2(t, u[:,col_IL], 0.0, 2.0*T, 1.0e-3*T)
l_IS = calc.avg_rms_2(t, u[:,col_IS], 0.0, 2.0*T, 1.0e-3*T)
l_ID = calc.avg_rms_2(t, u[:,col_ID], 0.0, 2.0*T, 1.0e-3*T)
l_IC = calc.avg_rms_2(t, u[:,col_IC], 0.0, 2.0*T, 1.0e-3*T)
l_v_out = calc.avg_rms_2(t, u[:,col_v_out], 0.0, 2.0*T, 1.0e-3*T)
t_start = 0.0
t_end = 2.0*T
l1 = calc.min_max_1(t, u[:,col_IL], t_start, t_end)
IL_ptop = l1[1] - l1[0]
print('IL_ptop:', "%11.4E"%IL_ptop)
l2 = calc.min_max_1(t, u[:,col_v_out], t_start, t_end)
VC_ptop = l2[1] - l2[0]
print('VC_ptop:', "%11.4E"%VC_ptop)
IL_rms = l_IL[2][0]
print('IL_rms:', "%11.4E"%IL_rms)
IL_avg = l_IL[1][0]
print('IL_avg:', "%11.4E"%IL_avg)
IS_rms = l_IS[2][0]
print('IS_rms:', "%11.4E"%IS_rms)
ID_rms = l_ID[2][0]
print('ID_rms:', "%11.4E"%ID_rms)
IC_rms = l_IC[2][0]
print('IC_rms:', "%11.4E"%IC_rms)
Vout_avg = l_v_out[1][0]
print('Vout_avg:', "%11.4E"%Vout_avg)
Vout_rms = l_v_out[2][0]
print('Vout_rms:', "%11.4E"%Vout_rms)
filename: boost_dcm_1.dat IL_ptop: 1.7985E+01 VC_ptop: 3.5029E-01 IL_rms: 9.2990E+00 IL_avg: 7.1999E+00 IS_rms: 7.3473E+00 ID_rms: 5.6999E+00 IC_rms: 5.0200E+00 Vout_avg: 1.3286E+01 Vout_rms: 1.3286E+01
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.