資源簡介
一一 干豆腐干的個股全面可以直接進行計算程序完全正確
代碼片段和文件信息
#include??????/*使用輸入/輸出函數*/
#include???????/*使用setw函數*/
#include??????????/*使用數學函數*/
#include?
#include?
#include?
#include?
void?main()
{
double?**Zarray;
double?**G;
double?**B;
cout<<“電研104?武星華?電力系統潮流計算“<<“\n“< /*定義數組Zarray[i][j]為網絡基本參數矩陣*/
?
?
int?ij;
????int?N=0;
int?L=0; /*定義N-節點個數,L-支路個數*/
cout<<“請輸入節點個數N:“< cin>>N;
cout<<“請輸入支路個數L:“< cin>>L;
cout<<“\n“<
?
if?((Zarray?=?new?double*[L])?==NULL)
{
? cout?<“Could?not?allocate.?“;
? exit(1);
? }
for(j=0;?j<6;?j++)
? {
? if?((Zarray[j]=?new?double[6])?==?NULL?)
{
cout?<“Could?not?allocate.?“;
exit(1);
}
? }
????for(i=0;?i ? {
for(j=0;?j<6;?j++)
{
Zarray[i][j]=0;
}
} /*將?Zarray[i][j]分配空間并且初始化*/
//////////////////////////////////////////////////////////////////????/*讀文件形成節點導納距陣*/
i=0;
int?a1=0?;
int a2=0?;
double?a3=0?;
double?a4=0?;
double?a5=0?;
double?a6=0?;
? ifstream?fin(“網絡基本參數矩陣.txt“);
while?(!fin.eof())
? {
fin?>>?a1?>>?a2?>>?a3?>>?a4?>>?a5?>>?a6?;
Zarray[i][0]=a1;
Zarray[i][1]=a2;
Zarray[i][2]=a3;
Zarray[i][3]=a4;
Zarray[i][4]=a5;
Zarray[i][5]=a6;
i++;
? }
????cout?<
cout?<“網絡基本參數矩陣:“?<
for(?i=0;?i {
for?(j=0;?j<6;?j++)
{
cout< }
cout?< }
cout<<“\n“<
if?((G=?new?double*[N])?==NULL)
? {
?
? cout?<“Could?not?allocate.?“;
? exit(1);
? }
? for(j=0;?j ? {
? if?((G[j]=?new?double[N])?==NULL)
? {
? cout?<“Could?not?allocate.?“;
? exit(1);
? }
? }
????for?(i=0;?i {
for?(j=0;?j {
G[i][j]=0;
}
}
if?((B=?new?double*[N])?==NULL)
? {
?
? cout?<“Could?not?allocate.?“;
? exit(1);
? }
? for(j=0;?j ? {
? if?((B[j]=?new?double[N])?==NULL)
? {
? cout?<“Could?not?allocate.?“;
? exit(1);
? }
? }
????for?(i=0;?i {
for?(j=0;?j {
B[i][j]=0;
}
}
int?JK;
double?rkxb;
for(i=0;i {
J=int?(Zarray[i][0]);
K=int?(Zarray[i][1]);
r=Zarray[i][2];
x=Zarray[i][3];
b=Zarray[i][4];
k=Zarray[i][5];
if(k!=0)
{
G[J-1][J-1]=G[J-1][J-1];
B[J-1][J-1]=B[J-1][J-1]-1/(x*k*k);
G[K-1][K-1]=G[K-1][K-1];
B[K-1][K-1]=B[K-1][K-1]-1/x;
G[J-1][K-1]=G[J-1][K-1];
B[J-1][K-1]=B[J-1][K-1]+1/(x*k);
G[K-1][J-1]=G[K-1][J-1];
B[K-1][J-1]=B[K-1][J-1]+1/(x*k);
}
else
{
G[J-1][J-1]=G[J-1][J-1]+r/(r*r+x*x);
B[J-1][J-1]=B[J-1][J-1]+b-x/(r*r+x*x);
G[K-1][K-1]=G[K-1][K-1]+r/(r*r+x*x);
B[K-1][K-1]=B[K-1][K-1]+b-x/(r*r+x*x);
G[J-1][K-1]=G[J-1][K-1]-r/(r*r+x*x);
B[J-1][K-1]=B[J-1][K-1]+x/(r*r+x*x);
G[K-1][J-1]=G[K-1][J-1]-r/(r*r+x*x);
B
- 上一篇:Source Insight黑色背景st
yle - 下一篇:MOEA/D的C++代碼
評論
共有 條評論