资源简介

以三机九节点系统为例计算电力系统潮流,适合初学者,易于理解

资源截图

代码片段和文件信息

#include
#include
#include
#include
#include
using namespace std;
#define KM 50
#define PI 3.1415926
int jzqn(void*pvoid*qint nn);
int main()
{
ifstream in(“in.txt“);
ofstream out(“out.txt“);
typedef complex cp;
int ijklmno;
char cs[120];
double rxbbkbadefmf;
struct jiedian
{
      int t;
      double ua1pqadpdqdudaex;
};
struct zhilu
{
      int tij;
      cp ZIK;
};
in.getline(s100);
in>>n>>o>>f;
double g[n+1][n+1]={}b[n+1][n+1]={}b1[n][n]={}c1[n][n]={};
struct jiedian jd[n+1]={};
struct zhilu zl[o]={};
for(i=1;i<=3;i++)
     in.getline(s100);
for(k=0;k{
      in>>zl[k].t;
      in>>i>>j>>r>>x;
      zl[k].i=i;
      zl[k].j=j;
      real(zl[k].Z)=r;
      imag(zl[k].Z)=x;
      a=r/(r*r+x*x);
      d=x/(r*r+x*x);
      if(zl[k].t==1)
      {
            in>>c>>kb;
            g[i][i]+=a;
            b[i][i]-=d;
            g[j][j]+=a/(kb*kb);
            b[j][j]-=d/(kb*kb);
            g[i][j]-=a/kb;
            g[j][i]-=a/kb;
            b[i][j]+=d/kb;
            b[j][i]+=d/kb;
            real(zl[k].K)=kb;
            continue;
      }
      if(zl[k].t==2)
      {
            in>>bb>>c;
            g[i][i]+=a;
            g[j][j]+=a;
            g[i][j]-=a;
            g[j][i]-=a;
            b[i][i]+=bb-d;
            b[j][j]+=bb-d;
            b[i][j]+=d;
            b[j][i]+=d;
            real(zl[k].K)=1;
            continue;
      }
      if(zl[k].t==3)
      {
            in>>c>>c;
            g[i][i]+=a;
            b[i][i]-=d;
      }
}
for(i=1;i<=3;i++)
     in.getline(s120);
e=0;
for(i=1;i<=n;i++)
{
      in>>c>>k>>jd[i].t;
      if(k==1)
      {
          in>>c>>c>>c>>c>>jd[i].u>>jd[i].a1;
          jd[i].a=jd[i].a1*PI/180;
      }
      if(k==2)
      {
           in>>a>>c>>d>>c>>jd[i].u>>c;
           jd[i].p=a-d;
      }
      if(k==3)
      {
            if(e==0)
            {    e=1;
                  l=i;   }
            in>>jd[i].p>>jd[i].q>>a>>d>>c>>c;
            jd[i].p-=a;
            jd[i].q-=d;
            jd[i].u=1;
      }
      if(jd[i].t==1)  in>>jd[i].x>>jd[i].e;
      else in>>c>>c;
}
m=n+1-l;
double b2[m+1][m+1]={}c2[m+1][m+1]={};
for(i=2;i<=n;i++)
      for(j=2;j<=n;j++)
          b1[i-1][j-1]=-b[i][j];
for(i=l;i<=n;i++)
      for(j=l;j<=n;j++)
          b2[i-l+1][j-l+1]=-b[i][j];
jzqn(b1c1n-1);
jzqn(b2c2m);
k=0;
while(1)
{
      fm=0;
      for(i=2;i<=(l-1);i++)
      {
            e=0;
            for(j=1;j<=n;j++)
            {
                  a=jd[i].a-jd[j].a;
                  e+=jd[j].u*(g[i][j]*cos(a)+b[i][j]*sin(a));
            }
            jd[i].dp=jd[i].p-jd[i].u*e;
            if(abs(jd[i].dp)>fm) fm=abs(jd[i].dp);
      }
      for(i=l;i<=n;i++)
      {
            e=0;
            r=0;
            for(j=1;j<=n;j++)
            {
                  x=jd[i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-01-31 13:14  程序\
     文件     1183777  2018-06-12 21:49  程序\cljs.exe
     文件        1730  2018-06-12 21:52  程序\in.txt
     文件       10088  2018-06-12 21:49  程序\main.cpp
     文件        4743  2018-06-12 21:57  程序\out.txt
     文件         120  2018-06-12 22:01  程序\程序说明.txt

评论

共有 条评论