Forward converter
The forward converter shown in the figure has an input voltage of $30\,$V and is connected to a load resistance of $5\,\Omega$. The duty ratio of the converter is 0.4, and the switching frequency is $50\,$kHz. The turns ratio of the transformer is 6:2:3. The output capacitance is $20\,\mu$F, and the filter inductance is $500\,\mu$H. The magnetizing inductance of the transformer as seen from the source side is $1\,$mH. If the diodes have a forward drop of $0.7\,V$ and the switches have a drop of $1\,$V, determine the following.- the output voltage
- the duration for which diode $D_1$ conducts.
- the efficiency of the converter.
from IPython.display import Image
Image(filename =r'forward_2_fig_1.png', width=450)
# run this cell to view the circuit file.
%pycat forward_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 forward_2_orig.in and produces a new circuit file forward_2.in, after replacing \$Vdc, \$L, etc. with values of our choice.
import gseim_calc as calc
s_D = "0.4"
s_Vdc = "30"
s_Lm = "1e-3"
s_L = "500e-6"
s_R = "5"
s_C = "20e-6"
s_N1 = "6"
s_N2 = "2"
s_N3 = "3"
s_f_hz = "50e3"
l = [
('$D', s_D),
('$Vdc', s_Vdc),
('$Lm', s_Lm),
('$L', s_L),
('$R', s_R),
('$C', s_C),
('$N1', s_N1),
('$N2', s_N2),
('$N3', s_N3),
('$f_hz', s_f_hz),
]
calc.replace_strings_1("forward_2_orig.in", "forward_2.in", l)
print('forward_2.in is ready for execution')
forward_2.in is ready for execution
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("forward_2.in")
os.system('run_gseim forward_2.in')
get_lib_elements: filename gseim_aux/xbe.aux get_lib_elements: filename gseim_aux/ebe.aux Circuit: filename = forward_2.in main: i_solve = 0 main: calling solve_trns mat_ssw_1_ex: n_statevar: 4 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=1.9648e-01 Transient simulation starts... i=0 solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=1.5543e-15 solve_ssw_ex: calling solve_ssw_1_ex for one more trns step Transient simulation starts... i=0 solve_ssw_1_ex over (after trns step for output) solve_ssw_ex ends, slv.ssw_iter_newton=1 GSEIM: Program completed.
0
The circuit file (forward_2.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on forward_2.in) creates two data files called forward_2.dat and forward_2_1.dat in the same directory. We can now use the python code below to compute/plot the various quantities of interest.
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
slv = calc.slv("forward_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_v_out = slv.get_index(i_slv,i_out,"v_out")
col_IL = slv.get_index(i_slv,i_out,"IL" )
col_ILm = slv.get_index(i_slv,i_out,"ILm" )
col_IS = slv.get_index(i_slv,i_out,"IS" )
col_ID1 = slv.get_index(i_slv,i_out,"ID1" )
col_IVs = slv.get_index(i_slv,i_out,"IVs" )
col_P_R = slv.get_index(i_slv,i_out,"P_R" )
col_P_Vs = slv.get_index(i_slv,i_out,"P_Vs" )
# 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_v_out = calc.avg_rms_2(t, u[:,col_v_out], T, 2.0*T, 1.0e-4*T)
print('average Vo:', "%11.4E"%l_v_out[1][0], "Volts")
l_v_out_1 = calc.min_max_1(t, u[:,col_v_out], 0.0, 2.0*T)
v_out_ptop = l_v_out_1[1] - l_v_out_1[0]
print('peak-to-peak ripple in Vo:', "%11.4E"%v_out_ptop, " Volts")
ndiv = 5000
n_ID1 = 0
delt_ID1, ID1p = calc.interp_linear_1(t, u[:,col_ID1], ndiv)
for k in range(ndiv):
if (ID1p[k] > 0): n_ID1 += 1
print('duration of conduction for D1 in one cycle:',
"%11.4E"%(1.0e6*float(n_ID1)*delt_ID1/(2.0)), 'micro seconds.')
l_P_Vs = calc.avg_rms_2(t, u[:,col_P_Vs], 0.0, 2.0*T, 1.0e-3*T)
l_P_R = calc.avg_rms_2(t, u[:,col_P_R], 0.0, 2.0*T, 1.0e-3*T)
print('average power (VS):', "%11.4E"%l_P_Vs[1][0], "W")
print('average power (load):', "%11.4E"%l_P_R[1][0], "W")
print('efficiency:', "%5.2f"%(100.0*l_P_R[1][0]/l_P_Vs[1][0]), "per cent")
color1='green'
color2='crimson'
color3='goldenrod'
color4='blue'
color5='cornflowerblue'
color6='red'
fig, ax = plt.subplots(6, sharex=False)
plt.subplots_adjust(wspace=0, hspace=0.0)
set_size(7, 7, ax[0])
for i in range(6):
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_IL ], color=color1, linewidth=1.0, label="$i_L$")
ax[1].plot(t*1e6, u[:,col_IVs ], color=color2, linewidth=1.0, label="$i_{Vs}$")
ax[2].plot(t*1e6, u[:,col_IS ], color=color3, linewidth=1.0, label="$i_S$")
ax[3].plot(t*1e6, u[:,col_ID1 ], color=color4, linewidth=1.0, label="$i_{D1}$")
ax[4].plot(t*1e6, u[:,col_v_out], color=color5, linewidth=1.0, label="$V_o$")
ax[5].plot(t*1e6, u[:,col_ILm ], color=color5, linewidth=1.0, label="$i_{Lm}$")
ax[0].set_ylabel(r'$i_L$' , fontsize=14)
ax[1].set_ylabel(r'$i_{Vs}$', fontsize=14)
ax[2].set_ylabel(r'$i_S$' , fontsize=14)
ax[3].set_ylabel(r'$i_{D1}$', fontsize=14)
ax[4].set_ylabel(r'$V_o$' , fontsize=14)
ax[5].set_ylabel(r'$i_{Lm}$', fontsize=14)
ax[5].set_xlabel('time (' + r'$\mu$' + 'sec)', fontsize=14)
for i in range(5):
ax[i].tick_params(labelbottom=False)
#plt.tight_layout()
plt.show()
filename: forward_2.dat average Vo: 5.0970E+00 Volts peak-to-peak ripple in Vo: 1.7419E-02 Volts duration of conduction for D1 in one cycle: 2.6160E+00 micro seconds. average power (VS): 6.2002E+00 W average power (load): 5.1960E+00 W efficiency: 83.80 per cent
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.