Você está na página 1de 13

UNIVERSIDADE FEDERAL DO ABC

PGEE PS-GRADUAO EM ENGENHARIA ELTRICA

CAIO CSAR DE MORAES

Trabalho 02 de ANESEP Anlise de fluxo usando


mtodos iterativos Gauss e Newton.

Santo Andr
2015

Sumrio

1.

2.

Modelo de 4 Barras e 4 Ramos Mtodo Newton-Rapshon...................3


1.1.

Cdigo fonte.......................................................................................3

1.2.

Resultado Newton..............................................................................9

Modelo de 4 Barras e 4 Ramos Mtodo Gauss-Seidel.......................10


2.1.

Cdigo Fonte....................................................................................10

2.2.

Resultado Gauss..............................................................................12

1. Modelo de 4 Barras e 4 Ramos Mtodo Newton-Rapshon


1.1.Cdigo fonte

%
%
%
%

-----------------------------------------------Aula 02 - ANESEP
Anlise de carga com mtodo de Newton-Rapshon
------------------------------------------------

%
%
%
%

-------------------------------CAIO CSAR DE MORAES


PROFESSOR DR EDMRCIO BELATI
--------------------------------

clear all;
clc;
%DADOS DAS LINHAS DE TRANSMISSO
%
|DA
|PARA |
R
|
X
|
%
|BARRA |BARRA |
[pu] | [pu] |
dados_linha = [ 1
2
0.01008
0.0504
1
3
0.00744
0.0372
2
4
0.00744
0.0372
3
4
0.01272
0.0636

Bshunt |
[pu]
|
0.1025;
0.0775;
0.0775;
0.1275;];

% DIVISO DOS DADOS DAS LINHAS EM VETORES - CLCULAR MATRIZ ADMITNCIA Y


db = dados_linha(:,1);
%Da barra nmero...
pb = dados_linha(:,2);
%Para barra nmero...
r = dados_linha(:,3);
%Resistencia R da linha em pu
x = dados_linha(:,4);
%Reatncia X da linha em pu
b = dados_linha(:,5);
%Admitncia do terra, shunt
z = r + x*1j;
%Impedncia Z complexa da linha
y = 1./z;
%Inverte elementos de z para admintncia
b = b*1j;
%Muda shunt para imaginrio
nbarras = max(max(db),max(pb)); %Determina o nmero total de barras
nramos = length(db);
%Identifica o nmero de ramos
Ybarra = zeros(nbarras,nbarras);%Inicializa matriz Y com zeros
% ELEMENTOS DA MATRIZ Ybarra
% COMPLETA ELEMENTOS FORA DA DIAGONAL PRINCIPAL
for k=1:nramos
Ybarra(db(k),pb(k)) = -y(k);
Ybarra(pb(k),db(k)) = Ybarra(db(k),pb(k));
end
% COMPLETA ELEMENTOS DENTRO DA DIAGONAL PRINCIPAL
for m=1:nbarras
for n=1:nramos
if db(n) == m | pb(n) == m;
Ybarra(m,m) = Ybarra(m,m) + y(n) + b(n);
end
end
end

Ybarra
G = real(Ybarra)
B = imag(Ybarra)
% DADOS FORNECIDOS DAS BARRAS
%Tipos: 1-Slack referncia; 2-PV(tenso controlada); 3-PQ(barra de carga)
%
|Barra|Tipo|Pc[pu] |Qc[pu] |Pg[pu]|Qg[pu]|E[pu] |theta|
dados_barra = [ 1
1
0.05
0.3099 0
0
1.00
0;
2
3
1.70
1.0535 0
0
1.00
0;
3
3
2.00
1.2394 0
0
1.00
0;
4
2
0.80
0.4958 3.18
0
1.02
0;];
%Barras PQ iniciadas com E=1.00pu e barras PV e PQ com theta=0
%Assumindo a barra 1 como a slack e servindo de referncia.
%DIVISO DOS DADOS DAS BARRAS EM VETORES
barra = dados_barra(:,1);
tipo = dados_barra(:,2);
PcW = dados_barra(:,3);
QcVAR = dados_barra(:,4);
PgW = dados_barra(:,5);
QgVAR = dados_barra(:,6);
E = dados_barra(:,7);
theta = dados_barra(:,8);
nbarra = max(barra);
P = PgW - PcW;
Q = QgVAR - QcVAR;
Pdado = P;
Qdado = Q;
Ep = E;
erro_max = 0.00001;
erro = 1;
Iter = 1;
pv = find(tipo == 2 | tipo == 1);
pq = find(tipo == 3);
npv = length(pv);
npq = length(pq);

%Nmero da barra
%Tipo da barra 1-Slack,2-PV e 3-PQ
%Potncia ativa consumida na barra
%Potncia reativa consumida na barra
%Potncia ativa injetada na barra
%Potncia reatica injetada na barra
%Tenso inicial da barra
%ngulo inicial da barra
%Nmero total de barras
%Potncia ativa lquida na barra
%Potncia reativa lquida na barra
%P dada
%Q dada
%Inicia varivel com tenso inicial
%Erro mximo aceito
%Inicia varivel erro
%Inicia contador de iteraes
%Barras PV
%Barras PQ
%Nmero de barras PV
%Nmero de barras PQ

while(erro > erro_max)

%Incio da iterao

P = zeros(nbarras,1);
Q = zeros(nbarras,1);
for i = 1:nbarra
for k = 1:nbarra
P(i) = P(i) + E(k)*E(i)*(G(i,k)*cos(theta(i)-theta(k))+
B(i,k)*sin(theta(i)-theta(k)));
Q(i) = Q(i) + E(i)*E(k)*(G(i,k)*sin(theta(i)-theta(k))B(i,k)*cos(theta(i)-theta(k)));
end
end
% P2 = E(2)*(E(1)*(G(2,1)*cos(theta(2)-theta(1))+B(2,1)*sin(theta(2)theta(1)))+(E(4)*(G(2,4)*cos(theta(2)-theta(4))+B(2,4)*sin(theta(2)theta(4)))));
% P3 = E(3)*(E(1)*(G(3,1)*cos(theta(3)-theta(1))+B(3,1)*sin(theta(3)theta(1)))+(E(4)*(G(3,4)*cos(theta(3)-theta(4))+B(3,4)*sin(theta(3)theta(4)))));

% P4 = E(4)*(E(2)*(G(4,2)*cos(theta(4)-theta(2))+B(4,2)*sin(theta(4)theta(2)))+(E(3)*(G(4,3)*cos(theta(4)-theta(3))+B(4,3)*sin(theta(4)theta(3)))));
% Q2 = E(2)*(E(1)*(G(2,1)*sin(theta(2)-theta(1))-B(2,1)*cos(theta(2)theta(1)))+(E(4)*(G(2,4)*sin(theta(2)-theta(4))-B(2,4)*cos(theta(2)theta(4)))));
% Q3 = E(3)*(E(1)*(G(3,1)*sin(theta(3)-theta(1))-B(3,1)*cos(theta(3)theta(1)))+(E(4)*(G(3,4)*sin(theta(3)-theta(4))-B(3,4)*cos(theta(3)theta(4)))));
%Deltas de tenso
%
%
%
%
%

dP2=Pdado(2)-P2;
dP3=Pdado(3)-P3;
dP4=Pdado(4)-P4;
dQ2=Qdado(2)-Q2;
dQ3=Qdado(3)-Q3;
dPa = Pdado-P;
dQa = Qdado-Q;
k = 1;
dQ = zeros(npq,1);
for i = 1:nbarra
if tipo(i) == 3
dQ(k,1) = dQa(i);
k = k+1;
end
end
dP = dPa(2:nbarra);
deltapot = [dP; dQ];

%Matriz H - Derivadas de Potncia ativa pelo ngulo


% H22 = (-B(2,2)*(E(2)^2)) - (E(2)*(E(1)*(G(2,1)*sin(theta(2)-theta(1))B(2,1)*cos(theta(2)-theta(1)))+...
%
E(2)*(G(2,2)*sin(theta(2)-theta(2))B(2,2)*cos(theta(2)-theta(2)))+...
%
E(3)*(G(2,3)*sin(theta(2)-theta(3))B(2,3)*cos(theta(2)-theta(3)))+...
%
E(4)*(G(2,4)*sin(theta(2)-theta(4))B(2,4)*cos(theta(2)-theta(4)))));
% H23 = (E(2)*E(3))*(G(2,3)*sin(theta(2)-theta(3))-B(2,3)*cos(theta(2)theta(3)));
% H24 = (E(2)*E(4))*(G(2,4)*sin(theta(2)-theta(4))-B(2,4)*cos(theta(2)theta(4)));
% H32 = (E(3)*E(2))*(G(3,2)*sin(theta(3)-theta(2))-B(3,2)*cos(theta(3)theta(2)));
% H33 = (-B(3,3)*(E(3)^2)) - (E(3)*(E(1)*(G(3,1)*sin(theta(3)-theta(1))B(3,1)*cos(theta(3)-theta(1)))+...
%
E(2)*(G(3,2)*sin(theta(3)-theta(2))B(3,2)*cos(theta(3)-theta(2)))+...
%
E(3)*(G(3,3)*sin(theta(3)-theta(3))B(3,3)*cos(theta(3)-theta(3)))+...
%
E(4)*(G(3,4)*sin(theta(3)-theta(4))B(3,4)*cos(theta(3)-theta(4)))));
% H34 = (E(3)*E(4))*(G(3,4)*sin(theta(3)-theta(4))-B(3,4)*cos(theta(3)theta(4)));
% H42 = (E(4)*E(2))*(G(4,2)*sin(theta(4)-theta(2))-B(4,2)*cos(theta(4)theta(2)));
% H43 = (E(4)*E(3))*(G(4,3)*sin(theta(4)-theta(3))-B(4,3)*cos(theta(4)theta(3)));

% H44 = (-B(4,4)*(E(4)^2)) - (E(4)*(E(1)*(G(4,1)*sin(theta(4)-theta(1))B(4,1)*cos(theta(4)-theta(1)))+...


%
E(2)*(G(4,2)*sin(theta(4)-theta(2))B(4,2)*cos(theta(4)-theta(2)))+...
%
E(3)*(G(4,3)*sin(theta(4)-theta(3))B(4,3)*cos(theta(4)-theta(3)))+...
%
E(4)*(G(4,4)*sin(theta(4)-theta(4))B(4,4)*cos(theta(4)-theta(4)))));
H = zeros(nbarra-1,nbarra-1);
for i = 1:(nbarra-1)
m = i+1;
for k = 1:(nbarra-1)
n = k+1;
if n == m
for n = 1:nbarra
H(i,k) = H(i,k) + E(m)* E(n)*(-G(m,n)*sin(theta(m)theta(n)) + B(m,n)*cos(theta(m)-theta(n)));
end
H(i,k) = H(i,k) - E(m)^2*B(m,m);
else
H(i,k) = E(m)*E(n)*(G(m,n)*sin(theta(m)-theta(n))B(m,n)*cos(theta(m)-theta(n)));
end
end
end
% Matriz N - Derivadas de Potncia ativa pela tenso
% N22 = (E(2)^-1)*((E(2)^2*G(2,2))+(E(2)*(E(1)*(G(2,1)*cos(theta(2)theta(1))+B(2,1)*sin(theta(2)-theta(1)))+...
%
E(2)*(G(2,2)*cos(theta(2)-theta(2))
+B(2,2)*sin(theta(2)-theta(2)))+...
%
E(3)*(G(2,3)*cos(theta(2)-theta(3))
+B(2,3)*sin(theta(2)-theta(3)))+...
%
E(4)*(G(2,4)*cos(theta(2)-theta(4))
+B(2,4)*sin(theta(2)-theta(4))))));
% N23 = E(2)*(G(2,3)*cos(theta(2)-theta(3))+B(2,3)*sin(theta(2)-theta(3)));
% N32 = E(3)*(G(3,2)*cos(theta(3)-theta(2))+B(3,2)*sin(theta(3)-theta(2)));
% N33 = (E(3)^-1)*((E(3)^2*G(3,3))+(E(3)*(E(1)*(G(3,1)*cos(theta(3)theta(1))+B(3,1)*sin(theta(3)-theta(1)))+...
%
E(2)*(G(3,2)*cos(theta(3)-theta(2))
+B(3,2)*sin(theta(3)-theta(2)))+...
%
E(3)*(G(3,3)*cos(theta(3)-theta(3))
+B(3,3)*sin(theta(3)-theta(3)))+...
%
E(4)*(G(3,4)*cos(theta(3)-theta(4))
+B(3,4)*sin(theta(3)-theta(4))))));
% N42 = E(4)*(G(4,2)*cos(theta(4)-theta(2))+B(4,2)*sin(theta(4)-theta(2)));
% N43 = E(4)*(G(4,3)*cos(theta(4)-theta(2))+B(4,3)*sin(theta(4)-theta(3)));
N = zeros(nbarra-1,npq);
for i = 1:(nbarra-1)
m = i+1;
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbarra
N(i,k) = N(i,k) + E(n)*(G(m,n)*cos(theta(m)-theta(n)) +
B(m,n)*sin(theta(m)-theta(n)));
end
N(i,k) = N(i,k) + E(m)*G(m,m);

