1.重新组织了文件。
2.准备试试把所有元素都读入内存中。 Signed-off-by: facat@lab.com <facat@lab.com>
This commit is contained in:
144
core/output7.cpp
Normal file
144
core/output7.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
#include "head.h"
|
||||
//int extern balance_node;
|
||||
#include "qt_readxml.h"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
bool Qt_readxml::XmlReaderDisnetReconfig(QIODevice *file8)
|
||||
{
|
||||
//std::cout<<"XmlReaderwriteFile"<<std::endl;
|
||||
QTextStream out(file8);
|
||||
/*------------------------------------------
|
||||
输出第一块
|
||||
-------------------------------------------*/
|
||||
out<<totalBus<<" "<<totalLine<<"\r\n";
|
||||
out<<0<<"\r\n";
|
||||
|
||||
/*------------------------------------------
|
||||
输出第二块
|
||||
-------------------------------------------*/
|
||||
int sub_no=substation.size();
|
||||
int k=1;
|
||||
for (int i=0;i<sub_no;i++)
|
||||
{
|
||||
int node;
|
||||
if (substation[i].GIS_type=="1001")
|
||||
{
|
||||
int connector_no=connector.size();
|
||||
for (int j=0;j<connector_no;j++)
|
||||
{
|
||||
if (connector[j].island==maxIsland)
|
||||
{
|
||||
if (connector[j].MemberOf_EquipmentContainer_res.size())
|
||||
{
|
||||
if (connector[j].MemberOf_EquipmentContainer_res[0].contains(substation[i].ID))
|
||||
{
|
||||
node = connector[j].link_from;
|
||||
substation[i].flag=node;
|
||||
out<<k<<" "<<node<<"\r\n";
|
||||
k++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out<<0<<"\r\n";
|
||||
/*------------------------------------------
|
||||
输出第三块
|
||||
-------------------------------------------*/
|
||||
k=1;
|
||||
int line=acline_segment.size();
|
||||
int trans=power_transformer.size();
|
||||
for (int i=0;i<line;i++)
|
||||
{
|
||||
if (acline_segment[i].island==maxIsland)
|
||||
{
|
||||
out<<k<<" "<<acline_segment[i].link_from<<" "<<acline_segment[i].link_to<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<trans;i++)
|
||||
{
|
||||
if (power_transformer[i].island==maxIsland)
|
||||
{
|
||||
out<<k<<" "<<power_transformer[i].link_1<<" "<<power_transformer[i].link_2<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
}
|
||||
out<<0<<"\r\n";
|
||||
out<<0<<"\r\n";
|
||||
out<<0<<"\r\n";
|
||||
out<<0<<"\r\n";
|
||||
|
||||
/*------------------------------------------
|
||||
输出第四块
|
||||
-------------------------------------------*/
|
||||
k=1;
|
||||
double UB=0;
|
||||
for (int i=1;i<=totalBus;i++)
|
||||
{
|
||||
double PG=0;
|
||||
double QG=0;
|
||||
for (int j=0;j<sub_no;j++)
|
||||
{
|
||||
if (substation[j].flag==i)
|
||||
PG=150;
|
||||
}
|
||||
int m;
|
||||
for (m=0;m<trans;m++)
|
||||
{
|
||||
if (power_transformer[m].island==maxIsland)
|
||||
if (power_transformer[m].low == i)
|
||||
break;
|
||||
}
|
||||
if(m<trans)
|
||||
{
|
||||
double PL=((power_transformer[m].APower)+(power_transformer[m].BPower)+(power_transformer[m].CPower));
|
||||
double QL=((power_transformer[m].AReactivePower)+(power_transformer[m].BReactivePower)+(power_transformer[m].CReactivePower));
|
||||
if (PL==0 && QL==0)
|
||||
{
|
||||
out<<k<<" "<<i<<" "<<PG<<" "<<QG<<" "<<"0"<<" "<<"0"<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
else
|
||||
{
|
||||
out<<k<<" "<<i<<" "<<PG<<" "<<QG<<" "<<QString().sprintf("%.6lf",PL)<<" "<<QString().sprintf("%.6lf",QL)<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out<<k<<" "<<i<<" "<<PG<<" "<<QG<<" "<<"0"<<" "<<"0"<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
}
|
||||
out<<0<<"\r\n";
|
||||
out<<0<<"\r\n";
|
||||
|
||||
/*------------------------------------------
|
||||
输出第五块
|
||||
-------------------------------------------*/
|
||||
k=1;
|
||||
for (int i=0;i<line;i++)
|
||||
{
|
||||
if (acline_segment[i].island==maxIsland)
|
||||
{
|
||||
out<<k<<" "<<acline_segment[i].link_from<<" "<<acline_segment[i].link_to<<" "<<"1"<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<trans;i++)
|
||||
{
|
||||
if (power_transformer[i].island==maxIsland)
|
||||
{
|
||||
out<<k<<" "<<power_transformer[i].link_1<<" "<<power_transformer[i].link_2<<" "<<"0"<<"\r\n";
|
||||
k++;
|
||||
}
|
||||
}
|
||||
out<<0<<"\r\n";
|
||||
out<<0<<"\r\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user