716ee3086 Assignment 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ASSIGNMENT -4

Name-Madhusmita Barik
Roll_No-716ee3086

%Gauss Seidel Method without using acceleration factor

clc
clear

Y=[3-9i,-2+6i,-1+3i,0;-2+6i,3.6667-11i,-0.6667+2i,-1+3i;-1+3i,-0.6667+2i,3.6667-11i,-2+6i;0,-
1+3i,-2+6i,3-9i];
V=[1.04;1.04;1;1];
P=[0;0.5;-1;0.3];
Q=[0;0;0.5;-0.1];

k=0;
volt_sub(1,1)=0;
chk=0;
delV=0.1;

while norm(delV) > 0.00001

V_old=V;
volt=Y*V;
volt_sub(2)=Y(2,2)*V(2,1);
Q(2)=-imag(conj(V(2,1))*volt(2,1));

if (Q(2)<0.2)
Q(2)=0.2;
if k==0
V(2)=1;
end
chk=1;
end
if(Q(2) >1)
Q(2)=1;
if k==0
V(2)=1;
end
chk=2;
end

for j=2:4
volt=Y*V;
volt_req=volt(j,1)-Y(j,j)*V(j,1);
V(j,1)=(P(j)-Q(j)*i)./(conj(V(j,1)))-volt_req;
V(j,1)=V(j,1)./Y(j,j);
if chk==0
V(2,1)=1.04*exp(angle(V(2,1))*i);
end

end
delV=(V-V_old);
k=k+1;
chk=0;
end
fprintf('The no. of iterations taken to converge=%d\n',k);
fprintf('The converged value of voltages of 4 buses= ');
V

The no. of iterations taken to converge=17


The converged value of voltages of 4 buses=
V =

1.0400 + 0.0000i
1.0832 - 0.0005i
1.0708 - 0.1144i
1.0762 - 0.0455i

%Gauss Seidel Method using acceleration factor

clc
clear
close

Y=[3-9i,-2+6i,-1+3i,0;-2+6i,3.6667-11i,-0.6667+2i,-1+3i;-1+3i,-0.6667+2i,3.6667-11i,-2+6i;0,-
1+3i,-2+6i,3-9i];
V=[1.04;1.04;1;1];
P=[0;0.5;-1;0.3];
Q=[0;0;0.5;-0.1];

iter=10;
k=0;
volt_sub(1,1)=0;
chk=0;
delV=0.1;
while norm(delV) > 0.00001
V_old=V;
volt=Y*V;
volt_sub(2)=Y(2,2)*V(2,1);
Q(2)=-imag(conj(V(2,1))*volt(2,1));
if (Q(2)<0.2)
Q(2)=0.2;
if k==0
V(2)=1;
end
chk=1;
end
if(Q(2) >1)
Q(2)=1;
if k==0
V(2)=1;
end
chk=2;
end

for j=2:4
volt=Y*V;
volt_req=volt(j,1)-Y(j,j)*V(j,1);
V(j,1)=(P(j)-Q(j)*i)./(conj(V(j,1)))-volt_req;
V(j,1)=V(j,1)./Y(j,j);
if chk==0
V(2,1)=1.04*exp(angle(V(2,1))*i);
end

end
V(j,1)=V(j,1)+0.8*(V(j,1)-V_old(j,1));
delV=(V-V_old);
k=k+1;
chk=0;
end

fprintf('The no. of iterations taken to converge=%d\n',k);


fprintf('The converged value of voltages of 4 buses= ');
V

The no. of iterations taken to converge=9


The converged value of voltages of 4 buses=
V =

1.0400 + 0.0000i
1.0832 - 0.0005i
1.0708 - 0.1144i
1.0762 - 0.0455i

Published with MATLAB® R2019a

You might also like