else

N(i,k) = E(m)*(G(m,n)*cos(theta(m)-theta(n)) +
B(m,n)*sin(theta(m)-theta(n)));
end
end
end
% Matriz M - Derivadas de Potncia reativa pelo ngulo.
% M22 = (-E(2)^2*G(2,2)) + (E(2)*(E(1)*(G(2,1)*cos(theta(2)-theta(1))
+B(2,1)+sin(theta(2)-theta(1)))+...
%
E(2)*(G(2,2)*cos(theta(2)-theta(2))
+B(2,2)+sin(theta(2)-theta(2)))+...
%
E(3)*(G(2,3)*cos(theta(2)-theta(3))
+B(2,3)+sin(theta(2)-theta(3)))+...
%
E(4)*(G(2,4)*cos(theta(2)-theta(4))
+B(2,4)+sin(theta(2)-theta(4)))));
% M23 =(-E(2)*E(3))*(G(2,3)*cos(theta(2)-theta(3))-B(2,3)*sin(theta(2)theta(3)));
% M24 =(-E(2)*E(4))*(G(2,4)*cos(theta(2)-theta(4))-B(2,4)*sin(theta(2)theta(4)));
% M32 =(-E(3)*E(2))*(G(3,2)*cos(theta(3)-theta(2))-B(3,2)*sin(theta(3)theta(2)));
% M33 = (-E(3)^2*G(3,3)) + (E(3)*(E(1)*(G(3,1)*cos(theta(3)-theta(1))
+B(3,1)+sin(theta(3)-theta(1)))+...
%
E(2)*(G(3,2)*cos(theta(3)-theta(2))
+B(3,2)+sin(theta(3)-theta(2)))+...
%
E(3)*(G(3,3)*cos(theta(3)-theta(3))
+B(3,3)+sin(theta(3)-theta(3)))+...
%
E(4)*(G(3,4)*cos(theta(3)-theta(4))
+B(3,4)+sin(theta(3)-theta(4)))));
% M34 =(-E(3)*E(4))*(G(3,4)*cos(theta(3)-theta(4))-B(3,4)*sin(theta(3)theta(4)));
M = zeros(npq,nbarra-1);
for i = 1:npq
m = pq(i);
for k = 1:(nbarra-1)
n = k+1;
if n == m
for n = 1:nbarra
M(i,k) = M(i,k) + E(m)* E(n)*(G(m,n)*cos(theta(m)theta(n)) + B(m,n)*sin(theta(m)-theta(n)));
end
M(i,k) = M(i,k) - E(m)^2*G(m,m);
else
M(i,k) = E(m)* E(n)*(-G(m,n)*cos(theta(m)-theta(n)) B(m,n)*sin(theta(m)-theta(n)));
end
end
end
% Matriz L - Derivadas de Potncia reativa pela tenso.
% L22 = (E(2)^-1)*((-B(2,2)*E(2)^2)+(E(2)*(E(1)*(G(2,1)*sin(theta(2)theta(1))-B(2,1)*cos(theta(3)-theta(1)))+...
%
E(2)*(G(2,2)*sin(theta(2)-theta(2))B(2,2)*cos(theta(3)-theta(2)))+...
%
E(3)*(G(2,3)*sin(theta(2)-theta(3))B(2,3)*cos(theta(3)-theta(3)))+...

%
E(4)*(G(2,4)*sin(theta(2)-theta(4))B(2,4)*cos(theta(3)-theta(4))))));
% L23 = (E(2)*E(3))*(G(2,3)*sin(theta(2)-theta(3))-B(2,3)*cos(theta(2)theta(3)));
% L32 = (E(3)*E(2))*(G(3,2)*sin(theta(3)-theta(2))-B(3,2)*cos(theta(3)theta(2)));
% L33 = (E(3)^-1)*((-B(3,3)*E(3)^2)+(E(3)*(E(1)*(G(3,1)*sin(theta(3)theta(1))-B(3,1)*cos(theta(3)-theta(1)))+...
%
E(2)*(G(3,2)*sin(theta(3)-theta(2))B(3,2)*cos(theta(3)-theta(2)))+...
%
E(3)*(G(3,3)*sin(theta(3)-theta(3))B(3,3)*cos(theta(3)-theta(3)))+...
%
E(4)*(G(3,4)*sin(theta(3)-theta(4))B(3,4)*cos(theta(3)-theta(4))))));
L = zeros(npq,npq);
for i = 1:npq
m = pq(i);
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbarra
L(i,k) = L(i,k) + E(n)*(G(m,n)*sin(theta(m)-theta(n)) B(m,n)*cos(theta(m)-theta(n)));
end
L(i,k) = L(i,k) - E(m)*B(m,m);
else
L(i,k) = E(m)*(G(m,n)*sin(theta(m)-theta(n)) B(m,n)*cos(theta(m)-theta(n)));
end
end
end
J = [H N; M L];
%
%
%
%
%

J= [H22
H32 H33
H42 H43
M22 M23
M32 M33

H23
H34
H44
M24
M34

%Matriz Jacobiana HNML


H24
N32
N42
L22
L32

N22 N23
N33
N43
L23
L33];

X = inv(J)*deltapot;
dTheta = X(1:nbarra-1);
dE = X(nbarra:end);

%Vetor de correo
% Mudana do ngulo da tenso
% Mudana do valor da tenso

theta(2:nbarra) = dTheta + theta(2:nbarra);


k = 1;
for i = 2:nbarra
if tipo(i) == 3
E(i) = dE(k) + E(i);
k = k+1;
end
end
Iter = Iter + 1;
erro = max(abs(deltapot));
end
thetagraus = theta.*(180/pi);

% Mostra resultado dos calculos das tenses, angulos e potencia reativa


fprintf('\n
RESULTADO DOS CALCULOS DAS TENSES, ANGULOS E POTENCIA
REATIVA NAS BARRAS\n\n');
fprintf('\n
Mtodo: Newton Rapshon\n\n');
fprintf('Erro mximo admitido entre iterao: %f \n\n',erro_max);
fprintf('Nmero de iteraes realizadas: %d \n\n',Iter);
mostrar = [E thetagraus P Q];
disp('
Tenso
ngulo
P
disp(mostrar)

')

1.2.Resultado Newton

Ybarra =
8.9852 -44.7460i -3.8156 +19.0781i -5.1696 +25.8478i 0.0000 + 0.0000i
-3.8156 +19.0781i 8.9852 -44.7460i 0.0000 + 0.0000i -5.1696 +25.8478i
-5.1696 +25.8478i 0.0000 + 0.0000i 8.1933 -40.7613i -3.0237 +15.1185i
0.0000 + 0.0000i -5.1696 +25.8478i -3.0237 +15.1185i 8.1933 -40.7613i

G=
8.9852 -3.8156 -5.1696
-3.8156

8.9852

-5.1696

0 -5.1696

8.1933 -3.0237

0 -5.1696 -3.0237

8.1933

B=
-44.7460 19.0781 25.8478
19.0781 -44.7460
25.8478

0 25.8478

0 -40.7613 15.1185

0 25.8478 15.1185 -40.7613

RESULTADO DOS CALCULOS DAS TENSES, ANGULOS E POTENCIA REATIVA NAS


BARRAS

Mtodo: Newton Rapshon

Erro mximo admitido entre iterao: 0.000010


Nmero de iteraes realizadas: 5

Tenso

ngulo

1.0000

1.3661

0.6420

0.9844 -0.9946 -1.7000 -1.0535


0.9714 -1.8932 -2.0000 -1.2394
1.0200

1.5221

2.3800

1.1203

2. Modelo de 4 Barras e 4 Ramos Mtodo Gauss-Seidel


2.1.Cdigo Fonte
%
%
%
%

-----------------------------------------------Aula 02 - ANESEP
Anlise de carga com mtodo de Gauss-Seidel
------------------------------------------------

%
%
%
%

-------------------------------CAIO CSAR DE MORAES


PROFESSOR DR EDMRCIO BELATI
--------------------------------

clear all;
clc;
%

DADOS DAS LINHAS DE TRANSMISSO

%
|DA
|PARA |
%
|BARRA |BARRA |
dados_linha = [ 1
2
1
3
2
4
3
4
%
% DIVISO DOS DADOS DAS LINHAS

R
|
X
|
[pu] | [pu] |
0.01008
0.0504
0.00744
0.0372
0.00744
0.0372
0.01272
0.0636

Bshunt |
[pu]
|
0.1025;
0.0775;
0.0775;
0.1275;];

EM VETORES - CLCULAR MATRIZ ADMITNCIA Y

db = dados_linha(:,1);
%Da barra nmero...
pb = dados_linha(:,2);
%Para barra nmero...
r = dados_linha(:,3);
%Resistencia R da linha em pu
x = dados_linha(:,4);
%Reatncia X da linha em pu
b = dados_linha(:,5);
%Admitncia do terra, shunt
z = r + x*1j;
%Impedncia Z complexa da linha
y = 1./z;
%Inverte elementos de z para admintncia
b = b*1j;
%Muda shunt para imaginrio
nbarras = max(max(db),max(pb)); %Determina o nmero total de barras
nramos = length(db);
%Identifica o nmero de ramos
Ybarra = zeros(nbarras,nbarras);%Inicializa matriz Y com zeros
% ELEMENTOS DA MATRIZ Ybarra
% COMPLETA ELEMENTOS FORA DA DIAGONAL PRINCIPAL
for k=1:nramos
Ybarra(db(k),pb(k)) = -y(k);
Ybarra(pb(k),db(k)) = Ybarra(db(k),pb(k));
end
% COMPLETA ELEMENTOS DENTRO DA DIAGONAL PRINCIPAL

10

for m=1:nbarras
for n=1:nramos
if db(n) == m | pb(n) == m;
Ybarra(m,m) = Ybarra(m,m) + y(n) + b(n);
end
end
end

Ybarra
G = real(Ybarra)
B = imag(Ybarra)
% DADOS FORNECIDOS DAS BARRAS
%Tipos: 1-Slack referncia; 2-PV(tenso controlada); 3-PQ(barra de carga)
%
|Barra|Tipo|Pc[pu] |Qc[pu] |Pg[pu]|Qg[pu]|E[pu] |theta|
dados_barra = [ 1
1
0.05
0.3099 0
0
1.00
0;
2
3
1.70
1.0535 0
0
1.00
0;
3
3
2.00
1.2394 0
0
1.00
0;
4
2
0.80
0.4958 3.18
0
1.02
0;];
%Barras PQ iniciadas com E=1.00pu e barras PV e PQ com theta=0
%Assumindo a barra 1 como a slack e servindo de referncia.
%DIVISO DOS DADOS DAS BARRAS EM VETORES
barra = dados_barra(:,1);
tipo = dados_barra(:,2);
PcW = dados_barra(:,3);
QcVAR = dados_barra(:,4);
PgW = dados_barra(:,5);
QgVAR = dados_barra(:,6);
E = dados_barra(:,7);
thet = dados_barra(:,8);
nbarra = max(barra);
P = PgW - PcW;
Q = QgVAR - QcVAR;
Ep = E;
erro_max = 0.0001;
erro = 1;
iteracao = 1;

%Nmero da barra
%Tipo da barra 1-Slack,2-PV e 3-PQ
%Potncia ativa consumida na barra
%Potncia reativa consumida na barra
%Potncia ativa injetada na barra
%Potncia reatica injetada na barra
%Tenso inicial da barra
%ngulo inicial da barra
%Nmero total de barras
%Potncia ativa lquida na barra
%Potncia reativa lquida na barra
%Inicia varivel com tenso inicial
%Erro mximo aceito
%Inicia varivel erro
%Inicia contador de iteraes

%CLCULO UTILIZANDO O MTODO DE GAUSS-SEIDEL

while (erro > erro_max)


%Inicia loop de iteraes
for i = 2:nbarra
somaYE = 0;
for k = 1:nbarra
if i ~= k
somaYE = somaYE + Ybarra(i,k)*E(k); %Somatrio E*Y
end
end
if tipo(i) == 2
% Calcula Q para as barras PV
Q(i) = -imag(conj(E(i))*(somaYE + Ybarra(i,i)*E(i)));
end
E(i) = (1/Ybarra(i,i))*((P(i)-1j*Q(i))/conj(E(i)) - somaYE);
% Calcula a tenso da barra

11

if tipo(i) == 2
% Para barras PV, mantem o mdulo da tenso e atualiza somento o
angulo

E(i) = abs(Ep(i))*cos(angle(E(i))) +
1j*abs(Ep(i))*sin(angle(E(i)));
end
end
iteracao = iteracao + 1;
% Incrementa contador de iterao
erro = max(abs(abs(E) - abs(Ep)));% Calcula o erro da iterao
Ep = E;
% Ep necessario na proxima iterao
end
% Final do loop de iteraes
fprintf('Erro mximo admitido entre iterao: %f \n\n',erro_max);
fprintf('Nmero de iteraes realizadas: %d \n\n',iteracao);
for n=1:nbarra
fprintf('V%d=%.4f[pu] theta %.4f Q%d=
%.4f[pu]\n',n,abs(E(n)),180/pi*angle(E(n)),n,Q(n));
end

2.2.Resultado Gauss

Ybarra =
8.9852 -44.7460i -3.8156 +19.0781i -5.1696 +25.8478i 0.0000 + 0.0000i
-3.8156 +19.0781i 8.9852 -44.7460i 0.0000 + 0.0000i -5.1696 +25.8478i
-5.1696 +25.8478i 0.0000 + 0.0000i 8.1933 -40.7613i -3.0237 +15.1185i
0.0000 + 0.0000i -5.1696 +25.8478i -3.0237 +15.1185i 8.1933 -40.7613i

G=
8.9852 -3.8156 -5.1696
-3.8156

8.9852

-5.1696

0 -5.1696

8.1933 -3.0237

0 -5.1696 -3.0237

8.1933

B=
-44.7460 19.0781 25.8478
19.0781 -44.7460
25.8478

0 25.8478

0 -40.7613 15.1185

0 25.8478 15.1185 -40.7613

Erro mximo admitido entre iterao: 0.000100

Nmero de iteraes realizadas: 4

12

V1=1.0000[pu] theta 0.0000 Q1=-0.3099[pu]


V2=0.9843[pu] theta -1.2357 Q2=-1.0535[pu]
V3=0.9714[pu] theta -2.0473 Q3=-1.2394[pu]
V4=1.0200[pu] theta 1.2981 Q4=1.1467[pu]

13

Você também pode gostar