資源描述:
《matlab潮流計(jì)算.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、.附錄1使用牛頓拉夫遜法進(jìn)行潮流計(jì)算的Matlab程序代碼%牛拉法計(jì)算潮流程序%-----------------------------------------------------------------------%B1矩陣:1、支路首端號(hào);2、末端號(hào);3、支路阻抗;4、支路對(duì)地電納%5、支路的變比;6、支路首端處于K側(cè)為1,1側(cè)為0%B2矩陣:1、該節(jié)點(diǎn)發(fā)電機(jī)功率;2、該節(jié)點(diǎn)負(fù)荷功率;3、節(jié)點(diǎn)電壓初始值%4、PV節(jié)點(diǎn)電壓V的給定值;5、節(jié)點(diǎn)所接的無(wú)功補(bǔ)償設(shè)備的容量%6、節(jié)點(diǎn)分類標(biāo)號(hào):1
2、為平衡節(jié)點(diǎn)(應(yīng)為1號(hào)節(jié)點(diǎn));2為PQ節(jié)點(diǎn);3為PV節(jié)點(diǎn);%------------------------------------------------------------------------clearall;formatlong;n=input('請(qǐng)輸入節(jié)點(diǎn)數(shù):nodes=');nl=input('請(qǐng)輸入支路數(shù):lines=');isb=input('請(qǐng)輸入平衡母線節(jié)點(diǎn)號(hào):balance=');pr=input('請(qǐng)輸入誤差精度:precision=');B1=input('請(qǐng)輸入由
3、各支路參數(shù)形成的矩陣:B1=');B2=input('請(qǐng)輸入各節(jié)點(diǎn)參數(shù)形成的矩陣:B2=');Y=zeros(n);e=zeros(1,n);f=zeros(1,n);V=zeros(1,n);sida=zeros(1,n);S1=zeros(nl);%------------------------------------------------------------------Word資料.fori=1:nl%支路數(shù)ifB1(i,6)==0%左節(jié)點(diǎn)處于1側(cè)p=B1(i,1);q=B1(i,
4、2);else%左節(jié)點(diǎn)處于K側(cè)p=B1(i,2);q=B1(i,1);endY(p,q)=Y(p,q)-1./(B1(i,3)*B1(i,5));%非對(duì)角元Y(q,p)=Y(p,q);%非對(duì)角元Y(q,q)=Y(q,q)+1./(B1(i,3)*B1(i,5)^2)+B1(i,4);%對(duì)角元K側(cè)Y(p,p)=Y(p,p)+1./B1(i,3)+B1(i,4);%對(duì)角元1側(cè)end%求導(dǎo)納矩陣disp('導(dǎo)納矩陣Y=');disp(Y)%-------------------------------
5、------------------------------------G=real(Y);B=imag(Y);%分解出導(dǎo)納陣的實(shí)部和虛部fori=1:n%給定各節(jié)點(diǎn)初始電壓的實(shí)部和虛部e(i)=real(B2(i,3));f(i)=imag(B2(i,3));V(i)=B2(i,4);%PV節(jié)點(diǎn)電壓給定模值endfori=1:n%給定各節(jié)點(diǎn)注入功率Word資料.S(i)=B2(i,1)-B2(i,2);%i節(jié)點(diǎn)注入功率SG-SLB(i,i)=B(i,i)+B2(i,5);%i節(jié)點(diǎn)無(wú)功補(bǔ)償量en
6、d%---------------------------------------------------------------------P=real(S);Q=imag(S);%分解出各節(jié)點(diǎn)注入的有功和無(wú)功功率ICT1=0;IT2=1;N0=2*n;N=N0+1;a=0;%迭代次數(shù)ICT1、a;不滿足收斂要求的節(jié)點(diǎn)數(shù)IT2whileIT2~=0%N0=2*n雅可比矩陣的階數(shù);N=N0+1擴(kuò)展列IT2=0;a=a+1;fori=1:nifi~=isb%非平衡節(jié)點(diǎn)C(i)=0;D(i)=0;f
7、orj1=1:nC(i)=C(i)+G(i,j1)*e(j1)-B(i,j1)*f(j1);%Σ(Gij*ej-Bij*fj)D(i)=D(i)+G(i,j1)*f(j1)+B(i,j1)*e(j1);%Σ(Gij*fj+Bij*ej)endP1=C(i)*e(i)+f(i)*D(i);%節(jié)點(diǎn)功率P計(jì)算eiΣ(Gij*ej-Bij*fj)+fiΣ(Gij*fj+Bij*ej)Q1=C(i)*f(i)-e(i)*D(i);%節(jié)點(diǎn)功率Q計(jì)算fiΣ(Gij*ej-Bij*fj)-eiΣ(Gij*fj+
8、Bij*ej)%求i節(jié)點(diǎn)有功和無(wú)功功率P',Q'的計(jì)算值V2=e(i)^2+f(i)^2;%電壓模平方%以下針對(duì)非PV節(jié)點(diǎn)來(lái)求取功率差及Jacobi矩陣元素-----------------------------ifB2(i,6)~=3%非PV節(jié)點(diǎn)DP=P(i)-P1;%節(jié)點(diǎn)有功功率差Word資料.DQ=Q(i)-Q1;%節(jié)點(diǎn)無(wú)功功率差%以上為除平衡節(jié)點(diǎn)外其它節(jié)點(diǎn)的功率計(jì)算--------------------------------------%求取Jacobi矩陣------------