import math
#initialisation of variables
D_12 = 23.8
D_23 = 23.8
D_31 = 47.6 #in ft
l = 230.0 #in mi
f = 60 #in Hz
P = 125e6 #in W
V = 215e3 #in V
#Calculations
D_eq = (D_12 * D_23 * D_31)**(1.0/3)
#From Table A.1 and A.2 for 30ft Rook
#z = R + i(Xa + Xd)
z = complex(0.1603,(0.415+0.4127))
#From Table A.1 and A.3 for 30ft Rook
y = complex(1e-6 / ( 0.0950 + 0.1008))
#Calculations
yl = 0.0455806 + complex(0.4750793)
Z_c = 404.43706 - complex(38.802997)
V_r = V / math.sqrt(3)
I_r = P / (math.sqrt(3)*V)
print(" Sending end voltage= {0:.2f}+{1:.2f}i".format(yl.real, yl.imag))
math.cosh_yl = math.cosh(yl.real) * math.cos(yl.imag) + complex(math.sinh(yl.real)) * math.sin(yl.imag)
math.sinh_yl = math.sinh(yl.real) * math.cos(yl.imag) + complex(math.cosh(yl.real)) * math.sin(yl.imag)
V_s = V_r * math.cosh_yl + I_r * Z_c * math.sinh_yl
I_s = I_r * math.cosh_yl + V_r * math.sinh_yl / Z_c
print( "Sending end voltage = {0:.2f}".format(abs(V_s.real)))
print("Angle = %.2f V " %(math.degrees(math.atan2(V_s.imag,V_s.real))))
print( "Sending end voltage = {0:.2f}".format(abs(I_s.real)))
print("Angle = %.2f V " %(math.degrees(math.atan2(I_s.imag,I_s.real))))
Line_voltage = math.sqrt(3) * abs(V_s) / 1000.0
Line_current = abs(I_s)
Power_factor = math.cos(math.atan2(V_s.imag,V_s.real) - math.atan2(I_s.imag,I_s.real))
Power = math.sqrt(3) * Line_voltage * Line_current * Power_factor
#Results
print(" Sending end line voltage = %.1f kV " %Line_voltage)
print(" Sending end line current = %.1f A " %Line_current)
print(" Sending end power = %.0f kW " %Power)
voltage_regulation = (((abs(V_s)/abs(math.cosh_yl)) - V_r)/V_r)*100
print(" Voltage Regulation = %.1f percent " %voltage_regulation)
B = 0.0020656
y1 = 2 * math.pi / B
Velocity = f * y1
print(" Wavelength = %.0f mi " %y1)
print(" Velocity = %.0f mi/s " %Velocity)
import math
#initialisation of variables
l = 230.0 #in mi
f = 60.0 #in Hz
P = 125e6 #in W
V = 215e3 #in V
#From Table A.1 and A.2 for 30ft Rook
#z = R + i(Xa + Xd)
z = 0.1603 + complex(0.415+0.4127)
#From Table A.1 and A.3 for 30ft Rook
y = complex(1e-6 / ( 0.0950 + 0.1008))
#Calculations
yl = 0.0455806 + complex(0.4750793)
Z_c = 404.43706 - complex(38.802997)
V_r = V / math.sqrt(3)
I_r = P / (math.sqrt(3)*V)
math.cosh_yl = math.cosh(yl.real) * math.cos(yl.imag) + complex(math.sinh(yl.real)) * math.sin(yl.imag)
math.sinh_yl = math.sinh(yl.real) * math.cos(yl.imag) + complex(math.cosh(yl.real)) * math.sin(yl.imag)
#Per Unit calculations
Base_impedance = V**2 / P
Base_current = P / (math.sqrt(3)*V)
Z_c_pu = Z_c / Base_impedance
V_r_pu = (V / math.sqrt(3)) / (V / math.sqrt(3))
I_r_pu = (P / (math.sqrt(3)*V)) / Base_current
V_s_pu = V_r_pu * math.cosh_yl + I_r_pu * Z_c_pu * math.sinh_yl
I_s_pu = I_r_pu * math.cosh_yl + V_r_pu * math.sinh_yl / Z_c_pu
Line_voltage = abs(V_s_pu)*V / 1000
Line_current = abs(I_s_pu)*Base_current
#Results
print(" Sending end line voltage = %.1f V " %Line_voltage)
print(" Sending end line current = %.1f A " %Line_current)
import math
#initialisation of variables
l = 230 #in mi
f = 60 #in Hz
P = 125e6 #in W
V = 215e3 #in V
#From Table A.1 and A.2 for 30ft Rook
#z = R + complex(Xa + Xd)
z = 0.1603 + complex(0.415+0.4127)
#From Table A.1 and A.3 for 30ft Rook
y = complex(1e-6 / ( 0.0950 + 0.1008))
#Calculations
yl = 0.0455806 + complex(0.4750793)
Z_c = 404.43706 - complex(38.802997)
cosh_yl = math.cosh(yl.real) * math.cos(yl.imag) + complex(math.sinh(yl.real)) * math.sin(yl.imag)
sinh_yl = math.sinh(yl.real) * math.cos(yl.imag) + complex(math.cosh(yl.real)) * math.sin(yl.imag)
#Equivalent pi circuit
Z1 = Z_c * sinh_yl
Y1_2 = (cosh_yl - 1)/(Z_c * sinh_yl)
#Results
print('Equivalent PI circuit')
print( "Total series impedance of the line = {0:.2f}".format(abs(Z1.real)))
print("Angle = %.2f ohm in series arm " %(math.degrees(math.atan2(Z1.imag,Z1.real))))
print( "Total Shunt admittance of the line = {0:.2f}".format(abs(Y1_2.real)))
print("Angle = %.2f ohm in each shunt arm " %(math.degrees(math.atan2(Y1_2.imag,Y1_2.real))))
#Nominal pi Circuit
Z = l * z
Y_2 = y * l/2
print('Nominal PI circuit')
print( "Total series impedance of the line = {0:.2f}".format(abs(Z.real)))
print("Angle = %.2f ohm in series arm " %(math.degrees(math.atan2(Z.imag,Z.real))))
print( "Total Shunt admittance of the line = {0:.2f}".format(abs(Y_2.real)))
print("Angle = %.2f ohm in each shunt arm " %(math.degrees(math.atan2(Y_2.imag,Y_2.real))))
zp = ((abs(Z)-abs(Z1))/abs(Z1))*100
yp = ((abs(Y_2)-abs(Y1_2))/abs(Y1_2))*100
print(" Line impedace of the series arm of the nominal pi exceeds that of equivalent pi by %.1f percent " %zp)
print(" Conductance of the shunt arms of the nominal pi is %.0f percent less than that of equivalent pi " %abs(yp))
import math
#initialisation of variables
l = 230.0 #in mi
f = 60.0 #in Hz
P = 125e6 #in W
V = 215e3 #in V
#From Table A.1 and A.2 for 30ft Rook
#z = R + i(Xa + Xd)
z = 0.1603 + complex(0.415+0.4127)
#From Table A.1 and A.3 for 30ft Rook
y =complex(1e-6 / ( 0.0950 + 0.1008))
#Calculations
yl = 0.0455806 + complex(0.4750793)
Z_c = 404.43706 - complex(38.802997)
cosh_yl = math.cosh(yl.real) * math.cos(yl.imag) + complex(math.sinh(yl.real)) * math.sin(yl.imag)
sinh_yl = math.sinh(yl.real)*math.cos(yl.imag) + complex(math.cosh(yl.real)) * math.sin(yl.imag)
#Equivalent pi circuit
Z1 = Z_c * sinh_yl
Y1_2 = (math.cosh_yl - 1)/(Z_c * sinh_yl)
A = cosh_yl
D = cosh_yl
B = Z1
C = sinh_yl / Z_c
print('For an uncompensated line')
print( "A = D = {0:.2f}".format(abs(A.real)))
print("Angle = %.2f v " %(math.degrees(math.atan2(A.imag,A.real))*180/math.pi))
print( "B = {0:.2f}".format(abs(B.real)))
print("Angle = %.2f ohm " %(math.degrees(math.atan2(B.imag,B.real))*180/math.pi))
print( "C = {0:.2f}".format(abs(C.real)))
print("Angle = %.2f ohm " %(math.degrees(math.atan2(C.imag,C.real))*180/math.pi))
#For a series compensation factor of 70%
cf = 0.7
B1 = Z1 - complex(cf) * l * (0.415 + 0.4127) #X_a = 0.415 ohm/mi,X_d = 0.4127 in
A1 = B1 * Y1_2 + 1
C1 = 2 * Y1_2 + B1 * (Y1_2)**2
#Results
print('For a series compensation factor of 70%')
print( "A = D = {0:.2f}".format(abs(A1.real)))
print("Angle = %.2f " %(math.degrees(math.atan2(A1.imag,A1.real))))
print( "B = {0:.2f}".format(abs(B1.real)))
print("Angle = %.2f ohm " %(math.degrees(math.atan2(B1.imag,B1.real))))
print( "C = {0:.2f}".format(abs(C1.real)))
print("Angle = %.2f ohm " %(math.degrees(math.atan2(C1.imag,C1.real))))
import math
#initialisation of variables
l = 230.0 #in mi
f = 60.0 #in Hz
P = 125e6 #in W
V = 215e3 #in V
#From Table A.1 and A.2 for 30ft Rook
#z = R + i(Xa + Xd)
z = 0.1603 + complex(0.415+0.4127)
#From Table A.1 and A.3 for 30ft Rook
y = complex(1e-6 / ( 0.0950 + 0.1008))
#Calculations
yl = 0.0455806 + complex(0.4750793)
Z_c = 404.43706 - complex(38.802997)
V_r = V / math.sqrt(3)
I_r = P / (math.sqrt(3)*V)
cosh_yl = math.cosh(yl.real) * math.cos(yl.imag) + complex(math.sinh(yl.real)) * math.sin(yl.imag)
sinh_yl = math.sinh(yl.real) * math.cos(yl.imag) + complex(math.cosh(yl.real)) * math.sin(yl.imag)
V_s = V_r * cosh_yl + I_r * Z_c * sinh_yl
I_s = I_r * cosh_yl + V_r * sinh_yl / Z_c
#Equivalent pi circuit
Z1 = Z_c * sinh_yl
Y1_2 = (cosh_yl - 1)/(Z_c * sinh_yl)
#Total capacitive Susceptance
B_c = complex(y) * l
#For 70% Compensation
cf = 0.7
B_L = - B_c * 0.7
#From appendix
A = 1
D = 1
B = 0
C = -complex(B_L)
#From Table A.6 for combining two networks in series
A_eq = cosh_yl + Z1 * C
voltage_regulation = ((abs(V_s)/abs(A_eq))-V_r)*100.0/V_r
print(" Voltage regulation in percent ")
print(voltage_regulation)