Thursday, 19 December 2019

Gauss Seidal Matlab Program



LOAD FLOW ANALYSIS USING GAUSS SEIDAL METHOD

Program:-

clc;
x=input('enter the no of elements:');
a=0;
y=0;
for e=1:x
    i=input('enter the starting node:');
    j=input('enter the ending node:');
y(e,e)=input('enter the admittance value:');
a(e,i)=1;
a(e,j)=-1;
end
ybus=a'*y*a;
ybus
    b=input('enter the no of buses:');
for i=2:b
i
pg(i)=input('enter the generator power in mw:');
qg(i)=input('enter the generator in kvar:');
pl(i)=input('enter the load in mw:');
ql(i)=input('enter the load in kvar:');
end
v(1)=input('enter the slack bus voltage');
acc=input('enter the acceleration factor:');
for i=2:b
v(i)=input('enter the voltage:');
p(i)=pg(i)-pl(i);
q(i)=qg(i)-ql(i);
end
    n=input('enter the no of iteration:');
for i=1:n
for j=2:b
i(j)=0;
for k=1:b;
if(j~=k)
i(j)=i(j)+(ybus(j,k)*v(k));
end
end
s(j)=v(j);
            v(j)=((((p(j)-q(j))/conj(v(j)))-i(j))/ybus(j,j));
v(j)=s(j)+acc*(v(j)-s(j));
end
end
for i=1:b
disp('bus');
i
disp('voltage');
v(i)
end


OUTPUT:

Enter the number of elements5
Enter the starting node:1
Enter the ending node:2
Enter the admittance value:2-6j
Enter the starting node:1
Enter the ending node:3
Enter the admittance value:1-3j
Enter the starting node:2
Enter the ending node:3
Enter the admittance value:66-2j
Enter the starting node:2
Enter the ending node:4
Enter the admittance value:1-3j
Enter the starting node:3
Enter the ending node:4
Enter the admittance value:2-6j
ybus = 3.0000 - 9.0000i   -2.0000 + 6.0000i   -1.0000 + 3.0000i       0         
           -2.0000 + 6.0000i  69.0000 -11.0000i  -66.0000 + 2.0000i   -1.0000  + 3.0000i
            -1.0000 + 3.0000i -66.0000 + 2.0000i  69.0000 -11.0000i   -2.0000 + 6.0000i
              0                          -1.0000 + 3.0000i   -2.0000 + 6.0000i      3.0000 - 9.0000i
Enter the no.of buses:4
i = 2
Enter the generator power in mw:0
Enter the generator power in kvar:0
Enter the load in mw:5
Enter the load in kvar:2
i =3
Enter the generator power in mw:0
Enter the generator power in kvar:0
Enter the load in mw:-1
Enter the load in kvar:0.1j
i = 4
Enter the generator power in mw:0
Enter the generator power in kvar:0
Enter the load in mw:3
Enter the load in kvar:0.1j
Enter the slack bus voltage:1.04
Enter the acceleration factor:1
Enter the voltage:1
Enter the voltage:1
Enter the voltage:1
Enter the no of iteration:1
Bus
i =1
Voltage
ans = 1.0400
bus
i = 2
Voltage
ans = 0.9593 - 0.0100i
Bus
i = 3
Voltage
ans = 0.9778 - 0.0122i
Bus
i = 4
Voltage

ans = 0.8616 - 0.3081i





If any queries contact me thro mail kuaality778@gmail.com

No comments:

Post a Comment

google-site-verification: google18ae80885fc3d876.html