pg=3000 #kva rating of generators single phase
xg=0.1 #10%reactanse of generator
vg=11 #voltage at the terminals of generator
xbf=5 #reactanse of feeder fron bus to fault
pb=pg ;vb=vg ;ib=pg/vg #let power and voltage of as respective base then current base
zb=(vb*10**3)/ib #base impedence
xpu=xbf/zb #per unit reactance of feeder
tx=(xg/2)+(xpu) #total reactance
sckva=pg/tx #short circuit kva is ratio ofpower to total reactance
sci=sckva/vg #short circuit current
print 'a'
print " p.u.feeder reactor %.3fp.u \n total reactance is %.3fp.u \n short circuit kVA %dkVA \n short circuit current %.1fA"%(xpu,tx,sckva,sci)
gz=zb*xg #generator impedence
tz=(gz/2)+xbf #total impedence
scc=(vg*10**3)/tz #short circuit current in ampears
print 'b'
print " generator impedence %.3fohm \n total impedence %.3f ohm \n short circuit current %.1fA"%(gz,tz,scc)
from math import sqrt
pa1=20000 ; pa2=30000 #kva in in 3 ph power
va1=11 ; va2=11 #voltage in kilo volts
pt1=20000 ; pt2=30000#kva of 3 ph transformer
vpt1=11 ; vpt2=11#voltage of primery of transformer
vst1=132 ; vst2=132#voltage of secondary of transformer
xg1=0.5 ; xg2=0.65 #reactance of generator
xt1=0.05 ;xt2=0.05 #reactance of transformer with their own kva
pb=pa2; vbg=va2 ;vbt=vpt2 #assumeing base quantoties
xtn1=xt1*pb/pa1 ;xtn2=xt2*pb/pa2 #transformer reactance with new base
xgn1=xg1*pb/pa1; xgn2=xg2*pb/pa2
xn1=xtn1+xgn1 ;xn2=xtn2+xgn2 #reactancee up to fault from each generator
xn=(xn1*xn2)/(xn1+xn2) #equalent reactance between generator and fault
sckva=pb/xn #short circuit KVA
print '(a)'
print " equivalent reactance is %.4f p.u \n short circuit KVA %dKVA"%(xn,sckva)
print '(b)'
sccb=sckva/(vst1*sqrt(3))
sccg1=sccb*(xn2/(xn1+xn2))*vst1/vpt1
sccg2=sccb*(xn1/(xn1+xn2))*vst2/vpt2
print " short circuit current on bus bar side %.1fA \n short circuit current of generator 1 is %.1fA \n short circuit current of generator 2 is %.1fA \n"%(sccb,sccg1,sccg2)
pa1=20000 ; pa2=30000 #kva in in 3 ph power
va1=11 ; va2=11 #voltage in kilo volts
pt1=20000 ; pt2=30000#kva of 3 ph transformer
vpt1=11 ; vpt2=11#voltage of primery of transformer
vst1=132 ; vst2=132#voltage of secondary of transformer
xg1=0.5 ;xg2=0.65 #reactance of generator
xt1=0.05 ;xt2=0.05 #reactance of transformer with their own kva
pb=pa2 ;vbg=va2 ;vbt=vpt2 #assumeing base quantoties
xtn1=xt1*pb/pa1 ;xtn2=xt2*pb/pa2 #transformer reactance with new base
xgn1=xg1*pb/pa1 ;xgn2=xg2*pb/pa2
xn1=xtn1+xgn1 ;xn2=xtn2+xgn2 #reactancee up to fault from each generator
xn=(xn1*xn2)/(xn1+xn2) #equalent reactance between generator and fault
sckva=pb/xn #short circuit KVA
pf=50000 #fault kva rating
xf=pb/pf #reactance from fault
xx=xf*xn1/(xn1-xf)
x=xx-xn2 #reactance to be added
bi=(vst1**2)*1000/(pb)
xo=x*bi
print " reactance to be added in circuit of generator 2 have %.1f p.u. \n reactance in ohms %.1f"%(x,xo)
pa=50; xgb=0.5; xb=0.1 #given power,reactance of generator
x1=xgb+xb
x=x1*x1*xgb/(x1*x1+x1*xgb+x1*xgb)
f=pa/x
print " total reactance %.4f.p.u \n fault MVA %.1fMVA"%(x,f)
vb=33
pb=20 ;zb=vb**2/pb #base voltage and base power
pa1=10 ;pa2=10; xa1=0.08; xa2=0.08 #given power and reactance for different branches
pbb=20 ;xb=0.06 ;pc=15 ;xc=0.12; pd=20; xd=0.08
xab=2.17; xbc=3.26; xcd=1.63; xda=4.35
xap1=xa1*pb/pa1
xap2=xa2*pb/pa2 ;xap=xap1*xap2/(xap1+xap2)
xbp=xb*pb/pbb
xcp=xc*pb/pc
xdp=xd*pb/pd #generators reactance in per unit
xabp=round(xab*100/zb)/100
xbcp=round(xbc*100/zb)/100
xcdp=round(xcd*100/zb)/100
xdap=round(xda*100/zb)/100 #reactance in per unit between bus
def del2star(d12,d23,d31):
dsum=d12+d23+d31
s1=d12*d31/(dsum)
s2=d12*d23/(dsum)
s3=d31*d23/dsum
return [s1,s2,s3]
def star2del(s1,s2,s3):
d12=s1+s2+(s1*s2)/s3
d23=s2+s3+(s2*s3)/s1
d31=s3+s1+(s3*s1)/s2
return [d12,d31,d23]
[xac,xrc,xra]=star2del(xcdp,xdap,xdp)
rc=xrc*xcp/(xrc+xcp)
ra=xra*xap/(xra+xap)
[xpr,xpc,xpa]=del2star(xac,rc,ra)
xf1=xbcp+xpc
xf2=xpr+xabp
xf=xf1*xf2/(xf1+xf2)
xfr=xf+xpa
xx=xfr*xbp/(xfr+xbp)
netr=xx #net reactance
fkva=pb*1000/xx
print "the rating of circuit breaker should be %d KVA, or %d MVA"%(fkva,fkva/1000)
p=150 #given ,power
v=11 #given voltage
xg=0.12 #reactance of generator
xb=0.08 #reactance of line
scca=1/xg
ms=scca**2
sccb=1/(xg+xb)
ms1=sccb**2
print 'a'
print "short circuit current is %.3fp.u \n ratio of mechanical stress on short circuit to aech. stresses on full load %.2f"%(scca,ms)
print 'b'
print "short circuit current is with reactor %.3fp.u \n ratio of mechanical stress on short circuit to aech. stresses on full load with reactor %.f"%(sccb,ms1)
from math import acos, pi, sin, cos, atan
xf=complex(0,0.04)
pf=0.8 ;ph=acos(pf)*180/pi
v=1 ;i=1 #let v and i
vb=v+i*xf*(complex(cos(ph*pi/180),-sin(ph*pi/180)))
iv=vb-abs(v)
print "bus bar voltage %.4f.p.u at angle %.1f\nincrease in voltage %.4f =%.4f percent"%(abs(vb),atan(vb.imag/vb.real)*180/pi,abs(iv),abs(iv*100))
p1=30 ;x1=0.3 #power and reactance of different sets
p2=30 ;x2=0.3
p3=20 ;x3=0.3
l=10 ;xl=0.04
pb=p1 ;xp3=x3*pb/p3
tr=(xp3*x1*x2)/(xp3*x1+xp3*x2+x1*x2)
sc=pb/tr
print 'a'
print "total reactance %.4f p.u \n short circuit MVA on l.v.bus %.2fMVA"%(tr,sc)
print 'b'
xlp=xl*pb/l
trr=tr+xlp
scc=pb/trr
print "total reactance seen from h.v.side of transformer %.2fp.u \n short circuit MVA %.2fMVA"%(trr,scc)
p1=30 ;x1=0.15; p2=10; x2=0.125
pt=10 ;vs=3.3 ;pm=100
pb=p1 #let base as power of unit 1
x22=x2*pb/p2; x11=x1*pb/p1
xx=1/((1/x22)+(1/x11)+(1/x11))
xl=(pb/pm)-xx
xt2=xl*pt/pb
bi=vs**2/pt
xtt=xt2*bi
print " reactance of transformer is %.4f.p.u \n reactance of transformer on %dMVA base is %.5fp.u. \n reactance of transformer %.4fohm"%(xl,pt,xl,xtt)
from math import sqrt,pi
#given #p=power/v=voltage/f=frequency/x=reactance/iff=feeder reactance take off
pa=20 ;va=11 ;f=50 ;xa=0.2 ;pb=30 ;xb=0.2 ;pf=10 ;xf=0.06; iff=0.5
pba=20 ;vba=11
xap=xa*pba/pb
xfp=xf*pba/pf
nx=xfp+(xa/2)*(xa/2+xap)/(xa+xap)
fcp=nx**(-1)
bc=pba*1000/(va*sqrt(3))
fc=fcp*bc
print 'a'
print "fault current %.2fohm"%(fc)
ic=iff*fcp
xtx=ic**(-1)
xn=xtx-nx
zb=va**2/pba
xnn=xn*zb
print 'b'
print "reactance required %.4fohm"%(xnn)
n1=5 ;x=0.4 ;d=0.1; g=20 #given
mva=(g/x)+(g*(n1-1)/(x+n1*d))
n2=10 #given
mva2=(g/x)+(g*(n2-1)/(x+n2*d))
print 'a'
print "fault MVA =(g/x)+(g*(n-1)/(x+nd)) \n fault level is to equal to fault MVA if n=infinity"
print 'b'
print " MVA=%.2fMVA if n=%d \n MVA=%.2fMVA if n=%d"%(mva,n1,mva2,n2)
fl=g*((1/x)+(1/d))
print 'c'
print "\nfault level %dMVA"%(fl)