Phasors

The single-phase equivalent circuit of a 2200/220 V, 50 Hz transformer is given below. Draw the phasor diagram showing the relationship between ${\bf{V}}_p$ and ${\bf{V}}_m$, with the angle of ${\bf{V}}_m$ taken as $0^{\circ}$.

The transformer parameters are $R_p = 0.21\,\Omega$, $X_p = 3.84\,\Omega$, $R_c = 4800\,\Omega$, $X_m = 3500\,\Omega$, $R_s = 0.006\,\Omega$, $X_s = 0.022\,\Omega$, $R_L = 0.5\,\Omega$.

In [1]:
from IPython.display import Image
Image(filename =r'phasor_5_fig_1.png', width=500)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat phasor_5_orig.in

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

In [3]:
import gseim_calc as calc
import numpy as np

n = 10.0 # turns ratio
Rp = 0.21
Xp = 3.84
Rs = 0.006
Xs = 0.022
Xm = 3500.0
Rc = 4800.0
RL = 0.5

Vs_rms = 2200.0
Vs = Vs_rms*np.sqrt(2.0)

n2 = n*n
Rsp = Rs*n2
Xsp = Xs*n2
RLp = RL*n2

f = 50.0
omg = 2.0*np.pi*f
Lp = Xp/omg
Lsp = Xsp/omg
Lm = Xm/omg

s_Vs  = ("%11.4E"%(Vs )).strip()
s_Rp  = ("%11.4E"%(Rp )).strip()
s_Rc  = ("%11.4E"%(Rc )).strip()
s_Rsp = ("%11.4E"%(Rsp)).strip()
s_RLp = ("%11.4E"%(RLp)).strip()
s_Lp  = ("%11.4E"%(Lp )).strip()
s_Lm  = ("%11.4E"%(Lm )).strip()
s_Lsp = ("%11.4E"%(Lsp)).strip()

l = [
  ('$Vs',  s_Vs),
  ('$Rp',  s_Rp),
  ('$Rc',  s_Rc),
  ('$Rsp', s_Rsp),
  ('$RLp', s_RLp),
  ('$Lp',  s_Lp),
  ('$Lm',  s_Lm),
  ('$Lsp', s_Lsp),
]
calc.replace_strings_1("phasor_5_orig.in", "phasor_5.in", l)
print('phasor_5.in is ready for execution')
phasor_5.in is ready for execution
Execute the following cell to run GSEIM on phasor_5.in.
In [4]:
import os
import dos_unix
# uncomment for windows:
#dos_unix.d2u("phasor_5.in")
os.system('run_gseim phasor_5.in')
Circuit: filename = phasor_5.in
main: i_solve = 0
GSEIM: Program completed.
Out[4]:
0

The circuit file (phasor_5.in) is created in the same directory as that used for launching Jupyter notebook. The last step (i.e., running GSEIM on phasor_5.in) creates data files phasor_5_1.dat and phasor_5_2.dat in the same directory. We can now use the python code below to compute and display the quantities of interest.

In [5]:
import numpy as np
import gseim_calc as calc
import matplotlib.pyplot as plt 
from matplotlib.ticker import (MultipleLocator, AutoMinorLocator)
from setsize import set_size
import cmath

rad_to_deg = 180.0/np.pi

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

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

Ic  = slv.get_scalar_complex_1(i_slv, i_out, "Ic",  u)
Im  = slv.get_scalar_complex_1(i_slv, i_out, "Im",  u)
Ip  = slv.get_scalar_complex_1(i_slv, i_out, "Ip",  u)
Isp = slv.get_scalar_complex_1(i_slv, i_out, "Isp", u)

s_format = "%7.2f"

print('current phasors in rectangular form:')

calc.print_complex_rect('Ic' , Ic,  s_format)
calc.print_complex_rect('Im' , Im,  s_format)
calc.print_complex_rect('Ip' , Ip,  s_format)
calc.print_complex_rect('Isp', Isp, s_format)

print('current phasors in polar form:')

calc.print_complex_polar('Ic' , Ic,  s_format)
calc.print_complex_polar('Im' , Im,  s_format)
calc.print_complex_polar('Ip' , Ip,  s_format)
calc.print_complex_polar('Isp', Isp, s_format)

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

Vm  = slv.get_scalar_complex_1(i_slv, i_out, "Vm",  u)
Vp  = slv.get_scalar_complex_1(i_slv, i_out, "Vp",  u)
VRp = slv.get_scalar_complex_1(i_slv, i_out, "VRp", u)
VLp = slv.get_scalar_complex_1(i_slv, i_out, "VLp", u)

# treat angle of Vm as zero

theta = cmath.phase(Vm)

Ic  = calc.change_angle_1(Ic,  theta)
Im  = calc.change_angle_1(Im,  theta)
Ip  = calc.change_angle_1(Ip,  theta)
Isp = calc.change_angle_1(Isp, theta)

Vm  = calc.change_angle_1(Vm,  theta)
Vp  = calc.change_angle_1(Vp,  theta)
VRp = calc.change_angle_1(VRp, theta)
VLp = calc.change_angle_1(VLp, theta)

IpRp = Rp*Ip
IpXp = Xp*Ip*(complex(0.0,1.0))

print('voltage phasors in rectangular form:')

calc.print_complex_rect('Vm',   Vm,   s_format)
calc.print_complex_rect('Vp',   Vp,   s_format)
calc.print_complex_rect('IpRp', IpRp, s_format)
calc.print_complex_rect('IpXp', IpXp, s_format)

print('voltage phasors in polar form:')

calc.print_complex_polar('Vm',   Vm,   s_format)
calc.print_complex_polar('Vp',   Vp,   s_format)
calc.print_complex_polar('IpRp', IpRp, s_format)
calc.print_complex_polar('IpXp', IpXp, s_format)

l_colors = ["blue", "red", "green", "grey", "dodgerblue", "tomato"]

l1 = []
l1_labels = []

color_Vm   = calc.phasor_append_1a(l1, l1_labels, Vm,   "$V_m$",     l_colors)
color_Vp   = calc.phasor_append_1a(l1, l1_labels, Vp,   "$V_p$",     l_colors)
color_IpRp = calc.phasor_append_1a(l1, l1_labels, IpRp, "$I_pR_p$",  l_colors)
color_IpXp = calc.phasor_append_1a(l1, l1_labels, IpXp, "$jI_pX_p$", l_colors)

theta_deg = 20.0
length_arrow = calc.phasor_3(l1, 0.02)
l1_arrow = calc.phasor_2(l1, theta_deg, length_arrow, 0.2)

l2 = []
l2_colors = []

calc.phasor_append_2(l2, l2_colors, Vm, (Vm + IpRp), color_IpRp)
calc.phasor_append_2(l2, l2_colors, (Vm + IpRp), (Vm + IpRp + IpXp), color_IpXp)

l2_arrow = calc.phasor_2(l2, theta_deg, length_arrow, 0.2)

fig, ax = plt.subplots()
ax.set_aspect('equal', adjustable='box')
ax.grid()

for i, l_dummy in enumerate(l1_arrow):
    for k, t in enumerate(l_dummy):
        if (k == 0): 
            ax.plot(t[0],t[1], color=l_colors[i], label=l1_labels[i])
        else:
            ax.plot(t[0],t[1], color=l_colors[i])

for i, l_dummy in enumerate(l2_arrow):
    for k, t in enumerate(l_dummy):
        ax.plot(t[0],t[1], color=l2_colors[i], linestyle='--', dashes=(4, 2))

calc.revise_axis_limits_1(ax, 3.0)
ax.legend(loc='center left', fontsize=11, bbox_to_anchor=(1.05, 0.5))

plt.xlabel('Re (V)', fontsize=11)
plt.ylabel('Im (V)', fontsize=11)
plt.show()
filename: phasor_5_1.dat
current phasors in rectangular form:
Ic: (   0.64,   -0.05)
Im: (  -0.07,   -0.88)
Ip: (  60.88,   -8.13)
Isp: (  60.30,   -7.21)
current phasors in polar form:
Ic: magnitude:    0.64, angle:   -4.33 deg
Im: magnitude:    0.88, angle:  -94.33 deg
Ip: magnitude:   61.42, angle:   -7.61 deg
Isp: magnitude:   60.73, angle:   -6.82 deg
filename: phasor_5_2.dat
voltage phasors in rectangular form:
Vm: (3076.05,    0.00)
Vp: (3102.43,  234.72)
IpRp: (  12.88,   -0.74)
IpXp: (  13.51,  235.46)
voltage phasors in polar form:
Vm: magnitude: 3076.05, angle:    0.00 deg
Vp: magnitude: 3111.30, angle:    4.33 deg
IpRp: magnitude:   12.90, angle:   -3.28 deg
IpXp: magnitude:  235.85, angle:   86.72 deg
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 [ ]: