#Variable declaration
V_1 = 9.0 #Potential across top unit(kV)
V_2 = 11.0 #Potential across middle unit(kV)
n = 3.0 #Number of disc insulators
#Calculation
#Case(a)
K = (V_2-V_1)/V_1 #Ratio of capacitance b/w pin & earth to self capacitance
#Case(b)
V_3 = V_2+(V_1+V_2)*K #Potential across bottom unit(kV)
V = V_1+V_2+V_3 #Voltage between line and earth(kV)
V_l = 3**0.5*V #Line voltage(kV)
#Case(c)
eff = V/(n*V_3)*100 #String efficiency(%)
#Result
print('Case(a): Ratio of capacitance b/w pin & earth to self-capacitance of each unit, K = %.2f ' %K)
print('Case(b): Line voltage = %.2f kV' %V_l)
print('Case(c): String efficiency = %.f percent' %eff)
from sympy import Symbol
#Variable declaration
C = Symbol('C')
m = 10.0 #Mutual capacitance of top insulator
#Calculation
X = 1*C+m*C #Mutual capacitance
Y = (1.0+2)*C+m*C #Mutual capacitance
Z = (1.0+2+3)*C+m*C #Mutual capacitance
U = (1.0+2+3+4)*C+m*C #Mutual capacitance
V = (1.0+2+3+4+5)*C+m*C #Mutual capacitance
#Result
print('Mutual capacitance of each unit:')
print(' X = ' +repr(X)+'')
print(' Y = ' +repr(Y)+'')
print(' Z = ' +repr(Z)+'')
print(' U = ' +repr(U)+'')
print(' V = ' +repr(V)+'')
from sympy import Symbol
#Variable declaration
V = Symbol('V')
n = 3.0 #Number of insulators
#Calculation
V_1 = 155.0/475.0*V #Potential across top unit
V_2 = 154.0/155.0*V_1 #Potential across middle unit
V_3 = 166.0/155.0*V_1 #Potential across bottom unit
eff = V*100/(n*V_3) #String efficiency(%)
#Result
print('Voltage across top unit, V_1 = ' +repr(V_1)+'')
print('Voltage across middle unit, V_2 = ' +repr(V_2)+'')
print('Voltage across bottom unit, V_3 = ' +repr(V_3)+'')
print('String efficiency = %.2f percent' %eff)
#Variable declaration
V_3 = 17.5 #Voltage across line unit(kV)
c = 1.0/8 #Shunt capacitance = 1/8 of insulator capacitance
n = 3.0 #Number of insulators
#Calculation
K = c #String constant
V_1 = V_3/(1+3*K+K**2) #Voltage across top unit(kV)
V_2 = (1+K)*V_1 #Voltage across middle unit(kV)
V = V_1+V_2+V_3 #Voltage between line & earth(kV)
eff = V*100/(n*V_3) #String efficiency(%)
#Result
print('Line to neutral voltage, V = %.2f kV' %V)
print('String efficiency = %.2f percent' %eff)
#Variable declaration
n = 8.0 #Number of insulators
#Calculation
A = 1.0/(n-1) #Line to pin capacitance
B = 2.0/(n-2) #Line to pin capacitance
C = 3.0/(n-3) #Line to pin capacitance
D = 4.0/(n-4) #Line to pin capacitance
E = 5.0/(n-5) #Line to pin capacitance
F = 6.0/(n-6) #Line to pin capacitance
G = 7.0/(n-7) #Line to pin capacitance
#Result
print('Line-to-pin capacitance are:')
print(' A = %.3f*C' %A)
print(' B = %.3f*C' %B)
print(' C = %.3f*C' %C)
print(' D = %.3f*C' %D)
print(' E = %.3f*C' %E)
print(' F = %.3f*C' %F)
print(' G = %.3f*C' %G)
#Variable declaration
m = 6.0 #Mutual capacitance
n = 5.0 #Number of insulators
#Calculation
E_4 = (1+(1/m)) #Voltage across 4th insulator as percent of E_5(%)
E_3 = (1+(3/m)+(1/m**2)) #Voltage across 3rd insulator as percent of E_5(%)
E_2 = (1+(6/m)+(5/m**2)+(1/m**3)) #Voltage across 2nd insulator as percent of E_5(%)
E_1 = (1+(10/m)+(15/m**2)+(7/m**3)+(1/m**4)) #Voltage across 1st insulator as percent of E_5(%)
E_5 = 100/(E_4+E_3+E_2+E_1+1) #Voltage across 5th insulator as percent of E_5(%)
E4 = E_4*E_5 #Voltage across 4th insulator as percent of E_5(%)
E3 = E_3*E_5 #Voltage across 3rd insulator as percent of E_5(%)
E2 = E_2*E_5 #Voltage across 2nd insulator as percent of E_5(%)
E1 = E_1*E_5 #Voltage across 1st insulator as percent of E_5(%)
eff = 100/(n*E1/100) #String efficiency(%)
#Result
print('Voltage distribution as a percentage of voltage of conductor to earth are:')
print(' E_1 = %.2f percent' %E1)
print(' E_2 = %.2f percent' %E2)
print(' E_3 = %.1f percent' %E3)
print(' E_4 = %.1f percent' %E4)
print(' E_5 = %.2f percent' %E_5)
print('String efficiency = %.f percent' %eff)
print('\nNOTE: Changes in obtained answer from that of textbook is due to more precision')
#Variable declaration
n = 3.0 #Number of insulators
C_1 = 0.2 #Capacitance in terms of C
C_2 = 0.1 #Capacitance in terms of C
#Calculation
#Without guard ring
e_2_a = 13.0/13.3 #Potential across middle unit as top unit
e_1_a = 8.3/6.5*e_2_a #Potential across bottom unit
E_a = 1+(1/(8.3/6.5))+(1/e_1_a) #Voltage in terms of e_1
eff_a = E_a/n*100 #String efficiency(%)
e1_a = 1/E_a #Voltage across bottom unit as a % of line voltage
e2_a = 1/(8.3/6.5)*e1_a #Voltage across middle unit as a % of line voltage
e3_a = 1/e_1_a*e1_a #Voltage across top unit as a % of line voltage
#With guard ring
e_2_b = 15.4/15.5 #Potential across middle unit as top unit
e_1_b = 8.3/7.7*e_2_b #Potential across bottom unit
E_b = 1+(1/(8.3/7.7))+(1/e_1_b) #Voltage in terms of e_1
eff_b = E_b/n*100 #String efficiency(%)
e1_b = 1/E_b #Voltage across bottom unit as a % of line voltage
e2_b = 1/(8.3/7.7)*e1_b #Voltage across middle unit as a % of line voltage
e3_b = 1/e_1_b*e1_b #Voltage across top unit as a % of line voltage
#Result
print('Without guard ring:')
print(' Voltage across bottom unit, e_1 = %.2f*E' %e1_a)
print(' Voltage across bottom unit, e_2 = %.2f*E' %e2_a)
print(' Voltage across bottom unit, e_3 = %.2f*E' %e3_a)
print(' String efficiency = %.1f percent' %eff_a)
print('\nWith guard ring:')
print(' Voltage across bottom unit, e_1 = %.2f*E' %e1_b)
print(' Voltage across bottom unit, e_2 = %.2f*E' %e2_b)
print(' Voltage across bottom unit, e_3 = %.3f*E' %e3_b)
print(' String efficiency = %.2f percent' %eff_b)
#Variable declaration
n = 3.0 #Number of insulators
#Calculation
V_1 = 0.988 #Voltage across top unit as middle unit
V_3 = 1.362 #Voltage across bottom unit as middle unit
V_2 = 1/(V_1+1+V_3) #Voltage across middle unit as % of line voltage to earth
V1 = V_1*V_2*100 #Voltage across top unit as % of line voltage to earth
V2 = V_2*100 #Voltage across middle unit as % of line voltage to earth
V3 = V_3*V_2*100 #Voltage across bottom unit as % of line voltage to earth
eff = 100/(n*V3/100) #String efficiency(%)
#Result
print('Case(a): Voltage across top unit as a percentage of line voltage to earth, V_1 = %.2f percent' %V1)
print(' Voltage across middle unit as a percentage of line voltage to earth, V_2 = %.2f percent' %V2)
print(' Voltage across bottom unit as a percentage of line voltage to earth, V_3 = %.2f percent' %V3)
print('Case(b): String efficiency = %.2f percent' %eff)
#Variable declaration
n = 3.0 #Number of insulators
V = 20.0 #Voltage across each conductor(kV)
c = 1.0/5 #Capacitance ratio
#Calculation
V_2 = 6.0/5.0 #Voltage across middle unit as top unit
V_1 = V/(1+2*V_2) #Voltage across top unit(kV)
V_3 = V_2*V_1 #Voltage across bottom unit(kV)
C_x = c*(1+(1/V_2)) #Capacitance required
#Result
print('Case(a): Voltage on the line-end unit, V_3 = %.2f kV' %V_3)
print('Case(b): Value of capacitance required, Cx = %.3f*C' %C_x)