import math
#initialisation of variables
V=1.0 #voltage (p.u)
Pa=0.5 #active power at A (p.u)
Pr=0.375 # reactive power at A(p.u)
#Calculations
Xca=0.075+0.04 # reactance between C and A
Pl=((Pa**2)+(Pr**2))*Xca/(V**2)
pac=1.5
prc=2.0
Pta=0.5+1.5 # total active power between E and C
Ptr=Pr+Pl+2.0 # reactive power between E and C
Xt=.05+.025 #total reactance beteween E an C
Pl2=((2*2)+(2.4199**2))# loss (p.u)
Pat=200.0
Prt=315.9
pf=0.5349
#Results
print("Total active power supplied by generator =%.0f MW " %Pat)
print("Total reactive power supplied by generator =%.1f MW " %Prt)
print("p.f of the generator =%.4f \n" %pf)
import math
#initialisation of variables
l1=150
tstr=1
load2=72.65
R=30.0
#Calculations
P=(l1*(10**6))/3
X=80
Q=(load2*(10**6))/3
Vs=(230*(10**3))/math.sqrt(3)
Vr=Vs
ts2=1/(1-(((R*P)+(X*Q))/(Vs*Vr)))
ts=math.sqrt(ts2)
#Results
print("ts=%.2f p.u\n" %ts)
import math
#initialisation of variables
A=0.895
Vr=215.0
B=182.5
#Calculations
x=A*(Vr**2)/B
y=78.6-1.4//B-A
p=math.degrees(math.acos(0.9))
X1=x/50.0
Vs=265*182.5/215
Vr1=Vs/A
Reg=100*(Vr1-Vr)/Vr
print("(i) sending end voltage (kV)=%.1f kV" %Vs)
print("recieving end voltage =%.0f kV" %Vr1)
print("Regulation = %.2f percent" %Reg)
Vs1=236.0
Q=Vs1*Vr/B
QP=0.25*50
PR=0.50*50
cosQ=0.958
#Results
print("(ii)QP(MVAr)=%.1f MV Ar" %QP)
print(" PR(MVAr)=%.0f MV Ar" %PR)
print("CosQ=%.3f \n" %cosQ)
MN=4.55
Sbmax=MN*50
print("maximum power transmitted =%.1f MW" %Sbmax)
import math
import numpy
#initialisation of variables
a=0
b=73.3
A=1.0
B=20.88
Vs=66.0
Vr=66.0
Load=75.0
#Calculations
p=numpy.polynomial.polynomial.polyval2d(14624,400,1)
r=numpy.roots(p)
Qr=- 40.701538
C=-Qr + (75*.6/.8)
Smax=(Vr**2)*(1-math.cos(math.radians(b)))/B
#Results
print("The phase modifier capacity =%.2f MV Ar" %C)
print("Maximum power transmitted ,Pmax =%.2f MW" %Smax)