import math
#initialisation of variables
P_g1 = 50e6
V_g1 = 13.8e3
P_g2 = 25e6
V_g2 = 13.8e3
P_t = 75e6
V_t_lt = 13.8e3
V_t_ht = 69e3
X11_g = 0.25
X11_t = 0.10
Vbase = 69e3
Pbase = 75e6
Vbase_lt = 13.8e3
V_ht = 66e3
def pucalc(pu_Z_given,base_kV_given,base_kV_new,base_kVA_new,base_kVA_given):
X11=(pu_Z_given * (base_kV_given/base_kV_new)**2 * (base_kVA_new/base_kVA_given));
return X11
#Calculations
X11_d_g1 = pucalc(X11_g,V_t_lt,Vbase_lt,Pbase,P_g1)
X11_d_g2 = pucalc(X11_g,V_t_lt,Vbase_lt,Pbase,P_g2)
E_g1 = V_ht / Vbase
E_g2 = V_ht / Vbase
print('For Generator 1')
print("Xd11 = %.3f per unit \n Eg1 = %.3f per unit \n" %(X11_d_g1,E_g1))
print('For Generator 2')
print("Xd11 = %.3f per unit \n Eg2 = %.3f per unit \n" %(X11_d_g2,E_g2))
X_g12 = (X11_d_g1 * X11_d_g2) / (X11_d_g1 + X11_d_g2)
I11 = E_g1 / (complex(X_g12 + X11_t))
print('Subtransient current in the short circuit in per unit is= {0:.2f}+{1:.2f}i'.format(I11.real, I11.imag))
Vdt = I11 * complex(X11_t)
print('Voltage on the delta side of the transformer in per unit is')
print(Vdt)
I11_g1 = (E_g1 - Vdt) / complex(X11_d_g1)
I11_g2 = (E_g2 - Vdt) / complex(X11_d_g2)
print('Subtransient current in generator 1 and 2 in per unit respectively')
print(I11_g1)
print(I11_g2)
Ibase = Pbase / (math.sqrt(3) * Vbase_lt)
I11_1 = abs(I11_g1) * Ibase
I11_2 = abs(I11_g2) * Ibase
#Results
print('Subtransient current in generator 1 and 2 in Amperes respectively')
print(I11_1)
print(I11_2)
import math
#initialisation of variables
Pgm = 30e6
Vgm = 13.2e3
Xgm = 0.20
Xl = 0.10
Pm = 20e6
pfm = 0.8
Vt_m = 12.8e3
Pbase = Pgm
Vbase = Vgm
#Calculations
Vf = Vt_m / Vbase
Ibase = Pbase / (math.sqrt(3) * Vbase)
I_L = (Pm / (pfm * math.sqrt(3) * Vt_m)) * complex(math.cos(36.9 * math.pi/180),math.sin(36.9 * math.pi / 180)) / Ibase
print('Line Current in per unit is = {0:.2f}+{1:.2f}i'.format(I_L.real, I_L.imag))
Vt_g = Vf + complex(Xl) * I_L
E11_g = Vt_g + complex(Xgm) * I_L
I11_g = E11_g / complex(Xgm + Xl)
I11_gA = Ibase * I11_g
print('Fault current in the generator side in per unit = {0:.2f}+{1:.2f}i'.format(I11_g.real, I11_g.imag))
print('Fault current in the generator side in A= {0:.2f}+{1:.2f}i'.format(I11_gA.real, I11_gA.imag))
E11_m = Vf -complex(Xgm) * I_L
I11_m = E11_m / complex(Xgm)
I11_mA = Ibase * I11_m
print('Fault current in the motor side in per unit = {0:.2f}+{1:.2f}i'.format(I11_m.real, I11_m.imag))
print('Fault current in the motor side in A= {0:.2f}+{1:.2f}i'.format(I11_mA.real, I11_mA.imag))
If = I11_g + I11_m
If_Ib = If * Ibase
#Results
print('Toatl Fault current in per unit %If=%.2f')
print('Total Fault current in A= {0:.2f}+{1:.2f}i'.format(If_Ib.real, If_Ib.imag))
import math
#initialisation of variables
Pgm = 30e6
Vgm = 13.2e3
Xgm = 0.20
Xl = 0.10
Pm = 20e6
pfm = 0.8
Vt_m = 12.8e3
Pbase = Pgm
Vbase = Vgm
#Calculations
Vf = Vt_m / Vbase
Ibase = Pbase / (math.sqrt(3) * Vbase)
I_L = (Pm / (pfm * math.sqrt(3) * Vt_m)) * complex(math.cos(36.9 * math.pi/180),math.sin(36.9 * math.pi / 180)) / Ibase
Zth = (complex(Xgm+Xl) * (complex(Xgm))) / (complex(Xgm+Xl) + (complex(Xgm)))
print('Zth in per unit = {0:.2f}+{1:.2f}i'.format(Zth.real, Zth.imag))
I11_f = Vf / Zth
print('Subtransient fault current in per unit = {0:.2f}+{1:.2f}i'.format(I11_f.real, I11_f.imag))
If_g = I11_f * complex(Xgm) / (complex(Xgm+Xl) + complex(Xgm))
If_m = I11_f * (complex(Xgm + Xl)) / (complex(Xgm+Xl) + (complex(Xgm)))
I11_g = I_L + If_g
#Results
print('Subtransient fault current in generator side in per unit = {0:.2f}+{1:.2f}i'.format(I11_g.real, I11_g.imag))
I11_m = If_m - I_L
print('Subtransient fault current in motor side in per unit = {0:.2f}+{1:.2f}i'.format(I11_m.real, I11_m.imag))
import math
#initialisation of variables
Pg1 = 270e6
Pg3 = 225e6
Pbase = 100e6
V = 1
X = 0.3
Xg_b1 = X * Pbase /Pg1
Xg_b3 = X * Pbase /Pg3
y10 = 1 / complex(Xg_b1)
y30 = 1 / complex(Xg_b3)
y12 = 1 / complex(0.168)
y15 = 1 / complex(0.126)
y23 = 1 / complex(0.126)
y34 = 1 / complex(0.336)
y35 = 1 / complex(0.210)
y45 = 1 / complex(0.252)
#Ybus by inspection
Ybus = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]
Ybus[0][0] = y10 + y12 + y15
Ybus[1][1] = y12 + y23
Ybus[3][2] = y30 + y23 + y35 + y34
Ybus[3][3] = y34 + y45
Ybus[4][4] = y45 + y15 + y35
Ybus[0][1] = -y12
Ybus[1][0] = Ybus[0][1]
Ybus[0][2] = 0
Ybus[0][3] =0
Ybus[1][2] = -y23
Ybus[2][1] = Ybus[1][2]
Ybus[1][4] = 0
Ybus[1][3] =0
Ybus[2][3] = -y34
Ybus[3][2] = Ybus[2][3]
Ybus[2][0] = 0
Ybus[3][4] = -y45
Ybus[4][3] = Ybus[3][4]
Ybus[3][0] = 0
Ybus[3][1] = 0
Ybus[0][4] = -y15
Ybus[4][0] = Ybus[0][4]
Ybus[4][1] = 0
Ybus[2][4] = -y35
Ybus[4][2] = Ybus[2][4]
print('Ybus=')
print(Ybus)
I11 = V / Ybus[3][3]
print(I11,' The subtransient current in a three-phase fault on bus 4 in per unit is ')
V3 = V - I11 * Ybus[3][2]
V5 = V - I11 * Ybus[3][4]
print('Voltages at bus 3 and 5 repectively in per unit = {0:.2f}+{1:.2f}i'.format(V3.real, V3.imag))
print('and {0:.2f}+{1:.2f}i'.format(V5.real, V5.imag))
I3 = V3 * y34
I5 = V5 * y45
#Results
print('Currents to fault from bus 3 in per unit = {0:.2f}+{1:.2f}i'.format(I3.real, I3.imag))
print(I5,'Currents to fault from bus 5 in per unit')
print('Currents to fault from bus 5 in per unit = {0:.2f}+{1:.2f}i'.format(I5.real, I5.imag))
print('Total current to fault in per unit = {0:.2f}+{1:.2f}i'.format((I3.real+I5.real),(I3.imag+I5.imag)))
import math
#initialisation of variables
Pg = 25e6
Vg = 13.8e3
X11_dg = 0.15
X11_dm = 0.20
Pmbase = 5e6
Vbasem = 6.9e3
P_tr = 25e6
V_ht = 13.8e3
V_lt = 6.9e3
X_tr = 0.10
Vbus_m = 6.9e3
#Calculations
#the subtransient current in the fault
X11_dm1 = X11_dm * (P_tr / Pmbase)
Vf = 1.0
Xeqm = 1.0/(4*X11_dm1)
Xeq_trg = X11_dg + X_tr
Zth = Xeqm * Xeq_trg / (Xeqm + Xeq_trg)
I11_f = Vf / complex(Zth)
Ibase_vbus = P_tr / (math.sqrt(3) * Vbus_m)
I11_f_a = abs(I11_f) * Ibase_vbus
print(" Fault current in per unit = -j%.0f " %abs(I11_f.real))
print(" Fault current in amperes = %.0f " %I11_f_a)
#the subtransient current in breaker A
Ig_f = I11_f * Xeq_trg / (Xeqm + Xeq_trg)
Im_f = 0.25 * (I11_f - Ig_f)
I11_pu = Ig_f + 3 * Im_f
I11_a = I11_pu * Ibase_vbus
print(" Subtransient current through breaker A in per unit is -j%.0f " %abs(I11_pu))
print(" Subtransient current through breaker A in amperes is %.0f " %abs(I11_a))
#Symmetrical short-circuit interrupting current in the fault and in breaker A
X11_dm2 = 1.5 * X11_dm1
Xeqm1 = X11_dm2 / 4
Zth_c = (Xeqm1 * Xeq_trg) / (Xeqm1 + Xeq_trg)
Ig_f1 = Vf * Xeqm1 / (Zth_c * (Xeqm1 + Xeq_trg))
Im_f1 = (Vf * Xeq_trg) / (4 * Zth_c * (Xeqm1 + Xeq_trg))
I11_1pu = Ig_f1 + 3 * Im_f1
I11_1a = I11_1pu * Ibase_vbus
print('Symmetrical Short circuit current to be interrupted in A = %0.2f' %I11_1a)
I11_pu_cb = Ig_f1 + 4 * Im_f1
I11_a_cb = I11_pu_cb * Ibase_vbus
print('The short circuit current rating of breakers must be atleast(in amperes) = %0.2f' %I11_a_cb)
Vcb = 15.5e3
I_ic = 8900
k = 2.67
Iic = I_ic * k
Icb = Vcb * I_ic / Vbus_m
#Results
print("The required capability of %.0f A is well below 80 percent of %.0f A\n and the breaker is suitable with respect to the short-circuit current" %(abs(I11_a_cb),abs(Icb)))