import math
#initialisation of variables
R_dc = 0.01558 #in ohm per 1000 ft at 20 degree Celsius
R_ac = 0.0956 #in ohm per mi at 50 degree Celsius
A = 1113000 #in cmil
l = 1000.0 #in ft
p = 17 # $p$(rho) = 2.83e-8 ohm.m = 17 ohm.cmil per ft
#Calculations
#Verification of dc resistance
R_0_1 = p*l*1.02/A #1.02 is to account for 2\% increase in spiraling
print(" The dc resistance at 20 degree Celsius = %f ohm per 1000 ft" %R_0_1)
T = 228.0 #in degree Celsius
t1 = 50.0 #in degree Celsius
t2 = 20.0 #in degree Celsius
#to obtain dc resistance at 50 degree celsius
R0 = R_0_1 * (T + t1)/(T + t2)
print(" The dc resistance at 50 degree Celsius = %f ohm per 1000 ft " %R0)
R = R_ac / 5.280e3 #to convert ohm per mi to ohm per ft,ac resistance
R_0 = R0 / 1000.0 #to convert ohm per 1000 ft to ohm per ft,dc resistance
#Results
# to calculate ratio of ac to dc resistance
print(" Ratio of ac to dc resistance = %.3f " %(R / R_0))
print(" Skin effect causes a %.1f increase in resistance."%(((R/R_0)-1)*100))
import math
#initialisation of variables
r_x = 0.25e-2 #radius of circuit in m,composed of 3 wires a,b,c
r_y = 0.50e-2 #radius of return circuit in m,composed of 2 wires d,e
d_c = 9.0 #distance between the two circuits
d_w = 6.0 #distance between wires of same circuit
#Calculations
#To find GMD between sides X and Y
D_ad = d_c
D_be = D_ad
D_ae = math.sqrt(d_w**2+d_c**2)
D_bd = D_ae
D_ce = D_ae
D_cd = math.sqrt(d_c**2+(2*d_w)**2)
#GMD is given by
D_m = (D_ad * D_ae * D_bd * D_be * D_cd * D_ce)**(1.0/6)
print(" The GMD between the sides X and Y = %.3f m " %D_m)
#To find GMR for the side X
D_aa = r_x * 0.7788#multiplication by 0.7788 to adjust the radiuss
#in order to account for internal flux
D_ab = d_w
D_ac = 2 * d_w
D_ba = d_w
D_bb = D_aa
D_bc = D_ab
D_ca = D_ac
D_cb = D_ab
D_cc = D_aa
#GMR for side X
D_s_x = (D_aa * D_ab * D_ac * D_ba * D_bb * D_bc * D_ca * D_cb * D_cc)**(1/9)
print(" The GMR for side X = %.3f m " %D_s_x)
#To find GMR for the side Y
D_dd = r_y * 0.7788
D_de = d_w
D_ee = D_dd
D_ed = D_de
#GMR for side Y
D_s_y = (D_dd * D_de * D_ee * D_ed)**(1/4)
print(" The GMR for side Y = %.3f m " %D_s_y)
#Inductance
L_x = 2e-7 *math.log(D_m / D_s_x)
L_y = 2e-7 *math.log(D_m / D_s_y)
L = L_x + L_y
#Results
print(" Inductance of side X = %.3fe-7 H/m " %(L_x*10**7))
print(" Inductance of side Y = %.3fe-7 H/m " %(L_y*10**7))
print(" Inductance of Complete line = %.3fe-7 H/m" %(L*10**7))
print(" = %.2f mH/mi " %(L*1609e3))
import math
#initialisation of variables
f = 60.0 #in Hz
D_m = 20.0 #in ft
#Inductive Reactance with D_s known
D_s = 0.0217 #in ft from Table A(appendix).1
X_L = 2.022e-3*f*math.log(D_m/D_s)
print('With GMR known')
print("Inductive Reactance for one conductor,XL = %.3f ohm/mi " %X_L)
#Calculations
#Inductive Reactance with D_s not known
print('With GMR not known')
X_a = 0.465 #inductive reactance at 1 ft spacingin ohm per mi from Table A.1
X_d = 0.3635 #inductive reactance spacing factor in ohm per mi from Table A.1
#Results
print(" Inductive reactance of one conductor = %.4f ohm/mi " %(X_a + X_d))
print('Since conductors composing the two lines are identical')
XL = 2 * (X_a + X_d)
print(" Inductive reactance,XL = %.3f ohm/mi " %(XL))
import math
#initialisation of variables
#Given Values
D_12 = 20.0
D_23 = D_12
D_31 = 38.0
#in ft
f=60.0 #frequency in Hz
#From Table A.1
D_s = 0.0373 #in ft
X_a = 0.399 #inductive reactance at 1 ft spacing in ohm/mi
X_d = 0.389 #inductive reactance spacing factor in ohm/mi for 24.8ft
#Calculations
D_eq =(D_12*D_23*D_31)**(1.0/3)
L = 2e-7 * math.log(D_eq/D_s)*10**7
X_L=2*math.pi*f*L*10**-7*1609.0 #multiplication by 1609 to convert to ohm/mi
#Results
print("Inductance = %.4fe-7 H/m " %L)
print("Inductive reactance = %.4f ohm/mi/phase" %X_L)
X_L1 = X_a + X_d
print("Inductive reactance from Xa and Xd = %.4f ohm/mi/phase " %X_L1)
import math
#initialisation of variables
d = 0.45 #in m
l = 160.0 #in km
d_12 = 8.0
d_23 = 8.0
d_31 = 16 #in m
f = 60#in Hz
P = 100#in MVA
V = 345#in kV
#From Table A1
D_s = 0.0466#in ft
#Calculations
D_b_s = math.sqrt(D_s * 0.3048 * d)#multiplicqation by 0.3048 is to convert D_s
#from ft to m
D_eq=(d_12*d_23*d_31)**(1/3)
X_L=2*math.pi*f*2e-7*10**3*math.log(D_eq/D_b_s) #10^3 to get ohm/km
#To find per unit series reactance
Z = V**2/P #Base Impedance
X = X_L*l/Z #per unit series reactance
#Results
print(" Inductive reactance = %.3f ohm/km/phase " %X_L)
print(" Base Impedance = %.0f ohm " %Z)
print(" Per unit series resistance of the line = %.3f per unit " %X)
import math
#initialisation of variables
f = 60.0 #in Hz
#From Table A.1
D_s = 0.0229 #in ft
#Distances from given figure 3.15
d_a_c = 18.0
d_c_a = d_a_c
d_b_b = 21.0
d = 10.0 #distance between conductors
d_a_b = math.sqrt(d**2 + (d_b_b - 19.5)**2)
d_a_b1 = math.sqrt(d**2 + (d_b_b - 1.5)**2)
d_aa1_actual = math.sqrt((d * 2)**2 + d_a_c**2)
d_bb1_actual = d_b_b
d_cc1_actual = d_aa1_actual
d_aa1_pos = math.sqrt(d_aa1_actual * D_s)
d_bb1_pos = math.sqrt(d_bb1_actual * D_s)
d_cc1_pos = math.sqrt(d_cc1_actual * D_s)
#Calculations
#GMD's between phases
D_p_ab = ((d_a_b * d_a_b1)**(2*1.0/4))#in ft
D_p_bc = D_p_ab
D_p_ca = (((d*2) * d_c_a)**(2*1.0/4))#in ft
D_eq = (D_p_ab * D_p_bc * D_p_ca)**(1.0/3)#in ft
print(" Equivalent GMD = %.1f ft "%D_eq)
#GMR
D_p_s = (d_aa1_pos * d_bb1_pos * d_cc1_pos)**(1.0/3)
print(" GMR = %.3f ft " %D_p_s)
#Inductance
L = 2e-7*math.log(D_eq/D_p_s)
X_L = 2*math.pi*f*L*1609 #multiplication by 1609 is to convert to ohm/mi
#Results
print(" The Inductive reactance = %.3f ohm/mi/phase " %X_L)