#Variable declaration
R_1 = 60.0 #Surge impedance of underground cable(ohm)
R_2 = 400.0 #Surge impedance of overhead line(ohm)
e = 100.0 #Maximum value of surge(kV)
#Calculation
i = e*1000/R_1 #Current(A)
k = (R_2-R_1)/(R_2+R_1)
e_ref = k*e #Reflected voltage(kV)
e_trans = e+e_ref #Transmitted voltage(kV)
e_trans_alt = (1+k)*e #Transmitted voltage(kV). Alternative method
i_ref = -k*i #Reflected current(A)
i_trans = e_trans*1000/R_2 #Transmitted current(A)
i_trans_alt = (1-k)*i #Transmitted current(A). Alternative method
#Result
print('Reflected voltage at the junction = %.f kV' %e_ref)
print('Transmitted voltage at the junction = %.f kV' %e_trans)
print('Reflected current at the junction = %.f A' %i_ref)
print('Transmitted current at the junction = %.f A' %i_trans)
#Variable declaration
R_A = 500.0 #Surge impedance of line A(ohm)
R_B = 70.0 #Surge impedance of line B(ohm)
R_C = 600.0 #Surge impedance of line C(ohm)
e = 20.0 #Rectangular voltage wave(kV)
#Calculation
E_2 = e*(1+((R_B-R_A)/(R_B+R_A))) #Transmitted wave(kV)
E_4 = E_2*(1+((R_C-R_B)/(R_C+R_B))) #First voltage impressed on C(kV)
E_3 = E_2*(R_C-R_B)/(R_C+R_B) #Reflected wave(kV)
E_5 = E_3*(R_A-R_B)/(R_A+R_B) #Reflected wave(kV)
E_6 = E_5*(1+((R_C-R_B)/(R_C+R_B))) #Transmitted wave(kV)
second = E_4+E_6 #Second voltage impressed on C(kV)
#Result
print('First voltage impressed on C = %.1f kV' %E_4)
print('Second voltage impressed on C = %.1f kV' %second)
#Variable declaration
Z = 100.0 #Surge impedance of cable(ohm)
Z_1 = 600.0 #Surge impedance of open wire(ohm)
Z_2 = 1000.0 #Surge impedance of open wire(ohm)
e = 2.0 #Steep fronted voltage(kV)
#Calculation
Z_t = Z_1*Z_2/(Z_1+Z_2) #Resultant surge impedance(ohm)
E = e*(1+((Z_t-Z)/(Z_t+Z))) #Transmitted voltage(kV)
I_1 = E*1000/Z_1 #Current(A)
I_2 = E*1000/Z_2 #Current(A)
E_ref = e*(Z_t-Z)/(Z_t+Z) #Reflected voltage(kV)
I_ref = -E_ref*1000/Z #Reflected current(A)
#Result
print('Voltage in the cable = %.3f kV' %E)
print('Current in the cable, I_1 = %.2f A' %I_1)
print('Current in the cable, I_2 = %.3f A' %I_2)
print('Voltage in the open-wire lines i.e Reflected voltage = %.3f kV' %E_ref)
print('Current in the open-wire lines i.e Reflected current = %.2f A' %I_ref)
import cmath
from sympy import Symbol,solve,exp,diff
#Variable declaration
Z_c = 400.0 #Characteristic impedance(ohm)
Z = 400.0 #Characteristic impedance of each feeder(ohm)
Z_1 = 50.0 #Effective characteristic impedance(ohm)
t = Symbol('t')
V = 600*(exp(-0.4*t)-exp(-t)) #Voltage wave
#Calculation
Z_t = Z*Z/(Z+Z) #Resultant surge impedance(ohm)
E_A = 1+((Z_t-Z)/(Z_t+Z)) #Voltage transmitted at A in terms of V
E_B = E_A*(1+((Z_1-Z)/(Z_1+Z))) #Voltage transmitted at B or C in terms of V
v = diff(600*(exp(-0.4*t)-exp(-t)), t) #Differentiating to obtain maximum voltage
sol = solve(v,t) #Value of time(sec)
time = sol[0] #Only one value satisfies(sec)
V_max = E_B*600*(exp(-0.4*time)-exp(-time)) #Maximum voltage(kV)
#Result
print('Maximum voltage which appear across the feeder end of winding of each transformer = %.1f kV' %V_max)