3-phase CSI
A three-phase current source inverter as shown in the figure is feeding a star-connected resistive load. The circuit parameters are $I_s = 10\,$A, $R_a = 30\,\Omega$. What is the power consumed by the three-phase load for 180-degree and 120-degree conduction?In [1]:
from IPython.display import Image
Image(filename =r'CSI_3ph_1_fig_1.png', width=350)
Out[1]:
In [2]:
# run this cell to view the circuit file.
%pycat CSI_3ph_1_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 CSI_3ph_1_orig.in and produces a new circuit file CSI_3ph_1.in, after replacing \$Vdcby2, \$L, etc. with values of our choice.
In [3]:
import gseim_calc as calc
s_Idc = "10"
s_R = "30"
s_f_clock = "50"
# 180-deg conduction:
s_D = "0.5"
# 120-deg conduction:
#s_D = "0.33333"
l = [
('$Idc', s_Idc),
('$R', s_R),
('$D', s_D),
('$f_clock', s_f_clock),
]
calc.replace_strings_1("CSI_3ph_1_orig.in", "CSI_3ph_1.in", l)
print('CSI_3ph_1.in is ready for execution')
CSI_3ph_1.in is ready for execution
Execute the following cell to run GSEIM on CSI_3ph_1.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("CSI_3ph_1.in")
os.system('run_gseim CSI_3ph_1.in')
get_lib_elements: filename gseim_aux/xbe.aux get_lib_elements: filename gseim_aux/ebe.aux Circuit: filename = CSI_3ph_1.in main: i_solve = 0 main: calling solve_trns Transient simulation starts... i=0 i=1000 i=2000 i=3000 GSEIM: Program completed.
Out[4]:
0
The circuit file (CSI_3ph_1.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on CSI_3ph_1.in) creates data files called CSI_3ph_1_1.dat, etc. 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
f_hz = 50.0
T = 1.0/f_hz
slv = calc.slv("CSI_3ph_1.in")
i_slv = 0
i_out = 0
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u1 = np.loadtxt(filename)
t1 = u1[:, 0]
col_g1 = slv.get_index(i_slv,i_out,"g1")
col_g2 = slv.get_index(i_slv,i_out,"g2")
col_g3 = slv.get_index(i_slv,i_out,"g3")
col_g4 = slv.get_index(i_slv,i_out,"g4")
col_g5 = slv.get_index(i_slv,i_out,"g5")
col_g6 = slv.get_index(i_slv,i_out,"g6")
i_out = 1
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u2 = np.loadtxt(filename)
t2 = u2[:, 0]
col_p_Ra = slv.get_index(i_slv,i_out,"p_Ra")
col_p_Rb = slv.get_index(i_slv,i_out,"p_Rb")
col_p_Rc = slv.get_index(i_slv,i_out,"p_Rc")
i_out = 2
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u3 = np.loadtxt(filename)
t3 = u3[:, 0]
col_i_a = slv.get_index(i_slv,i_out,"i_a")
l_p_Ra = calc.avg_rms_2(t2, u2[:,col_p_Ra], T, 2.0*T, 1.0e-4*T)
l_p_Rb = calc.avg_rms_2(t2, u2[:,col_p_Rb], T, 2.0*T, 1.0e-4*T)
l_p_Rc = calc.avg_rms_2(t2, u2[:,col_p_Rc], T, 2.0*T, 1.0e-4*T)
pwr_total = l_p_Ra[1][0] + l_p_Rb[1][0] + l_p_Rc[1][0]
print('average power delivered to load:', "%11.4E"%pwr_total)
fig, ax = plt.subplots(2, sharex=False, gridspec_kw={'height_ratios': [2, 1]})
plt.subplots_adjust(wspace=0, hspace=0.0)
set_size(6.5, 4, ax[0])
for i in range(2):
ax[i].set_xlim(left=0.0, right=2.0*T*1e3)
ax[i].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[0].set_ylabel(r'$g_x$', fontsize=12)
ax[1].set_ylabel(r'$i_a$', fontsize=12)
ax[0].tick_params(labelbottom=False)
color1 = "tomato"
color2 = "dodgerblue"
color3 = "olive"
color4 = "blue"
color5 = "grey"
color6 = "green"
color7 = "crimson"
dy = 1.5
ax[0].plot(t1*1e3, (u1[:,col_g1] ), color=color1, linewidth=1.0, label="$g_1$")
ax[0].plot(t1*1e3, (u1[:,col_g2] - dy), color=color2, linewidth=1.0, label="$g_2$")
ax[0].plot(t1*1e3, (u1[:,col_g3] - 2*dy), color=color3, linewidth=1.0, label="$g_3$")
ax[0].plot(t1*1e3, (u1[:,col_g4] - 3*dy), color=color4, linewidth=1.0, label="$g_4$")
ax[0].plot(t1*1e3, (u1[:,col_g5] - 4*dy), color=color5, linewidth=1.0, label="$g_5$")
ax[0].plot(t1*1e3, (u1[:,col_g6] - 5*dy), color=color6, linewidth=1.0, label="$g_6$")
ax[0].tick_params(left = False)
ax[0].set_yticks([])
ax[1].plot(t3*1e3, u3[:,col_i_a], color=color7, linewidth=1.0, label="$i_a$")
ax[1].set_xlabel('time (msec)', fontsize=12)
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: CSI_3ph_1_1.dat filename: CSI_3ph_1_2.dat filename: CSI_3ph_1_3.dat average power delivered to load: 4.4999E+03
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.
In [ ]: