Boost Converter: CCM
The boost converter given below allows an input $40\,$V to $100\,$V and gives an output of $120\,$V at a $12\,$kW load. The inductor is $10\,\mu$H. Determine the switching frequency needed to keep the peak-to-peak inductor current below $10\,\%$ for all input voltages.from IPython.display import Image
Image(filename =r'boost_ccm_2_fig_1.png', width=320)
# run this cell to view the circuit file.
%pycat boost_ccm_2_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_2_orig.in and produces a new circuit file boost_ccm_2.in, after replacing \$L, \$C, \$R, \$D, \$f_hz with the values of our choice.
import gseim_calc as calc
Vin = 60
Vout = 120
D = (Vout-Vin)/Vout
print('Duty ratio:', D)
P = 12.0e3
R = Vout*Vout/P
print('R:', R)
f_hz = 100.0e3 # to be changed by user
s_Vin = ("%11.4E"%Vin).strip()
s_D = ("%11.4E"%D).strip()
s_R = ("%11.4E"%R).strip()
s_f_hz = ("%11.4E"%f_hz).strip()
l = [
('$Vin', s_Vin),
('$L', '10u'),
('$C', '2200u'),
('$R', s_R),
('$D', s_D),
('$f_hz', s_f_hz)
]
calc.replace_strings_1("boost_ccm_2_orig.in", "boost_ccm_2.in", l)
print('boost_ccm_2.in is ready for execution')
Duty ratio: 0.5 R: 1.2 boost_ccm_2.in is ready for execution
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_ccm_2.in")
os.system('run_gseim boost_ccm_2.in')
get_lib_elements: filename gseim_aux/xbe.aux get_lib_elements: filename gseim_aux/ebe.aux Circuit: filename = boost_ccm_2.in main: i_solve = 0 main: calling solve_trns mat_ssw_1_ex: n_statevar: 3 Transient simulation starts... i=0 i=1000 solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=6.9132e+01 Transient simulation starts... i=0 i=1000 solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=2.8858e+01 Transient simulation starts... i=0 i=1000 solve_ssw_ex: ssw_iter_newton=2, rhs_ssw_norm=3.9432e-11 solve_ssw_ex: calling solve_ssw_1_ex for one more trns step Transient simulation starts... i=0 i=1000 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_2.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_ccm_2.in) creates a data file boost_ccm_2.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_2.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")
# since we have stored two cycles, we need to divide the last time point
# by 2 to get the period:
T = t[-1]/2
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)
l = calc.avg_rms_2(t, u[:,col_IL], 0.0, 2*T, 1.0e-4*T)
ax.plot(t, u[:,col_IL], color=color1, linewidth=1.0, label="$I_L$")
ax.plot(l[0], l[1], color=color1, linewidth=1.0, label="$I_L^{\mathrm{avg}}$", linestyle='--', dashes=(5,3))
ax.plot(l[0], l[2], color=color1, linewidth=1.0, label="$I_L^{\mathrm{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_2.dat
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
slv = calc.slv("boost_ccm_2.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(4, 2.5, 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_ccm_2.dat
On the output file produced by GSEIM (in this case, boost_ccm_2.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_2.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")
T = t[-1]/2
t_start = 0.0
t_end = 2.0*T
l = calc.min_max_1(t, u[:,col_IL], t_start, t_end)
IL_ptop = l[1] - l[0]
print('IL_ptop:', "%11.4E"%IL_ptop)
l = calc.min_max_1(t, u[:,col_v_out], t_start, t_end)
VC_ptop = l[1] - l[0]
print('VC_ptop:', "%11.4E"%VC_ptop)
l = calc.avg_rms_2(t, u[:,col_IL], 0.0, 2*T, 1.0e-4*T)
IL_rms = l[2][0]
print('IL_rms:', "%11.4E"%IL_rms)
IL_avg = l[1][0]
print('IL_avg:', "%11.4E"%IL_avg)
print('x (in percent):', "%5.2F"%(100*IL_ptop/IL_avg))
l = calc.avg_rms_2(t, u[:,col_IS], 0.0, 2*T, 1.0e-4*T)
IS_rms = l[2][0]
print('IS_rms:', "%11.4E"%IS_rms)
l = calc.avg_rms_2(t, u[:,col_ID], 0.0, 2*T, 1.0e-4*T)
ID_rms = l[2][0]
print('ID_rms:', "%11.4E"%ID_rms)
l = calc.avg_rms_2(t, u[:,col_IC], 0.0, 2*T, 1.0e-4*T)
IC_rms = l[2][0]
print('IC_rms:', "%11.4E"%IC_rms)
l = calc.avg_rms_2(t, u[:,col_v_out], 0.0, 2*T, 1.0e-4*T)
Vo_rms = l[2][0]
print('Vo_rms:', "%11.4E"%Vo_rms)
filename: boost_ccm_2.dat IL_ptop: 2.9900E+01 VC_ptop: 2.2630E-01 IL_rms: 1.9918E+02 IL_avg: 1.9900E+02 x (in percent): 15.03 IS_rms: 1.4084E+02 ID_rms: 1.4084E+02 IC_rms: 9.9661E+01 Vo_rms: 1.1948E+02
import numpy as np
import matplotlib.pyplot as plt
from setsize import set_size
Vgmin = 40.0
Vgmax = 100.0
Vg = np.linspace(Vgmin, Vgmax, num=61)
L = 10.0e-6
Vo = 120.0
P = 12000.0
x = 0.1
k = 1.0/(P*x*L)
F = k*Vg*Vg*(1.0-(Vg/Vo))*1e-3 # converted to kHz
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(Vg, F, color=color1, linewidth=1.0)
ax.set_xlim(left=Vgmin, right=Vgmax)
plt.xlabel(r'$V_g$', fontsize=11)
plt.ylabel(r'$F$ (kHz)', 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()
import numpy as np
import matplotlib.pyplot as plt
from setsize import set_size
Vgmin = 40.0
Vgmax = 100.0
Vg = np.linspace(Vgmin, Vgmax, num=61)
F = [150.0e3, 177.7e3, 200.0e3]
label1 = [r'$150\,$kHz', r'$177.7\,$kHz', r'$200\,$kHz']
L = 10.0e-6
Vo = 120.0
P = 12000.0
color1 = ['green', 'crimson', 'goldenrod']
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.set_xlim(left=Vgmin, right=Vgmax)
plt.xlabel(r'$V_g$', fontsize=11)
plt.ylabel(r'$x$', fontsize=11)
for i, f1 in enumerate(F):
k = 1.0/(P*F[i]*L)
x = k*Vg*Vg*(1.0-(Vg/Vo))
ax.plot(Vg, x, color=color1[i], linewidth=1.0, label=label1[i])
plt.axhline(y = 0.1, color = 'blue', linestyle = '--', linewidth=0.8, dashes=(5,5))
plt.axvline(x = 80, color = 'blue', linestyle = '--', linewidth=0.8, dashes=(5,5))
ax.legend(loc = 'lower right',frameon = True, fontsize = 10, title = None,
markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
prop = {'size' : 10},)
plt.tight_layout()
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.