l = 10.0 #Length of 1-phase line(km)
d = 100.0 #Spacing b/w conductors(cm)
r = 0.3 #Radius(cm)
u_r_1 = 1.0 #Relative permeability of copper
u_r_2 = 100.0 #Relative permeability of steel
r_1 = 0.7788*r #Radius of hypothetical conductor(cm)
import math
L_1 = 4 * 10**(-7) * math.log(d/r_1) #Loop inductance(H/m)
L_T1 = L_1 * l * 10**6 #Total loop inductance(mH)
L_2 = 4 * 10**(-7) * (math.log(d/r) + (u_r_2/4))#Loop inductance(H/m)
L_T2 = L_2 * l * 10**6 #Total loop inductance(mH)
print('(i) Total loop inductance of copper conductor = %.2f mH' %L_T1)
print('(ii)Total loop inductance of steel conductor = %.2f mH' %L_T2)
r = 0.4 #Radius of conductor(cm)
h = 1000 #Height of line(cm)
import math
d = 2*h #Spacing between conductors(cm)
L = 2 * 10**(-4) * math.log(2*h/(0.7788*r)) * 1000 #Inductance of conductor(mH/km)
print('Inductance of the conductor = %.3f mH/km' %L)
d_ab = 4 #Distance b/w conductor a & b(m)
d_bc = 9 #Distance b/w conductor b & c(m)
d_ca = 6 #Distance b/w conductor c & a(m)
r = 1.0 #Radius of each conductor(cm)
import math
D_m = (d_ab * d_bc * d_ca)**(1.0/3) #Geometric mean separation(m)
r_1 = 0.7788 * (r/100) #Radius of hypothetical conductor(m)
L = 2 * 10**(-7) * math.log(D_m/r_1) * 10**6 #Line inductance(mH/phase/km)
print('Line inductance , L = %.2f mH/phase/km' %L)
r = 1.0 #Radius of each conductor(cm)
d_11 = 30 #Distance b/w conductor 1 & 1'(cm)
d_22 = 30 #Distance b/w conductor 2 & 2'(cm)
d_12 = 130 #Distance b/w conductor 1 & 2(cm)
d_122 = 160 #Distance b/w conductor 1 & 2'(cm)
d_112 = 100 #Distance b/w conductor 1' & 2(cm)
d_1122 = 130 #Distance b/w conductor 1' & 2'(cm)
import math
r_1 = 0.7788 * r #Radius of hypothetical conductor(cm)
D_s = (d_11 * r_1 * d_22 * r_1)**(1.0/4) #Geometric mean radius(cm)
D_m = (d_12 * d_122 * d_112 * d_1122)**(1.0/4) #Geometric mean separation(cm)
L = 4 * 10**(-7) * math.log(D_m/D_s) * 10**6 #Loop inductance(mH/km)
R = 2**0.5 #Radius of single conductor(cm)
d = 130.0 #Conductor position(cm)
L_1 = 4*10**(-7)*math.log(d/(0.7788*R))*10**6 #Loop inductance(mH/km)
L_diff = (L_1 - L)/L*100 #Change in inductance(%)
r_diff = D_s - R #Effective radius difference
print('Loop inductance , L = %.3f mH/km' %L)
print('Loop inductance having two conductors only , L = %.3f mH/km' %L_1)
print('There is an Increase of %.f percent in inductance value ' %L_diff)
print('Effective radius of bundled conductors is about %.1f times that of unbundled system reducing field stress almost by that ratio' %r_diff)
r = 1.5 #Radius of each conductor(cm)
D_a1a2 = 0.3 #Distance b/w conductor a1 & a2(m)
D_a2a1 = 0.3 #Distance b/w conductor a2 & a1(m)
D_a1b1 = 15.3 #Distance b/w conductor a1 & b1(m)
D_a1b2 = 15.6 #Distance b/w conductor a1 & b2(m)
D_a2b1 = 15.0 #Distance b/w conductor a2 & b1(m)
D_a2b2 = 15.3 #Distance b/w conductor a2 & b2(m)
D_b1c1 = 15.3 #Distance b/w conductor b1 & c1(m)
D_b1c2 = 15.6 #Distance b/w conductor b1 & c2(m)
D_b2c1 = 15.0 #Distance b/w conductor b2 & c1(m)
D_b2c2 = 15.3 #Distance b/w conductor b2 & c2(m)
D_a1c1 = 30.6 #Distance b/w conductor a1 & c1(m)
D_a1c2 = 30.9 #Distance b/w conductor a1 & c2(m)
D_a2c1 = 30.3 #Distance b/w conductor a2 & c1(m)
D_a2c2 = 30.6 #Distance b/w conductor a2 & c2(m)
import math
r_1 = 0.7788 * (r/100) #Radius of hypothetical conductor(m)
D_s = (D_a1a2 * r_1 * D_a2a1 * r_1)**(1.0/4) #Geometric mean radius(m)
D_ab = (D_a1b1 * D_a1b2 * D_a2b1 * D_a2b2)**(1.0/4) #Mutual GMD b/w conductor a & b(m)
D_bc = (D_b1c1 * D_b1c2 * D_b2c1 * D_b2c2)**(1.0/4) #Mutual GMD b/w conductor b & c(m)
D_ca = (D_a1c1 * D_a1c2 * D_a2c1 * D_a2c2)**(1.0/4) #Mutual GMD b/w conductor c & a(m)
D_m = (D_ab * D_bc * D_ca)**(1.0/3) #Geometric mean separation(m)
L = 2 * 10**(-4) * math.log(D_m/D_s) * 1000 #Inductance(mH/km)
print('Inductance/phase/km = %.3f mH/km' %L)
r = 0.6 #Radius of each conductor(cm)
d = 150 #Separation distance(cm)
L = 40*10**3 #Length of overhead line(m)
f = 50 #Frequency(Hertz)
v = 50*10**3 #System voltage(V)
import math
C_ab = (math.pi * 8.854 * 10**(-12))/(math.log(d/r)) * L #Capacitance b/w conductors(F)
I = complex(0,v * 2 * math.pi * f * C_ab) #Charging current leads voltage by 90°(A)
print('Capacitance between two conductors , C_ab = %.3e F' %C_ab)
print('Charging current , I = j%.3f A' %I.imag)
r = 0.015 #Radius of each conductor(m)
D_a1a2 = 0.3 #Distance b/w conductor a1 & a2(m)
D_a2a1 = 0.3 #Distance b/w conductor a2 & a1(m)
D_a1b1 = 15.3 #Distance b/w conductor a1 & b1(m)
D_a1b2 = 15.6 #Distance b/w conductor a1 & b2(m)
D_a2b1 = 15.0 #Distance b/w conductor a2 & b1(m)
D_a2b2 = 15.3 #Distance b/w conductor a2 & b2(m)
D_b1c1 = 15.3 #Distance b/w conductor b1 & c1(m)
D_b1c2 = 15.6 #Distance b/w conductor b1 & c2(m)
D_b2c1 = 15.0 #Distance b/w conductor b2 & c1(m)
D_b2c2 = 15.3 #Distance b/w conductor b2 & c2(m)
D_a1c1 = 30.6 #Distance b/w conductor a1 & c1(m)
D_a1c2 = 30.9 #Distance b/w conductor a1 & c2(m)
D_a2c1 = 30.3 #Distance b/w conductor a2 & c1(m)
D_a2c2 = 30.6 #Distance b/w conductor a2 & c2(m)
import math
D_s = (D_a1a2 * r * D_a2a1 * r)**(1.0/4) #Geometric mean radius(m)
D_ab = (D_a1b1 * D_a1b2 * D_a2b1 * D_a2b2)**(1.0/4) #Mutual GMD b/w conductor a & b(m)
D_bc = (D_b1c1 * D_b1c2 * D_b2c1 * D_b2c2)**(1.0/4) #Mutual GMD b/w conductor b & c(m)
D_ca = (D_a1c1 * D_a1c2 * D_a2c1 * D_a2c2)**(1.0/4) #Mutual GMD b/w conductor c & a(m)
D_m = (D_ab * D_bc * D_ca)**(1.0/3) #Geometric mean separation(m)
C_n = 2 * math.pi * 8.854 * 10**(-9) /(math.log(D_m/D_s)) #Capacitance per phase(F/km)
print('Capacitance per phase , C_n = %.3e F/km' %C_n)
r = 0.015 #Radius of each conductor(m)
D_ab = 15 #Horizontal distance b/w conductor a & b(m)
D_bc = 15 #Horizontal distance b/w conductor b & c(m)
D_ac = 30 #Horizontal distance b/w conductor a & c(m)
import math
D_m = (D_ab * D_bc * D_ac)**(1.0/3) #Geometric mean separation(m)
D_s = 2**(1.0/2) * r #Geometric mean radius(m)
C_n = 2 * math.pi * 8.854 * 10**(-9) /(math.log(D_m/D_s)) #Capacitance/phase/km(F/km)
print('Capacitance per phase , C_n = %.3e F/km' %C_n)
h = 5 #Height of conductor above ground(m)
d = 1.5 #Conductor spacing(m)
r = 0.006 #Radius of conductor(m)
import math
C_AB = math.pi * 8.854*10**-9/math.log(d/(r*(1+((d*d)/(4*h*h)))**0.5)) #Capacitance with effect of earth(F/km)
C_AB1 = math.pi * 8.854*10**-9/math.log(d/r) #Capacitance ignoring effect of earth(F/km)
ch = (C_AB - C_AB1)/C_AB * 100 #Change in capacitance with effect of earth(%)
print('Line capacitance with effect of earth , C_AB = %.3e F/km' %C_AB)
print('Line capacitance ignoring effect of earth , C_AB = %.3e F/km' %C_AB1)
print('With effect of earth slight increase in capacitance = %.1f percent' %ch)
R = 0.16 #Resistance(ohm)
L = 1.26*10**(-3) #Inductance(H)
C = 8.77*10**(-9) #Capacitance(F)
l = 200.0 #Length of line(km)
P = 50.0 #Power(MVA)
pf = 0.8 #Lagging power factor
V_r = 132000.0 #Receiving end voltage(V)
f = 50.0 #Frequency(Hz)
import math
import cmath
w = 2 * math.pi * f
z = complex(R, w*L) #Series impedance per phase per km(ohm)
y = complex(0, w*C) #Shunt admittance per phase per km(mho)
g = (y*z)**(0.5) #propagation constant(/km)
gl = g * l
Z_c = (z/y)**(0.5) #Surge impedance(ohm)
cosh_gl = cmath.cosh(gl)
sinh_gl = cmath.sinh(gl)
A = cosh_gl
B = Z_c * sinh_gl
C = (sinh_gl/Z_c)
D = cosh_gl
fi = math.acos(pf) #Power factor angle(radians)
V_R = V_r/(3**0.5) #Receiving end voltage(V)
I_R = (P*10**6/((3**0.5)*V_r))*(pf - complex(0,math.sin(fi)))#Receiving end current(A)
V_S = (A*V_R + B*I_R) #Sending end voltage(V/phase)
V_S_L = V_S * (3**0.5)*10**-3 #Sending end line voltage(kV)
I_S = C*V_R + D*I_R #Sending end current(A)
pf_S = math.cos(cmath.phase(I_S) - cmath.phase(V_S)) #Sending end power factor
P_S = abs(V_S*I_S)*pf_S*10**-6 #Sending end power/phase(MW)
P_R = (P/3)*pf #Receiving end power/phase(MW)
P_L = 3*(P_S - P_R) #Total line loss(MW)
print('Sending end voltage , V_S = %.2f∠%.2f° kV/phase' %(abs(V_S*10**-3),cmath.phase(V_S)*180/math.pi))
print('Sending end line voltage = %.2f kV' %abs(V_S_L))
print('Sending end current , I_S = %.2f∠%.2f° A' %(abs(I_S),cmath.phase(I_S)*180/math.pi))
print('Sending end power factor = %.2f lagging' %pf_S)
print('Total transmission line loss = %.3f MW' %P_L)
print('\nNOTE : Changes in answer is due to more decimal places')
R = 0.1 #Resistance/phase/km(ohm)
D_m = 800.0 #Spacing b/w conductors(cm)
d = 1.5 #Diameter of each conductor(cm)
l = 300.0 #Length of transmission line(km)
f = 50.0 #Frequency(Hz)
import math
import cmath
L = 2*10**(-4)*math.log(D_m*2/d) #Inductance/phase/km(H)
C = 2*math.pi*8.854*10**(-9)/math.log(D_m*2/d) #Capacitance/phase/km(F)
w = 2 * math.pi * f
z = complex(R, w*L) #Series impedance per phase per km(ohm/km)
y = complex(0, w*C) #Shunt admittance per phase per km(mho/km)
g = (y*z)**(0.5) #propagation constant(/km)
gl = g * l
Z_c = (z/y)**(0.5) #Surge impedance(ohm)
sinh_gl = cmath.sinh(gl)
tanh_gl = cmath.tanh(gl/2)
Z_S = Z_c * sinh_gl #Series impedance(ohm)
Y_P = (1/Z_c)*cmath.tanh(gl/2) #Pillar admittance(mho)
print('Values of equivalent-pi network are :')
print('Series impedance , Z_S = (%.2f + j%.2f) ohm' %(Z_S.real,Z_S.imag))
print('Pillar admittance , Y_P = %.2e∠%.2f° mho = j%.2e mho' %(abs(Y_P),(cmath.phase(Y_P)*180/math.pi),Y_P.imag))
print('\nNOTE : Changes in answer is due to more decimal places')
V_r = 220000.0 #Voltage(V)
P = 100.0 #Power(MW)
r = 0.08 #Series resistance(ohm)
x = 0.8 #Series reactance(ohm)
s = 6.0*10**(-6) #Shunt susceptance(mho)
pf = 0.8 #Power factor lagging
l_1 = 60.0 #Transmission length(km) for case(i)
l_2 = 200.0 #Transmission length(km) for case(ii)
l_3 = 300.0 #Transmission length(km) for case(iii)
l_4 = 500.0 #Transmission length(km) for case(iv)
import math
import cmath
z = complex(r,x) #Series impedance/km(ohm)
y = complex(0,s) #Shunt admittance/km(mho)
theta_R = math.acos(pf)
P_R = P/3 #Active power at receiving end/phase(MW)
Q_R = (P/3)*math.tan(theta_R) #Reactive power at receiving end/phase(MVAR)
V_R = V_r/(3**0.5) #Receiving end voltage/phase(V)
I_R = P*10**6/((3**0.5)*V_r*pf)*(pf - complex(0,math.sin(theta_R)))#Receiving end current(A)
Z_c = (z/y)**(0.5) #Surge impedance(ohm)
A_1 = 1 #Constant A
B_1 = z*l_1 #Constant B(ohm)
C_1 = 0 #Constant C(mho)
D_1 = A_1 #Constant D
V_S_1 = A_1*V_R + B_1*I_R #Sending end voltage(V/phase)
I_S_1 = I_R #Sending end current(A)
theta_S_1 = cmath.phase(I_S_1) - cmath.phase(V_S_1) #Sending end power factor
P_S_1 = abs(V_S_1*I_S_1)*math.cos(theta_S_1)*10**-6 #Sending end power(MW)
n_1 = (P_R/P_S_1)*100 #Transmission efficiency(%)
reg_1 = (abs(V_S_1/A_1) - V_R)/V_R*100 #Regulation(%)
Q_S_1 = V_S_1 * I_S_1.conjugate()*10**-6 #Sending end reactive power(MVAR)
Q_line_1 = Q_S_1.imag - Q_R #Reactive power absorbed by line(MVAR)
Z_S_2 = z*l_2
Y_P_2 = y*l_2/2
A_2 = 1 + Y_P_2*Z_S_2
B_2 = Z_S_2
C_2 = Y_P_2*(2 + Y_P_2*Z_S_2)
D_2 = A_2
V_S_2 = A_2*V_R + B_2*I_R #Sending end voltage(V/phase)
I_S_2 = C_2*V_R + D_2*I_R #Sending end current(A)
S_S_2 = V_S_2*I_S_2.conjugate()*10**-6 #Sending end complex power(MVA)
P_S_2 = S_S_2.real #Power at sending end(MW)
n_2 = (P_R/P_S_2)*100 #Transmission efficiency(%)
reg_2 = (abs(V_S_2/A_2) - V_R)/V_R*100 #Regulation(%)
Q_line_2 = S_S_2.imag - Q_R #Reactive power absorbed by line(MVAR)
g_3 = (y*z)**(0.5) #propagation constant(/km)
gl_3 = g_3 * l_3
cosh_gl_3 = cmath.cosh(gl_3)
sinh_gl_3 = cmath.sinh(gl_3)
A_3 = cosh_gl_3
B_3 = Z_c * sinh_gl_3
C_3 = sinh_gl_3/Z_c
D_3 = cosh_gl_3
V_S_3 = A_3*V_R + B_3*I_R #Sending end voltage(V/phase)
I_S_3 = C_3*V_R + D_3*I_R #Sending end current(A)
S_S_3 = V_S_3*I_S_3.conjugate()*10**-6 #Sending end complex power(MVA)
P_S_3 = S_S_3.real #Power at sending end(MW)
n_3 = (P_R/P_S_3)*100 #Transmission efficiency(%)
reg_3 = (abs(V_S_3/A_3) - V_R)/V_R*100 #Regulation(%)
Q_line_3 = S_S_3.imag - Q_R #Reactive power absorbed by line(MVAR)
g_4 = (y*z)**(0.5) #propagation constant(/km)
gl_4 = g_4 * l_4
cosh_gl_4 = cmath.cosh(gl_4)
sinh_gl_4 = cmath.sinh(gl_4)
A_4 = cosh_gl_4
B_4 = Z_c * sinh_gl_4
C_4 = sinh_gl_4/Z_c
D_4 = cosh_gl_4
V_S_4 = A_4*V_R + B_4*I_R #Sending end voltage(V/phase)
I_S_4 = C_4*V_R + D_4*I_R #Sending end current(A)
S_S_4 = V_S_4*I_S_4.conjugate()*10**-6 #Sending end complex power(MVA)
P_S_4 = S_S_4.real #Power at sending end(MW)
n_4 = (P_R/P_S_4)*100 #Transmission efficiency(%)
reg_4 = (abs(V_S_4/A_4) - V_R)/V_R*100 #Regulation(%)
Q_line_4 = S_S_4.imag - Q_R #Reactive power absorbed by line(MVAR)
print('Case(i) : For Length = 60 km')
print('Efficiency , n = %.2f percent' %n_1)
print('Regulation = %.3f percent' %reg_1)
print('Reactive power at sending end , Q_S = %.2f MVAR' %Q_S_1.imag)
print('Reactive power absorbed by line , Q_line = %.2f MVAR' %Q_line_1)
print('\nCase(ii) : For Length = 200 km')
print('Efficiency , n = %.2f percent' %n_2)
print('Regulation = %.2f percent' %reg_2)
print('Reactive power at sending end , Q_S = %.2f MVAR' %S_S_2.imag)
print('Reactive power absorbed by line , Q_line = %.2f MVAR' %Q_line_2)
print('\nCase(iii) : For Length = 300 km')
print('Efficiency , n = %.2f percent' %n_3)
print('Regulation = %.2f percent' %reg_3)
print('Reactive power at sending end , Q_S = %.2f MVAR' %S_S_3.imag)
print('Reactive power absorbed by line , Q_line = %.2f MVAR' %Q_line_3)
print('\nCase(iv) : For Length = 500 km')
print('Efficiency , n = %.2f percent' %n_4)
print('Regulation = %.2f percent' %reg_4)
print('Reactive power at sending end , Q_S = %.2f MVAR' %S_S_4.imag)
print('Reactive power absorbed by line , Q_line = %.2f MVAR' %Q_line_4)
print('\nNOTE : ERROR : Calculation mistake in case(iv) efficiency in textbook')
import math
import cmath
A = 0.8*cmath.exp(1j*1.4*math.pi/180) #Line constant
B = 326.0*cmath.exp(1j*84.8*math.pi/180) #Line constant(ohm)
V_R = 220.0 #Receiving end voltage(kV)
V_S = 220.0 #Sending end voltage(kV)
P = 75.0 #Power(MVA) for case(a)
pf = 0.8 #Power factor lagging
a = cmath.phase(A) #Phase angle of A(radian)
b = cmath.phase(B) #Phase angle of B(radian)
P_R = P * pf #Active power demanded by load(MW)
P_React = P *(1-pf**2)**0.5 #Reactive power demanded by load(MVAR)
cos_b_delta_1 = P_R*abs(B)/(V_R*V_S) + abs(A)*math.cos(b-a) #cos(b-delta)[in radians]
delta_1 = b - math.acos(cos_b_delta_1) #delta(radians)
Q_R_1 = (V_R*V_S/abs(B))*math.sin(b-delta_1) - (abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power at sending end(MVAR)
Reactive_power_1 = P_React - Q_R_1 #Reactive power to be supplied by compensating equipment(MVAR)
cos_b_delta_2 = (abs(A)*V_R/V_S)*math.cos(b-a) #cos(b-delta)[in radians]
delta_2 = b - math.acos(cos_b_delta_2) #delta(radians)
Q_R_2 = (V_R*V_S/abs(B))*math.sin(b-delta_2) - (abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power at sending end(MVAR)
Reactive_power_2 = Q_R_2 #Reactive power to be absorbed by compensating equipment(MVAR)
print('(a) Reactive VARs to be supplied by compensating equipment = %.2f MVAR' %Reactive_power_1)
print('(b) Reactive VARs to be absorbed by compensating equipment = %.2f MVAR' %Reactive_power_2)
r = 25.0 #Resistance/phase(ohm)
x = 90.0 #Reactance/phase(ohm)
V_S = 145.0 #Sending end voltage(kV)
V_R = 132.0 #Receiving end voltage(kV)
P_R_1 = 0 #Power(MW)
P_R_2 = 50.0 #Power(MW)
import math
import cmath
A = 1.0*cmath.exp(1j*0*math.pi/180) #Line constant
B = complex(r,x) #Line constant(ohm)
a = cmath.phase(A) #Phase angle of A(radian)
b = cmath.phase(B) #Phase angle of B(radian)
cos_b_delta_1 = (V_R/V_S)*math.cos(b-a)
delta_1 = b - math.acos(cos_b_delta_1)
Q_R_1 = (V_R*V_S/abs(B))*math.sin(b-delta_1) - (abs(A)*V_R**2/abs(B))*math.sin(b-a)
cos_b_delta_2 = (P_R_2*abs(B)/(V_R*V_S))+(abs(A)*V_R/V_S)*math.cos(b-a)
delta_2 = (b - math.acos(cos_b_delta_2))
Q_R_2 = (V_R*V_S/abs(B))*math.sin(b-delta_2)-(abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power available at receiving end(MVAR)
Q_S_2 = Q_R_1 + Q_R_2 #Reactive power to be supplied by equipment(MVAR)
pf = math.cos(math.atan(Q_S_2/P_R_2)) #Power factor
print('Rating of device = %.2f MVAR' %Q_R_1)
print('Power factor = %.2f lagging' %pf)
import math
import cmath
A = 0.9*cmath.exp(1j*1.0*math.pi/180) #Line constant
B = 143.0*cmath.exp(1j*84.5*math.pi/180) #Line constant(ohm)
V_R = 220.0 #Receiving end voltage(kV)
V_S = 240.0 #Sending end voltage(kV)
P = 100.0 #Power(MVA)
pf = 0.8 #Power factor lagging
a = cmath.phase(A) #Phase angle of A(radian)
b = cmath.phase(B) #Phase angle of B(radian)
P_R = P * pf #Active power at receiving end(MW)
cos_b_delta = (P_R*abs(B)/(V_R*V_S))+(abs(A)*V_R/V_S)*math.cos(b-a) #cos(b-delta)[in radians]
delta_1 = (b - math.acos(cos_b_delta))
Q_R = (V_R*V_S/abs(B))*math.sin(b-delta_1)-(abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power at receiving end(MVAR)
P_Re = P *(1-pf**2)**0.5 #Reactive power(MVAR)
rating = P_Re - Q_R #Rating of phase modifier(MVAR)
delta_2 = b #Maximum power is received when delta = b
P_Rmax = (V_R*V_S/abs(B))-(abs(A)*V_R**2/abs(B))*math.cos(b-a) #Maximum power at receiving end(MW)
Q_R = -(abs(A/B)*V_R**2)*math.sin(b-a) #Reactive power at receive end(MVAR)
P_S = (V_S**2*abs(A/B))*math.cos(b-a)-(V_S*V_R/abs(B))*math.cos(b+delta_2) #Sending end power(MW)
n_line = (P_Rmax/P_S)*100 #Line efficiency(%)
print('Case(a) :')
print('Rating of phase modifier = %.3f MVAR' %rating)
print('Power angle , delta = %.2f°' %(delta_1*180/math.pi))
print('\nCase(b) :')
print('Maximum power at receive end , P_Rmax = %.2f MW' %P_Rmax)
print('Reactive power available , Q_R = %.2f MVAR' %Q_R)
print('Line efficiency = %.2f percent' %n_line)
import math
import cmath
A = 0.96*cmath.exp(1j*1.0*math.pi/180) #Line constant
B = 100.0*cmath.exp(1j*83.0*math.pi/180) #Line constant(ohm)
V_R = 110.0 #Receiving end voltage(kV)
V_S = 110.0 #Sending end voltage(kV)
pf = 0.8 #Power factor lagging
delta = 15*math.pi/180 #Power angle(radians)
a = cmath.phase(A) #Phase angle of A(radian)
b = cmath.phase(B) #Phase angle of B(radian)
P_R = (V_R*V_S/abs(B))*math.cos(b-delta) - (abs(A/B)*V_R**2)*math.cos(b-a) #Active power at receiving end(MW)
Q_RL = P_R*math.tan(math.acos(pf)) #Reactive power demanded by load(MVAR)
Q_R = (V_R*V_S/abs(B))*math.sin(b-delta) - (abs(A/B)*V_R**2)*math.sin(b-a) #Reactive power(MVAR)
rating = Q_RL - Q_R #Rating of device(MVAR)
P_S = (V_S**2*abs(A/B))*math.cos(b-a) - (V_R*V_S/abs(B))*math.cos(b+delta) #Sending end active power(MW)
n_line = (P_R/P_S)*100 #Efficiency of line(%)
Q_S = (V_S**2*abs(A/B))*math.sin(b-a) - (V_R*V_S/abs(B))*math.sin(b+delta) #Sending end reactive power(MVAR)
print('(i) Active power demanded by load , P_R = %.2f MW' %P_R)
print(' Reactive power demanded by load , Q_RL = %.2f MVAR' %Q_RL)
print('(ii) Rating of the device , Q_R = %.2f MVAR' %rating)
print('(iii)Efficiency of line = %.2f percent' %n_line)
print('(iv) Reactive power supplied by source and line , Q_S = %.2f MVAR' %Q_S)