Push-pull converter

For the push-pull converter shown in the figure, the input voltage is $80\,$V. The output is connected to a $2\,\Omega$ resistance. The turns ratio of the transformer is $N_p:N_s = 2:1$. The gate signals $g_1$ and $g_2$ are shown in the figure. The magnetizing inductance as seen from the secondary is $5\,$mH. The output capacitance is $20\,\mu$F, and the filter inductance is $500\,\mu$H.
  1. What is the output voltage?
  2. What are the peak stress voltages on switches $S_1$, $S_2$ and their rms currents?
  3. What are the peak stress voltages on diodes $D_1$, $D_2$ and their average currents?
  4. Plot the currents $i_{L1}$ and $i_1$, and determine their ripple frequencies.
In [1]:
from IPython.display import Image
Image(filename =r'push_pull_2_fig_1.png', width=800)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat push_pull_2_orig.in

We now replace the strings such as \$Vdc, \$L, with the values of our choice by running the python script given below. It takes an existing circuit file push_pull_2_orig.in and produces a new circuit file push_pull_2.in, after replacing \$Vdc, \$L, etc. with values of our choice.

In [3]:
import gseim_calc as calc

s_Vdc = "80"
s_L = "500e-6"
s_R = "2"
s_C = "20e-6"
s_Np = "2"
s_Ns = "1"

f_hz = 50.0e3
T = 1/f_hz
s_Tend = "2e-3"
Tend = float(s_Tend)
T1 = Tend - 2.0*T
s_T1 = ("%11.4E"%(T1)).strip()

l = [
  ('$Vdc', s_Vdc),
  ('$L', s_L),
  ('$R', s_R),
  ('$C', s_C),
  ('$Np', s_Np),
  ('$Ns', s_Ns),
  ('$Tend', s_Tend),
  ('$T1', s_T1),
]
calc.replace_strings_1("push_pull_2_orig.in", "push_pull_2.in", l)
print('push_pull_2.in is ready for execution')
push_pull_2.in is ready for execution
Execute the following cell to run GSEIM on push_pull_2.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("push_pull_2.in")
os.system('run_gseim push_pull_2.in')
get_lib_elements: filename gseim_aux/xbe.aux
get_lib_elements: filename gseim_aux/ebe.aux
Circuit: filename = push_pull_2.in
main: i_solve = 0
main: calling solve_trns
Transient simulation starts...
i=0
i=10000
i=20000
GSEIM: Program completed.
Out[4]:
0

The circuit file (push_pull_2.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on push_pull_2.in) creates a data file called push_pull_2.dat in the same directory. We can now use the python code below to compute/plot the various quantities of interest.

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

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

i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u = np.loadtxt(filename)
ta = u[:, 0]
t = ta - ta[0]

col_v_out = slv.get_index(i_slv,i_out,"v_out")
col_IL1   = slv.get_index(i_slv,i_out,"IL1"  )
col_IL2   = slv.get_index(i_slv,i_out,"IL2"  )
col_VD1   = slv.get_index(i_slv,i_out,"VD1"  )
col_VD2   = slv.get_index(i_slv,i_out,"VD2"  )
col_VS1   = slv.get_index(i_slv,i_out,"VS1"  )
col_VS2   = slv.get_index(i_slv,i_out,"VS2"  )

i_out = 1
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u1 = np.loadtxt(filename)
t1a = u1[:, 0]
t1 = t1a - t1a[0]

col_ID1 = slv.get_index(i_slv,i_out,"ID1")
col_ID2 = slv.get_index(i_slv,i_out,"ID2")
col_IS1 = slv.get_index(i_slv,i_out,"IS1")
col_IS2 = slv.get_index(i_slv,i_out,"IS2")

# since we have stored two cycles, we need to divide the last time point
# by 2 to get the period:

T = t[-1]/2

max_VD1 = -min(u[:,col_VD1])
max_VD2 = -min(u[:,col_VD2])
max_VS1 =  max(u[:,col_VS1])
max_VS2 =  max(u[:,col_VS2])

print('max stress on D1:', "%11.4E"%(max_VD1), 'V')
print('max stress on D2:', "%11.4E"%(max_VD2), 'V')
print('max stress on S1:', "%11.4E"%(max_VS1), 'V')
print('max stress on S2:', "%11.4E"%(max_VS2), 'V')

l_ID1 = calc.avg_rms_2(t1, u1[:,col_ID1], 0.0, 2.0*T, 1.0e-3*T)
l_ID2 = calc.avg_rms_2(t1, u1[:,col_ID2], 0.0, 2.0*T, 1.0e-3*T)
l_IS1 = calc.avg_rms_2(t1, u1[:,col_IS1], 0.0, 2.0*T, 1.0e-3*T)
l_IS2 = calc.avg_rms_2(t1, u1[:,col_IS2], 0.0, 2.0*T, 1.0e-3*T)

print('average ID1:', "%11.4E"%l_ID1[1][0], 'A')
print('average ID2:', "%11.4E"%l_ID2[1][0], 'A')
print('rms ID1:'    , "%11.4E"%l_ID1[2][0], 'A')
print('rms ID2:'    , "%11.4E"%l_ID2[2][0], 'A')
print('average IS1:', "%11.4E"%l_IS1[1][0], 'A')
print('average IS2:', "%11.4E"%l_IS2[1][0], 'A')
print('rms IS1:'    , "%11.4E"%l_IS1[2][0], 'A')
print('rms IS2:'    , "%11.4E"%l_IS2[2][0], 'A')

color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'
color5='cornflowerblue'
color6='red'

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

set_size(7, 8, ax[0])

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

ax[0].plot(t*1e6, u[:,col_v_out], color=color1, linewidth=1.0, label="$V_o$")
ax[1].plot(t*1e6, u[:,col_VD1  ], color=color2, linewidth=1.0, label="$V_{D1}$")
ax[2].plot(t*1e6, u[:,col_VD2  ], color=color3, linewidth=1.0, label="$V_{D2}$")
ax[3].plot(t*1e6, u[:,col_VS1  ], color=color4, linewidth=1.0, label="$V_{S1}$")
ax[4].plot(t*1e6, u[:,col_VS2  ], color=color5, linewidth=1.0, label="$V_{S2}$")

ax[0].set_ylabel(r'$V_o$'   , fontsize=14)
ax[1].set_ylabel(r'$V_{D1}$', fontsize=14)
ax[2].set_ylabel(r'$V_{D2}$', fontsize=14)
ax[3].set_ylabel(r'$V_{S1}$', fontsize=14)
ax[4].set_ylabel(r'$V_{S2}$', fontsize=14)

ax[4].set_xlabel('time (' + r'$\mu$' + 'sec)', fontsize=14)

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

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

#plt.tight_layout()
plt.show()
filename: push_pull_2_1.dat
filename: push_pull_2_2.dat
max stress on D1:  3.9996E+01 V
max stress on D2:  3.9996E+01 V
max stress on S1:  1.6000E+02 V
max stress on S2:  1.6000E+02 V
average ID1:  1.9995E+00 A
average ID2:  1.9992E+00 A
rms ID1:  2.3673E+00 A
rms ID2:  2.3670E+00 A
average IS1:  1.9993E-01 A
average IS2:  2.0029E-01 A
rms IS1:  4.4743E-01 A
rms IS2:  4.4794E-01 A
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("push_pull_2.in")

i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u = np.loadtxt(filename)
ta = u[:, 0]
t = ta - ta[0]

col_IL1 = slv.get_index(i_slv,i_out,"IL1")
col_IL2 = slv.get_index(i_slv,i_out,"IL2")

i_out = 1
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u1 = np.loadtxt(filename)
t1a = u1[:, 0]
t1 = t1a -t1a[0]

col_ID1 = slv.get_index(i_slv,i_out,"ID1")
col_ID2 = slv.get_index(i_slv,i_out,"ID2")
col_IS1 = slv.get_index(i_slv,i_out,"IS1")
col_IS2 = slv.get_index(i_slv,i_out,"IS2")

# since we have stored two cycles, we need to divide the last time point
# by 2 to get the period:

T = t[-1]/2

i1 = u[:,col_IL1] + u[:,col_IL2]

color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'
color5='red'
color6='cornflowerblue'
color7='brown'

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

set_size(7, 10, ax[0])

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

ax[0].plot(t*1e6, u[:,col_IL1], color=color1, linewidth=1.0, label="$i_{L1}$")
ax[1].plot(t*1e6, u[:,col_IL2], color=color4, linewidth=1.0, label="$i_{L2}$")
ax[2].plot(t*1e6, i1          , color=color6, linewidth=1.0, label="$i_1$")

ax[3].plot(t1*1e6, u1[:,col_ID1], color=color2, linewidth=1.0, label="$i_{D1}$")
ax[4].plot(t1*1e6, u1[:,col_ID2], color=color3, linewidth=1.0, label="$i_{D2}$")
ax[5].plot(t1*1e6, u1[:,col_IS1], color=color4, linewidth=1.0, label="$i_{S1}$")
ax[6].plot(t1*1e6, u1[:,col_IS2], color=color5, linewidth=1.0, label="$i_{S2}$")

ax[0].set_ylabel(r'$i_{L1}$', fontsize=14)
ax[1].set_ylabel(r'$i_{L2}$', fontsize=14)
ax[2].set_ylabel(r'$i_1$'   , fontsize=14)
ax[3].set_ylabel(r'$i_{D1}$', fontsize=14)
ax[4].set_ylabel(r'$i_{D2}$', fontsize=14)
ax[5].set_ylabel(r'$i_{S1}$', fontsize=14)
ax[6].set_ylabel(r'$i_{S2}$', fontsize=14)

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

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

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

#plt.tight_layout()
plt.show()
filename: push_pull_2_1.dat
filename: push_pull_2_2.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.