Bidirectional voltage source converter

A sinusoidal pulse width modulated three-phase converter given below is used to inject power to the three-phase balanced $400\,$V, $50\,$Hz AC voltage source from a solar plant. The DC side of the converter is maintained at $800\,$V. The three-phase balanced modulation voltages are $m_a(t)$, $m_b(t)$, $m_c(t)$, and the triangular carrier voltage is $v_c(t)$. The A-phase modulating voltage is $m_a(t) = 0.5\,\sin\,(100\,\pi\,t + 30^{\circ})$. The circuit parameters are $V_{dc} = 600\,$V, $L = 10\,$mH. Find the power injected to the AC voltage source in KW.
In [1]:
from IPython.display import Image
Image(filename =r'VSC_bi_2_fig_1.png', width=700)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat VSC_bi_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 VSC_bi_2_orig.in and produces a new circuit file VSC_bi_2.in, after replacing \$Vdc, \$L, etc. with values of our choice.

In [3]:
import gseim_calc as calc
import numpy as np
s_Vdc = "800"

VL = 400.0
A_sin = VL*np.sqrt(2/3)
s_ea = ("%11.4E"%(A_sin)).strip()

s_L = "0.01"
s_R = "0.001"
s_sin = "0.5"
s_f_sin = "50"
s_f_carrier = "10e3"
s_dt_min = "0.01e-6"
s_dt_nrml = "1e-6"

phi_a_sin = 30.0
phi_b_sin = phi_a_sin - 120.0
phi_c_sin = phi_a_sin - 240.0

s_phi_a_sin = ("%11.4E"%(phi_a_sin)).strip()
s_phi_b_sin = ("%11.4E"%(phi_b_sin)).strip()
s_phi_c_sin = ("%11.4E"%(phi_c_sin)).strip()

l = [
  ('$Vdc', s_Vdc),
  ('$L', s_L),
  ('$R', s_R),
  ('$A_ea', s_ea),
  ('$A_sin', s_sin),
  ('$f_sin', s_f_sin),
  ('$f_carrier', s_f_carrier),
  ('$dt_min', s_dt_min),
  ('$dt_nrml', s_dt_nrml),
  ('$phi_a_sin', s_phi_a_sin),
  ('$phi_b_sin', s_phi_b_sin),
  ('$phi_c_sin', s_phi_c_sin),
]
calc.replace_strings_1("VSC_bi_2_orig.in", "VSC_bi_2.in", l)
print('VSC_bi_2.in is ready for execution')
VSC_bi_2.in is ready for execution
Execute the following cell to run GSEIM on VSC_bi_2.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("VSC_bi_2.in")
os.system('run_gseim VSC_bi_2.in')
get_lib_elements: filename gseim_aux/xbe.aux
get_lib_elements: filename gseim_aux/ebe.aux
Circuit: filename = VSC_bi_2.in
main: i_solve = 0
main: calling solve_trns
mat_ssw_1_ex: n_statevar: 3
Transient simulation starts...
i=0
i=10000
i=20000
i=30000
i=40000
solve_ssw_ex: ssw_iter_newton=0, rhs_ssw_norm=1.8177e-01
Transient simulation starts...
i=0
i=10000
i=20000
i=30000
i=40000
solve_ssw_ex: ssw_iter_newton=1, rhs_ssw_norm=5.0614e-12
Transient simulation starts...
i=0
i=10000
i=20000
i=30000
i=40000
solve_ssw_ex: ssw_iter_newton=2, rhs_ssw_norm=1.1491e-13
Transient simulation starts...
i=0
i=10000
i=20000
i=30000
i=40000
solve_ssw_ex: ssw_iter_newton=3, rhs_ssw_norm=8.1222e-14
solve_ssw_ex: calling solve_ssw_1_ex for one more trns step
Transient simulation starts...
i=0
i=10000
i=20000
i=30000
i=40000
solve_ssw_1_ex over (after trns step for output)
solve_ssw_ex ends, slv.ssw_iter_newton=3
GSEIM: Program completed.
Out[4]:
0

The circuit file (VSC_bi_2.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on VSC_bi_2.in) creates data files called VSC_bi_2_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("VSC_bi_2.in")

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

col_ea = slv.get_index(i_slv,i_out,"ea")
col_eb = slv.get_index(i_slv,i_out,"eb")
col_ec = slv.get_index(i_slv,i_out,"ec")

i_out = 2
filename = slv.l_filename_all[i_slv][i_out]
print('filename:', filename)
u2 = np.loadtxt(filename)
t2 = u2[:, 0]

col_ILa  = slv.get_index(i_slv,i_out,"ILa")
col_ILb  = slv.get_index(i_slv,i_out,"ILb")
col_ILc  = slv.get_index(i_slv,i_out,"ILc")
col_P_ea = slv.get_index(i_slv,i_out,"P_ea")
col_P_eb = slv.get_index(i_slv,i_out,"P_eb")
col_P_ec = slv.get_index(i_slv,i_out,"P_ec")

l_P_ea = calc.avg_rms_2(t2, u2[:,col_P_ea], T, 2.0*T, 1.0e-4*T)
l_P_eb = calc.avg_rms_2(t2, u2[:,col_P_eb], T, 2.0*T, 1.0e-4*T)
l_P_ec = calc.avg_rms_2(t2, u2[:,col_P_ec], T, 2.0*T, 1.0e-4*T)

pwr_total = l_P_ea[1][0] + l_P_eb[1][0] + l_P_ec[1][0]
print('average power injected to ea:', "%11.4E"%(-l_P_ea[1][0]))
print('average power injected to eb:', "%11.4E"%(-l_P_eb[1][0]))
print('average power injected to ec:', "%11.4E"%(-l_P_ec[1][0]))
print('average power injected to AC source (total):', "%11.4E"%(-pwr_total))

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

set_size(6.5, 3, 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'$e_x$', fontsize=12)
ax[1].set_ylabel(r'$i_x$', fontsize=12)

ax[0].tick_params(labelbottom=False)

color1 = "blue"
color2 = "green"
color3 = "crimson"

ax[0].plot(t1*1e3, u1[:,col_ea], color=color1, linewidth=1.0, label="$e_a$")
ax[0].plot(t1*1e3, u1[:,col_eb], color=color2, linewidth=1.0, label="$e_b$")
ax[0].plot(t1*1e3, u1[:,col_ec], color=color3, linewidth=1.0, label="$e_c$")

ax[1].plot(t2*1e3, u2[:,col_ILa], color=color1, linewidth=1.0, label="$i_a$")
ax[1].plot(t2*1e3, u2[:,col_ILb], color=color2, linewidth=1.0, label="$i_b$")
ax[1].plot(t2*1e3, u2[:,col_ILc], color=color3, linewidth=1.0, label="$i_c$")

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

for k in range(2):
    ax[k].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: VSC_bi_2_2.dat
filename: VSC_bi_2_3.dat
average power injected to ea:  5.1925E+03
average power injected to eb:  5.1925E+03
average power injected to ec:  5.1926E+03
average power injected to AC source (total):  1.5578E+04
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 [ ]: