Boost Converter: CCM Small-Signal Model

A boost converter is operated with the following parameters: $V_g = 15\,$V, $D = 0.3$, $L = 2\,$mH, $C = 100\mu$F, $R = 10\,\Omega$, and switching frequency of $40\,$kHz. The control ($D$) to output ($V_o$) transfer function of the boost converter is given by, $$ G_{vd}\,(s) = G_{d0}\,\frac{1-\displaystyle\frac{s}{\omega_z}}{1+\displaystyle\frac{s}{Q\,\omega_0}+ \left ( \displaystyle\frac{s}{\omega_0} \right )^2} $$

Determine the following.

  1. $G_{d0}$
  2. $\omega _z$
  3. $\omega _0$
  4. $Q$
Verify the small signal model by applying a step change in duty cycle (change duty cycle from 0.3 to 0.31) and plot the response from transfer function and from simulation on the same graph.
In [1]:
from IPython.display import Image
Image(filename =r'boost_ccm_4_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_ccm_4_orig.in

We now replace the strings such as \$D1, \$D2, with the values of our choice by running the python script given below. It takes an existing circuit file boost_ccm_4_orig.in and produces a new circuit file boost_ccm_4.in, after replacing \$D1, \$D2, etc. with values of our choice. Note the use of the set_rparm statement in the solve block to equate the parameter D of the element named clock1 by the value of the variable y of the element named pwl. pwl generates a step change which is coupled to D of clock1 by the set_rparm statement.

In [3]:
import gseim_calc as calc
s_D1 = '0.3'
s_D2 = '0.31'
s_t1 = '25e-3'
s_t2 = '25.001e-3'

l = [
  ('$D1', s_D1),
  ('$D2', s_D2),
  ('$t1', s_t1),
  ('$t2', s_t2)
]
calc.replace_strings_1("boost_ccm_4_orig.in", "boost_ccm_4.in", l)
print('boost_ccm_4.in is ready for execution')
boost_ccm_4.in is ready for execution
Execute the following cell to run GSEIM on boost_ccm_4.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("boost_ccm_4.in")
os.system('run_gseim boost_ccm_4.in')
Circuit: filename = boost_ccm_4.in
main: calling solve_trns
Transient simulation starts...
i=0
i=10000
i=20000
i=30000
i=40000
i=50000
i=60000
i=70000
i=80000
GSEIM: Program completed.
Out[4]:
0

The circuit file (boost_ccm_4.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on boost_ccm_4.in) creates a data file boost_ccm_4.dat in the same directory. We can now use the python code below to plot the output voltage versus time to ensure that the circuit is in a steady state before the step in $D$. If it is not, it would not make sense to compare the simulation results with the results (to be obtained in a later cell) of the boost converter small-signal model.

In [5]:
import gseim_calc as calc

calc.plot_single_curve(
   infile='boost_ccm_4.in',
   i_slv=0,
   i_out=0,
   var_name="v_out",
   color="green",
   linewidth=1.0,
   x_size=4.0,
   y_size=2.5,
   x_label='time (msec)',
   y_label=r'$V_o$',
   label_font_size=11,
   t_start=0.0,
   t_end=40.0e-3,
   t_offset=0.0,
   t_mult=1e3)
filename: boost_ccm_4.dat
No description has been provided for this image
In [6]:
import control as ct
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size

# get values of Vin, D, etc from the circuit file:
fin = open("boost_ccm_4.in", "r")
for line in fin:
    if 'name=VS' in line:
        for s in line.split():
            if s.startswith('vdc='):
                Vin = float(s.split('=')[1])
                print('Vin:', Vin)
    elif 'name=clock1' in line:
        for s in line.split():
            if s.startswith('f_hz='):
                f_hz = float(s.split('=')[1])
                print('f_hz:', f_hz)
    elif 'name=pwl' in line:
        for s in line.split():
            if s.startswith('v1='):
                D1 = float(s.split('=')[1])
                print('D1:', D1)
            if s.startswith('v2='):
                D2 = float(s.split('=')[1])
                print('D2:', D2)
            if s.startswith('t1='):
                # t_step: time when D changes from D1 to D2
                t_step = float(s.split('=')[1])
                print('t_step:', t_step)
    elif 'name=L' in line:
        for s in line.split():
            if s.startswith('l='):
                L = float(s.split('=')[1])
                print('L:', L)
    elif 'name=C' in line:
        for s in line.split():
            if s.startswith('c='):
                C = float(s.split('=')[1])
                print('C:', C)
    elif 'name=R' in line:
        for s in line.split():
            if s.startswith('r='):
                R = float(s.split('=')[1])
                print('R:', R)
    elif 't_end=' in line:
        for s in line.split():
            if s.startswith('t_end='):
                t_end = float(s.split('=')[1])
                print('t_end:', t_end)

fin.close()

T = 1.0/f_hz

# Compute transfer function parameters:
Gd0 = Vin/((1.0-D1)*(1.0-D1))
w_z = (1.0-D1)*(1.0-D1)*R/L
w_0 = (1.0-D1)/np.sqrt(L*C)
Q = (1.0-D1)*R*np.sqrt(C/L)

print('Gd0:', "%11.4E"%Gd0)
print('w_z:', "%11.4E"%w_z)
print('w_0:', "%11.4E"%w_0)
print('Q:', "%11.4E"%Q)

# construct transfer function of the boost converter small-signal model:
num = np.array([(-Gd0/w_z), Gd0])
den = np.array([(1.0/(w_0*w_0)),(1.0/(Q*w_0)),1.0])
H1 = ct.tf(num, den)

# Compute step response, treating t_step as t=0.
t_end_1 = t_end - t_step
t_vec = np.linspace(0,t_end_1,200)

# xf stands for transfer function
t_xf, y_xf1 = ct.step_response(H1,t_vec)
# scale y_xf1, taking into account initial and final values of Vout
y0   = (Vin/(1.0-D1))
y_xf = y0 + y_xf1*(D2-D1)

# since (t_xf, y_xf1) is the response for a step at t=0, we use the
# following to offset time and make it correspond to the circuit
# simulation results.

l_t_xf_plot = []
l_y_xf_plot = []

ndiv = 20
delt = t_step/ndiv

for i in range(ndiv):
    t0 = -t_step + delt*float(i)/float(ndiv)
    l_t_xf_plot.append(t0)
    l_y_xf_plot.append(y0)

for i in range(len(t_xf)):
    a0 = t_xf[i]
    b0 = y_xf[i]
    l_t_xf_plot.append(a0)
    l_y_xf_plot.append(b0)

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

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

set_size(6, 6, ax[0])

# plot Vout obtained by simulation:

slv = calc.slv("boost_ccm_4.in")

i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u = np.loadtxt(filename)
t_sim = u[:, 0]
t_scale = 1e3

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

l1 = calc.avg_rms_1(t_sim, v_out, T)

t_min = 24e-3
t_max = 35e-3

y_min = 1e10
y_max = -1e10

for i, v0 in enumerate(v_out):
    if (t_sim[i] > t_min) and (t_sim[i] < t_max):
        if y_min > v0:
            y_min = v0
        if y_max < v0:
            y_max = v0

y_top = y_max + 0.1*(y_max-y_min)
y_bot = y_min - 0.1*(y_max-y_min)

ax[0].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[0].set_xlim(left=t_scale*t_min, right=t_scale*t_max)
ax[0].set_ylim(top=y_top, bottom=y_bot)
ax[0].set_xlabel('time (msec)', fontsize=11)

# plot circuit simulation result:
ax[0].plot(t_scale*t_sim, v_out, color=color3, linewidth=1.0, label="$V_{out}^{sim}$")

# plot transfer function result:
ax[0].plot(t_scale*(np.array(l_t_xf_plot) + t_step), np.array(l_y_xf_plot), color=color1,
  linewidth=1.0, label="$V_{out}^{XF}$")

# plot average value of Vout as obtained by simulation:
ax[0].plot(t_scale*(np.array(l1[0])), np.array(l1[1]), color=color2,
  linewidth=1.0, linestyle='--', dashes=(5,3), label="$V_{out}^{avg}$")

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},)

# plot on an expanded scale:

t_min = 24.5e-3
t_max = 30e-3

y_min = 1e10
y_max = -1e10

for i, v0 in enumerate(v_out):
    if (t_sim[i] > t_min) and (t_sim[i] < t_max):
        if y_min > v0:
            y_min = v0
        if y_max < v0:
            y_max = v0

y_top = y_max + 0.1*(y_max-y_min)
y_bot = y_min - 0.1*(y_max-y_min)

ax[1].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[1].set_xlim(left=t_scale*t_min, right=t_scale*t_max)
ax[1].set_ylim(top=y_top, bottom=y_bot)
ax[1].set_xlabel('time (msec)', fontsize=11)

# plot circuit simulation result:
ax[1].plot(t_scale*t_sim, v_out, color=color3, linewidth=1.0, label="$V_{out}^{sim}$")

# plot transfer function result:
ax[1].plot(t_scale*(np.array(l_t_xf_plot) + t_step), np.array(l_y_xf_plot), color=color1,
  linewidth=1.0, label="$V_{out}^{XF}$")

# plot average value of Vout as obtained by simulation:
ax[1].plot(t_scale*(np.array(l1[0])), np.array(l1[1]), color=color2,
  linewidth=1.0, linestyle='--', dashes=(5,3), label="$V_{out}^{avg}$")

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()
Vin: 15.0
L: 0.002
C: 0.0001
R: 10.0
f_hz: 40000.0
t_step: 0.025
D1: 0.3
D2: 0.31
t_end: 0.04
Gd0:  3.0612E+01
w_z:  2.4500E+03
w_0:  1.5652E+03
Q:  1.5652E+00
filename: boost_ccm_4.dat
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 [ ]: