SEPIC Converter: CCM

The SEPIC converter given below has an input voltage of $V_i = 20\,V$. The average output voltage is $V_o = 10\,V$, and the load resistance is $20\,\Omega$. The switching frequency is $10\,$kHz. If $L_1 = 1\,$mH, $L_2 = 1$mH, $C_1 = 100\mu$F, and $C_2 = 200\,\mu$F, evaluate the following quantities:
  1. duty ratio
  2. peak-to-peak ripple voltage across the capacitor $C_2$
  3. peak-to-peak ripple in the inductor currents $L_1$ and $L_2$
  4. rms current through switch, diode, inductor, and capacitor
In [1]:
from IPython.display import Image
Image(filename =r'SEPIC_ccm_1_fig_1.png', width=400)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat SEPIC_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 SEPIC_ccm_1_orig.in and produces a new circuit file SEPIC_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 = '20'
s_L1 = '1m'
s_L2 = '1m'
s_C1 = '100u'
s_C2 = '200u'
s_R = '20'
s_D = '0.5'      # to be changed by user
s_f_hz = '10e3'
s_ncycles = '3'  # no. of output cycles
l = [
  ('$Vin', s_Vin),
  ('$L1', s_L1),
  ('$L2', s_L2),
  ('$C1', s_C1),
  ('$C2', s_C2),
  ('$R', s_R),
  ('$D', s_D),
  ('$f_hz', s_f_hz),
  ('$ncycles', s_ncycles)
]
calc.replace_strings_1("SEPIC_ccm_1_orig.in", "SEPIC_ccm_1.in", l)
print('SEPIC_ccm_1.in is ready for execution')
SEPIC_ccm_1.in is ready for execution
Execute the following cell to run GSEIM on SEPIC_ccm_1.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("SEPIC_ccm_1.in")
os.system('run_gseim SEPIC_ccm_1.in')
Circuit: filename = SEPIC_ccm_1.in
main: calling solve_sss
solve_sss starting: sss_n_st: 4
solve_sss_ex: sss_iter_newton=0, rhs_sss_norm=1.9284e+00, sss_period_1_compute=2.0000e-04
solve_sss_ex: sss_iter_newton=1, rhs_sss_norm=8.8265e-13, sss_period_1_compute=2.0000e-04
solve_sss_ex: calling sss_solve_trns_ex for one more trns step
Transient simulation starts...
i=0
GSEIM: Program completed.
Out[4]:
0

The circuit file (SEPIC_ccm_1.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on SEPIC_ccm_1.in) creates a data file SEPIC_ccm_1.dat in the same directory. We can now use the python code below to view the inductor current as a function of time.

