0% found this document useful (0 votes)
23 views16 pages

PS

The document presents a fast decoupled load flow analysis and a Gauss-Seidel load flow analysis for a power system with three buses. It includes the formulation of the admittance matrix, bus data, and iterative calculations to determine voltage and angle values at each bus. The results show the convergence of the voltage and angle values over several iterations.

Uploaded by

csai91957
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views16 pages

PS

The document presents a fast decoupled load flow analysis and a Gauss-Seidel load flow analysis for a power system with three buses. It includes the formulation of the admittance matrix, bus data, and iterative calculations to determine voltage and angle values at each bus. The results show the convergence of the voltage and angle values over several iterations.

Uploaded by

csai91957
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

22011P0231

FAST DECOUPLED LOAD FLOW ANALYSIS

clc;
nbus=3;
Y=[5.882-23.528i -2.94+11.764i -2.941+11.764i;
-2.941+11.764i 5.882-23.528i -2.941+11.764i;
-2.941+11.764i -2.941+11.764i 5.882-23.528i;]
busdata=[1 1 1.04 0 0 0 0 0;
2 2 1.04 0 -1.5 0 0 0 ;
3 3 1 0 0.5 1 0 0;]
bus=busdata(:,1);
type=busdata(:,2);
V=busdata(:,3);
del=busdata(:,4);
P=busdata(:,5);
Q=busdata(:,6);
Qmin=busdata(:,7);
Qmax=busdata(:,8);
Psp=P;
Qsp=Q;
G=real(Y);
B=imag(Y);
PV=find(type==2|type==1);
PQ=find(type==3);
npv=length(PV);
npq=length(PQ);
tol=1;
iter=1;
while(tol>0.01)
P=zeros(nbus,1);
Q=zeros(nbus,1);
for i=1:nbus
for k=1:nbus
P(i)=P(i)+V(i)*V(k)*(G(i,k)*cos(del(i)-del(k))+B(i,k)*sin(del(i)-del(k)));
Q(i)=Q(i)+V(i)*V(k)*(G(i,k)*sin(del(i)-del(k))-B(i,k)*cos(del(i)-del(k)));
end
end
if iter<=7&&iter>2
for n=2:nbus
if type(n)==2
if Q<Qmin(n)
Q=Qmin(n);
elseif Q>Qmax(n)
Q=Qmax(n);
end
end
end
end
dPa=Psp-P;
dQa=Qsp-Q;
k=1;
dQ=zeros(npq,1);
for i=1:nbus
if type(i)==3
dQ(k,1)=dQa(i);
k=k+1;
22011P0231

end
end
dP=dPa(2:nbus);

M=[dP;dQ];
j1=zeros(nbus-1,nbus-1);
for i=1:(nbus-1)
m=i+1;
for k=1:(nbus-1)
n=k+1;
if n==m
j1(i,k)=-V(m)^2*B(m,m);
else
j1(i,k)=-V(m)*V(n)*B(m,n);
end
end
end
j2=zeros(nbus-1,npq);
j3=zeros(npq,nbus-1);
j4=zeros(npq,npq);
for i=npq
for k=npq
j4(i,k)=j1(nbus-1,nbus-1);
end
end
J=[j1 j2;j3 j4];
X=(inv(J))*M;
dTh=X(1:nbus-1);
dV=X(nbus:end);
del(2:nbus)=dTh+del(2:nbus);
k=1;
for i=2:nbus
if type(i)==3
V(i)=dV(k)+V(i);
k=k+1;
end
end
tol=max(abs(M));
iter
V
del
J
iter=iter+1;
end
22011P0231

output:

Y=

5.8820 -23.5280i -2.9400 +11.7640i -2.9410 +11.7640i


-2.9410 +11.7640i 5.8820 -23.5280i -2.9410 +11.7640i
-2.9410 +11.7640i -2.9410 +11.7640i 5.8820 -23.5280i

busdata =

1.0000 1.0000 1.0400 0 0 0 0 0


2.0000 2.0000 1.0400 0 -1.5000 0 0 0
3.0000 3.0000 1.0000 0 0.5000 1.0000 0 0

iter =

V=

1.0400
1.0400
1.0825

del =

0
-0.0650
-0.0025

J=

25.4479 -12.2346 0
-12.2346 23.5280 0
0 0 23.5280

iter =

V=

1.0400
1.0400
1.0858
22011P0231

del =

0
-0.0652
-0.0233

J=

25.4479 -13.2439 0
-13.2439 27.5704 0
0 0 27.5704

iter =

V=

1.0400
1.0400
1.0813

del =

0
-0.0655
-0.0250

J=

25.4479 -13.2838 0
-13.2838 27.7367 0
0 0 27.7367

iter =

V=

1.0400
1.0400
1.0808

del =

0
-0.0656
22011P0231
-0.0240

J=

25.4479 -13.2297 0
-13.2297 27.5112 0
0 0 27.5112

iter =

