pre=1e-5;
Z=[ 1 2 0.00+0.03i 1.05 0.25i; 2 3 0.08+0.3i 1 0.5i; 2 4 0.1+0.35i 1 0.5i; 3 4 0.04+0.25i 1 0.5i;
3 5 0.00+0.015i 1.05 0.25i]; Y=zeros(n); for i=1:nl
p=Z(i,1);q=Z(i,2);
Y(p,q)=Y(p,q)-1./(Z(i,3)*Z(i,4)); Y(q,p)=Y(p,q);
Y(q,q)=Y(q,q)+1./(Z(i,3)*Z(i,4)^2); Y(p,p)=Y(p,p)+1./Z(i,3); end %形成节点导纳矩阵 disp('节点导纳矩阵Y为:'); disp(Y);
G=real(Y);B=imag(Y); B=imag(Y); B1=B(2:5,2:5); B11=B(2:4,2:4); B1 B11
delt(2)=0; delt(3)=0; delt(4)=0;delt(5)=0; u(2)=1.0; u(3)=1.0; u(4)=1.00; p(2)=-3.7; q(2)=-1.3; p(3)=-2; q(3)=-1; p(4)=-1.6; q(4)=-0.8; P(5)=5; q(5)=0; k=0;precision=1; k,delt,u N1=4;
while precision>0.00001
delt(1)=0;u(1)=1.05;u(5)=1.05; for m=1:N1
for n=1:N1+1
pt(n)=u(m)*u(n)*(G(m,n)*cos(delt(m)-delt(n))+B(m,n)*sin(delt(m)-delt(n)));
qt(n)=u(m)*u(n)*(G(m,n)*sin(delt(m)-delt(n))-B(m,n)*cos(delt(m)-delt(n)));
end
pp(m)=p(m)-sum(pt);
qq(m)=q(m)-sum(qt); end
for m=1:N1
PU(m)=pp(m)/u(m);
PU1(m)=pp(m)/(u(m)^2); QU(m)=qq(m)/u(m); end
ddelt=-inv(B1)*PU1(m);
precision=max(abs(PU1(m))); uu=-inv(B11)*QU(m)'; precision=max(abs(uu)); for n=1:N1-1
delt(n)=delt(n)+uu(2*n-1); u(n)=u(n)+uu(2*n); end
for n=N1
delt(n)=delt(n)+uu(2*n-1); end k=k+1;
k,delt,u end
for n=1:N1+1
U(n)=u(n)*(cos(delt(n))+j*sin(delt(n))); end
for m=1:N1+1
I(m)=Y(1,m)*U(m); end
S1=U(1)*sum(conj(I)) for n=1:N1+1
q5(n)=u(5)*u(n)*(G(5,n)*sin(delt(5)-delt(n))-B(5,n)*cos(delt(5)-delt(5))); end
Q5=sum(q5) for m=1:N1+1
for n=1:N1+1
S(m,n)=U(m)*(conj(U(m))-conj(U(n)))*conj(-Y(m,n)); end end S
x=1:k;
subplot(5,1,1); plot(x,u(1),'rp') grid on
title('迭代过程中各节点的电压幅值') subplot(5,1,2); plot(x,u(2),'rp') grid on
subplot(5,1,3); plot(x,u(3),'rp') grid on
ylabel('电压标幺值') subplot(5,1,4); plot(x,u(4),'rp') grid on
subplot(5,1,5); plot(x,u(5),'rp') grid on
xlabel('迭代次数')
迭代过程中各节点的电压幅值4200-2-4050100150200250300050100150200250300电压标幺值-10-12-14210420050100150迭代次数200250300050100150200250300050100150200250300
因篇幅问题不能全部显示,请点此查看更多更全内容