p=100 #rating of alternater
sd=0.04 #speed of alrternator drops
df=-0.1 #change in frequency and drops so -ve
f=50 #frequency is 50hz
r=sd*f/p #r in hz/MW
dp=-(df)/r
print " speed regulation of alternator is %.2fHz/MW \n change in power output %dMW"%(r,dp)
p=100 #power of alternator
f=50 #frequency
h=5 #h constant of machine kW-sec kVA
inl=50 #load suddenly increase by
de=0.5 #time delay
ke=h*p*10**3 #kinetic energy
lke=inl*10**3*de #loss in kinetic energy
nf=((1-(lke/ke))**(de))*f #now frequency
fd=(1-nf/f)*100 #frequency deviation
print "kinetic energy stored at rated speed %.1e kW-sec \nloss in kinetic energy due to increase in load %.1e kW-sec \nnew frequency %.3fHz \nfrequency deviation %.3f"%(ke,lke,nf,fd)
ar1=500 #alternator rating1
pl=0.5 #each alternator is operating at half load
ar2=200 #alternator rating2
f=50 #frequency
il=140 #load increase by 140 MW
fd=49.5 #frequency drops
fdd=-f+fd #frequency deviation
dp1=(ar1*pl)-il #change in load alternator 1
dp2=-(ar2*pl)+il #change in load of alternator 2
r1=-fdd/dp1
r2=-fdd/dp2
print " R1=%.3fohm \n R2=%.4fohm"%(r1,r2)
from __future__ import division
rc=10000 #rated capacity
r=2 #regulation in all units
li=0.02 #load increase
f=50 #frequency
d=rc/(2*f) #d=partial derevative with respect to frequency
d=d/rc
b=d+1/r
m=li*rc/2
mpu=m/rc
df=-mpu/b
dff=-mpu/d
print "static frequency drop %fHz \nfrequency drop %dHz"%(df,dff)
from __future__ import division
cac=10000 #control area capacity
nol=5000 #normal operating
h=5 #inertial constent
r=3 #regulation
cf=1 #1%change in corresponds to 1% change in load
f=50 #frequency
d=cac/(2*f)
dpu=d/(cac)
kp=1/dpu
tp=2*h/(f*dpu)
print "d=%.2fp.u.MW/hz, \nkp=%dhz/p.u.MW \ntp=%dsecond"%(dpu,kp,tp)
from __future__ import division
rc=10000 #rated capacity
r=2 #regulation in all units
li=0.02 #load increase
f=50 #frequency
d=rc/(2*f) #d=partial derevative with respect to frequency
dd=d/rc
b=dd+1/r
m=li*rc/2
mpu=m/rc
df=-mpu/b
dff=-mpu/dd
cf=abs(df*d)
inc=-(df/r)*10**4
print "the contribution of frequency drop to meet increase in load %.3fMW \nincrease in generation cost Rs%.2f"%(cf,inc)
p=100 #MVA of generated
f=50 #frequency
rpm=3000 #no load rpm
lad=25 #load applied to the machiene
t=0.5 #time delay
h=4.5 #inertia constent
ke=h*p #kinetic energy is product of h*p
lke=lad*t #loss of ke
nf=(((ke-lke)/ke)**t)*f #new frequency ((1-lke/ke)**t)*f
fd=(1-(nf/f))*100 #frequency deviation
print "ke at no load %dMW-sec \nloss in k.e due to load %.1fMW-sec \nnew frequency %.1fHz \nfrequency deviation %.1fpercent"%(ke,lke,nf,fd)
c=4000#capacity
f=50 #frequency
ol=2500 #operating load
r=2 #speed regulation
h=5 #inertial constant
dl=0.02 #change in load
df=0.01 #change in frequency
dff=-0.2 #change in steady state frequency
d=(dl*ol)/(df*f) #
dpu=d/c #din pu
b=dpu+(1/r)
m=-dff*b
print "largest chang in load is %.3fp.u.MW=%dMW"%(m,m*c)
kp=(1/dpu)
tp=(kp)*2*h/f
tt=(r+kp)/(r*tp) #time constant
print "\ndf=(dff)(1-e**%f*t)"%(tt)
from __future__ import division
c=4000 #capacity of system
f=50 #frequency #operatingload=rated area capacity
h=5 #time constent
r=0.025 #
dl=0.01 #change in load
df=0.01 #change in frequency
rr=r*f #
d=(dl*c)/(df*f)
dpu=d/c
kp=1/dpu
tp=(kp)*(2*h/f)
tt=(rr+kp)/(rr*tp)
sfe=(kp*rr*dpu)/(rr+kp)
ki=(1+(kp/r))**2/(4*tp*kp)
print " df=-%.5f(1-e**(-%.1f)) \n ki=%.4fp.u.MW/Hz"%(sfe,tt,ki)
tg=0.2 #time constent of steam turbine
t=2 #time constant of turbine
h=5 #inertia constent
r=0.04 #given
dl=0.01 #change in load
df=0.01 #change in frequency
c=1500 #capacity
f=50 #frequency
adl=0.01 #max allowable change in load
print '(a)'
print "\ntransfer function of governor gr= 1/(1+%.1f*s) \n transfer function of turbine gt=1/(1+%d*s)"%(tg,t)
rr=r*f
d=(dl*c)/(df*f)
dpu=(d/c)
kp=(1/dpu)
tp=(kp*(2*h)/(f))
print "\ntransfer function of power system \n Gp=(%d/(1+%d*s)\n Df=-gp/(1+(0.5*(gr*gt*gp)))"%(kp,tp)
ddf=-(kp)/(1+kp/r)
dff=df*f
m=dff/(ddf)
mm=m*c
print '(b)'
print "\nthe largest step in the load if the frequency change by more than %.2f in steady state %dMW"%(adl,mm)
if mm<0:
print "\nthe minu sign is becose of the that if frequency is to increase by %f \nthe change in load be negative."%(adl)
else:
print "\nthe largest step in load if the frequency is to decrease by %f /n the change in load be positive"%(adl)
print '(c)'
print 'when integral controller is used,static frequency error is zero'
pa=5000 #power of unit a
pb=10000 #power of unit b
r=2 #given speed regulation in p.uMW
d=0.01 #d in p.u.MW/Hz
dpa=0 #change in power in unit a
dpb=-100 #change in power in unit b
pbas=10000 #assume base as 10000
ra=r*pbas/pa #speed regulation of the unit a
da=d*pa/pbas #da of unit b
rb=r*pbas/pb #speed regulation of unit b
db=d*pb/pbas #db of unit b
ba=da+(1/ra) #area frequency response of a
bb=db+(1/rb) #area frequency response of b
ma=dpa/pbas #change in power a in per unit in unit a
mb=dpb/pbas #change in power a in per unit in unit b
df=(ma+mb)/(ba+bb) #change in frequency
dpab=(ba*mb-bb*ma)/(ba+bb) #change in power between ab
print "change in frequency is %.5fHz \nchange in power %.6f p.u.MW"%(df,dpab)
pa=500 #power of unit a
pb=2000 #power of unit b
ra=2.5 #speed regulation of a
rb=2 #speed regulation of b
dl=0.01 #change in load
df=0.01 # change in frequency
pt=20 #change in tie line power
ptl=0 #let other power station has zero
pbas=2000 #assume base as 2000MW
f=50 #assume frequency
da=(dl*pa)/(df*f) #change in power w.r.t frequency
dapu=da/(pbas) # change in power w.r.t frequency in per unit
db=(dl*pb)/(df*f) #change in power in unit b
dbpu=db/pbas #change in power w.r.t frequency in per unit
raa=ra*pbas/pa #speed regulation with pbase
rbb=rb*pbas/pb #speed regulation with pbase
ba=dapu+(1/raa) #area frequency response a
bb=dbpu+(1/rbb) #area frequency response b
ma=pt/pbas #assume change in power in unit a alone due to tie power
mb=ptl/pbas #change in power in unit b
df=-(ma+mb)/(ba+bb) #change in frequency
dpp=(ba*mb-bb*ma)/(ba+bb) #change in power
print '(a)'
print "change in frequency is %.3fHz \n change in power between ab %.5fp.u.MW \n \t\t%.2fMW"%(df,dpp,dpp*pbas)
ma2=ptl/pbas #assume change in power in unit a alone due to tie power
mb2=pt/pbas #change in power in unit b
df2=-(ma2+mb2)/(ba+bb) #change in frequency
dpp2=(ba*mb2-bb*ma2)/(ba+bb) #change in power
print '(b)'
dpba=dpp2*pbas
print " change in frequency is %.3fHz \n change in power between ab %.5fp.u.MW \n"%(df2,dpp2)
print " change in power %fMW"%(dpba)
from __future__ import division
from math import cos, pi
p=4000 #power area
n=2 #number of units
r=2 #speed regulation
h=5
pt=600 #given tie power
pan=40 #power angle
stp=100
f=50
t=(pt/p)*cos(pan*pi/180)
wo=((2*pi*f*t/h)**2-(f/(4*r*h))**2)**(0.5)
print '(a)'
print " the damped angular frequency is %.2fradians/sec if speed govenor loop is closed"%(wo)
print '(b)'
print " since the two area are imilier ,each area will supply half of increase in load .this also evident besause ba=bb \n change in power %dMW \n speed regulation is infininy"%(stp/2)
wo1=(2*pi*f*t/h)**(0.5) #if govenor loop is open alpha is zero
print " damped angular frequency if speed governor loop is open %.3frad/sec "%(wo1)
from math import cos, acos, sin,pi
Aa=0.98; Ap=3 #magnitude and angle of constant A
Ba=110 ;Bp=75 #magnitude and angle of constant B
p=50 #given power 50
pf=0.8 #given power factor is 0.8
vr=132 #voltage at reseving station
vs=132 #voltage at source station to be maintained
vsr1=p*pf+(Aa*(vr**2)/Ba)*cos(pi/180*(Bp-Ap))
ph=vsr1*Ba/(vs*vr)
phh=acos(ph)*180/pi
Del=Bp-phh
qrr=((vs*vr/Ba)*sin(phh*pi/180))-((Aa*(vr)**(2)/Ba)*sin((Bp-Ap)*pi/180)) #reactive power to maintain voltage equal
qrre=p*sin(acos(pf)) #reactive power for the load
qrc=qrre-qrr
print "the reactive power supply and reseving power is %dkV \nreactive power %.2fMvar"%(vs,qrr)
print "\nthe required compensator network neeeded %.2fMvar"%(qrc)
print '(b)'
cosb=(Aa*cos(pi/180*(Bp-Ap))*(vr)**(2)/Ba)*(Ba/(vs*vr)) #under no oad condition
phb=acos(cosb)*180/pi
qrb=(vs*vr*sin(phb*pi/180)/Ba)-(Aa*vr*vr*sin(pi/180*(Bp-Ap))/Ba)
if qrb>0 :
print "thus under no load condition the line delivers %.2fMvar at receiving end.the reactive power must be absorbed by shunt reactor at receving end. thus the capacity of shunt reactor, for no load condition is %.2fMvar. "%(qrb,qrb)
else:
print "thus under no load condition the line absorbs %.2fMvar at receiving end.the reactive power must be delivered by shunt reactor at receving end. or reactive must suppiled by the source thus the capacity of shunt reactor, for no load condition is %.2fMvar. "%(qrb,qrb)
from math import sqrt,acos,sin,pi
v=220 #line voltage
ps=11 ; ss=220; pr=220 ;sr=11 #primer and secondary end terminal voltages of tapping transformer
zr=20; zi=60 #impedence of line in real ndimagenary parts
p=100 #power at recieving end is 100MVA
pf=0.8 #power factor at recievin t=1 #prodect of 2 off terminal tap setting is 1
vt=11 #tap setting for 11 kv voltage bus
P=(p*pf*10**6)/3 #real power
Q=(p*sin(acos(pf))*10**6)/3 #reactance power
v1=v*(10**3)/sqrt(3)
ts=(1/(1-(zr*P+zi*Q)/(v1**2)))**(0.5)
print " tapping ratio at the source %.3f \n tapping ratio at the receving end %.2f"%(ts,1/ts)
from math import sqrt,acos,sin,pi
vp=132; vs=33; vt=11 #voltage at primary ,secondary ,teritiory
pp=75; ps=50; pt=25 #MVA rating at prinary ,secondary,teritiory
rpr=0.12 ;rv=132; rp=75 #reactance power of primary under rv and rp as voltage and power base
poa=60 ;rea=50 #load real and reactive power a
pva=125 ;svaa=33 #primary and secondary voltage a
svsb=25 ;pvb=140; svbb=33 #primary and secondary voltage at no load
print '(a)'
vbas=132 ;mvabas=75 #assume voltage and MVA base
v1pu=pva/vbas #voltage in per unit
v1apu=round(v1pu*1000)/1000 #rounding off
qre=rea/mvabas #reactive power in per unit
vn1a=(v1apu+sqrt(v1apu**2-4*rpr*qre))/2 #voltage using quadratic equation formulae
vn2a=(v1apu-sqrt(v1apu**2-4*rpr*qre))/2
vnaa=vn1a*vbas
v12=pvb/vbas
q=svsb/mvabas
vn1b=(v12+sqrt(v12**2-4*rpr*q))/2 #voltage using quadratic equation formulae
vn1b=round(vn1b*1000)/1000
vnbb=vn1b*vbas #vn in no load condition
print "vn=%.3f.p.u \n vn=%.3fkV"%(vn1a,vnaa)
print '(b)'
print "vn=%.3f.p.u \n vn=%.3fkV"%(vn1b,vnbb)
z=vnaa/svaa ;x=vnbb/svbb
print "\n transformation ratio under load condition %.3f \n transformation ratio under no load condition %.3f \n the actual ratio can be taken as mean of the above value i.e.%.3fpercent\n varying by (+/-)%.3fpercent"%(z,x,(z+x)/2,x-(z+x)/2)
ca=200 #capacity of unit a
cb=100 #capacity of unit b
ra=1.5 #speed regulation of unit a
rb=3 #speed regulation of unit b
f=50 #frequency
pla=100 #load on each bus
plb=100
raa=ra*f/(pla*ca)
rbb=rb*f/(plb*cb)
pa=rbb*(pla+plb)/(raa+rbb)
pb=pla+plb-pa
tp=pa-pla
print " generation at the plant a is %dMW and \n generation at the plant b is %dMW \n transfer power from plant a to b is %dMW"%(pa,pb,tp)
from math import sqrt,acos,sin,pi
za=1.5 ;zb=2.5 #impedence between two lines
v=11 #plant operatio\ng voltage
l=20 ; pf=0.8 #load at 20 MW at 0.8 pf
i=l*10**3/(v*pf*sqrt(3)) ;ph=-acos(pf)*180/pi #current and phase angle of transfrming current
vd=complex(za,zb)*complex(i*cos(ph*pi/180),i*sin(ph*pi/180)) #voltage drop due to loss
print "the current transfer is %.1fA at an angle %.2f"%(i,ph)
print "\nvoltage drop in the interconnector is %.2f+j%.2fV \nso voltage boost needed is %.2f+j%.2fV "%(vd.real,vd.imag,vd.real,vd.imag)
from math import atan, cos,acos,pi
zaa=3 ;zbb=9 #impedence given between line
pas=1 #power at two units are equal to 1p.u
par=1
pbs=1.05 #power at sending end is 1.05 and power at receiving end is 1p.u
pbr=1
i=1 #assume current is 1p.u
los=i*complex(zaa/100,zbb/100)
csd=((abs(los)**2)-pas**2-par**2)/(2*pas*par) #load angle between two stations
csa=(pas**2+abs(los)**2-par**2)/(2*pas*abs(los)) #angle between source and loss
ta=180-atan(zbb/zaa)*180/pi-acos(csa)*180/pi #transfering power factor angle
print "(a)"
print "load angle is %.2f\n"%(cos(csd*pi/180))
if sin(ta*pi/180)<0:
print "real power is %.3fp.u \nreactive power %.3fp.u lagging"%(cos(ta*pi/180),abs(sin(ta*pi/180)))
else:
print "real power is %.3fp.u \nreactive power %.3fp.u leading"%(cos(ta*pi/180),sin(ta*pi/180))
csd2=(abs(los)**2-pbs**2-pbr**2)/(2*pbs*pbr) #load angle between two stations
csa2=(pbr**2-pbs**2+abs(los)**2)/(2*pbr*abs(los)) #angle between source and loss
f=180-atan(zbb/zaa)*180/pi-acos(csa2)*180/pi #transfering power factor angle
print '(b)'
print "load angle is %.2f\n"%(cos(csd2*pi/180))
if sin(f*pi/180)<0 :
print "real power is %.3fp.u \nreactive power %.3fp.u lagging"%(cos(f*pi/180),abs(sin(f*pi/180)))
else:
print "real power is %.3fp.u \nreactive power %.3fp.u leading"%(cos(f*pi/180),sin(f*pi/180))