V=

1.0400
1.0400
1.0810

del =

0
-0.0655
-0.0238

J=

25.4479 -13.2228 0
-13.2228 27.4826 0
0 0 27.4826
22011P0231
GAUSS-SEIDAL LOAD FLOW ANALYSIS

clc;
close all;
linedata = [ 1 2 0.05 0.15 0 1;
1 3 0.10 0.30 0 1;
2 3 0.15 0.45 0 1;
2 4 0.1 0.3 0 1;
3 4 0.05 0.15 0 1;]
fb=linedata(:,1);
tb=linedata(:,2);
r=linedata(:,3);
x=linedata(:,4);
ycp=linedata(:,5);
a=linedata(:,6);
z=r+1.i*x;
y=1./z;
ycp=1.i*ycp;
nb=max(max(fb),max(tb));
n1=length(fb);
Y=zeros(nb,nb);
for k=1:n1
Y(fb(k),tb(k))=Y(fb(k),tb(k))-y(k)/a(k);
Y(tb(k),fb(k))=Y(fb(k),tb(k));
end
for m=1:nb
for n=1:n1
if fb(n)==m
Y(m,m)=Y(m,m)+y(n)/(a(n)^2)+ycp(n);
else
if tb(n)==m
Y(m,m)=Y(m,m)+y(n)+ycp(n);
end
end
end
end
Y
busdata=[1 1 1.04 0 0 0 0 0 0 0;
2 2 1.04 0 0.5 0 0 0 0.2 1.0;
3 3 1.0 0 0 0 1.0 -0.5 0 0;
4 4 1.0 0 0 0 -0.3 0.1 0 0;]
Y=Y();
bus=busdata(:,1);
type=busdata(:,2);
V=busdata(:,3);
th=busdata(:,4);
genMW=busdata(:,5);
genMVAR=busdata(:,6);
loadMW=busdata(:,7);
loadMVAR=busdata(:,8);
Qmin=busdata(:,9);
Qmax=busdata(:,10);
nbus=max(bus);
P=genMW-loadMW;
Q=genMVAR-loadMVAR;
Vprev=V;
22011P0231

toler=1;
iteration=1;
while(toler>0.01)
for i=2:nbus

sumyV=0;
for k=1:nbus
if i~=k
sumyV=sumyV+(Y(i,k)*V(k));
end
end
if type(i)==2
Q(i)=-imag(conj(V(i))*(sumyV+Y(i,i)*V(i)));
if Q(i)>Qmax(i)||Q(i)<Qmin(i)
if (Q(i)<Qmin(i))
Q(i)=Qmin(i);
else
Q(i)=Qmax(i);
end
type(i)=3;
end
end
V(i)=(1/Y(i,i))*((P(i)-1i*Q(i))/conj(V(i))-sumyV);
if type(i)==2
Vmag=abs(Vprev(i));
th=angle(V(i));
V(i)=Vmag*(cos(th)+1i*sin(th));
end
end
toler=max(abs(abs(V)-abs(Vprev)));
Vprev=V;
disp('voltage at iteration');
disp(iteration);
disp(V);
iteration=iteration+1;
end
iteration
V
Vmag=abs(V)
Ang=180/pi*angle(V)
P
Q
22011P0231

output:

linedata =

Column 1

1.0000
1.0000
2.0000
2.0000
3.0000

Column 2

2.0000
3.0000
3.0000
4.0000
4.0000

Column 3

0.0500
0.1000
0.1500
0.1000
0.0500

Column 4

0.1500
0.3000
0.4500
0.3000
0.1500

Column 5

0
0
0
0
0

Column 6

1.0000
1.0000
1.0000
1.0000
1.0000
22011P0231
Y=

Column 1

3.0000 - 9.0000i
-2.0000 + 6.0000i
-1.0000 + 3.0000i
0.0000 + 0.0000i

Column 2

-2.0000 + 6.0000i
3.6667 -11.0000i
-0.6667 + 2.0000i
-1.0000 + 3.0000i

Column 3

-1.0000 + 3.0000i
-0.6667 + 2.0000i
3.6667 -11.0000i
-2.0000 + 6.0000i

Column 4

0.0000 + 0.0000i
-1.0000 + 3.0000i
-2.0000 + 6.0000i
3.0000 - 9.0000i

busdata =

Column 1

1.0000
2.0000
3.0000
4.0000

Column 2

1.0000
2.0000
3.0000
4.0000

Column 3

1.0400
1.0400
1.0000
1.0000
22011P0231
Column 4

0
0
0
0

Column 5

0
0.5000
0
0

Column 6

0
0
0
0

Column 7

0
0
1.0000
-0.3000

Column 8

0
0
-0.5000
0.1000

Column 9

0
0.2000
0
0

Column 10

0
1.0000
0
0

voltage at iteration
1

1.0400 + 0.0000i
1.0395 + 0.0335i
1.0317 - 0.0894i
1.0343 - 0.0151i
22011P0231
voltage at iteration
2

