Boost Converter: CCM
The boost converter given below is switched at $40\,$kHz and at a duty ratio of 0.3 with a load resistance of $1\,\Omega$. The input voltage to the boost converter is $15\,$V. The inductor is $10\,\mu$H with an ESR of $100\,$m$\Omega$ and the output capacitator is $1000\,\mu$F. The on-state resistance of the switch S is $25\,$m$\Omega$, and the on-state drop across the diode is $0.8\,$V.Evaluate the following quantities:
- output voltage
- average input current
- output power
- efficiency
- average power dissipated in the switch, diode, and inductor
from IPython.display import Image
Image(filename =r'boost_ccm_3_fig_1.png', width=320)
# run this cell to view the circuit file.
%pycat boost_ccm_3_orig.in
We now replace the strings such as \$Vin, \$L, with the values of our choice by running the python script given below. It takes an existing circuit file boost_ccm_3_orig.in and produces a new circuit file boost_ccm_3.in, after replacing \$Vin, \$L, etc. with values of our choice.
import gseim_calc as calc
s_Vin = '15'
s_L = '10u'
s_ESR = '100m'
s_R_sw = '25m'
s_V_D = '0.8'
s_R_load = '1'
s_f_hz = '40k'
s_D = '0.3'
l = [
('$Vin', s_Vin),
('$L', s_L),
('$ESR', s_ESR),
('$R_load', s_R_load),
('$V_D', s_V_D),
('$R_sw', s_R_sw),
('$f_hz', s_f_hz),
('$D', s_D)
]
calc.replace_strings_1("boost_ccm_3_orig.in", "boost_ccm_3.in", l)
print('boost_ccm_3.in is ready for execution')
boost_ccm_3.in is ready for execution
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_ccm_3.in")
os.system('run_gseim boost_ccm_3.in')
get_lib_elements: filename gseim_aux/xbe.aux get_lib_elements: filename gseim_aux/ebe.aux Circuit: filename = boost_ccm_3.in main: i_solve = 0 main: calling solve_trns mat_ssw_1_ex: n_statevar: 3 Transient simulation starts... i=0 i=1000 i=2000 solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=3.1513e+01 Transient simulation starts... i=0 i=1000 i=2000 solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=2.9947e-13 Transient simulation starts... i=0 i=1000 i=2000 solve_ssw_ex: ssw_iter_newton=2, rhs_ssw_norm=1.8460e-14 Transient simulation starts... i=0 i=1000 i=2000 solve_ssw_ex: ssw_iter_newton=3, rhs_ssw_norm=2.6665e-14 Transient simulation starts... i=0 i=1000 i=2000 solve_ssw_ex: ssw_iter_newton=4, rhs_ssw_norm=6.1535e-15 solve_ssw_ex: calling solve_ssw_1_ex for one more trns step Transient simulation starts... i=0 i=1000 i=2000 solve_ssw_1_ex over (after trns step for output) solve_ssw_ex ends, slv.ssw_iter_newton=4 GSEIM: Program completed.
0
The circuit file (boost_ccm_3.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_ccm_3.in) creates two data files boost_ccm_3.dat and boost_ccm_3_1.dat in the same directory. We can now use the python code below to plot the various quantities of interest.
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
slv = calc.slv("boost_ccm_3.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
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)
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_3.dat average output voltage: 1.6882E+01 average input current: 2.4171E+01
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
slv = calc.slv("boost_ccm_3.in")
i_slv = 0
i_out = 1
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_P_VS = slv.get_index(i_slv,i_out,"P_VS")
col_P_ESR = slv.get_index(i_slv,i_out,"P_ESR")
col_P_S = slv.get_index(i_slv,i_out,"P_S")
col_P_D = slv.get_index(i_slv,i_out,"P_D")
col_P_R = slv.get_index(i_slv,i_out,"P_R")
# 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_P_VS = calc.avg_rms_2(t, u[:,col_P_VS], 0.0, 2.0*T, 1.0e-3*T)
l_P_ESR = calc.avg_rms_2(t, u[:,col_P_ESR], 0.0, 2.0*T, 1.0e-3*T)
l_P_S = calc.avg_rms_2(t, u[:,col_P_S], 0.0, 2.0*T, 1.0e-3*T)
l_P_D = calc.avg_rms_2(t, u[:,col_P_D], 0.0, 2.0*T, 1.0e-3*T)
l_P_R = calc.avg_rms_2(t, u[:,col_P_R], 0.0, 2.0*T, 1.0e-3*T)
print('average power (VS):', "%11.4E"%l_P_VS[1][0])
print('average power (ESR):', "%11.4E"%l_P_ESR[1][0])
print('average power (switch):', "%11.4E"%l_P_S[1][0])
print('average power (diode):', "%11.4E"%l_P_D[1][0])
print('average power (load):', "%11.4E"%l_P_R[1][0])
print('efficiency:', "%11.4E"%(l_P_R[1][0]/l_P_VS[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)
ax.plot(t, u[:,col_P_R], color=color1, linewidth=1.0, label="$P_{R}$")
ax.plot(l_P_R[0], l_P_R[1], color=color1, linewidth=1.0, label="$P_{R}^{avg}$", linestyle='--', dashes=(5,3))
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_3_1.dat average power (VS): 3.6256E+02 average power (ESR): 5.9092E+01 average power (switch): 4.4809E+00 average power (diode): 1.3916E+01 average power (load): 2.8501E+02 efficiency: 7.8610E-01
import numpy as np
import matplotlib.pyplot as plt
from setsize import set_size
Dmin = 0.001
Dmax = 0.999
D = np.linspace(Dmin, Dmax, num=100)
VD = 0.8
Vin = 15
L_ESR = 100.0e-3
R_sw = 25.0e-3
R_load = 1.0
M = (1.0/(1.0-D))*(1.0 - (1.0 - D)*VD/Vin)/(1.0 + ((L_ESR + D*R_sw)/((1.0-D)*(1.0-D)*R_load)))
M_ideal = 1.0/(1.0-D)
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(D, M, color=color1, linewidth=1.0, label=r'$M$')
ax.plot(D, M_ideal, color=color4, linewidth=1.0, linestyle = '--', dashes=(4,3), label=r'$M_{ideal}$')
ax.set_xlim(left=0.0, right=1.0)
ax.set_ylim(bottom=0.0, top=5.0)
plt.xlabel(r'$D$', fontsize=11)
plt.ylabel(r'$M$', fontsize=11)
ax.legend(loc = 'upper left',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()
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.