Boost Converter: CCM

Two parallel-connected boost converters are feeding a resistive load of $R=10\,\Omega$ as shown below. The switching frequency is $2\,$kHz, and the control signals for switches $S_1$ and $S_2$ are as shown. The input voltage is $V_s=10\,$V, and $L_1=L_2=1\,$mH. The capacitance $C$ is large enough to make $v_o$ constant. Determine
  1. the peak-to-peak current through $L_1$
  2. the rms value of the source current.
In [1]:
from IPython.display import Image
Image(filename =r'boost_ccm_9_fig_1.png', width=700)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat boost_ccm_9_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_9_orig.in and produces a new circuit file boost_ccm_9.in, after replacing \$L, \$C, \$R, \$D, \$f_hz with the values of our choice.

In [3]:
import gseim_calc as calc
s_Vin = '50'
s_L = '1e-3'
s_C = '50e-6'
s_R = '10'
s_D = '0.5'
s_f_hz = '2e3'

f_hz = float(s_f_hz)
T = 1/f_hz
s_t0 = ("%11.4E"%(T/2)).strip()

l = [
  ('$Vin', s_Vin),
  ('$L', s_L),
  ('$C', s_C),
  ('$R', s_R),
  ('$D', s_D),
  ('$f_hz', s_f_hz),
  ('$t0', s_t0),
]
calc.replace_strings_1("boost_ccm_9_orig.in", "boost_ccm_9.in", l)
print('boost_ccm_9.in is ready for execution')
boost_ccm_9.in is ready for execution
Execute the following cell to run GSEIM on boost_ccm_8.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_ccm_9.in")
os.system('run_gseim boost_ccm_9.in')
get_lib_elements: filename gseim_aux/xbe.aux
get_lib_elements: filename gseim_aux/ebe.aux
Circuit: filename = boost_ccm_9.in
main: i_solve = 0
main: calling solve_trns
mat_ssw_1_ex: n_statevar: 4
Transient simulation starts...
i=0
i=1000
solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=1.2296e+01
Transient simulation starts...
i=0
i=1000
solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=2.2691e-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=1
GSEIM: Program completed.
Out[4]:
0

The circuit file (boost_ccm_9.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_ccm_9.in) creates a data file boost_ccm_9.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]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

