#Variable declaration
L = 30.0 #Height of arrester located(m)
BIL = 650.0 #BIL(kV)
de_dt = 1000.0 #Rate of rising surge wave front(kV/µ-sec)
V = 132.0 #Transformer voltage at HV side(kV)
E_a = 400.0 #Discharge voltage of arrester(kV)
v = 3.0*10**8 #Velocity of surge propagation(m/sec)
#Calculation
E_t = E_a+(2.0*de_dt*L/300) #Highest voltage the transformer is subjected(kV)
#Result
print('Highest voltage to which the transformer is subjected, E_t = %.f kV' %E_t)
#Variable declaration
V_hv = 132.0 #Voltage at the HV side of transformer(kV)
V_lv = 33.0 #Voltage at the LV side of transformer(kV)
V = 860.0 #Insulator allowable voltage(kV)
Z = 400.0 #Line surge impedance(ohm)
BIL = 550.0 #BIL(kV)
#Calculation
V_rating_LA = V_hv*1.1*0.8 #Voltage rating of LA(kV)
E_a = 351.0 #Discharge voltage at 5 kA(kV)
I_disc = (2*V-E_a)*1000/Z #Discharge current(A)
L_1 = 37.7 #Separation distance in current b/w arrester tap and power transformer tap(m)
dist = 11.0 #Lead length from tap point to ground level(m)
de_dt = 500.0 #Maximum rate of rise of surge(kV/µ-sec)
Inductance = 1.2 #Inductance(µH/metre)
di_dt = 5000.0 #di/dt(A/µ-sec)
lead_drop = Inductance*dist*di_dt/1000 #Drop in the lead(kV)
E_d = E_a+lead_drop #(kV)
V_tr_terminal = E_d+2*de_dt*L_1/300 #Voltage at transformer terminals(kV)
E_t = BIL/1.2 #Highest voltage the transformer is subjected(kV)
L = (E_t-E_a)/(2*de_dt)*300 #Distance at which lightning arrester located from transformer(m)
L_lead = (E_t-E_a*1.1)/(2*de_dt)*300 #Distance at which lightning arrester located from transformer taken 10% lead drop(m)
#Result
print('Rating of L.A = %.1f kV' %V_rating_LA)
print('Location of L.A, L = %.f m' %L)
print('Location of L.A if 10 percent lead drop is considered, L = %.1f m' %L_lead)
print('Maximum distance at which a ligtning arrester is usually connected from transformer is %.f-%.f m' %(L-2,L+3))
#Variable declaration
V = 138.0 #Voltage(kV)
Z = 400.0 #Surge impedance(ohm)
L = 15.0 #Distance of surge diverter to transformer(m)
E = 960.0 #Maximum surge(kV)
L_lead = 6.0 #Surge diverter lead length(m)
L_line = 60.0 #Distance of surge diverter to line entrance(m)
margin_5 = 0.25 #Protective margin b/w BIL & protective level
margin_6 = 0.15 #Margin with surge diverter
#Calculation
V_rating_LA = V*1.1*0.8 #Voltage rating of LA(kV)
V_rated = 120.0 #Chosen rated voltage(kV)
max_spark_over = V_rated*3.1 #Front of wave spark-over,max(kV)
max_full_spark_over = V_rated*2.8 #Full wave spark-over,max(kV)
max_switch_spark_over = 3.0*V_rated #Switching surge spark over,max(kV)
E_d = max_switch_spark_over #Maximum discharge voltage(kV)
I_disch = (2*E-E_d)/Z #Discharge current(kA)
V_LA_lead = L_lead*1.2*I_disch/2 #Voltage drop in surge diverter lead(kV)
E_d1 = E_d+V_LA_lead #Effective discharge voltage(kV)
de_dt = 480.0 #Maximum rate of rise of surge(kV/µ-sec)
V_tr_terminal = E_d1+2*de_dt*L/300 #Voltage at transformer terminals(kV)
BIL_calc = V_tr_terminal*(1+margin_5) #BIL calculated(kV)
BIL_1 = 550.0 #Standard BIL(kV)
max_switch_spark_over_margin = max_switch_spark_over*(1+margin_6) #Switching surge spark over,max(kV)
distance_effect = 2.0*de_dt*L_line/300 #Distance effect for line entrance(kV)
V_peak_entrance = E_d1+distance_effect #Voltage at peak entrance(kV)
#Result
print('Appropriate BIL of transformer and switchgear = 650 kV')