Professional Documents
Culture Documents
Experiment no: 5
21/02/2012
AIM:
To write a Matlab Program to determine
1. The phasor value of voltage at the load bus 2 & 3 using Newton Raphson method.
2. The power flow including line flow and line losses for the given power system.
SAMPLE DATA:
0 . 0 2
0
S
V
l a c k
1
. 0 1
j 0 . 0 3
j 0
. 0
0 . 0 1
2 5
j 0
4 0 M0
5M0
. 0
a r
2 5
1.050o
3
V3 = 1.04
2 0 M0
Line impedances are in per unit with 100MVA base, line charging susceptances are neglected
ALGORITHM:
1. Start.
2. Obtain Ybus from the given line impedances.
3. For PQ buses calculate the real and reactive power and for PV buses calculate real power.
4. Compute the power mismatches given by p=Pspecified-Pcalculated and q=Qspecified-Qcalculated
For PQ buses and p=Pspecified-Pcalculated for PV buses and form the matrix DEL
5. Compute Jacobian matrix J.
6. Compute the the matrix X= J-1*DEL and get v and .
7. Update values of v and using vnew=vold+ v and new= old + .
8. With new calculated values repeat step 3 for fixed number of iterations.
9. Compute slack bus real and reactive power.
10. Determine the line flows and losses.
11. Stop.
PROGRAM
clc
clear all
% BASE MVA=100;
% Type 1=slack bus;
% Type 2=load bus;
% Type 3=PV bus;
% BUSDATA
%
busno type |V| Vang
BUSDATA=[1
1
1.05 0
2
2
1
0
Qmin
0
0
Qmax
0
0
3
3 1.04
0
2
0
0
0
nload=input('enter the no. of load bus:')
ngen=input('enter the no. of gen bus:')
% LINEDATA
%
fb tb
R
X
LINEDATA=[1 2
0.02 0.04
2 3 0.0125 0.025
3 1
0.01
0.03];
% ybus
YBUS=[20-j*50 -10+j*20 -10+j*30
-10+j*20 26-j*52 -16+j*32
-10+j*30 -16+j*32 26-j*62];
Y1=abs(YBUS);
Y2=(180/pi)*angle(YBUS);
nbus=max(BUSDATA(:,1));
type=BUSDATA(:,2);
V=BUSDATA(:,3);
DEL=(180/pi)*BUSDATA(:,4);
GENMW=BUSDATA(:,5);
GENMVAR=BUSDATA(:,6);
LOADMW=BUSDATA(:,7);
LOADMVAR=BUSDATA(:,8);
Qmin=BUSDATA(:,9);
Qmax=BUSDATA(:,10);
Psp=GENMW-LOADMW
Qsp=GENMVAR-LOADMVAR
for i=2:nbus
Pcal(i)=0;
for k=1:nbus
Pcal(i)=Pcal(i)+(V(i)*V(k)*Y1(i,k)*cosd(Y2(i,k)+DEL(k)-DEL(i)));
end
delp(i)=Psp(i)-Pcal(i)
if (type(i)==2)
delq=zeros(1,3);
Qcal(i)=0;
for k=1:nbus
Qcal(i)=Qcal(i)-(V(i)*V(k)*Y1(i,k)*sind(Y2(i,k)+DEL(k)-DEL(i)));
end
delq(i)=Qsp(i)-Qcal(i)
end
end
J=zeros(nbus,nbus);
for k=2:3
if type(k)==2
jsum1=0;
jsum2=0;
jsum3=0;
jsum7=0;
0 ];
jsum9=0;
jsum8=0;
for l=1:3
if (k~=l)
jsum1=jsum1+(V(k)*V(l)*Y1(k,l)*sind(Y2(k,l)+DEL(l)-DEL(k)));
J(1,1)=jsum1;
jsum7=jsum7+(V(k)*V(l)*Y1(k,l)*cosd(Y2(k,l)+DEL(l)-DEL(k)));
J(3,1)=jsum7;
jsum3=jsum3+(V(l)*Y1(k,l)*cosd(Y2(k,l)+DEL(l)-DEL(k)));
s=(2*V(k)*Y1(k,k)*cosd(Y2(k,k)));
jsum3=s+jsum3;
J(1,3)=jsum3;
jsum9=jsum9-(V(l)*Y1(k,l)*sind(Y2(k,l)+DEL(l)-DEL(k)));
t=-(2*V(k)*Y1(k,k)*sind(Y2(k,k)));
jsum9=t+jsum9;
J(3,3)=jsum9;
if (k~=l)&&(l~=1)
jsum2=jsum2-(V(k)*V(l)*Y1(k,l)*sind(Y2(k,l)+DEL(l)-DEL(k)));
J(1,2)=jsum2;
jsum8=jsum8-(V(k)*V(l)*Y1(k,l)*cosd(Y2(k,l)+DEL(l)-DEL(k)));
J(3,2)=jsum8;
end
end
end
else type(k)=3;
jsum4=0;
jsum5=0;
jsum6=0;
for l=1:3
if (k~=l)
jsum5=jsum5+(V(k)*V(l)*Y1(k,l)*sind(Y2(k,l)+DEL(l)-DEL(k)));
J(2,2)=jsum5;
if (k~=l)&&(l~=1)
jsum4=jsum4-(V(k)*V(l)*Y1(k,l)*sind(Y2(k,l)+DEL(l)-DEL(k)));
J(2,1)=jsum4;
jsum6=jsum6+(V(k)*Y1(k,l)*cosd(Y2(k,l)+DEL(l)-DEL(k)));
J(2,3)=jsum6;
end
end
end
end
end
disp(J)
M=[delp'
delq'];
DEL1=zeros(3,1)
DEL1(1)=M(2,1);
DEL1(2)=M(3,1);
DEL1(3)=M(5,1);
X=zeros(3,1);
X=inv(J)*DEL1
delth2=X(1);
delth3=X(2);
delV2=X(3);
DEL(2)=DEL(2)+(delth2*180/pi)
DEL(3)=DEL(3)+(delth3*180/pi)
V(2)=V(2)+delV2
P1=0;
Q1=0;
Q3=0;
for l=1:3
P1=P1+(V(1)*V(l)*Y1(1,l)*cosd(Y2(1,l)+DEL(l)-DEL(1)))
Q1=Q1-(V(1)*V(l)*Y1(1,l)*sind(Y2(1,l)+DEL(l)-DEL(1)))
Q3=Q3-(V(3)*V(l)*Y1(3,l)*sind(Y2(3,l)+DEL(l)-DEL(3)))
end
for k=1:3
for l=1:3
if(k==l)
i(k,k)=0;i(l,l)=0;s(k,k)=0;s(l,l)=0;
else
i(k,l)=(V(k)-V(l))*(-1*YBUS(k,l))
i(l,k)=(V(l)-V(k))*(-1*YBUS(l,k))
s(k,l)=(V(k)*(conj(i(k,l))))*100;
s(l,k)=(V(l)*(conj(i(l,k))))*100;
sline(k,l)=(s(k,l)+s(l,k))
end
end
end
Sloss=sline(1,2)+sline(2,3)+sline(3,1)
RESULTS
enter the no. of load bus:1
nload =
1
enter the no. of gen bus:1
ngen =
1
Psp =
0
-4
2
Qsp =
0
-2.5000
0
delq =
0 -0.2200
0
delp =
0 -2.8600 1.4384
J=
54.2800 -33.2800 76.8600
-33.2800 66.0400 -16.6400
-27.1400 16.6400 153.7200
X=
-0.0412
-0.0012
-0.0086
DEL =
0
-2.3633
0
DEL =
0
-2.3633
-0.0670
V=
1.0500
0.9914
1.0400
P1 =
22.0500
Q1 =
55.1250
Q3 =
-32.7472
P1 =
12.5075
Q1 =
33.8938
Q3 =
-66.3759
P1 =
1.6258
Q1 =
1.1210
Q3 =
0.6833
i=
0
-0.5859 + 1.1717i
sline =
0.5859 - 1.1717i
0
3.4324 + 6.8649i
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
0
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
0
-0.1000 + 0.3000i
0
0
sline =
0
3.4324 + 6.8649i 0.1000 + 0.3000i
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
0
-0.1000 + 0.3000i
0
0
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
0
-0.1000 + 0.3000i
0
0
sline =
0
3.4324 + 6.8649i
0.1000 + 0.3000i
3.4324 + 6.8649i
0
0
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
-0.7774 + 1.5548i
-0.1000 + 0.3000i
0
0
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
-0.7774 + 1.5548i
-0.1000 + 0.3000i
0.7774 - 1.5548i
0
sline =
0
3.4324 + 6.8649i
0.1000 + 0.3000i
3.4324 + 6.8649i
0
3.7771 + 7.5542i
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
-0.7774 + 1.5548i
-0.1000 + 0.3000i
0.7774 - 1.5548i
0
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
-0.7774 + 1.5548i
-0.1000 + 0.3000i
0.7774 - 1.5548i
0
sline =
0
3.4324 + 6.8649i
0.1000 + 0.3000i
3.4324 + 6.8649i
0
3.7771 + 7.5542i
0.1000 + 0.3000i
0
0
i=
0
0.5859 - 1.1717i
0.1000 - 0.3000i
-0.5859 + 1.1717i
0
-0.7774 + 1.5548i
-0.1000 + 0.3000i
0.7774 - 1.5548i
0
i=
0
0.5859 - 1.1717i
-0.5859 + 1.1717i
0
-0.1000 + 0.3000i
0.7774 - 1.5548i
sline =
0
3.4324 + 6.8649i
0.1000 + 0.3000i
3.4324 + 6.8649i
0
3.7771 + 7.5542i
Sloss =
7.3096 +14.7191i
0.1000 - 0.3000i
-0.7774 + 1.5548i
0
0.1000 + 0.3000i
3.7771 + 7.5542i
0
PROGRAM:
clc
clear all
g=2;
e2=100;
while(abs(e2)>1.6)
l=[130;140];
e=[100;100];
t=[20;20];
ps=zeros(2,1);
ph=zeros(2,1);
pl=zeros(2,1);
q=zeros(2,1);
for j=1:2
disp(j);
while (abs(e(j))>t(j))
ps(j)=(l(j)-110.4)/0.04461;
ph(j)=(l(j)-(59.64*g))/(l(j)*0.00016);
pl(j)=0.00008*ph(j)^2;
e(j)=1200+pl(j)-ph(j)-ps(j)
disp(e(j));
if (abs(e(j))<t(j))
q(j)=330+4.97*ph(j);
else
ln(j)=input('new projected value of lambda:')
l(j)=ln(j);
end
end
end
s=0;
for i=1:2
s=s+(12*q(i));
end
e2=s-100000
if (abs(e2)<1.6)
disp('schedule output');
else
disp(g);
gn=input('new projected value of gama:')
g=gn;
end
end
RESULT:
e=
266.5017
100.000
e=
-7.4706
-36.8508
e2 =
-6.4950e+003
2
new projected value of gama:2.02
gn =
2.0200
PROGRAM:
clc
clear all
n=input ('number of intervals:');
ps=zeros(n,1);
ph=zeros(n,1);
g=zeros(n,1);
v=zeros(n,1);
ld=zeros(n,1);
e=10;
% vs=input('enter initial volume(acre ft):');
% vf=input('enter final voume(acer ft):');
% r=input('enter inflow(acre ft/hr):');
% ld=input('enter load in each interval:')
vs=100000;
vf=60000;
r=2000;
ld=[1200;1500;1100;1800;950;1300];
tr=r*24*3;
tvu=vs+tr-vf;
for i=1:n
q(i)=tvu/(n*12);
ph(i)=(q(i)-330)/4.97;
ps(i)=ld(i)-ph(i);
td=q(i)*12;
v(i)=vs+(12*r)-(q(i)*12);
vs=v(i);
g(i)=(9.2+(0.00368*ps(i)))/4.97;
end
ft=0;
for i=1:n
ft=ft+12*1.15*(500+(8*ps(i))+(0.0016*ps(i)^2));
end
delf=20;
while(delf>e)
disp(g);
disp(ft);
disp(ps);
disp(ph);
disp(q);
a=input('enter j+(max g):');
b=input('enter j-(min g):');
delq=input('enter delq:');
q(a)=q(a)+delq;
q(b)=q(b)-delq;
ph(a)=(q(a)-330)/4.97;
ps(a)=ld(a)-ph(a);
ph(b)=(q(b)-330)/4.97;
ps(b)=ld(b)-ph(b);
delf=12*((g(a)*delq)+(g(b)*delq));
g(a)=(9.2+(0.00368*ps(a)))/4.97;
g(b)=(9.2+(0.00368*ps(b)))/4.97;
for i=1:n
ft=ft+12*1.15*(500+(8*ps(i))+(0.0016*ps(i)^2));
end
end
RESULT
number of intervals:6
gamma:
2.4081
2.6302
2.3340
2.8523
2.2230
2.4821
Operating cost:
7.1973e+005
Ps:
1.0e+003 *
0.7522
1.0522
0.6522
1.3522
0.5022
0.8522
Ph:
447.7979
447.7979
447.7979
447.7979
447.7979
447.7979
Discharge:
1.0e+003 *
2.5556 2.5556 2.5556 2.5556 2.5556 2.5556
enter j+(max g):4
enter j-(min g):5
enter delq:1000
gamma:
2.4081
2.6302
2.3340
2.7034
2.3719
2.4821
Operating cost:
1.4337e+006
Ps:
1.0e+003 *
0.7522
1.0522
0.6522
1.1510
0.7034
0.8522
Ph:
447.7979
447.7979
447.7979
649.0051
246.5907
447.7979
Discharge:
1.0e+003 *
2.5556 2.5556 2.5556 3.5556 1.5556 2.5556