資源描述:
《電力系統(tǒng)通用潮流計(jì)算c語(yǔ)言程序》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫(kù)。
1、#include#include#include#includeusingnamespacestd;//節(jié)點(diǎn)號(hào)類型負(fù)荷有功負(fù)荷無(wú)功母線數(shù)據(jù)(類型1=PV節(jié)點(diǎn),2=PQ節(jié)點(diǎn),3=平衡節(jié)點(diǎn))structBUS{intbusno;inttype;floatPd;floatQd;};//發(fā)電機(jī)數(shù)據(jù)節(jié)點(diǎn)號(hào)有功發(fā)電電壓幅值structGenerator{intbusno;floatPg;floatVg;};//支路信息節(jié)點(diǎn)I節(jié)點(diǎn)JRXB/2kstructLine{intbusi;intbusj;floatR;floatX;floa
2、tB;floatk;};//deltaPdeltaQdeltaV^2//voidfun1(doubleYG[][50],doubleYB[][50],doublee[],doublef[],inttype[],intN,doubleW[],doubleP[],doubleQ[],doubleV[]){doubledP=0,dQ=0,dV=0;inti,j;for(i=0;i3、]*V[i]-e[i]*e[i]-f[i]*f[i];dP=P[i]-e[i]*A-f[i]*B;W[2*i]=dP;dQ=Q[i]-f[i]*A+e[i]*B;if(type[i]==1)W[2*i+1]=dQ;elseW[2*i+1]=dV;}}//Jacobi矩陣//voidJacobi(doubleYG[][50],doubleYB[][50],doublee[50],doublef[50],inttype[50],intN,doubleJa[100][101]){inti,j;for(i=0;i4、]==1){Ja[2*i][2*j]=-(YG[i][j]*e[i]+YB[i][j]*f[i]);Ja[2*i][2*j+1]=YB[i][j]*e[i]-YG[i][j]*f[i];Ja[2*i+1][2*j]=Ja[2*i][2*j+1];Ja[2*i+1][2*j+1]=-Ja[2*i][2*j];}else{Ja[2*i][2*j]=-YG[i][j]*e[i]+YB[i][j]*f[i];Ja[2*i][2*j+1]=YB[i][j]*e[i]-YG[i][j]*f[i];Ja[2*i+1][2*j+1]=Ja[2*i+1][2*j]=0;}}else{doublea[50]=
5、{0},b[50]={0};for(intk=0;k6、[i]+YB[i][i]*f[i];}else{Ja[2*i+1][2*j]=-2*e[i];Ja[2*i+1][2*j+1]=-2*f[i];}}}}}}//高斯消元法解方程組函數(shù)//voidgauss(doublea[][101],intn){inti,j,k;doublec;for(k=0;k7、k>=0;k--)for(j=k+1;j