資源描述:
《c語(yǔ)言計(jì)算潮流程序》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫(kù)。
1、節(jié)點(diǎn)數(shù):3支路數(shù):3計(jì)算精度:0.00010支路1:0.0300+j0.09001┠—————□—————┨2支路2:0.0200+j0.09002┠—————□—————┨3支路3:0.0300+j0.09003┠—————□—————┨1節(jié)點(diǎn)1:PQ節(jié)點(diǎn),S(1)=-0.5000-j0.2000節(jié)點(diǎn)2:PQ節(jié)點(diǎn),S(2)=-0.6000-j0.2500節(jié)點(diǎn)3:平衡節(jié)點(diǎn),U(3)=1.0000∠0.0000n=5;nl=5;isb=1;pr=0.00001;B1=[120.03i01.050;230.08+0.3i0.5i10;240.1+0.35
2、i010;340.04+0.25i0.5i10;350.015i01.051];B2=[001.051.0501;03.7+1.3i1.05002;02+1i1.05002;01.6+0.8i1.05002;501.051.0503];X=[10;20;30;40;50];na=3;Y=zeros(n);YI=zeros(n);e=zeros(1,n);f=zeros(1,n);V=zeros(1,n);O=zeros(1,n);fori=1:nifX(i,2)~=0;p=X(i,1);Y(p,p)=1./X(i,2);endendfori=1:nl
3、ifB1(i,6)==0p=B1(i,1);q=B1(i,2);elsep=B1(i,2);q=B1(i,1);endY(p,q)=Y(p,q)-1./(B1(i,3)*B1(i,5));YI(p,q)=YI(p,q)-1./B1(i,3);Y(q,p)=Y(p,q);YI(q,p)=YI(p,q);Y(q,q)=Y(q,q)+1./(B1(i,3)*B1(i,5)^2)+B1(i,4)./2;YI(q,q)=YI(q,q)+1./B1(i,3);Y(p,p)=Y(p,p)+1./B1(i,3)+B1(i,4)./2;YI(p,p)=YI(p,p)+
4、1./B1(i,3);endG=real(Y);B=imag(YI);BI=imag(Y);fori=1:nS(i)=B2(i,1)-B2(i,2);BI(i,i)=BI(i,i)+B2(i,5);endP=real(S);Q=imag(S);fori=1:ne(i)=real(B2(i,3));f(i)=imag(B2(i,3));V(i)=B2(i,4);endfori=1:nifB2(i,6)==2V(i)=sqrt(e(i)^2+f(i)^2);O(i)=atan(f(i)./e(i));endendfori=2:nifi==nB(i,i)=
5、1./B(i,i);elseIC1=i+1;forj1=IC1:nB(i,j1)=B(i,j1)./B(i,i);endB(i,i)=1./B(i,i);fork=i+1:nforj1=i+1:nB(k,j1)=B(k,j1)-B(k,i)*B(i,j1);endendendendp=0;q=0;fori=1:nifB2(i,6)==2p=p+1;k=0;forj1=1:nifB2(j1,6)==2k=k+1;A(p,k)=BI(i,j1);endendendendfori=1:naifi==naA(i,i)=1./A(i,i);elsek=i+1;
6、forj1=k:naA(i,j1)=A(i,j1)./A(i,i);endA(i,i)=1./A(i,i);fork=i+1:naforj1=i+1:naA(k,j1)=A(k,j1)-A(k,i)*A(i,j1);endendendendICT2=1;ICT1=0;kp=1;kq=1;K=1;DET=0;ICT3=1;whileICT2~=0
7、ICT3~=0ICT2=0;ICT3=0;fori=1:nifi~=isbC(i)=0;fork=1:nC(i)=C(i)+V(k)*(G(i,k)*cos(O(i)-O(k))+BI(i,k)*sin(O(
8、i)-O(k)));endDP1(i)=P(i)-V(i)*C(i);DP(i)=DP1(i)./V(i);DET=abs(DP1(i));ifDET>=prICT2=ICT2+1;endendendNp(K)=ICT2;ifICT2~=0fori=2:nDP(i)=B(i,i)*DP(i);ifi~=nIC1=i+1;fork=IC1:nDP(k)=DP(k)-B(k,i)*DP(i);endelseforLZ=3:iL=i+3-LZ;IC4=L-1;forMZ=2:IC4I=IC4+2-MZ;DP(I)=DP(I)-B(I,L)*DP(L);en
9、dendendendfori=2:nO(i)=O(i)-DP(i);endkq=1;L=0;fori=1:n