Boost Converter: CCM
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. If $L = 200\,\mu$H and $C = 200\,\mu$F, evaluate the following quantities:- duty ratio
- peak-to-peak ripple voltage across the capacitor
- peak-to-peak ripple in the inductor current
- rms current through switch, diode, inductor, and capacitor
from IPython.display import Image
Image(filename =r'boost_ccm_1_fig_1.png', width=320)
# run this cell to view the circuit file.
%pycat boost_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 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 = '200u'
s_C = '200u'
s_R = '5'
s_D = '0.3'# 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_ccm_1_orig.in", "boost_ccm_1.in", l)
print('boost_ccm_1.in is ready for execution')
boost_ccm_1.in is ready for execution
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_ccm_1.in")
os.system('run_gseim boost_ccm_1.in')
get_lib_elements: filename gseim_aux/xbe.aux get_lib_elements: filename gseim_aux/ebe.aux Circuit: filename = boost_ccm_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=1.1357e+00 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=2.0882e+00 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=2, rhs_ssw_norm=7.1662e-14 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=2 GSEIM: Program completed.
0
The circuit file (boost_ccm_1.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_ccm_1.in) creates a data file boost_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.
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
slv = calc.slv("boost_ccm_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_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)
print('average output voltage:', "%11.4E"%l_v_out[1][0])
print('average input current:', "%11.4E"%l_IL[1][0])
color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'
fig, ax = plt.subplots()
plt.subplots_adjust(wspace=0, hspace=0.0)
set_size(4, 2.5, ax)
plt.grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
# comment out lines for variables which should not be shown
'''
ax.plot(t, x[col_IL-1], color=color1, linewidth=1.0, label="$I_L$")
'''
ax.plot(t, u[:,col_IL], color=color1, linewidth=1.0, label="$I_L$")
ax.plot(l_IL[0], l_IL[1], color=color1, linewidth=1.0, label="$I_L^{avg}$", linestyle='--', dashes=(5,3))
ax.plot(l_IL[0], l_IL[2], color=color1, linewidth=1.0, label="$I_L^{rms}$", linestyle='-.')
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_ccm_1.dat average output voltage: 7.1379E+00 average input current: 2.0400E+00
On the output file produced by GSEIM (in this case, boost_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.
import gseim_calc as calc
import numpy as np
slv = calc.slv("boost_ccm_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_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)
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)
filename: boost_ccm_1.dat IL_ptop: 2.9988E-01 VC_ptop: 8.5614E-02 IL_rms: 2.0418E+00 IS_rms: 1.1180E+00 ID_rms: 1.7086E+00 IC_rms: 9.3771E-01 Vout_avg: 7.1379E+00
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.