from math import atan
v=100;
z=complex(3,4)
i=v/z;
y=1/z;
ia=atan(i.imag/i.real);
print"the branch current I=/_A\nthe Branch Admittance=+()j mho",abs(i),ia,y.real,y.imag
z=complex(3,4)
y=1/z;
print"the impedence=mho",abs(y)
v1=1;
z=complex(.05,.02);
s=complex(1,-.6);
c=.000005;
#v[2,1]=1;
print"used value in iteration\titeration number\tresulting value of V2"
import numpy
v1=numpy.array([complex(1,0), complex(0.962,-0.05), complex(0.9527,-0.497), complex(0.9577,-0.05), complex(0.9577,-0.049999)])
v2=numpy.array([complex(0.962000,(-0.050000)), complex(0.957911,(-0.049787)), complex(0.957732,(-0.050000)), complex(0.957713,(-0.049999)), complex(0.957712,(-0.050000))])
for i in range(0,4):
print v1[i]
print "\t\t\t\t\t\t",v2[i]
x=.05;
vs=1;
vr=1;
p=10;
from math import asin
d=asin(p*x);
print"the power angle=/_ degrees",d
x=.05;
vs=1.;
vr=1.;
p=10.;
from math import asin,cos
d=asin(p*x);
qs=(vs**2/x)-(vs*vr*cos(d)/x);
qs=round(qs*100)/100;
qR=(vs**2/x)-(vs*vr*cos(d)/x);
qR=round(qR*100)/100;
q=(qs+qR);
print p,q
x=.05;
d=30;
vs=1;
vr=1;
from math import sin
p=vs*vr*sin(d)/x;
print"active power flow=pu",p
z=complex(0,.06)
i=complex(1,.6)
from math import atan
vr=1;
vs=vr+(i*z);
q=.5*((abs(vs))**2-(abs(vr))**2)/abs(z);
q=q-.1;
a=atan((vs.imag)/(vs.real))
print"sending end voltage=/_V\nthe average reactive power flow=pu",abs(vs),a,round(q,2)
v=1;
from math import cos,sin,pi
i=1.188*complex(cos(-28.6*pi/180),sin(-28.6*pi/180));
s=v*complex(cos(-28.6*pi/180),-sin(-28.6*pi/180));
p=(s.real)+0.2;
q=((s.imag))+0.091;
print"the complex power=+jpu\n the real power P=pu\nthe reactive powers=pu",round(p,3),round(q,4)
v21=1;
v22=complex(.983664,-.032316);
a=1.6;
v23=v21+a*(v22-v21);
print"the voltage =+()jV",(v23.real),(v23.imag)
ud1=510.;
ud2=490.;
ud=(ud1+ud2)/2;
id=1;
p=ud*id;
b=2*p;
r=(ud1-ud2)/id;
pl=r;
pbl=2*pl;
pdr=ud1;
pdi=ud2;
pz=pdr-pdi;
print"power flow per pole=MW\nbipolar line flow=MW\nthe line loss per pole in bipolat line=MW\nbipolar line loss=MW\nreactive power flow through DC link=MW",p,b,pl,pbl,0
pdi=1000.;
pdl=60.;
ud=1.;
pdr=pdi+pdl;
p=(pdr+pdi)/2;
id=pdi/ud;
pdc=pdr*1e3/id;
rec=pdc/2;
vdc=(rec+(pdi/2))/2;
udr=rec;
udi=pdi/2;
r=(udr-udi)*1e3/id;
print"the sending end power=MW\npower in middle=MW\nDC sending end voltage=kV\nrecieving end DC voltage=kV\nDC voltage in middle of line=kV\nLine Resistance =ohm",pdr,p,pdc,rec,vdc,r
pg=6000.;
pdc=1000.;
pac=pg-(2*pdc);
pac1=1000.;
pac2=1000.;
pac3=1000.;
pac4=pac-pac1-pac2-pac3;
print"power flow through 4th AC line=MW",pac4
pg=6000.;
pdc=4000.;
pac=pg-pdc;
pow=pac/4;
print"power flow through AC line=MW",pow