On the output files produced by GSEIM (in this case, SEPIC_ccm_1a.dat and SEPIC_ccm_1b.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 [5]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

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

v_out = slv.get_array_double(i_slv,i_out,"v_out",u)

# Divide the last time point by "s_ncycles" to get the period:

T_tot = t[-1]
T     = t[-1]/float(s_ncycles)

l_v_out = calc.avg_rms_3a(t, v_out, 0.0, T_tot, 1.0e-3*T)

print('average output voltage:', "%11.4E"%l_v_out[0])

color1='green'

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, v_out, color=color1, linewidth=1.0, label="$V_{out}$")
ax.axhline(y=l_v_out[0], color=color1, linewidth=1.0, label="$V_{out}^{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: SEPIC_ccm_1b.dat
average output voltage:  1.9972E+01
No description has been provided for this image
In [6]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

slv = calc.slv("SEPIC_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)
t = u[:, 0]
t_micro = t*1e6

IL1 = slv.get_array_double(i_slv,i_out,"IL1",u)
IL2 = slv.get_array_double(i_slv,i_out,"IL2",u)
IC1 = slv.get_array_double(i_slv,i_out,"IC1",u)
IC2 = slv.get_array_double(i_slv,i_out,"IC2",u)
ID  = slv.get_array_double(i_slv,i_out,"ID" ,u)
IS  = slv.get_array_double(i_slv,i_out,"IS" ,u)

T_ttl = t[-1]
T = T_ttl/float(s_ncycles)

l_IL1 = calc.avg_rms_3a(t, IL1, 0.0, T_ttl, 1.0e-3*T)
l_IL2 = calc.avg_rms_3a(t, IL2, 0.0, T_ttl, 1.0e-3*T)
l_IC1 = calc.avg_rms_3a(t, IC1, 0.0, T_ttl, 1.0e-3*T)
l_IC2 = calc.avg_rms_3a(t, IC2, 0.0, T_ttl, 1.0e-3*T)
l_ID  = calc.avg_rms_3a(t, ID , 0.0, T_ttl, 1.0e-3*T)
l_IS  = calc.avg_rms_3a(t, IS , 0.0, T_ttl, 1.0e-3*T)

print('average IL1:', "%11.4E"%l_IL1[0])
print('average IL2:', "%11.4E"%l_IL2[0])
print('average IC1:', "%11.4E"%l_IC1[0])
print('average IC2:', "%11.4E"%l_IC2[0])
print('average ID:' , "%11.4E"%l_ID[0])
print('average IS:' , "%11.4E"%l_IS[0])

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

set_size(6.5, 10, ax[0])

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

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

ax[0].set_ylabel(r'$I_{L1}$', fontsize=12)
ax[1].set_ylabel(r'$I_{L2}$', fontsize=12)
ax[2].set_ylabel(r'$I_{C1}$', fontsize=12)
ax[3].set_ylabel(r'$I_{C2}$', fontsize=12)
ax[4].set_ylabel(r'$I_D$',    fontsize=12)
ax[5].set_ylabel(r'$I_S$',    fontsize=12)

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

ax[0].plot(t_micro, IL1 , color=color1, linewidth=1.0, label="$I_{L1}$")
ax[0].axhline(y=l_IL1[0], color=color1, linewidth=1.0, label="$I_{L1}^{avg}$", linestyle='--', dashes=(5,3))

ax[1].plot(t_micro, IL2 , color=color2, linewidth=1.0, label="$I_{L2}$")
ax[1].axhline(y=l_IL2[0], color=color2, linewidth=1.0, label="$I_{L2}^{avg}$", linestyle='--', dashes=(5,3))

ax[2].plot(t_micro, IC1 , color=color3, linewidth=1.0, label="$I_{C1}$")
ax[2].axhline(y=l_IC1[0], color=color3, linewidth=1.0, label="$I_{C1}^{avg}$", linestyle='--', dashes=(5,3))

ax[3].plot(t_micro, IC2 , color=color4, linewidth=1.0, label="$I_{C2}$")
ax[3].axhline(y=l_IC2[0], color=color4, linewidth=1.0, label="$I_{C2}^{avg}$", linestyle='--', dashes=(5,3))

ax[4].plot(t_micro, ID  , color=color5, linewidth=1.0, label="$I_D$")
ax[4].axhline(y=l_ID[0] , color=color5, linewidth=1.0, label="$I_D^{avg}$", linestyle='--', dashes=(5,3))

ax[5].plot(t_micro, IS  , color=color6, linewidth=1.0, label="$I_S$")
ax[5].axhline(y=l_IS[0] , color=color6, linewidth=1.0, label="$I_S^{avg}$", linestyle='--', dashes=(5,3))

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

for i in range(1,6):
    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: SEPIC_ccm_1a.dat
average IL1:  1.0076E+00
average IL2: -9.9861E-01
average IC1:  4.7789E-03
average IC2:  4.7792E-03
average ID:  1.0034E+00
average IS:  1.0028E+00
No description has been provided for this image

This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur (nakul@gectcr.ac.in) and Prof. S. Sethupathy, IIT (ISM) Dhanbad (sethupathy@iitism.ac.in).

In [ ]: