1.给SWTICH的空node一个虚拟名称。
2.修复了getSubstationLoad的bug,要先判断再返回。 Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
parent
1c9f65b6cd
commit
7947ddc9b1
|
|
@ -22,6 +22,12 @@ void CIMExporter::add(const QPair<QString,QString>& fromTo,Switch* sw)
|
|||
switchStru.sw=sw;
|
||||
switchStru.fromID=fromTo.first;
|
||||
switchStru.toID=fromTo.second;
|
||||
// if(fromTo.second.trimmed()=="")
|
||||
// {
|
||||
//// QString id=sw->id;
|
||||
//// switchStru.toID=id.section('-',0,0)+id.section('-',0,0)+id.section('-',1,1);//定义一个虚拟的
|
||||
// switchStru.toID=sw->id;
|
||||
// }
|
||||
switchStru.id=sw->id;
|
||||
switchStru.isZeroBranch=true;
|
||||
switchStru.dispose=false;
|
||||
|
|
@ -113,8 +119,14 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID)
|
|||
foreach(QString file,files)
|
||||
{
|
||||
QFileInfo fileInfo(file);
|
||||
baseNames<<fileInfo.baseName();
|
||||
if(fileInfo.suffix().toLower()!="csv")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
baseNames<<fileInfo.baseName();
|
||||
// std::cout<<"has "<<fileInfo.baseName().toLocal8Bit().data()<<std::endl;
|
||||
}
|
||||
|
||||
writer<<QStringLiteral("变压器")<<"\r\n";
|
||||
writer<<QStringLiteral("节点号")<<"\t"<<QStringLiteral("节点号")<<"\t"<<QStringLiteral("型号")<<"\t"<<QStringLiteral("容量(MVA)")<<"\r\n";
|
||||
QStringList usedLoad;
|
||||
|
|
@ -128,24 +140,24 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID)
|
|||
}
|
||||
PowerTransformer *tf=ite->tf->getTF();
|
||||
QString subID=tf->getEquipmentMemberOf_EquipmentContainer();//所属Substation的ID
|
||||
|
||||
Substation *sub=static_cast<Substation *>(this->eleHT[subID]);
|
||||
if(!sub)
|
||||
{
|
||||
std::cout<<"CIMExporter:: can not substation of "<<subID.toStdString()<<std::endl;
|
||||
continue;
|
||||
}
|
||||
// std::cout<<"sub id"<< subID.toStdString()<<" "<<sub->getID().toStdString()<<std::endl;
|
||||
LoadMapping loadMapping;
|
||||
QVector<QSharedPointer<LoadInfo> > vecLoadInfo=loadMapping.getSubstationLoad(sub->getID());
|
||||
foreach(QSharedPointer<LoadInfo> p,vecLoadInfo)
|
||||
{
|
||||
|
||||
QFileInfo targetBasename(p->getLoadPath());
|
||||
// std::cout<<targetBasename.baseName().toLocal8Bit().data()<<std::endl;
|
||||
// std::cout<<"search for "<<p->getLoadPath().toLocal8Bit().data()<<std::endl;
|
||||
if( baseNames.contains( targetBasename.baseName()) and !usedLoad.contains(targetBasename.baseName()))
|
||||
{
|
||||
// std::cout<<"match "<<targetBasename.baseName().toLocal8Bit().data()<<std::endl;
|
||||
usedLoad<<targetBasename.baseName();
|
||||
// p->updateByTime(QTime(3,45,0));
|
||||
// std::cout<<this->numberIt(ite->toID)<<" "<< p->getPA()<<std::endl;
|
||||
writer<<ite->fromNum<<"\t";
|
||||
writer<<ite->toNum<<"\t";
|
||||
writer<<"type"<<"\t";
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void ElementReduction::doIt(const QString& rootID)
|
|||
|
||||
void ElementReduction::merge(QDomElement &element,QHash<QString,BranchStruc *>& idToBranch)
|
||||
{
|
||||
return;
|
||||
// return;
|
||||
QString parentID=idToBranch[element.tagName()]->id;
|
||||
QStringList sep=parentID.split('-');
|
||||
QString toID=sep.at(1)+sep.at(0);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ QSharedPointer<LoadInfo> LoadMapping::getALoad(const QString& id)
|
|||
|
||||
QVector<QSharedPointer<LoadInfo> > LoadMapping::getSubstationLoad(const QString& id)
|
||||
{
|
||||
if(!this->loads->contains(id))
|
||||
{
|
||||
return QVector<QSharedPointer<LoadInfo> >();
|
||||
}
|
||||
return (*this->loads)[id];
|
||||
}
|
||||
|
||||
|
|
@ -122,6 +126,7 @@ bool LoadMapping::readLoads(const QString &dir)
|
|||
continue;
|
||||
}
|
||||
QSharedPointer<LoadInfo> loadInfo=(*this->loadsToLoadInfo)[fileName];
|
||||
// std::cout<<"file name "<<fileName.toLocal8Bit().data()<<std::endl;
|
||||
loadInfo->setLoadPath(filePath);
|
||||
|
||||
}
|
||||
|
|
@ -174,6 +179,14 @@ bool LoadMapping::readMatch(const QString& dir)
|
|||
}
|
||||
QSharedPointer<LoadInfo> t(new LoadInfo);
|
||||
t->setLoadName(sep.at(i));
|
||||
// if(sep.at(i).trimmed()=="")
|
||||
// {
|
||||
// std::cout<<"empy "<<SFDid.toStdString()<<std::endl;
|
||||
// }
|
||||
// if(SFDid=="SFD-42760")
|
||||
// {
|
||||
// std::cout<<"SFD-42760 "<<sep.at(i).toStdString()<<std::endl;
|
||||
// }
|
||||
loads.push_back(t);
|
||||
(*this->loadsToLoadInfo)[sep.at(i)]=t;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@
|
|||
#include "regexextract.h"
|
||||
#include "task.h"
|
||||
#include <iostream>
|
||||
//#include "loadmapping.h"
|
||||
#include "loadmapping.h"
|
||||
//#include "loadinfo.h"
|
||||
#include "dgmapping.h"
|
||||
#include "topologytest.h"
|
||||
//#include "topologytest.h"
|
||||
//#include "recursedir.h"
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
|
@ -124,6 +125,16 @@ int main(int argc, char *argv[])
|
|||
// re.extract("D:/Project/佛山项目/数据/df8003/df8600/exportfiles/exportmodel_pw.xml");
|
||||
// re.exportBlocks("./a");
|
||||
|
||||
// LoadMapping lm;
|
||||
// lm.load("D:/Project/佛山项目/数据/搭网架参数文件/","D:/Project/佛山项目/数据/匹配的数据/","D:/Project/佛山项目/数据/exception.txt");//单例,执行一次行了。
|
||||
// std::cout<<lm.getSubstationLoad("SFD-42760").length()<<std::endl;
|
||||
// RecurseDir dir;
|
||||
// dir.setDir("D:/Project/佛山项目/数据/搭网架参数文件/");
|
||||
// QStringList files=dir.getFiles();
|
||||
// foreach(QString l,files)
|
||||
// {
|
||||
// std::cout<<l.toLocal8Bit().data()<<std::endl;
|
||||
// }
|
||||
DGMapping dgMapping;
|
||||
dgMapping.load("D:/Project/佛山项目/数据/DG.txt");
|
||||
// return a.exec();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#727泰林东乙线,AC-671678,D:\Project\佛山项目\数据\搭网架参数文件\泰安\泰安负荷\727泰林东乙线,(FD-2096,),
|
||||
#721南源线,AC-591821,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\721南源线,(FD-2014,FD-2019,FD-2000,)
|
||||
726制钢甲线,AC-671677,D:\Project\佛山项目\数据\搭网架参数文件\泰安\泰安负荷\726制钢甲线,(FD-2038)
|
||||
#726制钢甲线,AC-671677,D:\Project\佛山项目\数据\搭网架参数文件\泰安\泰安负荷\726制钢甲线,(FD-2038)
|
||||
721南源线,AC-591821,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\721南源线,(FD-2014,FD-2019,FD-2000,)
|
||||
|
||||
709美的甲线,AC-671399,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,)
|
||||
720美的乙线,AC-671401,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,)
|
||||
|
|
|
|||
|
|
@ -267,6 +267,10 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
nextNode=nextTerminalP->getConnectivityNode();
|
||||
fromTo.first=node;
|
||||
fromTo.second=nextNode;
|
||||
if(nextNode=="")
|
||||
{
|
||||
fromTo.second=foundEle->getID();//用虚拟节点
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue