1-phase VSI

The half bridge inverter given below is operated such that the voltage across the inductor is a $50\,$Hz square wave. The parameter values are $V_{dc} = 200\,$V, $L = 10\,$mH. What is the RMS current through the inductor under steady state (assuming average current through the inductor to be zero)?
In [1]:
from IPython.display import Image
Image(filename =r'VSI_1ph_16_fig_1.png', width=200)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat VSI_1ph_16_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 VSI_1ph_16_orig.in and produces a new circuit file VSI_1ph_16.in, after replacing \$Vdc, \$L, etc. with values of our choice.

In [3]:
import gseim_calc as calc
s_Vdc = '200'
s_L = '10m'

f_hz = 50.0
s_f_hz = "%11.4E"%(f_hz)

T = 1/f_hz
s_Tby2 = "%11.4E"%(T/2)

l = [
  ('$Vdc', s_Vdc),
  ('$L', s_L),
  ('$f_hz', s_f_hz),
  ('$Tby2', s_Tby2)
]
calc.replace_strings_1("VSI_1ph_16_orig.in", "VSI_1ph_16.in", l)
print('VSI_1ph_16.in is ready for execution')
VSI_1ph_16.in is ready for execution
Execute the following cell to run GSEIM on VSI_1ph_16.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("VSI_1ph_16.in")
os.system('run_gseim VSI_1ph_16.in')
get_lib_elements: filename gseim_aux/xbe.aux
get_lib_elements: filename gseim_aux/ebe.aux
Circuit: filename = VSI_1ph_16.in
main: i_solve = 0
main: calling solve_trns
mat_ssw_1_ex: n_statevar: 1
Transient simulation starts...
i=0
i=1000
solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=3.9690e+00
Transient simulation starts...
i=0
i=1000
solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=1.9895e-13
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 (VSI_1ph_16.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on VSI_1ph_16.in) creates a data file called VSI_1ph_16.datin 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("VSI_1ph_16.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 = 1e3*t1 # convert time to msec

col_IL    = slv.get_index(i_slv,i_out,"IL"   )
col_VL    = slv.get_index(i_slv,i_out,"VL"   )
col_ISrc1 = slv.get_index(i_slv,i_out,"ISrc1")
col_ISrc2 = slv.get_index(i_slv,i_out,"ISrc2")
col_g1    = slv.get_index(i_slv,i_out,"g1"   )
col_g2    = slv.get_index(i_slv,i_out,"g2"   )

# 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-4*T)

print('rms inductor current:', "%11.4E"%l_IL[2][0])

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

fig, ax = plt.subplots(2, sharex=False, gridspec_kw={'height_ratios': [1.5, 1]})
plt.subplots_adjust(wspace=0, hspace=0.0)

set_size(5, 4, ax[0])

for k in range(2):
    ax[k].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
    ax[k].set_xlim(left=0.0, right=2.0*T)

ax[0].tick_params(labelbottom=False)

ax[0].plot(t, u[:,col_IL], color=color2, linewidth=1.0, label="$i_L$")
ax[0].plot(l_IL[0], l_IL[2], color=color2, linewidth=1.0, label="$i_L^{rms}$", linestyle='--', dashes=(5,3))

ax[1].plot(t, u[:,col_VL], color=color1, linewidth=1.0, label="$v_L$")

ax[1].set_xlabel('time (msec)', fontsize=11)

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

#plt.tight_layout()
plt.show()
filename: VSI_1ph_16.dat
rms inductor current:  5.7735E+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 [ ]: