You are on page 1of 4

clc

clear
%Estableciendo matriz de admitancias
z12=0.02+0.04*i
z13=0.01+0.03*i
z23=0.0125+0.025*i
y12=1/z12
y13=1/z13
y23=1/z23
Y=[y12+y13 -y12 -y13; -y12 y23+y12 -y23; -y13 -y23 y23+y13]
G=real(Y)
B=imag(Y)

% Dando valores iniciales


t2=0
t3=0
v3=1

% Potencias y Voltajes
p2=0.5
p3=-1
q2=-0.6
v1=1.02
v2=1.02
t1=0
% Ángulos
t12=t1-t2
t13=t1-t3
t23=t2-t3
t21=-t12
t31=-t13
t32=-t23
dp2=p2-(v2^2)*(G(2,2))-v2*((G(2,1)*cosd(t21)+B(2,1)*sind(t21))*v1+
(G(2,3)*cosd(t23)+B(2,3)*sind(t23))*v3)
dp3=p3-(v3^2)*(G(3,3))-v3*((G(3,1)*cosd(t31)+B(3,1)*sind(t31))*v1+
(G(3,2)*cosd(t32)+B(3,2)*sind(t32))*v2)
dq3=q2+(v2^2)*(B(2,2))-v2*((G(2,1)*sind(t21)-B(2,1)*cosd(t21))*v1+(G(2,3)*sind(t23)-
B(2,3)*cosd(t23)))
dpq=[dp2;dp3;dq2]

% Matriz jacobiana
h22=(-B(2,2)*v2^2-q2)
h33=((-G(3,1)*sind(t31)+B(3,1)*cosd(t31))*v1*v3+(-
G(3,2)*sind(t32)+B(3,2)*cosd(t32))*v2*v3)
h23=((G(2,3)*sind(t23)-B(2,3)*cosd(t23)))*v2*v3
h32=((G(3,2)*sind(t32)-B(3,2)*cosd(t32)))*v2*v3
n22=v2^2*G(2,2)+p2
n32=(G(3,2)*cosd(t32)+B(3,2)*sind(t32))*v2*v3
j22=p2-v2^2*G(2,2)
j23=-(G(2,3)*cosd(t23)+B(2,3)*sind(t23)*v2*v3)
l22=-v2^2*B(2,2)+q2
j=[h22 h23 n22; h32 h33 n32; j22 j23 l22]
%Matriz inversa jacobiana
ji=inv(j)
dtv=ji*dpq

%actualizando variables
t2=t2+dtv(1)*180/pi
t3=t3+dtv(2)*180/pi
v2=v2+dtv(3)

%Ángulos
t12=t1-t2
t13=t1-t3
t23=t2-t3
t21=-t12
t31=-t13
t32=-t23
dp2=p2-(v2^2)*(G(2,2))-v2*((G(2,1)*cosd(t21)+B(2,1)*sind(t21))*v1+
(G(2,3)*cosd(t23)+B(2,3)*sind(t23))*v3)
dp3=p3-(v3^2)*(G(3,3))-v3*((G(3,1)*cosd(t31)+B(3,1)*sind(t31))*v1+
(G(3,2)*cosd(t32)+B(3,2)*sind(t32))*v2)
dq2=q2+(v2^2)*(B(2,2))-v2*((G(2,1)*sind(t21)-B(2,1)*cosd(t21))*v1+(G(2,3)*sind(t23)-
B(2,3)*cosd(t23)))
dpq=[dp2;dp3;dq2]
v=[v1 t1;v2 t2; v3 t3]
%Ecuaciones generales de potencias
p1=v1^2*G(1,1)+((G(1,2)*cosd(t12)+B(1,2)*sind(t12))*v1*v2+
(G(1,3)*cosd(t13)+B(1,3)*sind(t13))*v1*v3)
q1=-B(1,1)*v1^2+v1*((G(1,2)*sind(t12)-B(1,2)*cosd(t12))*v2+(G(1,3)*sind(t13)-
B(1,3)*cosd(t13))*v3)
q1=-B(3,3)*v3^2+v3*((G(3,1)*sind(t31)-B(3,1)*cosd(t31))*v1+(G(3,2)*sind(t32)-
B(3,2)*cosd(t32))*v2)

You might also like