资源简介
一一 干豆腐干的个股全面可以直接进行计算程序完全正确
代码片段和文件信息
#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 << endl ;
cout << “网络基本参数矩阵:“ << endl;
for( i=0; i {
for (j=0; j<6; j++)
{
cout<< setw(10) << Zarray[i][j];
}
cout << endl;
}
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++代码
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
评论
共有 条评论