Boost Converter: DCM

A boost converter is designed for nominal $12\,$V input and $48\,$V output. It switches at $10\,$kHz. In reality, the input can be anywhere between $6\,$V and $30\,$V. The load power ranges between $10\,$W and $200\,$W. Determine the maximum inductance $L$ that will ensure discontinuous current conduction mode under all allowed conditions.
In [1]:
from IPython.display import Image
Image(filename =r'boost_dcm_2_fig_1.png', width=320)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat boost_dcm_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_dcm_2_orig.in and produces a new circuit file boost_dcm_2.in, after replacing \$L, \$C, \$R, \$D, \$f_hz with the values of our choice.

In [3]:
import numpy as np
import sys
import gseim_calc as calc

# sample values:
f_hz = 10e3
Vin = 12.0
Vout = 48.0
Pout = 50.0
L = 2e-6 # to be changed by user
C = 2200e-6
T = 1/f_hz
R = Vout*Vout/Pout
print('R:', "%11.4E"%R)
k1 = (2.0*Vout/Vin)-1.0
k2 = (2.0*L/(R*T))
D = np.sqrt(k2*(k1*k1 - 1))/2
print('D:', "%11.4E"%D)
if (D < 0.05):
    print('D is too small. Halting...')
    sys.exit()
elif (D > 0.95):
    print('D is too large. Halting...')
    sys.exit()

s_Vin = ("%11.4E"%Vin).strip()
s_D = ("%11.4E"%D).strip()
s_R = ("%11.4E"%R).strip()
s_L = ("%11.4E"%L).strip()
s_C = ("%11.4E"%C).strip()
s_f_hz = ("%11.4E"%f_hz).strip()

print('L:', "%11.4E"%L)
print('C:', "%11.4E"%C)
print('f_hz:', "%11.4E"%f_hz)
print('Vin:', "%11.4E"%Vin)

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_2_orig.in", "boost_dcm_2.in", l)
print('boost_dcm_2.in is ready for execution')
R:  4.6080E+01
D:  1.0206E-01
L:  2.0000E-06
C:  2.2000E-03
f_hz:  1.0000E+04
Vin:  1.2000E+01
boost_dcm_2.in is ready for execution
Execute the following cell to run GSEIM on boost_dcm_2.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_dcm_2.in")
os.system('run_gseim boost_dcm_2.in')
get_lib_elements: filename gseim_aux/xbe.aux
get_lib_elements: filename gseim_aux/ebe.aux
Circuit: filename = boost_dcm_2.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
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=6.8227e+01
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=3.3054e+01
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=2, rhs_ssw_norm=3.5674e-04
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=3, rhs_ssw_norm=1.3397e-04
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=4, rhs_ssw_norm=2.8276e-05
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=5, rhs_ssw_norm=1.6211e-06
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_ex: ssw_iter_newton=6, rhs_ssw_norm=5.0990e-16
solve_ssw_ex: calling solve_ssw_1_ex for one more trns step
Transient simulation starts...
i=0
i=1000
i=2000
i=3000
i=4000
solve_ssw_1_ex over (after trns step for output)
solve_ssw_ex ends, slv.ssw_iter_newton=6
GSEIM: Program completed.
Out[4]:
0

The circuit file (boost_dcm_2.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_dcm_2.in) creates a data file boost_dcm_2.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_dcm_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.set_xlim(left=t[0], right=t[-1])

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_dcm_2.dat
No description has been provided for this image
In [6]:
import numpy as np
import matplotlib.pyplot as plt 

from setsize import set_size

slv = calc.slv("boost_dcm_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.set_xlim(left=t[0], right=t[-1])

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_2.dat
No description has been provided for this image

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.

In [7]:
import gseim_calc as calc
import numpy as np

slv = calc.slv("boost_dcm_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

l_IL = calc.avg_rms_2(t, u[:,col_IL], 0.0, 2*T, 1.0e-4*T)
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)

l_IS = calc.avg_rms_2(t, u[:,col_IS], 0.0, 2*T, 1.0e-4*T)
IS_rms = l_IS[2][0]
print('IS_rms:', "%11.4E"%IS_rms)

l_ID = calc.avg_rms_2(t, u[:,col_ID], 0.0, 2*T, 1.0e-4*T)
ID_rms = l_ID[2][0]
print('ID_rms:', "%11.4E"%ID_rms)

l_IC = calc.avg_rms_2(t, u[:,col_IC], 0.0, 2*T, 1.0e-4*T)
IC_rms = l_IC[2][0]
print('IC_rms:', "%11.4E"%IC_rms)

l_v_out = calc.avg_rms_2(t, u[:,col_v_out], 0.0, 2*T, 1.0e-4*T)
Vo_rms = l_v_out[2][0]
print('Vo_rms:', "%11.4E"%Vo_rms)
filename: boost_dcm_2.dat
IL_rms:  1.3024E+01
IL_avg:  4.1654E+00
IS_rms:  1.1277E+01
ID_rms:  6.5157E+00
IC_rms:  6.4315E+00
Vo_rms:  4.7562E+01
In [8]:
import numpy as np
import matplotlib.pyplot as plt 
from setsize import set_size

Vgmin = 6.0
Vgmax = 30.0
Vg = np.linspace(Vgmin, Vgmax, num=100)
l_P = [10.0, 200.0]
label1 = [r'$10\,$W', r'$200\,$W']
f_hz = 10e3
T = 1/f_hz
Vo = 48.0

color1 = ['green', 'crimson']

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'$F$', fontsize=11)

for i, P in enumerate(l_P):
    k = T/(2.0*P*Vo)
    x = k*Vg*Vg*(1.0-(Vg/Vo))
    ax.plot(Vg, x, color=color1[i], linewidth=1.0, label=label1[i])

ax.legend(loc = 'upper left',frameon = True, fontsize = 10, title = None,
   markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
   prop = {'size' : 10},)

plt.tight_layout()
plt.show()
No description has been provided for this image
In [9]:
import numpy as np
import matplotlib.pyplot as plt 
from setsize import set_size

Vgmin = 6.0
Vgmax = 30.0
Vg_arr = np.linspace(Vgmin, Vgmax, num=200)
l_Vg = Vg_arr.tolist()
P = 200.0
l_L = [10.0e-6, 7.875e-6]
label1 = [r'$10\,\mu$H', r'$7.875\,\mu$H']
f_hz = 10e3
T = 1/f_hz
Vo = 48.0
R = Vo*Vo/P

color1 = ['green', 'crimson']

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_L, L in enumerate(l_L):
    k = 2.0*L/(R*T)
    l_x = []
    for Vg in l_Vg:
        D = 1.0 - Vg/Vo
        k0 = D*(1.0-D)*(1.0-D)
        if k >= k0:
            y = Vg*Vg*(1.0-Vg/Vo)*T/(L*P)
        else:
            y = Vg*T*np.sqrt(Vo*(Vo-Vg)*k)/(L*P)
        l_x.append(y)
    ax.plot(l_Vg, l_x, color=color1[i_L], linewidth=1.0, label=label1[i_L])

plt.axhline(y = 2.0, color = 'blue', linestyle = '--', linewidth=0.8, dashes=(5,5))
ax.legend(loc = 'upper left',frameon = True, fontsize = 10, title = None,
   markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
   prop = {'size' : 10},)

plt.tight_layout()
plt.show()
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 [ ]: