diff --git a/testHasttable/cimexporter.cpp b/testHasttable/cimexporter.cpp index 1820927..f96319c 100644 --- a/testHasttable/cimexporter.cpp +++ b/testHasttable/cimexporter.cpp @@ -182,12 +182,16 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID) writer<<"type"<<"\t"; // writer<id<<"\t"; writer<getMVA()<<"\r\n"; + //加到LoadExport中 + LoadExporter loadExporter; + loadExporter.add(targetBasename.baseName(),p); break; } } } //列出DG + writer<::iterator ite=this->dg.begin(); ite!=this->dg.end(); ite++) diff --git a/testHasttable/cimexporter.h b/testHasttable/cimexporter.h index 2dabd1d..d661ff5 100644 --- a/testHasttable/cimexporter.h +++ b/testHasttable/cimexporter.h @@ -21,6 +21,7 @@ #include "topologytest.h" #include "elementreduction.h" #include "loadmatchexception.h" +#include "special/loadexporter.h" #include //#include "elementhashtable.h" //class Substation; diff --git a/testHasttable/elementhashtable.cpp b/testHasttable/elementhashtable.cpp index 0e1b48b..2081b5e 100644 --- a/testHasttable/elementhashtable.cpp +++ b/testHasttable/elementhashtable.cpp @@ -189,7 +189,7 @@ void ElementHashtable::ShowContainerInfo(const QString& fileName) } else { - std::cerr<<"not open"<"< t=(*LoadMapping::loadsToLoadInfo)[*ite]; + if(t->getLoadPath().trimmed().length()==0) + { + continue; + } +// std::cout<<"aa "<toLocal8Bit().data()<<" "<getLoadPath().toLocal8Bit().data()<updateByTime(time); } return true; diff --git a/testHasttable/main.cpp b/testHasttable/main.cpp index ffcbff1..e02a73a 100644 --- a/testHasttable/main.cpp +++ b/testHasttable/main.cpp @@ -8,6 +8,7 @@ #include "dgmapping.h" //#include "topologytest.h" //#include "recursedir.h" +#include "special/loadexporter.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -147,6 +148,8 @@ int main(int argc, char *argv[]) // eleReader.GoPath(); Task task; task.doAgainstTaskFile(eleReader); + LoadExporter loadExporter; + loadExporter.toSingleFile("D:/MyPro/cimforreduceloss/testHasttable/output/pan/load/singlefile.txt"); std::cout<<"Finished."< +LoadExporter::LoadExporter() +{ + +} + +LoadExporter::~LoadExporter() +{ + +} + +void LoadExporter::add(const QString& fileName, QSharedPointer loadInfo) +{ + this->ht.add(fileName,loadInfo); +// if(loadInfo->getLoadPath().trimmed().length()==0) +// { +// std::cout<<"fd"< > > loadSequence; + //24个时段 + for(int i=0;i<24;i++) + { + QTime time(i,0); + this->updateByTime(time); + QStringList keys; + keys=this->ht.keys(); + foreach(QString key, keys) + { + QSharedPointer p=this->ht.get(key); + double P=p->getPA()+p->getPB()+p->getPC(); + double Q=p->getQA()+p->getQB()+p->getQC(); + loadSequence[key].push_back(QPair(P,Q) ); + } + } + + QFile file(filePath); + if(file.open(QFile::WriteOnly)) + { + QTextStream stream(&file); + QStringList keys; + keys=loadSequence.keys(); + foreach(QString key, keys) + { + stream< > loadList=loadSequence[key]; + int seq=0; + for(QList >::iterator ite=loadList.begin();ite!=loadList.end();ite++) + { + stream<<"["<first<<"&&"<second<<")"<<","; + } + stream<<"\t\n"; + } + file.close(); + } + else + { + std::cout<<"cannot create file to export load."< +#include +#include +#include +#include +#include +#include +#include +#include + +class LoadExporter +{ + class HT_TYPE:public SingletonBase,HT_TYPE > + {}; +public: + LoadExporter(); + ~LoadExporter(); + void add(const QString &fileName, QSharedPointer loadInfo); + void toSingleFile(const QString& filePath); + void updateByTime(const QTime &time); +private: + HT_TYPE ht; + +}; + +#endif // LOADEXPORTER_H diff --git a/testHasttable/task.cpp b/testHasttable/task.cpp index fe5b8c4..acabaa6 100644 --- a/testHasttable/task.cpp +++ b/testHasttable/task.cpp @@ -71,7 +71,7 @@ void Task::doAgainstTaskFile(ElementHashtable &eleHT) eleHT.GoPath(); eleHT.ExportTo(QString("D:/MyPro/cimforreduceloss/testHasttable/output/pan/")+sep.at(0)+".txt"); eleHT.ShowContainerInfo(lineName); - break; +// break; } file.close(); } diff --git a/testHasttable/task.txt b/testHasttable/task.txt index a2bcdd5..9df1e1c 100644 --- a/testHasttable/task.txt +++ b/testHasttable/task.txt @@ -1,4 +1,4 @@ -727ֶ̩,AC-671678,D:\Project\ɽĿ\\ܲļ\̩\̩\727ֶ̩,(FD-2096,) +713ֶ̩,AC-671669,D:\Project\ɽĿ\\ܲļ\̩\̩\713ֶ̩,(FD-2098,FD-2096) 709ļ,AC-671399,D:\Project\ɽĿ\\ܲļ\\򸺺\709ļߡ720,(FD-2003,) diff --git a/testHasttable/testHasttable.pro b/testHasttable/testHasttable.pro index 61a64e8..6167c07 100644 --- a/testHasttable/testHasttable.pro +++ b/testHasttable/testHasttable.pro @@ -46,7 +46,8 @@ SOURCES += main.cpp \ dginfo.cpp \ topologytest.cpp \ elementreduction.cpp \ - element/dg.cpp + element/dg.cpp \ + special/loadexporter.cpp HEADERS += \ elementhashtable.h \ @@ -80,7 +81,8 @@ HEADERS += \ topologytest.h \ elementreduction.h \ element/commontype.h \ - element/dg.h + element/dg.h \ + special/loadexporter.h #release{ DEFINES += QT_NO_DEBUG_OUTPUT diff --git a/testHasttable/topologyrecorder.cpp b/testHasttable/topologyrecorder.cpp index 4df1504..2adc45c 100644 --- a/testHasttable/topologyrecorder.cpp +++ b/testHasttable/topologyrecorder.cpp @@ -28,7 +28,7 @@ bool TopologyRecorder::addDG(const QString& substationID, const QString &fromNod // std::cout<<"from node"<getName(),this); this->cimExporter.add(fromTo,DGP); -// std::cout<<"add "<<_DG->getName().toLocal8Bit().data()<getName().toLocal8Bit().data()<<" to "<usedDG[_DG->getName()]=0;//用过了,做个记号 } return true;