import math
#initialisation of variables
H=9.0
G=20.0 # machine Rating(MVA)
KE=H*G
#Calculations
print("(a)K.E stored in the rotor =%.0f MJ " %KE)
Pi=25000*.735
PG=15000.0
Pa=(Pi-PG)/(1000.0)
f=50.0
M=G*H/(math.pi*f)
a=Pa/M
print("(b) The accelerating power =%.3f MW " %Pa)
print("Acceleration =%.3f rad/sec_2" %a)
t=15.0/50
dele=math.sqrt(5.89)*t/2
Del=dele**2
k=2.425*math.sqrt(Del)*60/4*math.pi
speed=1504.2
#Results
print("(c)Rotor speed at the end of 15 cycles = %.1f r.p.m" %speed)
import math
#initialisation of variables
V1=1.1
V2=1
X=.5
cosdo=0.8
G=1.0
H=3.0
f=50.0
#Calculations
M=G*H/(math.pi*f)
dPe=V1*V2*cosdo/X
fn=(((dPe)/M)**.5)/6.28
sind0=0.75
d0=math.degrees(math.asin(sind0))
dPe2=V1*V2*math.cos(math.radians(d0))/X
fn2=(((dPe2)/M)**.5)/6.28
#Results
print("(i)fn=%.2f Hz " %fn)
print("(i)fn(Hz)=%.2f Hz " %fn2)
import math
#initialisation of variables
a=0.25 #sindo=.25
do=math.degrees(math.asin(a)) #
b=0.5 #sindc=.5
#Calculations
dc=math.degrees(math.asin(b))
c=math.cos(math.radians(do))+.5*do*math.pi/180.0
dm=dc
e=1
while e >.0001 :
dm=dm+.1
e=abs(c-(((.5*dm*math.pi)/180)+math.cos(math.radians(dm))))
#Results
print("dm approximately found to be %d degree" %dm)
import math
#initialisation of variables
sindo=.5
d0=math.degrees(math.asin(sindo))*math.pi/180.0
r1=.2
r2=.75
#Calculations
sindm=.5/.75
d=math.degrees(math.asin(sindm))
cosdm=math.cos(math.radians(d))
dm=math.pi*(180-(math.degrees(math.asin(sindm))))/180
Dc=((.5*(dm-d0))-(r2*cosdm)-(r1*math.cos(math.radians(d0))))/(r2-r1)
dc=math.degrees(math.acos(Dc))# critical angle
#Results
print("The critical clearing angle is given by=%.2f degrees" %dc)#Answers don't match due to difference in rounding off of digits
import math
#initialisation of variables
ZA=0.375
ZB=0.35
ZC=0.0545
#Calculations
ZAB=((ZA*ZB)+(ZB*ZC)+(ZC*ZA))/ZC #Reactance between the generator and infinite bus during the fault(p.u)
Zgbf=complex(0.3)+ complex(0.55/2) + complex(.15) #Reactance between the generator and infinite bus before the fault(p.u)
Zgb=complex(0.3)+ complex(0.55) + complex(.15) #Reactance between the generator and infinite bus after the fault is cleared (p.u)
Pmaxo=1.2*1.0/abs(Zgbf)# Maximum power output Before the fault(p.u)
Pmax1=1.2*1.0/abs(ZAB)# Maximum power output during the fault(p.u)
Pmax2=1.2*1.0/abs(Zgb)# Maximum power output after the fault(p.u)
r1=Pmax1/Pmaxo
r2=Pmax2/Pmaxo
Ps=1.0
sindo=Ps/Pmaxo
do=math.degrees(math.asin(sindo))
d0=math.degrees(math.asin(sindo))*math.pi/180
sindm=1/Pmax2
cosdm=math.cos(math.radians((math.degrees(math.asin(sindm)))))
Dm=math.pi*(180-(math.degrees(math.asin(sindm))))/180
Dc=(((sindo*(Dm-d0))-(r2*cosdm))-(r1*math.cos(math.radians(do))))/(r2-r1)
dc=math.degrees(math.acos(Dc))# critical angle
#Results
print("The critical clearing angle is given by= %.1f " %dc)
import math
#initialisation of variables
Pm=complex(0.12) + complex(0.035) + ((complex(.25)*complex(0.3))/complex(0.55))
Pm1=0
Pm2=1.1*1/.405
r1=0
#Calculations
r2=2.716/3.775
d0=(math.degrees(math.asin(1/3.775)))
dM=(180-math.degrees(math.asin(1/2.716)))
do=d0*math.pi/180
dm=dM*math.pi/180
dc=math.degrees(math.acos((((dm-do)*math.sin(math.radians(d0)))-(r1*math.cos(math.radians(d0)))+(r2*math.cos(math.radians(dM))))/(r2-r1)))
#Results
print("dc=%.2f" %dc)
import math
#initialisation of variables
Pc=0
V=0.98
#Calculations
Qc=V**2*((1/.4)-(1/1.1))/2
R=V**2*((1/.4)+(1/1.1))/2
Q=-(.98**2*((1.1-.4)/.44)/2) + (.98**2)*1.5/(2*.44)
#Results
print("(i)Q=%.2f MVAr" %(abs(Q)*100))
P=0.25
Q2=-((1.637**2)-(.25**2))**.5 + .7639
print("(ii)Q=%.4f p.u" %Q2)
Q3=-((1.637**2)-(.5**2))**.5 + .7639
print("(iii)Q=%.4f p.u" %Q3)
import math
#initialisation of variables
Pm=3.0
r1Pm=1.2
r2Pm=2
H=3
f=60
Dt=.02
Pe=1.5
Do=math.degrees(math.asin(1.5/3))
do=Do/57.33
wo=0
d=0
K10=0
#Calculations
l10=62.83*(1.5-1.2*math.sin(do))*.02
K20=(377.5574-376.992)*.02
l20=62.83*(1.5-1.2*math.sin(do))*.02
K30=(377.5574-376.992)*.02
l30=62.83*(1.5-1.2*math.sin(.5296547))*.02
K40=l30*0.02
l40=62.83*(1.5-1.2*math.sin(.5353094))*.02
d1=.53528
Dwo=(3*1.13094+2*1.123045+1.115699)/6
w1=wo+Dwo
d1=.53528
print("Runga-Kutta method-\n")
print("w1=%.6f \nd1=%.5f\n" %(w1,d1))
d7=1.026
w7=6.501
wp=376.992+6.501
K17=(wp-376.992)*0.02
l17=62.83*(1.5-1.2*math.sin(1.026))*.02
K27=(6.501+.297638)*0.02
l27=62.83*(1.5-1.2*math.sin(1.09101))*.02
K37=(6.501+.2736169)*0.02
l37=62.83*(1.5-1.2*math.sin(1.0939863))*.02
K47=(6.501+.545168)*0.02
l47=62.83*(1.5-1.2*math.sin(1.16149))*.02
Dd7=(K17+2*K27+2*K37+K47)/6
d8=d7+Dd7
Dw7=(l17+2*l27+2*l37+l47)/6
w8=w7+Dw7
print("d8=%.5f rad.\nw8=%.4frad/sec\n\n" %(d8,w8))
print("using Euler`s Modified Method-\n")
d0=0
d10=.524
w=62.83*(1.5-1.2*math.sin(.524))
d11=d10+0
w11=w*.02
d=1.13094
dav=(0+d)/2
wav=(56.547+56.547)/2
d01=.524+.56547*.02
w11=0+56.547*0.02
#Results
print("d01=%.4f\nw11=%.5f" %(d01,w11))