import math
import cmath
#Variable declaration
I_R = complex(12.0,24.0) #Line current(A)
I_Y = complex(16.0,-2.0) #Line current(A)
I_B = complex(-4.0,-6.0) #Line current(A)
#Calculation
alpha = cmath.exp(1j*120.0*math.pi/180) #Operator
I_R0 = 1.0/3*(I_R+I_Y+I_B) #Zero sequence component(A)
I_R1 = 1.0/3*(I_R+alpha*I_Y+alpha**2*I_B) #Positive sequence component(A)
I_R2 = 1.0/3*(I_R+alpha**2*I_Y+alpha*I_B) #Negative sequence component(A)
#Result
print('Positive sequence current, I_R1 = (%.3f + %.1fj) A' %(I_R1.real,I_R1.imag))
print('Negative sequence current, I_R2 = (%.3f + %.2fj) A' %(I_R2.real,I_R2.imag))
print('Zero sequence current, I_R0 = (%.1f + %.2fj) A' %(I_R0.real,I_R0.imag))
import math
import cmath
#Variable declaration
R_bc = 5.0 #Resistance of resistor connected b/w b & c(ohm)
R_ca = 10.0 #Resistance of resistor connected b/w c & a(ohm)
R_ab = 20.0 #Resistance of resistor connected b/w a & b(ohm)
V = 100.0 #Voltage of balanced system(V)
#Calculation
E_A = -V #Voltage across resistor connected b/w b & c(V)
angle = 60.0 #Angle in delta system(°)
E_B = V*cmath.exp(1j*60.0*math.pi/180) #Voltage across resistor connected b/w c & a(V)
E_C = V*cmath.exp(1j*-60.0*math.pi/180) #Voltage across resistor connected b/w a & b(V)
I_A = E_A/R_bc #Current flowing across resistor connected b/w b & c(A)
I_B = E_B/R_ca #Current flowing across resistor connected b/w c & a(A)
I_C = E_C/R_ab #Current flowing across resistor connected b/w a & b(A)
alpha = cmath.exp(1j*120.0*math.pi/180) #Operator
I_A0 = 1.0/3*(I_A+I_B+I_C) #Zero sequence delta current(A)
I_A1 = 1.0/3*(I_A+alpha*I_B+alpha**2*I_C) #Positive sequence delta current(A)
I_A2 = 1.0/3*(I_A+alpha**2*I_B+alpha*I_C) #Negative sequence delta current(A)
I_a0 = 0.0 #Zero sequence star current(A)
I_a1 = (alpha-alpha**2)*I_A1 #Positive sequence star current(A)
I_a2 = (alpha**2-alpha)*I_A2 #Negative sequence star current(A)
#Result
print('Current in the resistors are:')
print(' I_A = (%.f+%.fj) A' %(I_A.real,I_A.imag))
print(' I_B = (%.f+%.2fj) A' %(I_B.real,I_B.imag))
print(' I_C = (%.1f%.2fj) A' %(I_C.real,I_C.imag))
print('Sequence components of currents in the resistors:')
print(' Zero-sequence current, I_A0 = (%.3f+%.2fj) A' %(I_A0.real,I_A0.imag))
print(' Positive-sequence current, I_A1 = (%.2f+%.fj) A' %(I_A1.real,I_A1.imag))
print(' Negative-sequence current, I_A2 = (%.2f%.2fj) A' %(I_A2.real,I_A2.imag))
print('Sequence components of currents in the supply lines:')
print(' Zero-sequence current, I_a0 = %.f A' %I_a0)
print(' Positive-sequence current, I_a1 = %.1fj A' %I_a1.imag)
print(' Negative-sequence current, I_a2 = (%.1f+%.2fj) A' %(I_a2.real,I_a2.imag))
import math
import cmath
#Variable declaration
E_a = 100.0 #Line to line voltage(V)
E_b = 150.0 #Line to line voltage(V)
E_c = 200.0 #Line to line voltage(V)
#Calculation
e_A = 1.0 #100 V = 1 unit
e_B = 1.5 #150 V = 1 unit
e_C = 2.0 #200 V = 1 unit
cos_alpha = (e_C**2-e_A-e_B**2)/(2*e_B)
alpha = math.acos(cos_alpha)*180/math.pi #angle(°)
cos_beta = (e_A+e_B*cos_alpha)/e_C
beta = math.acos(cos_beta)*180/math.pi #angle(°)
E_A = E_a*cmath.exp(1j*180.0*math.pi/180) #Voltage(V)
E_B = E_b*cmath.exp(1j*(180.0-alpha)*math.pi/180) #Voltage(V)
E_C = E_c*cmath.exp(1j*-beta*math.pi/180) #Voltage(V)
a = cmath.exp(1j*120.0*math.pi/180) #Operator
E_A0 = 1.0/3*(E_A+E_B+E_C) #Zero sequence voltage(V)
E_A1 = 1.0/3*(E_A+a*E_B+a**2*E_C) #Positive sequence delta voltage(V)
E_A1_mag = abs(E_A1) #Magnitude of positive sequence delta voltage(V)
E_a1 = -1j/3**0.5*E_A1 #Positive sequence star voltage(V)
E_a1_mag = abs(E_a1) #Magnitude of positive sequence star voltage(V)
E_A2 = 1.0/3*(E_A+a**2*E_B+a*E_C) #Negative sequence delta voltage(V)
E_A2_mag = abs(E_A2) #Magnitude of negative sequence delta voltage(V)
E_a2 = 1j/3**0.5*E_A2 #Negative sequence star voltage(V)
E_a2_mag = abs(E_a2) #Magnitude of negative sequence star voltage(V)
#Result
print('Magnitude of positive sequence delta voltage, |E_A1| = %.f V' %E_A1_mag)
print('Magnitude of positive sequence star voltage, |E_a1| = %.1f V' %E_a1_mag)
print('Magnitude of negative sequence delta voltage, |E_A2| = %.f V' %E_A2_mag)
print('Magnitude of negative sequence star voltage, |E_a2| = %.f V' %E_a2_mag)
import math
import cmath
#Variable declaration
V = 2300.0 #Rated voltage(V)
kVA = 500.0 #kVA rating
E_A = 2760.0*cmath.exp(1j*0*math.pi/180) #Line voltage(V)
E_B = 2300.0*cmath.exp(1j*-138.6*math.pi/180) #Line voltage(V)
E_C = 1840.0*cmath.exp(1j*124.2*math.pi/180) #Line voltage(V)
#Calculation
a = cmath.exp(1j*120.0*math.pi/180) #Operator
E_A1 = 1.0/3*(E_A+a*E_B+a**2*E_C) #Positive sequence voltage(V)
E_A2 = 1.0/3*(E_A+a**2*E_B+a*E_C) #Negative sequence voltage(V)
E_a1 = -1j/3**0.5*E_A1 #Positive sequence star voltage(V)
E_a2 = 1j/3**0.5*E_A2 #Negative sequence star voltage(V)
E_a0 = 0.0 #Zero sequence voltage(V)
E_a = E_a1+E_a2+E_a0 #Symmetrical voltage component(V)
R = V**2/(kVA*1000) #Resistance(ohm)
I_a = abs(E_a)/R #Current in line a(A)
E_b = a**2*E_a1+a*E_a2+E_a0 #Symmetrical voltage component(V)
I_b = abs(E_b)/R #Current in line b(A)
E_c = a*E_a1+a**2*E_a2+E_a0 #Symmetrical voltage component(V)
I_c = abs(E_c)/R #Current in line c(A)
#Result
print('Current in line a, I_a = %.1f A' %I_a)
print('Current in line b, I_b = %.f A' %I_b)
print('Current in line c, I_c = %.1f A' %I_c)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to more precision here')
import math
import cmath
#Variable declaration
V = 2300.0 #Rated voltage(V)
kVA = 500.0 #kVA rating
I_1 = 100.0 #Line current(A)
I_2 = 100.0*cmath.exp(1j*180*math.pi/180) #Line current(A)
I_3 = 0 #Line current(A)
#Calculation
a = cmath.exp(1j*120.0*math.pi/180) #Operator
I_10 = 1.0/3*(I_1+I_2+I_3) #Symmetrical component of line current for phase 1(A)
I_11 = 1.0/3*(I_1+a*I_2+a**2*I_3) #Symmetrical component of line current for phase 1(A)
I_12 = 1.0/3*(I_1+a**2*I_2+a*I_3) #Symmetrical component of line current for phase 1(A)
I_20 = I_10 #Symmetrical component of line current for phase 2(A)
I_21 = a**2*I_11 #Symmetrical component of line current for phase 2(A)
I_22 = a*I_12 #Symmetrical component of line current for phase 2(A)
I_30 = I_10 #Symmetrical component of line current for phase 3(A)
I_31 = a*I_11 #Symmetrical component of line current for phase 3(A)
I_32 = a**2*I_12 #Symmetrical component of line current for phase 3(A)
#Result
print('Symmetrical component of line current for phase 1:')
print(' I_10 = %.1f A' %abs(I_10))
print(' I_11 = %.2f∠%.f° A' %(abs(I_11),cmath.phase(I_11)*180/math.pi))
print(' I_12 = %.2f∠%.f° A' %(abs(I_12),cmath.phase(I_12)*180/math.pi))
print('Symmetrical component of line current for phase 2:')
print(' I_20 = %.1f A' %abs(I_20))
print(' I_21 = %.2f∠%.f° A' %(abs(I_21),cmath.phase(I_21)*180/math.pi))
print(' I_22 = %.2f∠%.f° A' %(abs(I_22),cmath.phase(I_22)*180/math.pi))
print('Symmetrical component of line current for phase 3:')
print(' I_30 = %.1f A' %abs(I_30))
print(' I_31 = %.2f∠%.f° A' %(abs(I_31),cmath.phase(I_31)*180/math.pi))
print(' I_32 = %.2f∠%.f° A' %(abs(I_32),cmath.phase(I_32)*180/math.pi))
import math
import cmath
#Variable declaration
I_a = 1000.0 #Current to earth(A)
I_b = 0 #Current(A)
I_c = 0 #Current(A)
#Calculation
a = cmath.exp(1j*120.0*math.pi/180) #Operator
I_a0 = 1.0/3*(I_a+I_b+I_c) #Zero sequence component of current(A)
I_b0 = I_a0 #Zero sequence component of current(A)
I_c0 = I_a0 #Zero sequence component of current(A)
I_a1 = 1.0/3*(I_a+a*I_b+a**2*I_c) #Positive sequence component of current(A)
I_b1 = a**2*I_a1 #Positive sequence component of current(A)
I_c1 = a*I_a1 #Positive sequence component of current(A)
I_a2 = 1.0/3*(I_a+a**2*I_b+a*I_c) #Negative sequence component of current(A)
I_b2 = a*I_a2 #Negative sequence component of current(A)
I_c2 = a**2*I_a2 #Negative sequence component of current(A)
#Result
print('Zero sequence component of current for all phases are')
print(' I_a0 = %.1f∠%.f° A' %(abs(I_a0),cmath.phase(I_a0)*180/math.pi))
print(' I_b0 = %.1f∠%.f° A' %(abs(I_b0),cmath.phase(I_b0)*180/math.pi))
print(' I_c0 = %.1f∠%.f° A' %(abs(I_c0),cmath.phase(I_c0)*180/math.pi))
print('Positive sequence component of current for all phases are')
print(' I_a1 = %.1f∠%.f° A' %(abs(I_a1),cmath.phase(I_a1)*180/math.pi))
print(' I_b1 = %.1f∠%.f° A' %(abs(I_b1),360+cmath.phase(I_b1)*180/math.pi))
print(' I_c1 = %.1f∠%.f° A' %(abs(I_c1),cmath.phase(I_c1)*180/math.pi))
print('Negative sequence component of current for all phases are')
print(' I_a2 = %.1f∠%.f° A' %(abs(I_a2),cmath.phase(I_a2)*180/math.pi))
print(' I_b2 = %.1f∠%.f° A' %(abs(I_b2),cmath.phase(I_b2)*180/math.pi))
print(' I_c2 = %.1f∠%.f° A' %(abs(I_c2),360+cmath.phase(I_c2)*180/math.pi))
import math
import cmath
#Variable declaration
I_A = 1000.0 #Current through line A(A)
I_C = 0 #Current through line C(A)
#Calculation
I_B = 1000.0*cmath.exp(1j*180.0*math.pi/180) #Current through line B(A)
a = cmath.exp(1j*120.0*math.pi/180) #Operator
I_a0 = 1.0/3*(I_A+I_B+I_C) #Zero sequence component of current(A)
I_b0 = I_a0 #Zero sequence component of current(A)
I_c0 = I_a0 #Zero sequence component of current(A)
I_a1 = 1.0/3*(I_A+a*I_B+a**2*I_C) #Positive sequence component of current(A)
I_b1 = a**2*I_a1 #Positive sequence component of current(A)
I_c1 = a*I_a1 #Positive sequence component of current(A)
I_a2 = 1.0/3*(I_A+a**2*I_B+a*I_C) #Negative sequence component of current(A)
I_b2 = a*I_a2 #Negative sequence component of current(A)
I_c2 = a**2*I_a2 #Negative sequence component of current(A)
#Result
print('Current in line A, I_A = %.f∠%.f° A' %(abs(I_A),cmath.phase(I_A)*180/math.pi))
print('Current in line B, I_B = %.f∠%.f° A' %(abs(I_B),cmath.phase(I_B)*180/math.pi))
print('Current in line C, I_C = %.f A' %I_C)
print('Symmetrical current components of line A are:')
print(' I_a0 = %.f A' %abs(I_a0))
print(' I_a1 = %.1f∠%.f° A' %(abs(I_a1),cmath.phase(I_a1)*180/math.pi))
print(' I_a2 = %.1f∠%.f° A' %(abs(I_a2),cmath.phase(I_a2)*180/math.pi))
print('Symmetrical current components of line B are:')
print(' I_b0 = %.f A' %abs(I_b0))
print(' I_b1 = %.1f∠%.f° A' %(abs(I_b1),cmath.phase(I_b1)*180/math.pi))
print(' I_b2 = %.1f∠%.f° A' %(abs(I_b2),cmath.phase(I_b2)*180/math.pi))
print('Symmetrical current components of line C are:')
print(' I_c0 = %.f A' %abs(I_c0))
print(' I_c1 = %.1f∠%.f° A' %(abs(I_c1),cmath.phase(I_c1)*180/math.pi))
print(' I_c2 = %.1f∠%.f° A' %(abs(I_c2),cmath.phase(I_c2)*180/math.pi))
import math
import cmath
#Variable declaration
R = 20000.0 #Resistance of voltmeter(ohm)
E_R = 100.0 #Line-to-neutral voltage(A)
E_Y = 200.0*cmath.exp(1j*270.0*math.pi/180) #Line-to-neutral voltage(A)
E_B = 100.0*cmath.exp(1j*120.0*math.pi/180) #Line-to-neutral voltage(A)
#Calculation
a = cmath.exp(1j*120.0*math.pi/180) #Operator
V_R0 = 1.0/3*(E_R+E_Y+E_B) #Zero sequence voltage(V)
V_R1 = 1.0/3*(E_R+a*E_Y+a**2*E_B) #Positive sequence voltage(V)
V_R2 = 1.0/3*(E_R+a**2*E_Y+a*E_B) #Negative sequence voltage(V)
I_R1 = V_R1/R #Positive sequence current(A)
I_R2 = V_R2/R #Negative sequence current(A)
V_Y1 = a**2*V_R1 #Positive sequence voltage of line Y(V)
V_Y2 = a*V_R2 #Negative sequence voltage of line Y(V)
V_Y = V_Y1+V_Y2 #Voltmeter reading connected to the yellow line(V)
I_Y = abs(V_Y)/R*1000 #Current through voltmeter(mA)
#Result
print('Voltmeter reading connected to the yellow line, |V_Y| = %.1f V' %abs(V_Y))
print('Current through voltmeter, I_Y = %.3f mA' %I_Y)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to more precision here')
import math
import cmath
#Variable declaration
V = 400.0 #Voltage(V)
Z_ab = 20.0 #Resistor load(ohm)
Z_bc = -1j*40.0 #Capacitor load(ohm)
Z_ca = 5.0+1j*10.0 #Inductor and resistance load(ohm)
#Calculation
V_ab = V #Line voltage(V)
V_bc = V*cmath.exp(1j*-120.0*math.pi/180) #Line voltage(V)
V_ca = V*cmath.exp(1j*120.0*math.pi/180) #Line voltage(V)
I_ab = V_ab/Z_ab #Current(A)
I_bc = V_bc/Z_bc #Current(A)
I_ca = V_ca/Z_ca #Current(A)
I_a = I_ab-I_ca #Line current(A)
I_b = I_bc-I_ab #Line current(A)
I_c = I_ca-I_bc #Line current(A)
phi = -120.0-cmath.phase(I_a)*180/math.pi #φ(°)
P = abs(I_a*V_bc)*math.cos(phi*math.pi/180)/1000 #Wattmeter reading(kW)
#Result
print('Line currents are:')
print(' I_a = %.1f∠%.1f° A' %(abs(I_a),cmath.phase(I_a)*180/math.pi))
print(' I_b = %.1f∠%.2f° A' %(abs(I_b),cmath.phase(I_b)*180/math.pi))
print(' I_c = %.2f∠%.f° A' %(abs(I_c),cmath.phase(I_c)*180/math.pi))
print('Wattmeter reading, P = %.2f kW' %P)
print('\nNOTE: ERROR: Calculation mistakes in the textbook solution')