from __future__ import division
from sympy import *
import math
#Variable declaration:
Pl = 10000 #load(kW)
pf = 0.8 #power factor(lag)
Vl = 33000 #receiving end line voltage(V)
R = 5 #line resistance(ohm)
X = 10 #line reactance(ohm)
#Calculation:
I2 = math.floor(Pl*1000/(3**0.5*Vl*0.8)) #load current(A)
Ip = I2*pf #A
Iq = I2*math.sin(math.acos(pf)) #A
V1 = round(Vl/3**0.5) #sending end voltage(V)
#Let Im be the current taken by the synchronous condenser.
Im = symbols('Im') #A
Im1 = solve((V1+Ip*R-X*(Im-Iq))**2+(Ip*X+(Im-Iq)*R)**2-V1**2,Im)[0]
C = 3*V1*round(Im1)/1000 #kVAR
#Result:
print "Capacity of synchronous condenser is",math.floor(C),"kVAR"
from __future__ import division
import math
#Variable declaration:
Pl = 25000 #load(kW)
pf = 0.8 #power factor(lag)
Vl = 33000 #receiving end line voltage(V)
R = 5 #line resistance(ohm)
X = 20 #line reactance(ohm)
#Calculation:
I2 = round(Pl*1000/(3**0.5*Vl*pf),1) #load current(A)
Ip = I2*pf #A
Iq = I2*math.sin(math.acos(pf)) #A
V1 = Vl/3**0.5 #sending end voltage(V)
#Let Im be the current taken by the synchronous condenser.
Im = symbols('Im') #A
Im1 = solve((V1+Ip*R-X*(Im-Iq))**2+(Ip*X+(Im-Iq)*R)**2-V1**2,Im)[0]
C = 3*V1*Im1/1000 #kVAR
#Result:
print "Capacity of synchronous condenser is",round(C/1000,2),"MVAR"