parent
5b9625f708
commit
41502b5afa
|
|
@ -33,6 +33,8 @@ void CIMExporter::add(const QPair<QString,QString>& fromTo,Transformer* tf)
|
||||||
|
|
||||||
void CIMExporter::exportTo(const QString& path)
|
void CIMExporter::exportTo(const QString& path)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//输出到文件
|
//输出到文件
|
||||||
QFile fd(path);
|
QFile fd(path);
|
||||||
if(fd.open(QFile::WriteOnly))
|
if(fd.open(QFile::WriteOnly))
|
||||||
|
|
@ -122,9 +124,7 @@ void CIMExporter::exportTo(const QString& path)
|
||||||
std::cout<<name.toLocal8Bit().data()<<"not used"<<std::endl;
|
std::cout<<name.toLocal8Bit().data()<<"not used"<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this->topologyTest();
|
||||||
|
|
||||||
|
|
||||||
fd.close();
|
fd.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,3 +162,39 @@ int CIMExporter::numberIt(const QString& id)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CIMExporter::topologyTest()
|
||||||
|
{
|
||||||
|
//检查一下拓扑关系
|
||||||
|
QList<QPair<int,int> > linkage;
|
||||||
|
for(QList<CIMExporter::LineStru>::iterator ite=this->line.begin();
|
||||||
|
ite!=this->line.end();
|
||||||
|
ite++)
|
||||||
|
{
|
||||||
|
linkage.push_back(QPair<int,int>(ite->fromNum,ite->toNum));
|
||||||
|
}
|
||||||
|
for(QList<CIMExporter::SwitchStru>::iterator ite=this->sw.begin();
|
||||||
|
ite!=this->sw.end();
|
||||||
|
ite++)
|
||||||
|
{
|
||||||
|
linkage.push_back(QPair<int,int>(ite->fromNum,ite->toNum));
|
||||||
|
}
|
||||||
|
for(QList<CIMExporter::TransformerStru>::iterator ite=this->tf.begin();
|
||||||
|
ite!=this->tf.end();
|
||||||
|
ite++)
|
||||||
|
{
|
||||||
|
linkage.push_back(QPair<int,int>(ite->fromNum,ite->toNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
TopologyTest tpTest(this->number.keys().length());
|
||||||
|
if(tpTest.start(linkage))
|
||||||
|
{
|
||||||
|
std::cout<<"topoloty ok!"<<std::endl;
|
||||||
|
return true;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
std::cout<<"not ok topology"<<std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "loadmapping.h"
|
#include "loadmapping.h"
|
||||||
#include "loadinfo.h"
|
#include "loadinfo.h"
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include "topologytest.h"
|
||||||
//#include "elementhashtable.h"
|
//#include "elementhashtable.h"
|
||||||
class Substation;
|
class Substation;
|
||||||
class CIMExporter
|
class CIMExporter
|
||||||
|
|
@ -50,6 +51,7 @@ public:
|
||||||
void add(const QPair<QString,QString>& fromTo,Transformer* tf);
|
void add(const QPair<QString,QString>& fromTo,Transformer* tf);
|
||||||
void exportTo(const QString& path);
|
void exportTo(const QString& path);
|
||||||
private:
|
private:
|
||||||
|
bool topologyTest();
|
||||||
QList<LineStru> line;
|
QList<LineStru> line;
|
||||||
QList<SwitchStru> sw;
|
QList<SwitchStru> sw;
|
||||||
QList<TransformerStru> tf;
|
QList<TransformerStru> tf;
|
||||||
|
|
@ -59,6 +61,7 @@ private:
|
||||||
void idToNumber(QList<T> &s);//把所有元件的标识进行编号
|
void idToNumber(QList<T> &s);//把所有元件的标识进行编号
|
||||||
QString loadDir;
|
QString loadDir;
|
||||||
const QHash<QString,BasicElementInfo *>& eleHT;
|
const QHash<QString,BasicElementInfo *>& eleHT;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CIMEXPORTER_H
|
#endif // CIMEXPORTER_H
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,114 @@
|
||||||
//#include "loadmapping.h"
|
//#include "loadmapping.h"
|
||||||
//#include "loadinfo.h"
|
//#include "loadinfo.h"
|
||||||
#include "dgmapping.h"
|
#include "dgmapping.h"
|
||||||
|
#include "topologytest.h"
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
|
// TopologyTest tpTest(96);
|
||||||
|
// QList<QPair<int,int> > p;
|
||||||
|
// p.push_back(QPair<int,int>(1,2) );
|
||||||
|
// p.push_back(QPair<int,int>(1,3) );
|
||||||
|
// p.push_back(QPair<int,int>(3,4) );
|
||||||
|
// p.push_back(QPair<int,int>(4,5) );
|
||||||
|
// p.push_back(QPair<int,int>(5,6) );
|
||||||
|
// p.push_back(QPair<int,int>(6,7) );
|
||||||
|
// p.push_back(QPair<int,int>(8,9) );
|
||||||
|
// p.push_back(QPair<int,int>(9,10) );
|
||||||
|
// p.push_back(QPair<int,int>(11,12) );
|
||||||
|
// p.push_back(QPair<int,int>(13,14) );
|
||||||
|
// p.push_back(QPair<int,int>(15,16) );
|
||||||
|
// p.push_back(QPair<int,int>(17,18) );
|
||||||
|
// p.push_back(QPair<int,int>(18,19) );
|
||||||
|
// p.push_back(QPair<int,int>(19,20) );
|
||||||
|
// p.push_back(QPair<int,int>(20,21) );
|
||||||
|
// p.push_back(QPair<int,int>(21,22) );
|
||||||
|
// p.push_back(QPair<int,int>(22,23) );
|
||||||
|
// p.push_back(QPair<int,int>(24,25) );
|
||||||
|
// p.push_back(QPair<int,int>(26,27) );
|
||||||
|
// p.push_back(QPair<int,int>(28,29) );
|
||||||
|
// p.push_back(QPair<int,int>(30,31) );
|
||||||
|
// p.push_back(QPair<int,int>(32,33) );
|
||||||
|
// p.push_back(QPair<int,int>(33,34) );
|
||||||
|
// p.push_back(QPair<int,int>(35,36) );
|
||||||
|
// p.push_back(QPair<int,int>(37,38) );
|
||||||
|
// p.push_back(QPair<int,int>(38,39) );
|
||||||
|
// p.push_back(QPair<int,int>(36,40) );
|
||||||
|
// p.push_back(QPair<int,int>(41,42) );
|
||||||
|
// p.push_back(QPair<int,int>(42,43) );
|
||||||
|
// p.push_back(QPair<int,int>(40,44) );
|
||||||
|
// p.push_back(QPair<int,int>(45,46) );
|
||||||
|
// p.push_back(QPair<int,int>(46,47) );
|
||||||
|
// p.push_back(QPair<int,int>(44,48) );
|
||||||
|
// p.push_back(QPair<int,int>(49,50) );
|
||||||
|
// p.push_back(QPair<int,int>(50,51) );
|
||||||
|
// p.push_back(QPair<int,int>(52,53) );
|
||||||
|
// p.push_back(QPair<int,int>(54,55) );
|
||||||
|
// p.push_back(QPair<int,int>(56,57) );
|
||||||
|
// p.push_back(QPair<int,int>(57,58) );
|
||||||
|
// p.push_back(QPair<int,int>(55,59) );
|
||||||
|
// p.push_back(QPair<int,int>(60,61) );
|
||||||
|
// p.push_back(QPair<int,int>(61,62) );
|
||||||
|
// p.push_back(QPair<int,int>(59,63) );
|
||||||
|
// p.push_back(QPair<int,int>(64,65) );
|
||||||
|
// p.push_back(QPair<int,int>(65,66) );
|
||||||
|
// p.push_back(QPair<int,int>(67,68) );
|
||||||
|
// p.push_back(QPair<int,int>(69,70) );
|
||||||
|
// p.push_back(QPair<int,int>(71,72) );
|
||||||
|
// p.push_back(QPair<int,int>(73,74) );
|
||||||
|
// p.push_back(QPair<int,int>(75,76) );
|
||||||
|
// p.push_back(QPair<int,int>(77,78) );
|
||||||
|
// p.push_back(QPair<int,int>(7,79) );
|
||||||
|
// p.push_back(QPair<int,int>(79,8) );
|
||||||
|
// p.push_back(QPair<int,int>(10,80) );
|
||||||
|
// p.push_back(QPair<int,int>(80,11) );
|
||||||
|
// p.push_back(QPair<int,int>(12,81) );
|
||||||
|
// p.push_back(QPair<int,int>(81,13) );
|
||||||
|
// p.push_back(QPair<int,int>(81,15) );
|
||||||
|
// p.push_back(QPair<int,int>(80,17) );
|
||||||
|
// p.push_back(QPair<int,int>(80,24) );
|
||||||
|
// p.push_back(QPair<int,int>(25,82) );
|
||||||
|
// p.push_back(QPair<int,int>(82,83) );
|
||||||
|
// p.push_back(QPair<int,int>(83,84) );
|
||||||
|
// p.push_back(QPair<int,int>(84,26) );
|
||||||
|
// p.push_back(QPair<int,int>(83,85) );
|
||||||
|
// p.push_back(QPair<int,int>(85,28) );
|
||||||
|
// p.push_back(QPair<int,int>(83,86) );
|
||||||
|
// p.push_back(QPair<int,int>(86,30) );
|
||||||
|
// p.push_back(QPair<int,int>(83,32) );
|
||||||
|
// p.push_back(QPair<int,int>(34,35) );
|
||||||
|
// p.push_back(QPair<int,int>(36,37) );
|
||||||
|
// p.push_back(QPair<int,int>(40,41) );
|
||||||
|
// p.push_back(QPair<int,int>(44,45) );
|
||||||
|
// p.push_back(QPair<int,int>(48,49) );
|
||||||
|
// p.push_back(QPair<int,int>(82,87) );
|
||||||
|
// p.push_back(QPair<int,int>(80,88) );
|
||||||
|
// p.push_back(QPair<int,int>(79,52) );
|
||||||
|
// p.push_back(QPair<int,int>(53,89) );
|
||||||
|
// p.push_back(QPair<int,int>(89,90) );
|
||||||
|
// p.push_back(QPair<int,int>(90,54) );
|
||||||
|
// p.push_back(QPair<int,int>(55,56) );
|
||||||
|
// p.push_back(QPair<int,int>(59,60) );
|
||||||
|
// p.push_back(QPair<int,int>(63,64) );
|
||||||
|
// p.push_back(QPair<int,int>(90,67) );
|
||||||
|
// p.push_back(QPair<int,int>(90,69) );
|
||||||
|
// p.push_back(QPair<int,int>(90,71) );
|
||||||
|
// p.push_back(QPair<int,int>(79,73) );
|
||||||
|
// p.push_back(QPair<int,int>(74,91) );
|
||||||
|
// p.push_back(QPair<int,int>(91,75) );
|
||||||
|
// p.push_back(QPair<int,int>(79,73) );
|
||||||
|
// p.push_back(QPair<int,int>(74,91) );
|
||||||
|
// p.push_back(QPair<int,int>(91,71) );
|
||||||
|
// p.push_back(QPair<int,int>(91,77) );
|
||||||
|
// p.push_back(QPair<int,int>(79,92) );
|
||||||
|
// p.push_back(QPair<int,int>(68,93) );
|
||||||
|
// p.push_back(QPair<int,int>(70,94) );
|
||||||
|
// p.push_back(QPair<int,int>(72,95) );
|
||||||
|
// p.push_back(QPair<int,int>(76,96) );
|
||||||
|
|
||||||
|
|
||||||
|
// tpTest.start(p);
|
||||||
|
// return a.exec();
|
||||||
|
|
||||||
// LoadInfo loadInfo;
|
// LoadInfo loadInfo;
|
||||||
// loadInfo.setLoadPath("D:/Project/佛山项目/数据/搭网架参数文件/泰安/泰安负荷/718发展线/专变/威灵电机工业园电房1.csv");
|
// loadInfo.setLoadPath("D:/Project/佛山项目/数据/搭网架参数文件/泰安/泰安负荷/718发展线/专变/威灵电机工业园电房1.csv");
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ SOURCES += main.cpp \
|
||||||
loadinfo.cpp \
|
loadinfo.cpp \
|
||||||
loadmatchexception.cpp \
|
loadmatchexception.cpp \
|
||||||
dgmapping.cpp \
|
dgmapping.cpp \
|
||||||
dginfo.cpp
|
dginfo.cpp \
|
||||||
|
topologytest.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
elementhashtable.h \
|
elementhashtable.h \
|
||||||
|
|
@ -73,7 +74,8 @@ HEADERS += \
|
||||||
singletonbase.h \
|
singletonbase.h \
|
||||||
loadmatchexception.h \
|
loadmatchexception.h \
|
||||||
dgmapping.h \
|
dgmapping.h \
|
||||||
dginfo.h
|
dginfo.h \
|
||||||
|
topologytest.h
|
||||||
|
|
||||||
#release{
|
#release{
|
||||||
DEFINES += QT_NO_DEBUG_OUTPUT
|
DEFINES += QT_NO_DEBUG_OUTPUT
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
#include "topologytest.h"
|
||||||
|
#include <iostream>
|
||||||
|
TopologyTest::TopologyTest(int nodeN):nodeN(nodeN),access(nodeN)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TopologyTest::~TopologyTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TopologyTest::start(const QList<QPair<int,int> >& linkage)
|
||||||
|
{
|
||||||
|
//先建立所有的连接关系
|
||||||
|
QHash<int,QVector<int> > arch;
|
||||||
|
for(
|
||||||
|
QList<QPair<int,int> >::const_iterator ite=linkage.begin();
|
||||||
|
ite!=linkage.end();
|
||||||
|
ite++
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f=(*ite).first-1;
|
||||||
|
int s=(*ite).second-1;
|
||||||
|
std::cout<<f<<" to "<<s<<std::endl;
|
||||||
|
arch[(*ite).first-1].push_back((*ite).second-1);
|
||||||
|
arch[(*ite).second-1].push_back((*ite).first-1);
|
||||||
|
}
|
||||||
|
//开始找
|
||||||
|
bool flag=true;
|
||||||
|
// QList<int> keys=arch.keys();
|
||||||
|
for(int outer=0;
|
||||||
|
outer<this->nodeN;
|
||||||
|
outer++)
|
||||||
|
{
|
||||||
|
if(!flag)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for(int i=0;i<this->nodeN;i++)
|
||||||
|
{
|
||||||
|
this->access[i]=-100;
|
||||||
|
}
|
||||||
|
int n=outer;
|
||||||
|
this->next(n,arch);
|
||||||
|
//检查一下
|
||||||
|
for(int i=0;i<this->nodeN;i++)
|
||||||
|
{
|
||||||
|
if(this->access[i]==-100)
|
||||||
|
{
|
||||||
|
flag=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// if(!flag)
|
||||||
|
// {
|
||||||
|
// std::cout<<"no!!"<<std::endl;
|
||||||
|
// for(int i=0;i<this->access.length();i++)
|
||||||
|
// {
|
||||||
|
// if(this->access.at(i)==-100)
|
||||||
|
// {
|
||||||
|
// std::cout<<i+1<<",";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// std::cout<<std::endl;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// std::cout<<"yes!!"<<std::endl;
|
||||||
|
// }
|
||||||
|
return flag;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TopologyTest::next(int start,QHash<int,QVector<int> > &arch)
|
||||||
|
{
|
||||||
|
if(this->access[start]==100)
|
||||||
|
return;
|
||||||
|
// std::cout<<"fw "<<start<<std::endl;
|
||||||
|
this->access[start]=100;
|
||||||
|
QVector<int> nextNode=arch[start];
|
||||||
|
for(int i=0;i<nextNode.length();i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
this->next(nextNode.at(i),arch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef TOPOLOGYTEST_H
|
||||||
|
#define TOPOLOGYTEST_H
|
||||||
|
|
||||||
|
//检查拓扑是否完整
|
||||||
|
#include <QPair>
|
||||||
|
#include <QList>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QVector>
|
||||||
|
class TopologyTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopologyTest(int nodeN);
|
||||||
|
~TopologyTest();
|
||||||
|
bool start(const QList<QPair<int,int> >& linkage);
|
||||||
|
private:
|
||||||
|
void next(int start, QHash<int, QVector<int> > &arch);
|
||||||
|
QVector<int> access;
|
||||||
|
int nodeN;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TOPOLOGYTEST_H
|
||||||
Loading…
Reference in New Issue