slv = calc.slv("boost_ccm_9.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_IL1   = slv.get_index(i_slv,i_out,"IL1")
col_IL2   = slv.get_index(i_slv,i_out,"IL2")
col_IS1   = slv.get_index(i_slv,i_out,"IS1")
col_IS2   = slv.get_index(i_slv,i_out,"IS2")
col_ID1   = slv.get_index(i_slv,i_out,"ID1")
col_ID2   = slv.get_index(i_slv,i_out,"ID2")
col_IC    = slv.get_index(i_slv,i_out,"IC")
col_IR    = slv.get_index(i_slv,i_out,"IR")
col_v_out = slv.get_index(i_slv,i_out,"v_out")
col_ISRC  = slv.get_index(i_slv,i_out,"ISRC")
col_g1    = slv.get_index(i_slv,i_out,"g1")
col_g2    = slv.get_index(i_slv,i_out,"g2")

# 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_IL1   = calc.avg_rms_2(t, u[:,col_IL1]  , 0.0, 2.0*T, 1.0e-3*T)
l_IL2   = calc.avg_rms_2(t, u[:,col_IL2]  , 0.0, 2.0*T, 1.0e-3*T)
l_IS1   = calc.avg_rms_2(t, u[:,col_IS1]  , 0.0, 2.0*T, 1.0e-3*T)
l_IS2   = calc.avg_rms_2(t, u[:,col_IS2]  , 0.0, 2.0*T, 1.0e-3*T)
l_ID1   = calc.avg_rms_2(t, u[:,col_ID1]  , 0.0, 2.0*T, 1.0e-3*T)
l_ID2   = calc.avg_rms_2(t, u[:,col_ID2]  , 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_IR    = calc.avg_rms_2(t, u[:,col_IR]   , 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)
l_ISRC  = calc.avg_rms_2(t, u[:,col_ISRC] , 0.0, 2.0*T, 1.0e-3*T)

t_IL1 = np.array(l_IL1[0])
t_IL2 = np.array(l_IL2[0])
t_IS1 = np.array(l_IS1[0])
t_IS2 = np.array(l_IS2[0])
t_ID1 = np.array(l_ID1[0])
t_ID2 = np.array(l_ID2[0])
t_IC = np.array(l_IC[0])
t_IR = np.array(l_IR[0])
t_v_out = np.array(l_v_out[0])
t_ISRC = np.array(l_ISRC[0])

print('average output voltage:',"%11.4E"%l_v_out[1][0])
print('average S1 current:'   , "%11.4E"%l_IS1[1][0])
print('average S2 current:'   , "%11.4E"%l_IS2[1][0])
print('average D1 current:'   , "%11.4E"%l_ID1[1][0])
print('average D2 current:'   , "%11.4E"%l_ID2[1][0])
print('average L1 current:'   , "%11.4E"%l_IL1[1][0])
print('average L2 current:'   , "%11.4E"%l_IL2[1][0])
print('rms L1 current:'       , "%11.4E"%l_IL1[2][0])
print('rms L2 current:'       , "%11.4E"%l_IL2[2][0])
print('average load current:' , "%11.4E"%l_IR[1][0])
print('rms capacitor current:', "%11.4E"%l_IC[2][0])
print('rms source current:'   , "%11.4E"%l_ISRC[2][0])

l1 = calc.min_max_1(t, u[:,col_IL1], 0.0, 2.0*T)
IL1_ptop = l1[1] - l1[0]
print('IL1_ptop:', "%11.4E"%IL1_ptop)
l2 = calc.min_max_1(t, u[:,col_IL2], 0.0, 2.0*T)
IL2_ptop = l2[1] - l2[0]
print('IL2_ptop:', "%11.4E"%IL2_ptop)

fig, ax = plt.subplots(7, sharex=False)
plt.subplots_adjust(wspace=0, hspace=0.0)

set_size(6.5, 10, ax[0])

for i in range(7):
    ax[i].set_xlim(left=0.0, right=2.0*T*1e6)
    ax[i].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)

for i in range(6):
    ax[i].tick_params(labelbottom=False)

ax[0].set_ylabel(r'g_1'      , fontsize=12)
ax[1].set_ylabel(r'$i_L$'    , fontsize=12)
ax[2].set_ylabel(r'$i_C$'    , fontsize=12)
ax[3].set_ylabel(r'$i_D$'    , fontsize=12)
ax[4].set_ylabel(r'$i_S$'    , fontsize=12)
ax[5].set_ylabel(r'$i_{SRC}$', fontsize=12)
ax[6].set_ylabel(r'$v_o$'    , fontsize=12)

ax[0].set_ylim(bottom=-0.2, top=1.2)
ax[0].set_yticks([0.0, 1.0])

color1 = "blue"
color2 = "tomato"
color3 = "dodgerblue"
color4 = "olive"
color5 = "green"
color6 = "red"
color7 = "darkcyan"

ax[0].plot(t*1e6, u[:,col_g1], color=color1, linewidth=1.0, label="$g_1$")

ax[1].plot(t*1e6, u[:,col_IL1], color=color5, linewidth=1.0, label="$i_{L1}$")
ax[1].plot(t*1e6, u[:,col_IL2], color=color5, linewidth=1.0, label="$i_{L2}$", linestyle='--', dashes=(5,3))

ax[2].plot(t*1e6, u[:,col_IC], color=color3, linewidth=1.0, label="$i_C$")
ax[2].plot(t_IC*1e6, l_IC[1] , color=color3, linewidth=1.0, label="$i_C^{avg}$", linestyle='--', dashes=(5,3))

ax[3].plot(t*1e6, u[:,col_ID1], color=color4, linewidth=1.0, label="$i_{D1}$")
ax[3].plot(t*1e6, u[:,col_ID2], color=color5, linewidth=1.0, label="$i_{D2}$", linestyle='--', dashes=(5,3))

ax[4].plot(t*1e6, u[:,col_IS1], color=color2, linewidth=1.0, label="$i_{S1}$")
ax[4].plot(t*1e6, u[:,col_IS2], color=color2, linewidth=1.0, label="$i_{S2}$", linestyle='--', dashes=(5,3))

ax[5].plot(t*1e6, u[:,col_ISRC], color=color6, linewidth=1.0, label="$i_SRC$")
ax[5].plot(t_ISRC*1e6, l_ISRC[2] , color=color6, linewidth=1.0, label="$i_SRC^{rms}$", linestyle='--', dashes=(5,3))

ax[6].plot(t*1e6, u[:,col_v_out]  , color=color7, linewidth=1.0, label="$v_o$")
ax[6].plot(t_v_out*1e6, l_v_out[1], color=color7, linewidth=1.0, label="$v_o^{avg}$", linestyle='--', dashes=(5,3))

ax[6].set_xlabel('time ($\mu$sec)', fontsize=12)

for i in range(1,7):
    ax[i].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_9.dat
average output voltage:  9.9997E+01
average S1 current:  5.0190E+00
average S2 current:  5.0201E+00
average D1 current:  5.0117E+00
average D2 current:  5.0128E+00
average L1 current:  1.0031E+01
average L2 current:  1.0033E+01
rms L1 current:  1.0673E+01
rms L2 current:  1.0675E+01
average load current:  9.9997E+00
rms capacitor current:  3.6778E+00
rms source current:  2.0064E+01
IL1_ptop:  1.2500E+01
IL2_ptop:  1.2500E+01
No description has been provided for this image

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

In [ ]: