进行负荷映射的时候可能有相同的Substation ID,就把他们全部和起来。

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab 2015-01-22 15:43:28 +08:00
parent 7947ddc9b1
commit 01c77d2045
5 changed files with 27 additions and 23 deletions

View File

@ -154,7 +154,7 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID)
{ {
QFileInfo targetBasename(p->getLoadPath()); QFileInfo targetBasename(p->getLoadPath());
// std::cout<<"search for "<<p->getLoadPath().toLocal8Bit().data()<<std::endl; // std::cout<<"search for "<<targetBasename.baseName().toLocal8Bit().data()<<std::endl;
if( baseNames.contains( targetBasename.baseName()) and !usedLoad.contains(targetBasename.baseName())) if( baseNames.contains( targetBasename.baseName()) and !usedLoad.contains(targetBasename.baseName()))
{ {
usedLoad<<targetBasename.baseName(); usedLoad<<targetBasename.baseName();
@ -203,7 +203,7 @@ void CIMExporter::idToNumber(QList<T> &s)//把所有元件的标识进行编号
{ {
if(ite->dispose) if(ite->dispose)
{ {
std::cout<<ite->id.toStdString()<<" dispose"<<std::endl; // std::cout<<ite->id.toStdString()<<" dispose"<<std::endl;
continue; continue;
} }

View File

@ -31,7 +31,7 @@ void ElementReduction::doIt(const QString& rootID)
idToBranch[v->id]=v; idToBranch[v->id]=v;
linkage[v->fromID].push_back(v); linkage[v->fromID].push_back(v);
linkage[v->toID].push_back(v); linkage[v->toID].push_back(v);
std::cout<<v->fromID.toStdString()<<" "<<v->id.toStdString()<<" "<<v->toID.toStdString()<<std::endl; // std::cout<<v->fromID.toStdString()<<" "<<v->id.toStdString()<<" "<<v->toID.toStdString()<<std::endl;
} }
QDomDocument root; QDomDocument root;
@ -42,17 +42,17 @@ void ElementReduction::doIt(const QString& rootID)
root.appendChild(element); root.appendChild(element);
this->buildTreeTo(element,root,linkage,idToBranch); this->buildTreeTo(element,root,linkage,idToBranch);
// this->visited.remove(this->branchList.at(2)->id); // this->visited.remove(this->branchList.at(2)->id);
this->buildTreeFrom(element,root,linkage,idToBranch); // this->buildTreeFrom(element,root,linkage,idToBranch);
this->merge(element,idToBranch); this->merge(element,idToBranch);
QFile file("1.xml"); // QFile file("1.xml");
if(file.open(QFile::WriteOnly)) // if(file.open(QFile::WriteOnly))
{ // {
// root.setContent(&file); //// root.setContent(&file);
QTextStream writer(&file); // QTextStream writer(&file);
root.save(writer,4); // root.save(writer,4);
file.close(); // file.close();
} // }
//看看是不是每个都访问到了 //看看是不是每个都访问到了
foreach(BranchStruc* v,this->branchList) foreach(BranchStruc* v,this->branchList)
{ {
@ -99,7 +99,7 @@ void ElementReduction::merge(QDomElement &element,QHash<QString,BranchStruc *>&
branch->dispose=true; branch->dispose=true;
while(node.childNodes().length()>0) while(node.childNodes().length()>0)
{ {
std::cout<<"append "<<node.firstChild().nodeName().toStdString()<<" to "<<element.tagName().toStdString()<<std::endl; // std::cout<<"append "<<node.firstChild().nodeName().toStdString()<<" to "<<element.tagName().toStdString()<<std::endl;
element.appendChild(node.removeChild(node.firstChild())); element.appendChild(node.removeChild(node.firstChild()));
} }
element.removeChild(node); element.removeChild(node);

View File

@ -126,7 +126,7 @@ bool LoadMapping::readLoads(const QString &dir)
continue; continue;
} }
QSharedPointer<LoadInfo> loadInfo=(*this->loadsToLoadInfo)[fileName]; QSharedPointer<LoadInfo> loadInfo=(*this->loadsToLoadInfo)[fileName];
// std::cout<<"file name "<<fileName.toLocal8Bit().data()<<std::endl; std::cout<<"file name "<<fileName.toLocal8Bit().data()<<std::endl;
loadInfo->setLoadPath(filePath); loadInfo->setLoadPath(filePath);
} }
@ -170,7 +170,7 @@ bool LoadMapping::readMatch(const QString& dir)
QRegExp regExp("\\(.*\\)"); QRegExp regExp("\\(.*\\)");
SFDid=sep.at(0); SFDid=sep.at(0);
SFDid=SFDid.replace(regExp,""); SFDid=SFDid.replace(regExp,"");
QVector<QSharedPointer<LoadInfo> > loads; // QVector<QSharedPointer<LoadInfo> > loads;
for(int i=1;i<sep.length();i++) for(int i=1;i<sep.length();i++)
{ {
if(sep.at(i).trimmed().length()==0) if(sep.at(i).trimmed().length()==0)
@ -183,15 +183,18 @@ bool LoadMapping::readMatch(const QString& dir)
// { // {
// std::cout<<"empy "<<SFDid.toStdString()<<std::endl; // std::cout<<"empy "<<SFDid.toStdString()<<std::endl;
// } // }
// if(SFDid=="SFD-42760")
// { // std::cout<<SFDid.toStdString()<<std::endl;
// std::cout<<"SFD-42760 "<<sep.at(i).toStdString()<<std::endl; // loads.push_back(t);
// }
loads.push_back(t);
(*this->loadsToLoadInfo)[sep.at(i)]=t; (*this->loadsToLoadInfo)[sep.at(i)]=t;
// if(SFDid=="SFD-43064")
// {
// std::cout<<"SFD-43064 "<<sep.at(i).toLocal8Bit().data()<<std::endl;
// std::cout<<this->getSubstationLoad("SFD-43064").length()<<std::endl;
// }
(*this->loads)[SFDid].push_back(t);
} }
(*this->loads)[SFDid]=loads;
} }
file.close(); file.close();

View File

@ -127,7 +127,7 @@ int main(int argc, char *argv[])
// LoadMapping lm; // LoadMapping lm;
// lm.load("D:/Project/佛山项目/数据/搭网架参数文件/","D:/Project/佛山项目/数据/匹配的数据/","D:/Project/佛山项目/数据/exception.txt");//单例,执行一次行了。 // lm.load("D:/Project/佛山项目/数据/搭网架参数文件/","D:/Project/佛山项目/数据/匹配的数据/","D:/Project/佛山项目/数据/exception.txt");//单例,执行一次行了。
// std::cout<<lm.getSubstationLoad("SFD-42760").length()<<std::endl; // std::cout<<lm.getSubstationLoad("SFD-51339").length()<<std::endl;
// RecurseDir dir; // RecurseDir dir;
// dir.setDir("D:/Project/佛山项目/数据/搭网架参数文件/"); // dir.setDir("D:/Project/佛山项目/数据/搭网架参数文件/");
// QStringList files=dir.getFiles(); // QStringList files=dir.getFiles();

View File

@ -1,7 +1,8 @@
#727泰林东乙线,AC-671678,D:\Project\佛山项目\数据\搭网架参数文件\泰安\泰安负荷\727泰林东乙线,(FD-2096,), #727泰林东乙线,AC-671678,D:\Project\佛山项目\数据\搭网架参数文件\泰安\泰安负荷\727泰林东乙线,(FD-2096,),
#721南源线,AC-591821,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\721南源线,(FD-2014,FD-2019,FD-2000,) #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,) #721南源线,AC-591821,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\721南源线,(FD-2014,FD-2019,FD-2000,)
#701欲华线,AC-591811,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\701欲华线,(FD-2000,FD-2000,)
709美的甲线,AC-671399,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,) 709美的甲线,AC-671399,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,)
720美的乙线,AC-671401,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,) 720美的乙线,AC-671401,D:\Project\佛山项目\数据\搭网架参数文件\北滘\北滘负荷\709美的甲线、720美的乙线,(FD-2003,)