Buck-Boost Converter: CCM

The buck-boost converter given below, operating at $25\,$kHz has input voltage of $40\,$V and has an output voltage of $40\,$V. The output is connected to a resistance of $20\,\Omega$ and $C=100\,\mu$F. The peak-to-peak ripple in inductor current is $2\,$A.
  1. Determine the duty ratio of the converter.
  2. What is the inductance $L$?
  3. Plot the inductor current and capacitor voltage and mark the peaks.
  4. Find the avarage current through the inductor, switch, and diode.
  5. Find the peak-to-peak ripple voltage across $C$.
  6. Find the RMS current through inductor, switch, diode and capacitor.
In [1]:
from IPython.display import Image
Image(filename =r'buck_boost_ccm_1_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 buck_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 buck_boost_ccm_1_orig.in and produces a new circuit file buck_boost_ccm_1.in, after replacing \$L, \$C, \$R, \$D, \$f_hz with the values of our choice.

In [3]:
import gseim_calc as calc
s_Vin = '40'
s_L = '0.6e-3' # to be changed by user
s_C = '100e-6'
s_R = '20'
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("buck_boost_ccm_1_orig.in", "buck_boost_ccm_1.in", l)
print('buck_boost_ccm_1.in is ready for execution')
buck_boost_ccm_1.in is ready for execution
Execute the following cell to run GSEIM on buck_boost_ccm_1.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("buck_boost_ccm_1.in")
os.system('run_gseim buck_boost_ccm_1.in')
get_lib_elements: filename gseim_aux/xbe.aux
get_lib_elements: filename gseim_aux/ebe.aux
Circuit: filename = buck_boost_ccm_1.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=9.0859e-01
Transient simulation starts...
i=0
i=1000
solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=8.8457e-15
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 (buck_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 buck_boost_ccm_1.in) creates a data file buck_boost_ccm_1.dat in the same directory. We can now use the python code below to plot the quantities of interest and also to compute avrage and rms values.

In [5]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

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

l1 = calc.min_max_1(t, u[:,col_IL], 0.0, 2.0*T)
l2 = calc.min_max_1(t, u[:,col_v_out], 0.0, 2.0*T)

print('average output voltage:', "%11.4E"%l_v_out[1][0])
print('average inductor current:', "%11.4E"%l_IL[1][0])
print('average switch current:', "%11.4E"%l_IS[1][0])
print('average diode current:', "%11.4E"%l_ID[1][0])
print('peak-to-peak capacitor voltage:', "%11.4E"%(l2[1]-l2[0]))
print('rms inductor current:', "%11.4E"%l_IL[2][0])
print('rms switch current:', "%11.4E"%l_IS[2][0])
print('rms diode current:', "%11.4E"%l_ID[2][0])
print('rms capacitor current:', "%11.4E"%l_IC[2][0])

N = 10
t1 = np.linspace(0.0, 2.0*T, N)
ILmin = np.array([l1[0]]*N)
ILmax = np.array([l1[1]]*N)

color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'

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

set_size(4, 5, ax[0])

ax[0].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[0].set_xlim(left=0.0, right=2.0*T)
ax[0].set_xlabel('time (' + r'$\mu$' + 'sec)', fontsize=11)
ax[0].plot(t, u[:,col_IL], color=color1, linewidth=1.0, label="$i_L$")
ax[0].plot(t1, ILmin, color=color1, linewidth=1.0, label="$i_L^{min}$", linestyle="--", dashes=(5,3))
ax[0].plot(t1, ILmax, color=color1, linewidth=1.0, label="$i_L^{max}$", linestyle="-.")
ax[0].plot(l_IL[0], l_IL[1], color=color1, linewidth=1.0, label="$i_L^{avg}$", linestyle="dotted")
ax[0].legend(loc = 'lower right',frameon = True, fontsize = 10, title = None,
   markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
   prop = {'size' : 12},)

ax[1].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[1].set_xlim(left=0.0, right=2.0*T)
ax[1].set_xlabel('time (' + r'$\mu$' + 'sec)', fontsize=11)
ax[1].plot(t, u[:,col_v_out], color=color2, linewidth=1.0, label="$V_o$")
ax[1].plot(l_v_out[0], l_v_out[1], color=color2, linewidth=1.0, label="$V_o^{avg}$", linestyle="dotted")
ax[1].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: buck_boost_ccm_1.dat
average output voltage:  1.7130E+01
average inductor current:  1.2245E+00
average switch current:  3.6732E-01
average diode current:  8.5718E-01
peak-to-peak capacitor voltage:  1.0292E-01
rms inductor current:  1.2461E+00
rms switch current:  6.8249E-01
rms diode current:  1.0426E+00
rms capacitor current:  5.9345E-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 [ ]: