import math
#initialisation of variables
Va=100.0*complex(math.cos(math.radians(0)),math.sin(math.radians(0)))
Vb=33.0*complex(math.cos(math.radians(-100)),math.sin(math.radians(-100)))
Vc=38.0*complex(math.cos(math.radians(176.5)),math.sin(math.radians(176.5)))
L=1.0*(math.cos(math.radians(120)) + math.sin(math.radians(120)))
#Calculations
Va1=((Va + L*Vb + (L**2)*Vc))/3
Va2=((Va + L*Vc + (L**2)*Vb))/3
Vco=((Va + Vb + Vc))/3
#Results
print( "Va1= {0:.5f}+{1:.5f}i".format(Va1.real, Va1.imag))
print( "Va2= {0:.5f}+{1:.5f}i".format(Va2.real, Va2.imag))
print( "Vco= {0:.5f}+{1:.5f}i".format(Vco.real, Vco.imag))
import math
#initialisation of variables
Ia=complex(500,150) # Line current in phase a
Ib=complex(100,-600) # Line current in phase b
Ic=complex(-300,600) # Line current in phase c
#Calculations
L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))
Iao=(Ia+Ib+Ic)/3
Ia1=(Ia+Ib*L+(L**2)*Ic)/3
Ia2=(Ia+(L**2)*Ib +(L*Ic))/3
#Results
print( "Iao(amps)= {0:.5f}+{1:.5f}i".format(Iao.real, Iao.imag))
print( "Ia1(amps)= {0:.5f}+{1:.5f}i".format(Ia1.real, Ia1.imag))
print( "Ia2(amps)= {0:.5f}+{1:.5f}i".format(Ia2.real, Ia2.imag))
# Answer in the book is not correct.wrong calculation in the book
import math
#initialisation of variables
Ea=1.0
Z1=complex(0.25)
Z2=complex(.35)
Zo=complex(0.1)
Ia1=Ea/(Z1+Z2+Zo)
L=-complex(0.5,0.866)
Ia2=Ia1
Iao=Ia2
#Calculations
Ia=Ia1+Ia2+Iao
Ib=25*1000/((math.sqrt(3)*13.2))
If=Ib*abs(Ia)
Va1=Ea-(Ia1*Z1)
Va2=-Ia2*Z2
Va0=-Iao*Zo
Va=Va1+Va2+Va0
Vb1=(L**2)*Va1
Vb2=L*Va2
Vbo=Va0
Vco=Va0
Vc1=L*Va1
Vc2=(L**2)*Va2
Vb=Vb1+Vb2+Vbo
Vc=Vco+Vc1+Vc2
Vab=Va-Vb
Vac=Va-Vc
Vbc=Vb-Vc
vab=(13.2*abs(Vab))/math.sqrt(3)
vac=(13.2*abs(Vac))/math.sqrt(3)
vbc=(13.2*abs(Vbc))/math.sqrt(3)
#Results
print("fault current (amps)= %.2f" %If)#Answer don't match due to difference in rounding off of digits
print("Vab(kV)= {0:.5f}+{1:.5f}i" .format(Vab.real, Vab.imag)) #Answer don't match due to difference in rounding off of digits
print("Vac(kV)= {0:.5f}+{1:.5f}i" .format(Vac.real, Vac.imag)) #Answer don't match due to difference in rounding off of digits
print("Vbc(kV)= {0:.5f}+{1:.5f}i" .format(Vbc.real, Vbc.imag)) #Answer don't match due to difference in rounding off of digits
import math
#initialisation of variables
Ea=1.0
L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))
Z1=complex(0.25)
Z2=complex(0.35)
Ia1=Ea/(Z1+Z2)
Ia2=-Ia1
Iao=0
#Calculations
Ib1=(L**2)*Ia1
Ib2=L*Ia2
Ibo=0
Ib=Ib1+Ib2 +Ibo
Iba=1093
If=Iba*abs(Ib)
Va1=Ea-(Ia1*Z1)
Va2=-Ia2*Z2
Vao=0
Va=Va1+Va2+Vao
Vb=(L**2)*Va1+L*Va2
Vc=Vb
Vab=Va-Vb
Vac=Va-Vc
Vbc=Vb-Vc
#Results
vab=(abs(Vab)*13.2)/math.sqrt(3)
vbc=(abs(Vbc)*13.2)/math.sqrt(3)
vac=(abs(Vac)*13.2)/math.sqrt(3)
print("fault current (amps)= %.2f" %If)#Answer don't match due to difference in rounding off of digits
print("Vab(kV)= {0:.5f}+{1:.5f}i" .format(vab.real, vab.imag)) #Answer don't match due to difference in rounding off of digits
print("Vac(kV)= {0:.5f}+{1:.5f}i" .format(vac.real, vac.imag)) #Answer don't match due to difference in rounding off of digits
print("Vbc(kV)= {0:.5f}+{1:.5f}i" .format(vbc.real, vbc.imag)) #Answer don't match due to difference in rounding off of digits
import math
#initialisation of variables
Ea=complex(1,0)
Zo=complex(0.1)
Z1=complex(0.25)
Z2=complex(0.35)
#Calculations
Ia1=Ea/(Z1+(Zo*Z2/(Zo+Z2)))
Va1=Ea-Ia1*Z1
Va2=Va1
Vao=Va2
Ia2=-Va2/Z2
Iao=-Vao/Zo
I=Ia2+Iao
If=3*Iao # fault current
Ib=1093 # base current
Ifl=abs(If*Ib)
print("fault current (amps)= %.2f" %Ifl) #Answer don't match due to difference in rounding off of digits
Va=3*Va1
Vb=0
Vc=0
Vab=abs(Va)*13.2/math.sqrt(3)
Vac=abs(Va)*13.2/math.sqrt(3)
Vbc=abs(Vb)*13.2/math.sqrt(3)
#Results
print("Vab(kV)= {0:.5f}+{1:.5f}i" .format(Vab.real, Vab.imag))
print("Vac(kV)= {0:.5f}+{1:.5f}i" .format(Vac.real, Vac.imag))
print("Vbc(kV)= {0:.5f}+{1:.5f}i" .format(Vbc.real, Vbc.imag))
import math
#initialisation of variables
Vbl=13.8*115/13.2 # base voltage on the line side of transformer(kV)
Vbm=120*13.2/115 # base voltage on the motor side of transformer(kV)
Xt=10*((13.2/13.8)**2)*30/35.0 # percent reactance of transformer
Xm=20*((12.5/13.8)**2)*30.0/20 # percent reactance of motor
Xl=80*30*100.0/(120.0*120) #percent reactance of line
Xn=2*3*30*100/(13.8*13.8) # neutral reactance
Xz=200*30*100.0/(120.0*120)
#Calculations
Zn=complex(0.146) # negative sequence impedence
Zo=.06767 # zero sequence impedence
Z=complex(0.3596) #total impedence
Ia1=1.0/Z
Ia2=Ia1
Iao=Ia2
If1=3*Ia1
Ib=30*1000/(math.sqrt(3)*13.8)
Ibl=30*1000/(math.sqrt(3)*120)
Ifc=Ibl*abs(If1)
Z1=complex(0.146)
Z2=Z1
IA1=1.0/(Z1+Z2)
IA2=-IA1
L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))
IAo=0
IB=(L**2)*IA1 + L*IA2
IC=-IB
IF=abs(IB)*Ibl
Zo=complex(0.06767)
ia1=1/(Z1+(Zo*Z2/(Zo+Z2)))
ia2=ia1*Zo/(Z2+Zo)
iao=complex(3.553)
If2=3*iao
IF2=abs(If2*Ibl)
#Results
print("Fault Current (i)L-G fault, If=%.0f amps " %Ifc)
print("(ii)L-L fault ,If=%.1f amps" %IF)
print("(iii)L-L-G, If =%.0f amps" %IF2)
import math
#initialisation of variables
vx=3.0 # percent reactance of the series element
sinr=0.6
#Calculations
V=vx*sinr
#Results
print("Percent drop of volts=%.1f percent" %V)
import math
#initialisation of variables
Sb=8.0 # Base MVA
#Calculations
Zeq=(complex(0.15))*(complex(0.315))/(complex(0.465))
Scc=abs(Sb/Zeq)
#Results
print("short circuit capacity=%.2f MVA" %Scc)
import math
#initialisation of variables
X=1200*100.0/800 # percent reactance of other generating station
Xc=0.5*1200/(11.0*11)
#Calculations
Sc=1200*100.0/86.59 # short circuit MVA of the bus
Xf=119.84 # equivalent fault impedence between F and neutral bus
MVA=1200*100.0/Xf
#Results
print("short circuit capacity of each station=%.0f MVA" %MVA)
import math
#initialisation of variables
Sb=100.0 # base power (MVA)
#Calculations
SC=Sb/0.14
#Results
print("S.C. MVA =%.2f MVA " %SC)
import math
#initialisation of variables
Ib=50*1000.0/(math.sqrt(3.0)*13.2)# base current (amps.)
Vf=12.5/13.5 # the Prefault Voltage (p.u)
Xf=(complex(0.3))*(complex(0.2))/(complex(0.5)) # Fault impedence(p.u)
#Calculations
If=0.9469/(Xf) #Fault current (p.u)
Ifl=30*1000.0/((math.sqrt(3)*12.5*.8)) #full load current (amps)
Il=1732*(complex(math.cos(math.radians(36.8)),math.sin(math.radians(36.8))))/2186.0 #load current(p.u)
Ifm=3*(If)/5.0 # fault current supplied by motor (p.u)
Ifg=2*(If)/5.0 # fault current supplied by generator (p.u)
Ig=abs(Ifg +Il) #Net current supplied by generator during fault(p.u)
Im=abs(Ifm-Il) #Net current supplied by motor during fault(p.u)
Igf=Ig*2186
Imf=Im*2186
Ifc=2186*If
#Results
print("Fault current from the generator =%.3f amps" %Igf)
print("Fault current from the motor =%.3f amps" %Imf)
print("Fault current (amps) = {0:.5f}+{1:.5f}i" .format(Ifc.real, Ifc.imag))
import math
#initialisation of variables
Sb=75.0 # Base MVA
#Calculations
Xpu=0.15*Sb/15.0 # p.u reactance of the generator
Xt=complex(-0.08) #p.u reactanceof the transformer
X=9.75/112.0
Xa=X*33*33/75.0
#Results
print("The reactance of the reactor =%.3f ohms" %Xa)
import math
#initialisation of variables
Z1eq= complex((((8+5)*(8+5+12.0))/(100.0*(13+25))))
Z2eq=Z1eq
Zoeq=complex((5*45)*(10^-2)/(5+45))
Ea=1
#Calculations
Ia1=Ea/(Z1eq+ ((Zoeq*Z2eq)/(Zoeq+Z2eq)))
Ia2=(-Ia1*Zoeq)/(Zoeq+Z2eq)
Iao=(-Ia1*Z2eq)/(Zoeq+Z2eq)
Va1=Ea-(Ia1*Z1eq)
Va2=-Ia2*Z2eq
Vao=Va2
Ia=0
Ib=complex(-0.5 ,0.866)*Ia1 + (complex(-0.5,0.866)*Ia2) + Iao
Ic=complex(-0.5 ,0.866)*Ia1 + complex(-0.5 ,0.866)*Ia2 + Iao
ia1=Ia1*25/38
IA1=complex(ia1)
ia2=Ia2*25/38
IA2=complex(-ia2)
IA=IA1 + IA2
IB=IA1*complex(-0.5 ,0.866) + IA2*complex(-0.5 ,0.866)
IC=IA1*complex(-0.5 ,0.866) + IA2*complex(-0.5 ,0.866)
Va=Va1+Va2+Vao
Vb=0
Vc=0
Vab=.2564-Vb
Vbc=Vb-Vc
Vca=Vc-.2564
VA1=Ea-IA1*complex(.05)
VA2=-IA2*complex(0.05)
VA=VA1+VA2
VB=((complex(-0.5 ,0.866)*VA1) +(complex(-0.5 ,0.866)*VA2))
VC=VA1*complex(-0.5 ,0.866) + VA2*complex(-0.5 ,0.866)
VAB=VA-VB
VBC=VB-VC
VCA=VC-VA
#Results
#Answers don't match due to difference in rounding off of digits
print("fault currents ,Ia= %.2f" %Ia)
print("Ib= {0:.5f}+{1:.5f}i" .format(Ib.real, Ib.imag))
print("Ic= {0:.5f}+{1:.5f}i" .format(Ic.real, Ic.imag)) #Calculation in book is wrong.
print("IA= {0:.5f}+{1:.5f}i" .format(IA.real, IA.imag))
print("IB= {0:.5f}+{1:.5f}i" .format(IB.real, IB.imag))
print("IC= {0:.5f}+{1:.5f}i" .format(IC.real, IC.imag))
print("Voltages at fault point")
print("Vab(p.u)= %.2f" %Vab)
print("Vbc(p.u)= %.2f" %Vbc)
print("Vca(p.u)= %.2f" %Vca)
print("VAB= {0:.5f}+{1:.5f}i" .format(VAB.real, VAB.imag))
print("VBC= {0:.5f}+{1:.5f}i" .format(VBC.real, VBC.imag))
print("VCA= {0:.5f}+{1:.5f}i" .format(VCA.real, VCA.imag))
import math
#initialisation of variables
Ia1=complex(-0.8,-2.6) + complex(0.8,-0.4)
Ia2=complex(-3)
Iao=complex(-3)
A=complex(-0.8,-2.6) + complex(0.8,2)
a=.8
b=.6
#Calculations
Ipf=complex(a,b)
Isfc=3*Ia1
iA1=complex(0.8,-4)
iA2=complex(-1)
iAo=0
IA1=complex(iA1)
IA2=complex(-iA2)
IA=IA1 + IA2
L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))
IB=(L**2)*IA1 + IA2*L
IC=(L**2)*IA2 + IA1*L
#Results
print("(i) pre- fault current in line a = {0:.5f}+{1:.5f}i" .format(Ipf.real, Ipf.imag))
print("(ii) the subtransient fault current in p.u= {0:.5f}+{1:.5f}i" .format(Isfc.real, Isfc.imag))
print("IA= {0:.5f}+{1:.5f}i" .format(IA.real, IA.imag))
print("IB= {0:.5f}+{1:.5f}i" .format(IB.real, IB.imag))
print("IC= {0:.5f}+{1:.5f}i" .format(IC.real, IC.imag))
import math
#initialisation of variables
S_C_MVA=0.5/.05
#Results
print("S.C.MVA=%.2f MVA" %S_C_MVA)
import math
#initialisation of variables
vab=2000.0
vbc=2800.0
vca=2500.0
vb=2500.0 # base voltage (V)
#Calculations
Vab=vab/vb # per unit voltages
Vbc=vbc/vb
Vca=vca/vb
a=math.degrees(math.acos(((1.12**2)-((.8**2)+1))/(2*.8)))
b=136.11348
Vlab=Vab*complex(math.cos(math.radians(76.06)),math.sin(math.radians(76.06))) # line voltage
Vlca=Vca*complex(math.cos(math.radians(180)),math.sin(math.radians(180))) # line voltage
Vlbc=Vbc*complex(math.cos(math.radians(-43.9)),math.sin(math.radians(-43.9)))# line voltage
L=1*complex(math.cos(math.radians(120)),math.sin(math.radians(120)))
Vab1=(Vlab +(L*Vlbc) + ((L**2)*Vlca))/3.0 # symmetrical component of line voltage
Vab2=(Vlab +(L*Vlca) + ((L**2)*Vlbc))/3.0 # symmetrical component of line voltage
Vabo=0# symmetrical component of line voltage
Van1=Vab1*complex(math.cos(math.radians(-30)),math.sin(math.radians(-30)))
Van2=Vab2*complex(math.cos(math.radians(30)),math.sin(math.radians(30)))
Ia1=Van1/(1*complex(math.cos(math.radians(0)),math.sin(math.radians(0))))
Ia2=Van2/(1*complex(math.cos(math.radians(0)),math.sin(math.radians(0))))
VA1=complex(-Van1)
VA2=complex(Van2)
VA=VA1+ VA2
VB1=(L**2)*VA1
VB2=(L)*VA2
VB=VB1 + VB2
VC2=(L**2)*VA2
VC1=(L)*VA1
VC=VC1 + VC2
VAB=VA-VB
VBC=VB-VC
VCA=VC-VA
IA=VA
IB=VB
IC=VC
phase_IA=math.degrees(math.atan(IA.imag/IA.real))
phase_IB=math.degrees(math.atan(IB.imag/IB.real))
phase_IC=math.degrees(math.atan(IC.imag/IC.real))
#Results
print("VAB= {0:.5f}+{1:.5f}i" .format(VAB.real, VAB.imag))
print("VBC= {0:.5f}+{1:.5f}i" .format(VBC.real, VBC.imag))
print("VCA= {0:.5f}+{1:.5f}i" .format(VCA.real, VCA.imag))
print("IA(p.u)=%.2f at an agle of %.1f" %(abs(IA),phase_IA))
print("IB(p.u)=%.2f at an agle of %.1f" %(abs(IB),phase_IB))
print("IC(p.u)=%.2f at an agle of %.1f" %(abs(IC),phase_IC))