1.0400 + 0.0000i
1.0647 + 0.0146i
1.0465 - 0.0985i
1.0531 - 0.0286i

voltage at iteration
3

1.0400 + 0.0000i
1.0725 + 0.0080i
1.0574 - 0.1058i
1.0633 - 0.0362i

voltage at iteration
4

1.0400 + 0.0000i
1.0772 + 0.0042i
1.0633 - 0.1097i
1.0690 - 0.0404i

iteration =

V=

1.0400 + 0.0000i
1.0772 + 0.0042i
1.0633 - 0.1097i
1.0690 - 0.0404i

Vmag =

1.0400
1.0773
1.0689
1.0698

Ang =

0
0.2211
-5.8879
-2.1646
22011P0231
P=

0
0.5000
-1.0000
0.3000

Q=

0
0.2000
0.5000
-0.1000

GENERATION OF ADMITTANCE MATRIX


22011P0231

clc;
close all;
baseMVA = 100;

linedata = [ 1 2 0.02 0.06 0.03 1;


1 3 0.08 0.24 0.025 1;
2 3 0.06 0.18 0.02 1;
2 4 0.06 0.18 0.02 1;
3 4 0.01 0.03 0.01 1;
4 5 0.08 0.24 0.025 1 ];

lp = linedata(:,1); % From bus


lq = linedata(:,2); % To bus
r = linedata(:,3); % Resistance
x = linedata(:,4); % Reactance
ycp = linedata(:,5); % Charging Admittance
a = linedata(:,6); % Tap Ratio

y = 1 ./ (r + 1i .* x);
ycp = 1i .* ycp;

nbus = max(max(lp), max(lq));


nline = length(lp);

p = zeros(nbus, nbus);

for k = 1:nline
p(lp(k), lq(k)) = (p(lp(k), lq(k))) - (y(k) / a(k));
p(lq(k), lp(k)) = p(lp(k), lq(k));
end

for m = 1:nbus
for n = 1:nline
if lp(n) == m
p(m, m) = p(m, m) + (y(n) / (a(n)^2)) + ycp(n);
elseif lq(n) == m
p(m, m) = p(m, m) + y(n) + ycp(n);
end
end
end

disp('Bus Admittance Matrix (Ybus):');


disp(p);
22011P0231

Bus Admittance Matrix (Ybus):

6.2500 -18.6950i -5.0000 +15.0000i -1.2500 + 3.7500i 0.0000 + 0.0000i 0.0000 + 0.0000i
-5.0000 +15.0000i 8.3333 -24.9300i -1.6667 + 5.0000i -1.6667 + 5.0000i 0.0000 + 0.0000i
-1.2500 + 3.7500i -1.6667 + 5.0000i 12.9167 -38.6950i -10.0000 +30.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i -1.6667 + 5.0000i -10.0000 +30.0000i 12.9167 -38.6950i -1.2500 + 3.7500i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -1.2500 + 3.7500i 1.2500 - 3.7250i

>>

GENERATION OF IMPEDANCE MATRIX


22011P0231

clear;
clc;
linedata = [1 1 0 11^0.05;
2 2 1 11^0.1;
3 3 2 11^0.2];

[elements, ~] = size(linedata);

zbus = [];
currentbus = 0;

for count = 1:elements


% Get current size of Zbus
[rows, cols] = size(zbus);

fb = linedata(count, 2);
tb = linedata(count, 3);
Zs = linedata(count, 4);

newbus = max(fb, tb);


ref = min(fb, tb);

if newbus > currentbus && ref == 0


fprintf('New bus to reference bus!\n');
zbus = [zbus; zeros(1, cols), Zs];
currentbus = newbus;
continue;
end

if newbus > currentbus && ref ~= 0


fprintf('New bus to old bus!\n');
zbus = [zbus, zbus(:, ref); zbus(ref, :), Zs + zbus(ref, ref)];
currentbus = newbus;
continue;
end

if newbus <= currentbus && ref == 0


fprintf('Old bus to reference bus!\n');
zbus = zbus - (1 / (zbus(newbus, newbus) + Zs)) * (zbus(:, newbus) * zbus(newbus, :));
continue;
end

if newbus <= currentbus && ref ~= 0


fprintf('Old bus to old bus!\n');
zbus = zbus - (1 / (Zs + zbus(fb, fb) + zbus(tb, tb) - 2 * zbus(fb, tb))) * ...
((zbus(:, fb) - zbus(:, tb)) * (zbus(fb, :) - zbus(tb, :)));
continue;
end
end

disp('Final Bus Impedance Matrix (Zbus):');


disp(zbus);

New bus to reference bus!


New bus to old bus!
New bus to old bus!
22011P0231

Final Bus Impedance Matrix (Zbus):


1.1274 1.1274 1.1274
1.1274 2.3984 2.3984
1.1274 2.3984 4.0138

You might also like