import math
from numpy import exp
# GIVEN DATA
V_a = 7.3 * exp(1j*12.5*math.pi/180) ; # Phase voltage in V
V_b = 0.4 * exp(1j*(-100)*math.pi/180) ; # Phase voltage in V
V_c = 4.4 * exp(1j*154*math.pi/180) ; # Phase voltage in V
a = 1. * exp(1j*120*math.pi/180) ; # operator 'a' by application of symmetrical components theory to 3-Φ system . Refer section 9.3 for details
# CALCULATIONS
V_a0 = (1./3) * (V_a + V_b + V_c) ; # Analysis equ in V
V_a1 = (1./3) * (V_a + a*V_b + a**2*V_c) ;
V_a2 = (1./3) * (V_a + a**2*V_b + a*V_c) ;
V_b0 = V_a0 ;
V_b1 = a**2 * V_a1 ;
V_b2 = a * V_a2 ;
V_c0 = V_a0 ;
V_c1 = a * V_a1 ;
V_c2 = a**2 * V_a2 ;
# DISPLAY RESULTS
print ("EXAMPLE : 9.1 : SOLUTION :-") ;
print " The symmetrical components for the phase voltages V_a , V_b & V_c are" ;
print " V_a0 = %.2f<%.1f V "%(abs(V_a0),math.degrees(math.atan2(V_a0.imag,V_a0.real) )) ;
print " V_a1 = %.2f<%.1f V "%(abs(V_a1),math.degrees(math.atan2(V_a1.imag,V_a1.real) )) ;
print " V_a2 = %.2f<%.1f V "%(abs(V_a2),math.degrees(math.atan2(V_a2.imag,V_a2.real) )) ;
print " V_b0 = %.2f<%.1f V "%(abs(V_b0),math.degrees(math.atan2(V_b0.imag,V_b0.real) )) ;
print " V_b1 = %.2f<%.1f V "%(abs(V_b1),math.degrees(math.atan2(V_b1.imag,V_b1.real) )) ;
print " V_b2 = %.2f<%.1f V "%(abs(V_b2),math.degrees(math.atan2(V_b2.imag,V_b2.real) )) ;
print " V_c0 = %.2f<%.1f V "%(abs(V_c0),math.degrees(math.atan2(V_c0.imag,V_c0.real) )) ;
print " V_c1 = %.2f<%.1f V "%(abs(V_c1),math.degrees(math.atan2 (V_c1.imag,V_c1.real) )) ;
print " V_c2 = %.2f<%.1f V "%(abs(V_c2),math.degrees(math.atan2(V_c2.imag,V_c2.real) )) ;
print " NOTE : V_b1 = 3.97<-99.5 V & V_c2 = 2.52<-139.7 V result obtained is same as textbook answer V_b1 = 3.97<260.5 V & V_c2 = 2.52<220.3 V " ;
print " Changes is due to a**2 = 1<240 = 1<-120 where 1 is the magnitude & <240 is the angle in degree " ;
import math
from numpy import transpose,matrix,exp,conj
from numpy.linalg import inv
# GIVEN DATA
V_abc = matrix([[0] , [50] , [-50]]) ; # Phase voltages of a 3-Φ system in V
I_abc = matrix([[-5] , [5*1j] , [-5]]) ; # Phase current of a 3-Φ system in A
# CALCULATIONS
# For case (a)
S_3ph = transpose(V_abc) * conj(I_abc) ; # 3-Φ complex power in VA
# For case (b)
a = 1*exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1] , [1, a**2, a] , [1, a, a**2]]) ;
V_012 = inv(A) * (V_abc) ; # Sequence voltage matrices in V
I_012 = inv(A) * (I_abc) ; # Sequence current matrices in A
# For case (c)
S_3ph1 = 3 * matrix([V_012[0,0], V_012[1,0], V_012[2,0]]) * (conj(I_012)) ; # Three-phase complex power in VA . Refer equ 9.34(a)
# DISPLAY RESULTS
print ("EXAMPLE : 9.2 : SOLUTION :-") ;
print " a) Three-phase complex power using equ 9.30 , S_3-Φ = %.4f<%.f VA "%(abs(S_3ph) , \
math.degrees(math.atan2(S_3ph.imag,S_3ph.real) )) ;
print " b) Sequence Voltage matrices , [V_012] = V " ;
print " %.f<%.f "%(abs(V_012[0]),math.degrees(math.atan2(V_012[0].imag,V_012[0].real) )) ;
print " %.4f<%.f "%(abs(V_012[1]),math.degrees(math.atan2(V_012[1].imag,V_012[1].real) )) ;
print " %.4f<%.f "%(abs(V_012[2]),math.degrees(math.atan2(V_012[2].imag,V_012[2].real) )) ;
print " Sequence current matrices , [I_012] = A " ;
print " %.4f<%.1f "%(abs(I_012[0]),math.degrees(math.atan2(I_012[0].imag,I_012[0].real) )) ;
print " %.4f<%.f "%(abs(I_012[1]),math.degrees(math.atan2(I_012[1].imag,I_012[1].real) )) ;
print " %.4f<%.f "%(abs(I_012[2]),math.degrees(math.atan2(I_012[2].imag,I_012[2].real) )) ;
print " c) Three-phase complex power using equ 9.34 , S_3-Φ = %.4f<%.f VA "%(abs(S_3ph1) ,\
math.degrees(math.atan2(S_3ph1.imag,S_3ph1.real) )) ;
import math
from numpy.linalg import inv
from numpy import exp,matrix
# GIVEN DATA
l = 40 ; # line length in miles
# Conductor parameter from Table A.3
r_a = 0.206 ; # Ohms per conductor per mile in Ω/mi
r_b = r_a ; # r_a = r_b = r_c in Ω/mi
D_s = 0.0311 ; # GMR in ft where D_s = D_sa = D_sb = D_sc
D_ab = math.sqrt(2**2 + 8**2) ; # GMR in ft
D_bc = math.sqrt(3**2 + 13**2) ; # GMR in ft
D_ac = math.sqrt(5**2 + 11**2) ; # GMR in ft
D_e = 2788.5 ; # GMR in ft math.since earth resistivity is zero
r_e = 0.09528 ; # At 60 Hz in Ω/mi
# CALCULATIONS
# For case (a)
Z_aa = ((r_a + r_e) + 1j * 0.1213*math.log(D_e/D_s))*l ; # Self impedance of line conductor in Ω
Z_bb = Z_aa ;
Z_cc = Z_bb ;
Z_ab = (r_e + 1j * 0.1213*math.log(D_e/D_ab))*l ; # Mutual impedance in Ω
Z_ba = Z_ab ;
Z_bc = (r_e + 1j * 0.1213*math.log(D_e/D_bc))*l ;
Z_cb = Z_bc ;
Z_ac = (r_e + 1j * 0.1213*math.log(D_e/D_ac))*l ;
Z_ca = Z_ac ;
Z_abc = matrix([[Z_aa, Z_ab, Z_ac] , [Z_ba, Z_bb, Z_bc] , [Z_ca, Z_cb, Z_cc]]) ; # Line impedance matrix
# For case (b)
a = 1*exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1] ,[1, a**2, a] ,[1, a, a**2]]) ;
Z_012 = inv(A) * Z_abc*A ; # Sequence impedance matrix
# DISPLAY RESULTS
print ("EXAMPLE : 9.3 : SOLUTION :-") ;
print " a) Line impedance matrix , [Z_abc] = ", ; print Z_abc ;
print " b) Sequence impedance matrix of line , [Z_012] = ", ; print Z_012 ;
import math
from numpy import matrix
# GIVEN DATA
l = 40 ; # line length in miles
# Conductor parameter from Table A.3
r_a = 0.206 ; # Ohms per conductor per mile in Ω/mi
r_b = r_a ; # r_a = r_b = r_c in Ω/mi
D_s = 0.0311 ; # GMR in ft where D_s = D_sa = D_sb = D_sc
D_ab = math.sqrt(2**2 + 8**2) ; # GMR in ft
D_bc = math.sqrt(3**2 + 13**2) ; # GMR in ft
D_ac = math.sqrt(5**2 + 11**2) ; # GMR in ft
D_e = 2788.5 ; # GMR in ft math.since earth resistivity is zero
r_e = 0.09528 ; # At 60 Hz in Ω/mi
# CALCULATIONS
# For case (a)
Z_s = ((r_a + r_e) + 1j*0.1213*math.log(D_e/D_s))*l ; # Self impedance of line conductor in Ω . From equ 9.49
D_eq = (D_ab * D_bc * D_ac)**(1./3) ; # Equ GMR
Z_m = (r_e + 1j*0.1213*math.log(D_e/D_eq))*l ; # From equ 9.50
Z_abc = matrix([[Z_s, Z_m, Z_m] , [Z_m, Z_s, Z_m] , [Z_m, Z_m, Z_s]]) ; # Line impedance matrix
# For case (b)
Z_012 = matrix([[(Z_s+2*Z_m), 0, 0] , [0, (Z_s-Z_m), 0] , [0, 0, (Z_s-Z_m)]]) ; # Sequence impedance matrix . From equ 9.54
# DISPLAY RESULTS
print ("EXAMPLE : 9.4 : SOLUTION :-") ;
print " a) Line impedance matrix when line is completely transposed , [Z_abc] = ", ; print Z_abc ;
print " b) Sequence impedance matrix when line is completely transposed , [Z_012] = ", ; print Z_012 ;
import math
from numpy import matrix
from numpy.linalg import inv
# GIVEN DATA
Z_012 = matrix([[(19.6736 + 109.05044*1j), (0.5351182 + 0.4692097*1j), (- 0.5351182 + 0.4692097*1j)] ,
[(- 0.5351182 + 0.4692097*1j), (8.24 + 28.471684*1j), (- 1.0702365 - 0.9384195*1j) ],
[(0.5351182 + 0.4692097*1j), (1.0702365 - 0.9384195*1j), (8.24 + 28.471684*1j)]]) ; # Line impedance matrix . result of exa 9.3
Y_012 = inv(Z_012) ; # Sequence admitmath.tance of line
# CALCULATIONS
# For case (a)
Y_01 = Y_012[0,1] ;
Y_11 = Y_012[1,1] ;
m_0 = Y_01/Y_11 ; # Per-unit unbalance for zero-sequence in pu from equ 9.67b
m_0_per = m_0 * 100 ; # Per-unit unbalance for zero-sequence in percentage
# For case (b)
Z_01 = Z_012[0,1] ;
Z_00 = Z_012[0,0] ;
m_01 = -(Z_01/Z_00) ; # Per-unit unbalance for zero-sequence in pu from equ 9.67b
m_01_per = m_01 * 100 ; # Per-unit unbalance for zero-sequence in percentage
# For case (c)
Y_21 = Y_012[2,1] ;
Y_11 = Y_012[1,1] ;
m_2 = (Y_21/Y_11) ; # Per-unit unbalance for zero-sequence in pu from equ 9.67b
m_2_per = m_2 * 100 ; # Per-unit unbalance for zero-sequence in percentage
# For case (d)
Z_21 = Z_012[2,1] ;
Z_22 = Z_012[2,2] ;
m_21 = -(Z_21/Z_22) ; # Per-unit unbalance for zero-sequence in pu from equ 9.67b
m_21_per = m_21 * 100 ; # Per-unit unbalance for zero-sequence in percentage
# DISPLAY RESULTS
print ("EXAMPLE : 9.5 : SOLUTION :-") ;
print " a) Per-unit electromagnetic unbalance for zero-sequence , m_0 = %.2f<%.1f percent pu "%(abs(m_0_per),\
math.degrees(math.atan2(m_0_per.imag,m_0_per.real) )) ;
print " b) Approximate value of Per-unit electromagnetic unbalance for negative-sequence , m_0 = %.2f<%.1f percent pu "%\
(abs(m_01_per),math.degrees(math.atan2(m_01_per.imag,m_01_per.real) )) ;
print " c) Per-unit electromagnetic unbalance for negative-sequence , m_2 = %.2f<%.1f percent pu "%\
(abs(m_2_per),math.degrees(math.atan2(m_2_per.imag,m_2_per.real) )) ;
print " d) Approximate value of Per-unit electromagnetic unbalance for negative-sequence , m_2 = %.2f<%.1f percent pu "%\
(abs(m_21_per),math.degrees(math.atan2(m_21_per.imag,m_21_per.real) )) ;
import math
from numpy import exp,matrix
from numpy.linalg import inv
# GIVEN DATA
kv = 115 ; # Line voltage in kV
# For case (a)
h_11 = 90 ; # GMD b/w ground wires & their images
r_a = 0.037667 ; # Radius in metre
p_aa = 11.185 * math.log(h_11/r_a) ; # unit is F**(-1)m
p_bb = p_aa ;
p_cc = p_aa ;
l_12 = math.sqrt(22 + (45 + 37)**2) ;
D_12 = math.sqrt(2**2 + 8**2) ; # GMR in ft
p_ab = 11.185*math.log(l_12/D_12) ; # unit is F**(-1)m
p_ba = p_ab ;
D_13 = math.sqrt(3**2 + 13**2) ; # GMR in ft
l_13 = 94.08721051 ;
p_ac = 11.185 * math.log(l_13/D_13) ; # unit is F**(-1)m
p_ca = p_ac ;
l_23 = 70.72279912 ;
D_23 = math.sqrt(5**2 + 11**2) ; # GMR in ft
p_bc = 11.185 * math.log(l_23/D_23) ; # unit is F**(-1)m
p_cb = p_bc ;
P_abc = matrix([[p_aa, p_ab, p_ac] , [p_ba, p_bb, p_bc] , [p_ca, p_cb, p_cc]]) ; # Matrix of potential coefficients
# For case (b)
C_abc = inv(P_abc) ; # Matrix of maxwells coefficients
# For case (c)
a = 1*exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1] , [1, a**2, a] ,[1, a, a**2]]) ;
C_012 = inv(A) * C_abc * A ; # Matrix of sequence capacimath.tances
# For case (d)
C_01 = C_012[0,1] ;
C_11 = C_012[1,1] ;
C_21 = C_012[2,1] ;
d_0 = C_01/C_11 ; # Zero-sequence electrostatic unbalances . Refer equ 9.115
d_2 = -C_21/C_11 ; # Negative-sequence electrostatic unbalances . Refer equ 9.116
# DISPLAY RESULTS
print ("EXAMPLE : 9.6 : SOLUTION :-") ;
print " a) Matrix of potential coefficients , [P_abc] = ", ; print P_abc ;
print " b) Matrix of maxwells coefficients , [C_abc] = " ; print C_abc ;
print " c) Matrix of sequence capacimath.tances , [C_012] = ", ; print C_012 ;
print " d) Zero-sequence electrostatic unbalances , d_0 = %.4f<%.1f "%(abs(d_0),math.degrees(math.atan2(d_0.imag,d_0.real) )) ;
print " Negative-sequence electrostatic unbalances , d_2 = %.4f<%.1f "%(abs(d_2),math.degrees(math.atan2(d_2.imag,d_2.real) )) ;
import math
from numpy import exp,matrix,degrees,arctan2
# GIVEN DATA
kv = 230 ; # Line voltage in kV
Z_0 = 0.56 * 1j ; # impedance in Ω
Z_1 = 0.2618 * 1j ; # Impedance in Ω
Z_2 = 0.3619 * 1j ; # Impedance in Ω
z_f = 5 + 0*1j ; # fault impedance in Ω
v = 1 * exp(1j*0*math.pi/180) ;
# CALCULATIONS
# For case (a)
Z_B = kv**2/200 ; # Imedance base on 230 kV line
Z_f = z_f/Z_B ; # fault impedance in pu Ω
I_a0 = v/(Z_0 + Z_1 + Z_2 + 3*Z_f) ; # Sequence currents in pu A
I_a1 = I_a0 ;
I_a2 = I_a0 ;
a = 1 * exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1] , [1, a**2, a] , [1, a, a**2]]) ;
I_f = A * matrix([[I_a0] , [I_a1] , [I_a2]]) ; # Phase currents in pu A
# For case (b)
V_a = matrix([[0] , [v] , [0]]) - matrix([[Z_0, 0, 0] , [0, Z_1, 0] , [0, 0, Z_2]]) \
*matrix([[I_a0] , [I_a1] , [I_a2]]) ; # Sequence voltage in pu V
V_f = A*V_a ; # Phase voltage in pu V
# For case (c)
V_abf = V_f[0,0] - V_f[1,0] ; # Line-to-line voltages at fault points in pu V
V_bcf = V_f[1,0] - V_f[2,0] ; # Line-to-line voltages at fault points in pu V
V_caf = V_f[2,0] - V_f[0,0] ; # Line-to-line voltages at fault points in pu V
# DISPLAY RESULTS
print ("EXAMPLE : 9.9 : SOLUTION :-") ;
print " b) Sequence currents , I_a0 = I_a1 = I_a2 = %.4f<%.1f pu A "%(abs(I_a0),math.degrees(math.atan2(I_a0.imag,I_a0.real) )) ;
print " Phase currents in pu A , [I_af ; I_bf ; I_cf] = pu A " ;
print abs(I_f),degrees(arctan2(I_f.imag,I_f.real) ) ;
print " c) Sequence voltages are , [V_a0 ; V_a1 ; V_a2 ] = pu V " ;
print abs(V_a),degrees(arctan2(V_a.imag,V_a.real) ) ;
print " Phase voltages are , [V_af ; V_bf ; V_cf ] = pu V " ;
print abs(V_f),degrees(arctan2(V_f.imag,V_f.real) ) ;
print " d) Line-to-line voltages at fault points are , V_abf = %.4f<%.1f pu V "%(abs(V_abf),\
math.degrees(math.atan2(V_abf.imag,V_abf.real) )) ;
print " Line-to-line voltages at fault points are , V_abf = %.4f<%.1f pu V "%(abs(V_bcf),\
math.degrees(math.atan2(V_bcf.imag,V_bcf.real) )) ;
print " Line-to-line voltages at fault points are , V_caf = %.4f<%.1f pu V "%(abs(V_caf),\
math.degrees(math.atan2(V_caf.imag,V_caf.real) )) ;
print " NOTE : ERROR : Calclation mistake in textbook from casec onwards " ;
import math
from numpy import exp,matrix,arctan2,degrees,abs
# GIVEN DATA
Z_0 = 0.2619 * 1j ;
Z_1 = 0.25 * 1j ;
Z_2 = 0.25 * 1j ;
v = 1 * exp(1j*0*math.pi/180) ;
a = 1 * exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1] , [1, a**2, a] , [1, a, a**2]]) ;
# CALCULATIONS
# For case (b)
I_a0 = v/(Z_0 + Z_1 + Z_2) ; # Sequence currents at fault point F in pu A
I_a1 = I_a0 ;
I_a2 = I_a0 ;
# For case (c)
I_a1g1 = (1./2) * I_a1 ; # Sequence current at terminals of generator G1 in pu A
I_a2g1 = (1./2) * I_a2 ;
I_a0g1 = 0.5/(0.55 + 0.5)*I_a0 ; # By current division in pu A
# For case (d)
I_f = [A] * matrix([[I_a0g1], [ I_a1g1] , [I_a2g1]]) ; # Phase current at terminal of generator G1 in pu A
# For case (e)
V_a = matrix([[0] , [v] , [0]]) - matrix([[Z_0, 0, 0] , [0, Z_1, 0] , [0, 0, Z_2]])*matrix([[I_a0g1],[I_a1g1],[I_a2g1]]) ; # Sequence voltage in pu V
# For case (f)
V_f = [A]*V_a ; # Phase voltage at terminal of generator G1 in pu V
# For case (g)
I_a1g2 = (1./2) * I_a1 ; # By symmetry for Generator G2
I_a2g2 = (1./2) * I_a2 ;
I_a0g2 = 0 ; # By inspection
# V_a1(HV) leads V_a1(LV) by 30 degree & V_a2(HV) lags V_a2(LV) by 30 degree
I_a0G2 = I_a0g2 ;
I_a1G2 = abs(I_a1g2)*exp(1j * (math.degrees(math.atan2(I_a1g2.imag,I_a1g2.real) ) - 30) * math.pi/180) ; # (-90-30) = (-120)
I_a2G2 = abs(I_a2g2)*exp(1j *(math.degrees(math.atan2( I_a2g2.imag,I_a2g2.real) ) + 30) * math.pi/180) ; # (-90+30) = (-60)
I_f2 = [A] * matrix([[I_a0G2], [I_a1G2] , [I_a2G2]]) ; # Phase current at terminal of generator G2 in pu A
# Sequence voltage at terminal of generator G2 in pu V
V_a0G2 = 0 ;
V_a1G2 = abs(V_a[1,0])*exp(1j * (math.degrees(math.atan2(V_a[1,0].imag,V_a[1,0].real) ) - 30) * math.pi/180) ; # (0-30) = (-30)
V_a2G2 = abs(V_a[2,0])*exp(1j * (math.degrees(math.atan2(V_a[2,0].imag,V_a[2,0].real) ) + 30) * math.pi/180) ; # (180+30)=(210)=(-150)
V_f2 = A * matrix([[V_a0G2] , [V_a1G2] , [V_a2G2]]) ; # Phase voltage at terminal of generator G2 in pu V
# DISPLAY RESULTS
print ("EXAMPLE : 9.10 : SOLUTION :-") ;
print " b) The sequence current at fault point F , I_a0 = I_a1 = I_a2 = %.4f<%.f pu A "%(abs(I_a0),\
math.degrees(math.atan2(I_a0.imag,I_a0.real) )) ;
print " c) Sequence currents at the terminals of generator G1 , " ;
print " I_a0,G_1 = %.4f<%.f pu A "%(abs(I_a0g1),math.degrees(math.atan2(I_a0g1.imag,I_a0g1.real) )) ;
print " I_a1,G_1 = %.4f<%.f pu A "%(abs(I_a1g1),math.degrees(math.atan2(I_a1g1.imag,I_a1g1.real) )) ;
print " I_a2,G_1 = %.4f<%.f pu A "%(abs(I_a2g1),math.degrees(math.atan2(I_a2g1.imag,I_a2g1.real) )) ;
print " d) Phase currents at terminal of generator G1 are , [I_af ; I_bf ; I_cf] = pu A " ;
print abs(I_f),degrees(arctan2(I_f.imag,I_f.real) ) ;
print " e) Sequence voltages at the terminals of generator G1 , [V_a0 ; V_a1 ; V_a2 ] = pu V " ;
print abs(V_a),degrees(arctan2(V_a.imag,V_a.real) ) ;
print " f) Phase voltages at terminal of generator G1 are , [V_af ; V_bf ; V_cf] = pu V " ;
print abs(V_f),degrees(arctan2(V_f.imag,V_f.real) ) ;
print " g) Sequence currents at the terminals of generator G2 , " ;
print " I_a0,G_2 = %.f<%.f pu A "%(abs(I_a0G2),math.degrees(math.atan2(I_a0G2.imag,I_a0G2.real) )) ;
print " I_a1,G_2 = %.4f<%.f pu A"%(abs(I_a1G2),math.degrees(math.atan2(I_a1G2.imag,I_a1G2.real) )) ;
print " I_a2,G_2 = %.4f<%.f pu A"%(abs(I_a2G2),math.degrees(math.atan2(I_a2G2.imag,I_a2G2.real) )) ;
print " Phase currents at terminal of generator G2 are , [I_af ; I_bf ; I_cf] = pu A " ;
print abs(I_f2),degrees(arctan2(I_f2.imag,I_f2.real) ) ;
print " Sequence voltages at the terminals of generator G2 , [V_a0 ; V_a1 ; V_a2 ] = pu V" ;
print " %.f<%.f "%(abs(V_a0G2),math.degrees(math.atan2(V_a0G2.imag,V_a0G2.real) )) ;
print abs(V_a1G2),degrees(arctan2(V_a1G2.imag,V_a1G2.real) ) ;
print abs(V_a2G2),degrees(arctan2(V_a2G2.imag,V_a2G2.real) ) ;
print " Phase voltages at terminal of generator G2 are , [V_af ; V_bf ; V_cf] = pu V " ;
print abs(V_f2),degrees(arctan2(V_f2.imag,V_f2.real) ) ;
print " NOTE : ERROR : Calclation mistake in textbook casef " ;
print " In case g) V_a2 = 0.1641<-150 is same as textbook answer V_a2 = 0.1641<210 , i.e 360-150)=210 " ;
import math
from numpy import abs,degrees,arctan2,exp,matrix
# GIVEN DATA
kv = 230 ; # Line voltage in kV from Exa 9.9
Z_0 = 0.56*1j ; # Zero-sequence impedance in pu
Z_1 = 0.2618*1j ; # Zero-sequence impedance in pu
Z_2 = 0.3619*1j ; # Zero-sequence impedance in pu
z_f = 5 ; # Fault impedance in Ω
v = 1*exp(1j*0*math.pi/180) ; #
a = 1*exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1] , [1, a**2, a] ,[1, a, a**2]]) ;
# CALCULATIONS
# For case (b)
I_a0 = 0 ; # Sequence current in A
Z_B = kv**2/200 ; # Base impedance of 230 kV line
Z_f = z_f/Z_B ; # fault impedance in pu
I_a1 = v/(Z_1 + Z_2 + Z_f) ; # Sequence current in pu A
I_a2 = - I_a1 ; # Sequence current in pu A
I_f = [A] * matrix([[I_a0] , [I_a1] , [I_a2]]) ; # Phase current in pu A
# For case (c)
V_a = matrix([[0] , [v],[0]])- matrix([[Z_0,0,0],[0, Z_1,0],[0, 0, Z_2]])*matrix([[I_a0],[I_a1],[I_a2]]) ; # Sequence voltages in pu V
V_f = A*V_a ; # Phase voltages in pu V
# For case (d)
V_abf = V_f[0,0] - V_f[1,0] ; # Line-to-line voltages at fault points in pu V
V_bcf = V_f[1,0] - V_f[2,0] ; # Line-to-line voltages at fault points in pu V
V_caf = V_f[2,0] - V_f[0,0] ; # Line-to-line voltages at fault points in pu V
# DISPLAY RESULTS
print ("EXAMPLE : 9.11 :SOLUTION :-") ;
print " b) Sequence currents are , " ;
print " I_a0 = %.f pu A "%I_a0 ;
print " I_a1 = %.4f<%.2f pu A "%(abs(I_a1),math.degrees(math.atan2(I_a1.imag,I_a1.real) )) ;
print " I_a2 = %.4f<%.2f pu A "%(abs(I_a2),math.degrees(math.atan2(I_a2.imag,I_a2.real) )) ;
print " Phase currents are , [I_af ; I_bf ; I_cf] = pu A " ;
print abs(I_f),degrees(arctan2(I_f.imag,I_f.real) ) ;
print " c) Sequence voltages are , [V_a0 ; V_a1 ; V_a2] = pu V " ;
print abs(V_a),degrees(arctan2(V_a.imag,V_a.real) ) ;
print " Phase voltages are , [V_af ; V_bf ; V_cf] = pu V " ;
print abs(V_f),degrees(arctan2(V_f.imag,V_f.real) ) ;
print " d Line-to-line voltages at the fault points are " ;
print " V_abf = %.4f<%.1f pu V "%(abs(V_abf),math.degrees(math.atan2(V_abf.imag,V_abf.real) )) ;
print " V_bcf = %.4f<%.1f pu V "%(abs(V_bcf),math.degrees(math.atan2(V_bcf.imag,V_bcf.real) )) ;
print " V_caf = %.4f<%.1f pu V "%(abs(V_caf),math.degrees(math.atan2(V_caf.imag,V_caf.real) )) ;
print " NOTE : ERROR : Minor calclation mistake in textbook " ;
import math
from numpy import exp,matrix,degrees,arctan2
# GIVEN DATA
z_f = 5 ; # Fault-impedance in Ω
z_g = 10 ; # Ground-impedance in Ω
kv = 230 ; # Line voltage in kV from Exa 9.9
Z_0 = 0.56*1j ; # Zero impedance in pu Ω
Z_1 = 0.2618*1j ; # Positive sequence Impedance in pu Ω
Z_2 = 0.3619*1j ; # Negative sequence Impedance in pu Ω
v = 1*exp(1j*0*180/math.pi) ;
a = 1*exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1],[1, a**2, a],[1, a, a**2]]) ;
# CALCULATIONS
# For case (b)
Z_B = kv**2/200 ; # Base impedance of 230 kV line
Z_f = z_f/Z_B ; # fault impedance in pu Ω
Z_g = z_g/Z_B ;
I_a1 = v/( (Z_1 + Z_f) + ( (Z_2 + Z_f)*(Z_0 + Z_f + 3*Z_g)/((Z_2 + Z_f)+(Z_0 + Z_f + 3*Z_g)) )) ; # Sequence current in pu A
I_a2 = -((Z_0 + Z_f + 3*Z_g)/( (Z_2 + Z_f )+(Z_0 + Z_f + 3*Z_g) ))*I_a1 ; # Sequence current in pu A
I_a0 = -((Z_2 + Z_f)/( (Z_2 + Z_f)+(Z_0 + Z_f + 3*Z_g) ))*I_a1 ; # Sequence current in pu A
I_f = A* matrix([[I_a0], [I_a1], [I_a2]]) ; # Phase currents in pu A
# For case (c)
V = matrix([[0], [v], [0]]) - matrix([[Z_0, 0, 0] , [0, Z_1, 0] , [0, 0, Z_2]])* matrix([[I_a0], [I_a1], [I_a2]]) ; # Sequence Voltages in pu V
V_f = A * V ; # Phase voltages in pu V
# For case (d)
V_abf = V_f[0,0] - V_f[1,0] ; # Line-to-line voltages at fault points a & b
V_bcf = V_f[1,0] - V_f[2,0] ; # Line-to-line voltages at fault points b & c
V_caf = V_f[2,0] - V_f[0,0] ; # Line-to-line voltages at fault points c & a
# DISPLAY RESULTS
print ("EXAMPLE : 9.12 : SOLUTION :-") ;
print " b) Sequence currents are , " ;
print " I_a0 = %.4f<%.2f pu A "%(abs(I_a0),degrees(arctan2(I_a0.imag,I_a0.real) )) ;
print " I_a1 = %.4f<%.2f pu A "%(abs(I_a1),degrees(arctan2(I_a1.imag,I_a1.real) )) ;
print " I_a2 = %.4f<%.2f pu A "%(abs(I_a2),degrees(arctan2(I_a2.imag,I_a2.real) )) ;
print " Phase currents are , [I_af ; I_bf ; I_cf] = pu A " ;
print abs(I_f),degrees(arctan2(I_f.imag,I_f.real) ) ;
print " c) Sequence voltages , [V_a0 ; V_a1 ; V_a2] = pu V " ;
print abs(V),degrees(arctan2(V.imag,V.real) ) ;
print " Phase voltages , [V_af ; V_bf ; V_cf] = pu V " ;
print abs(V_f),degrees(arctan2(V_f.imag,V_f.real) ) ;
print " d) Line-to-line voltages at the fault points are , " ;
print " V_abf = %.4f<%.1f pu V "%(abs(V_abf),degrees(arctan2(V_abf.imag,V_abf.real) )) ;
print " V_bcf = %.4f<%.1f pu V "%(abs(V_bcf),degrees(arctan2(V_bcf.imag,V_bcf.real) )) ;
print " V_caf = %.4f<%.1f pu V "%(abs(V_caf),degrees(arctan2(V_caf.imag,V_caf.real) )) ;
import math
from numpy import degrees,arctan2,matrix,exp
# GIVEN DATA
z_f = 5. ; # Fault-impedance in Ω
Z_0 = 0.56*1j ; # Zero impedance in pu Ω
Z_1 = 0.2618*1j ; # Positive sequence Impedance in pu Ω
Z_2 = 0.3619*1j ; # Negative sequence Impedance in pu Ω
kv = 230. ; # Line voltage in kV from Exa 9.9
a = 1. * exp(1j*120*math.pi/180) ; # By symmetrical components theory to 3-Φ system
A = matrix([[1, 1, 1], [1, a**2, a] ,[1, a, a**2]]) ;
# CALCULATIONS
# For case (b)
Z_B = kv**2/200 ; # Base impedance of 230 kV line
Z_f = z_f/Z_B ; # fault impedance in pu Ω
v = 1*exp(1j*0*math.pi/180) ;
I_a0 = 0 ; # Sequence current in pu A
I_a1 = v/(Z_1 + Z_f) ; # Sequence current in pu A
I_a2 = 0 ; # Sequence current in pu A
I_f = A* matrix([[I_a0] , [I_a1] , [I_a2]]) ; # Phase-current in pu A
# For case (c)
V = matrix([[0],[v], [0]]) - matrix([[Z_0, 0, 0], [0, Z_1, 0] , [0, 0, Z_2]])*matrix([[I_a0], [I_a1],[I_a2]]) ; # Sequence Voltages in pu V
V_f = A*V ; # Phase voltages in pu V
# For case (d)
V_abf = V_f[0,0] - V_f[1,0] ; # Line-to-line voltages at fault points a & b
V_bcf = V_f[1,0] - V_f[2,0] ; # Line-to-line voltages at fault points b & c
V_caf = V_f[2,0] - V_f[0,0] ; # Line-to-line voltages at fault points c & a
# DISPLAY RESULTS
print ("EXAMPLE : 9.13 : SOLUTION :-") ;
print " b) Sequence currents are , " ;
print " I_a0 = %.1f pu A "%I_a0 ;
print " I_a1 = %.4f<%.1f pu A "%(abs(I_a1),degrees(arctan2(I_a1.imag,I_a1.real) )) ;
print " I_a2 = %.1f pu A "%I_a2 ;
print " Phase currents are , [I_af ; I_bf ; I_cf] = pu A " ;
print abs(I_f),degrees(arctan2(I_f.imag,I_f.real) ) ;
print " c) Sequence voltages , [V_a0 ; V_a1 ; V_a2] = pu V " ;
print abs(V),degrees(arctan2(V.imag,V.real) ) ;
print " Phase voltages , [V_af ; V_bf ; V_cf] = pu V " ;
print abs(V_f),degrees(arctan2(V_f.imag,V_f.real) ) ;
print " d) Line-to-line voltages at the fault points are , " ;
print " V_abf = %.4f<%.1f pu V "%(abs(V_abf),degrees(arctan2(V_abf.imag,V_abf.real) )) ;
print " V_bcf = %.4f<%.1f pu V "%(abs(V_bcf),degrees(arctan2(V_bcf.imag,V_bcf.real) )) ;
print " V_caf = %.4f<%.1f pu V "%(abs(V_caf),degrees(arctan2(V_caf.imag,V_caf.real) )) ;
print " NOTE : ERROR : Calclation mistake in textbook cased " ;
import math
from numpy import exp,matrix,arctan2,degrees
# GIVEN DATA
VG_1 = 1*exp(1j*0*math.pi/180) ;
VG_2 = 1*exp(1j*0*math.pi/180) ;
# CALCULATIONS
# For case (a)
I_1 = 1*exp(1j*0*math.pi/180) ;
I_2 = 1*exp(1j*0*math.pi/180) ;
V_1 = 0.4522*exp(1j*90*math.pi/180) ;
V_2 = 0.4782*exp(1j*90*math.pi/180) ;
Y_11 = I_1/V_1 ; # When V_2 = 0
Y_21 = (-0.1087)*Y_11 ; # When V_2 = 0
Y_22 = I_2/V_2 ; # When V_1 = 0
Y_12 = Y_21 ;
Y = matrix([[Y_11, Y_12] , [Y_21, Y_22]]) ; # Admitmath.tance matrix associated with positive-sequence n/w
# For case (b)
I_S1_12 = 2.0193*exp(1j*90*math.pi/180) ; # Short-ckt F & F' to neutral & by superposition theorem
I_S1_10 = 0.2884*exp(1j*90*math.pi/180) ; # Short-ckt F & F' to neutral & by superposition theorem
I_S2_12 = 0.4326*exp(1j*90*math.pi/180) ;
I_S2_10 = 1.4904*exp(1j*90*math.pi/180) ;
I_S1 = I_S1_12 + I_S1_10 ;
I_S2 = I_S2_12 + I_S2_10 ;
# DISPLAY RESULTS
print ("EXAMPLE : 9.14 :SOLUTION :-") ;
print " a) Admitmath.tance matrix associated with positive-sequence network , Y = ", ; print Y ;
print " b) Source currents Two-port Thevenin equivalent positive sequence network are , " ;
print " I_S1 = %.4f<%.f pu "%(abs(I_S1),degrees(arctan2(I_S1.imag,I_S1.real) )) ;
print " I_S2 = %.4f<%.f pu "%(abs(I_S2),degrees(arctan2(I_S2.imag,I_S2.real) )) ;
import math
from sympy import Symbol
from numpy import matrix,array,multiply
from numpy.linalg import det
# GIVEN DATA
Y_11 = -2.2115*1j ;
Y_12 = 0.2404*1j ;
Y_21 = 0.2404*1j ;
Y_22 = -2.0912*1j ;
Y = matrix([[Y_11, Y_12] , [Y_21, Y_22]]) ;
I_S1 = 2.3077*1j ;
I_S2 = 1.9230*1j ;
I_a1 = Symbol('I_a1') ;
I_a2 = Symbol('I_a2') ;
a = Y_12*I_S2 - Y_22*I_S1 ;
b = (Y_12+Y_22)*I_a1 ;
c = Y_12*I_S1 - Y_11*I_S2 ;
d = (Y_12 + Y_11)*I_a1 ;
V1 = multiply(matrix([1/det(Y)]) ,matrix([[(a-b)] , [(c+d)]])) ; # Gives the uncoupled positive sequence N/W
A = (Y_12+Y_22)*I_a2 ;
B = (Y_12 + Y_11)*I_a2 ;
V2 = multiply(matrix([(1/det(Y))]),matrix([[A] , [B]])) ; # Gives the uncoupled negative sequence N/W
# DISPLAY RESULTS
print ("EXAMPLE : 9.15 : SOLUTION :-") ;
print " a [V_a1 ; V_a11] = " ; print V1 ;
print " Values of Uncoupled positive-sequence network " ;
print " b [V_a2 ; V_a22] = " ; print V2 ;
print " Values of Uncoupled negative-sequence network " ;
import math
# GIVEN DATA
H_aa = 81.5 ;
D_aa = 1.658 ;
f = 60. ; # Freq in Hz
I = 20. ;
kV = 69. ; # Line voltage in kV
MVA = 25. ; # Transformer T1 rating in MVA
# CALCULATIONS
# For case (a)
C_0 = 29.842*10**-9/(math.log(H_aa/D_aa)) ; # Capacimath.tance in F/mi
b_0 = 2*math.pi*f*C_0 ; # Suscepmath.tance in S/mi
B_0 = b_0*I ; # For total system
X_C0 = (1/B_0) ; # Total zero-sequence reactancw in Ω
TC_0 = B_0/(2*math.pi*f) ; # Total zero-sequence capacimath.tance in F
# For case (c)
X_1 = 0.05 ; # Leakage reactancw of transformer T1 in pu
X_0 = X_1 ;
X_2 = X_1 ;
Z_B = kV**2/MVA ;
X_01 = X_0*Z_B ; # Leakage reactancw in Ω
V_F = 69*10**3/math.sqrt(3) ;
I_a0PC = V_F/(17310.8915*1j) ; # Zero-sequence current flowing through PC in A
I_PC = 3*abs(I_a0PC) ; # Continuous-current rating of the PC in A
# For case (d)
X_PC = (17310.8915 - X_01)/3 ; # Required reactancw value for PC in Ω
# For case (e)
L_PC = X_PC/(2*math.pi*f) ; # Inducmath.tance in H
# For case (f)
S_PC = (I_PC**2)*X_PC ; # Rating in VA
S_PC1 = S_PC*10**-3 ; # Continuous kVA rating in kVA
# For case (g)
V_PC = I_PC * X_PC ; # continuous-voltage rating for PC in V
# DISPLAY RESULTS
print ("EXAMPLE : 9.16 :SOLUTION :-") ;
print " a) Total zero-sequence suscepmath.tance per phase of system at 60 Hz , ΣX_C0 = %.4f Ω "%X_C0 ;
print " Total zero-sequence capacimath.tance per phase of system at 60 Hz , ΣC_0 = %.4e F "%TC_0 ;
print " c) Continuous-current rating of the PC , I_PC = 3I_a0PC = %.4f A "%(abs(I_PC)) ;
print " d) Required reactancw value for the PC , X_PC = %.4f Ω "%X_PC ;
print " e) Inducmath.tance value of the PC , L_PC = %.4f H "%L_PC ;
print " f) Continuous kVA rating for the PC , S_PC = %.2f kVA "%(S_PC1) ;
print " g) Continuous-voltage rating for PC , V_PC = %.2f V "%(V_PC) ;