1.如果负荷路径为空就不打开。
2.把所有负荷24时段输出到一个文件中。 Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
parent
3345e00fbd
commit
29828700d2
|
|
@ -182,12 +182,16 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID)
|
||||||
writer<<"type"<<"\t";
|
writer<<"type"<<"\t";
|
||||||
// writer<<ite->id<<"\t";
|
// writer<<ite->id<<"\t";
|
||||||
writer<<tf->getMVA()<<"\r\n";
|
writer<<tf->getMVA()<<"\r\n";
|
||||||
|
//加到LoadExport中
|
||||||
|
LoadExporter loadExporter;
|
||||||
|
loadExporter.add(targetBasename.baseName(),p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//列出DG
|
//列出DG
|
||||||
|
writer<<QStringLiteral("分布式电源")<<"\r\n";
|
||||||
for(QList<DGStru>::iterator ite=this->dg.begin();
|
for(QList<DGStru>::iterator ite=this->dg.begin();
|
||||||
ite!=this->dg.end();
|
ite!=this->dg.end();
|
||||||
ite++)
|
ite++)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include "topologytest.h"
|
#include "topologytest.h"
|
||||||
#include "elementreduction.h"
|
#include "elementreduction.h"
|
||||||
#include "loadmatchexception.h"
|
#include "loadmatchexception.h"
|
||||||
|
#include "special/loadexporter.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
//#include "elementhashtable.h"
|
//#include "elementhashtable.h"
|
||||||
//class Substation;
|
//class Substation;
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ void ElementHashtable::ShowContainerInfo(const QString& fileName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr<<"not open"<<relPath.toStdString()<<std::endl;
|
std::cerr<<"show container info not open"<<relPath.toStdString()<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ void ElementReduction::doIt(const QString& rootID)
|
||||||
// QFile file("1.xml");
|
// QFile file("1.xml");
|
||||||
// if(file.open(QFile::WriteOnly))
|
// if(file.open(QFile::WriteOnly))
|
||||||
// {
|
// {
|
||||||
//// root.setContent(&file);
|
|
||||||
// QTextStream writer(&file);
|
// QTextStream writer(&file);
|
||||||
|
|
||||||
// root.save(writer,4);
|
// root.save(writer,4);
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ bool LoadInfo::updateByTime(const QTime& time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<filePath.toLocal8Bit().data()<<"not open"<<std::endl;
|
std::cout<<filePath.toLocal8Bit().data()<<"update by time not open->"<<filePath.toLocal8Bit().data() <<std::endl;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ bool LoadMapping::broadcastUpdateByTime(const QTime& time)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
QSharedPointer<LoadInfo> t=(*LoadMapping::loadsToLoadInfo)[*ite];
|
QSharedPointer<LoadInfo> t=(*LoadMapping::loadsToLoadInfo)[*ite];
|
||||||
|
if(t->getLoadPath().trimmed().length()==0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// std::cout<<"aa "<<ite->toLocal8Bit().data()<<" "<<t->getLoadPath().toLocal8Bit().data()<<std::endl;
|
||||||
t->updateByTime(time);
|
t->updateByTime(time);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include "dgmapping.h"
|
#include "dgmapping.h"
|
||||||
//#include "topologytest.h"
|
//#include "topologytest.h"
|
||||||
//#include "recursedir.h"
|
//#include "recursedir.h"
|
||||||
|
#include "special/loadexporter.h"
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
|
|
@ -147,6 +148,8 @@ int main(int argc, char *argv[])
|
||||||
// eleReader.GoPath();
|
// eleReader.GoPath();
|
||||||
Task task;
|
Task task;
|
||||||
task.doAgainstTaskFile(eleReader);
|
task.doAgainstTaskFile(eleReader);
|
||||||
|
LoadExporter loadExporter;
|
||||||
|
loadExporter.toSingleFile("D:/MyPro/cimforreduceloss/testHasttable/output/pan/load/singlefile.txt");
|
||||||
std::cout<<"Finished."<<std::endl;
|
std::cout<<"Finished."<<std::endl;
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
#include "loadexporter.h"
|
||||||
|
#include <iostream>
|
||||||
|
LoadExporter::LoadExporter()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadExporter::~LoadExporter()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadExporter::add(const QString& fileName, QSharedPointer<LoadInfo> loadInfo)
|
||||||
|
{
|
||||||
|
this->ht.add(fileName,loadInfo);
|
||||||
|
// if(loadInfo->getLoadPath().trimmed().length()==0)
|
||||||
|
// {
|
||||||
|
// std::cout<<"fd"<<std::endl;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadExporter::toSingleFile(const QString& filePath)
|
||||||
|
{
|
||||||
|
//先按时间形成一个List
|
||||||
|
QHash<QString,QList<QPair<double,double> > > 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<LoadInfo> 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<double,double>(P,Q) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file(filePath);
|
||||||
|
if(file.open(QFile::WriteOnly))
|
||||||
|
{
|
||||||
|
QTextStream stream(&file);
|
||||||
|
QStringList keys;
|
||||||
|
keys=loadSequence.keys();
|
||||||
|
foreach(QString key, keys)
|
||||||
|
{
|
||||||
|
stream<<key<<",";
|
||||||
|
QList<QPair<double,double> > loadList=loadSequence[key];
|
||||||
|
int seq=0;
|
||||||
|
for(QList<QPair<double,double> >::iterator ite=loadList.begin();ite!=loadList.end();ite++)
|
||||||
|
{
|
||||||
|
stream<<"["<<seq++<<"]"<<"("<<ite->first<<"&&"<<ite->second<<")"<<",";
|
||||||
|
}
|
||||||
|
stream<<"\t\n";
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout<<"cannot create file to export load."<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadExporter::updateByTime(const QTime &time)
|
||||||
|
{
|
||||||
|
LoadMapping loadMapping;
|
||||||
|
loadMapping.broadcastUpdateByTime(time);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#ifndef LOADEXPORTER_H
|
||||||
|
#define LOADEXPORTER_H
|
||||||
|
#include "loadinfo.h"
|
||||||
|
#include "singletonbase.h"
|
||||||
|
#include "loadmapping.h"
|
||||||
|
//把所有按潘国超的要求输出到一个文件中。2015.02.5
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include <QTime>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QList>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QPair>
|
||||||
|
|
||||||
|
class LoadExporter
|
||||||
|
{
|
||||||
|
class HT_TYPE:public SingletonBase<QString,QSharedPointer<LoadInfo>,HT_TYPE >
|
||||||
|
{};
|
||||||
|
public:
|
||||||
|
LoadExporter();
|
||||||
|
~LoadExporter();
|
||||||
|
void add(const QString &fileName, QSharedPointer<LoadInfo> loadInfo);
|
||||||
|
void toSingleFile(const QString& filePath);
|
||||||
|
void updateByTime(const QTime &time);
|
||||||
|
private:
|
||||||
|
HT_TYPE ht;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOADEXPORTER_H
|
||||||
|
|
@ -71,7 +71,7 @@ void Task::doAgainstTaskFile(ElementHashtable &eleHT)
|
||||||
eleHT.GoPath();
|
eleHT.GoPath();
|
||||||
eleHT.ExportTo(QString("D:/MyPro/cimforreduceloss/testHasttable/output/pan/")+sep.at(0)+".txt");
|
eleHT.ExportTo(QString("D:/MyPro/cimforreduceloss/testHasttable/output/pan/")+sep.at(0)+".txt");
|
||||||
eleHT.ShowContainerInfo(lineName);
|
eleHT.ShowContainerInfo(lineName);
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,)
|
709美的甲线,AC-671399,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@ SOURCES += main.cpp \
|
||||||
dginfo.cpp \
|
dginfo.cpp \
|
||||||
topologytest.cpp \
|
topologytest.cpp \
|
||||||
elementreduction.cpp \
|
elementreduction.cpp \
|
||||||
element/dg.cpp
|
element/dg.cpp \
|
||||||
|
special/loadexporter.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
elementhashtable.h \
|
elementhashtable.h \
|
||||||
|
|
@ -80,7 +81,8 @@ HEADERS += \
|
||||||
topologytest.h \
|
topologytest.h \
|
||||||
elementreduction.h \
|
elementreduction.h \
|
||||||
element/commontype.h \
|
element/commontype.h \
|
||||||
element/dg.h
|
element/dg.h \
|
||||||
|
special/loadexporter.h
|
||||||
|
|
||||||
#release{
|
#release{
|
||||||
DEFINES += QT_NO_DEBUG_OUTPUT
|
DEFINES += QT_NO_DEBUG_OUTPUT
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ bool TopologyRecorder::addDG(const QString& substationID, const QString &fromNod
|
||||||
// std::cout<<"from node"<<fromNodeID.toStdString()<<std::endl;
|
// std::cout<<"from node"<<fromNodeID.toStdString()<<std::endl;
|
||||||
DG *DGP=new DG(fromTo,capacity,_DG->getName(),this);
|
DG *DGP=new DG(fromTo,capacity,_DG->getName(),this);
|
||||||
this->cimExporter.add(fromTo,DGP);
|
this->cimExporter.add(fromTo,DGP);
|
||||||
// std::cout<<"add "<<_DG->getName().toLocal8Bit().data()<<std::endl;
|
std::cout<<"add "<<_DG->getName().toLocal8Bit().data()<<" to "<<substationID.toStdString() <<std::endl;
|
||||||
this->usedDG[_DG->getName()]=0;//用过了,做个记号
|
this->usedDG[_DG->getName()]=0;//用过了,做个记号
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue