parent
d0b9071577
commit
3345e00fbd
|
|
@ -66,22 +66,31 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID)
|
||||||
QList<BranchStruc*> elements;
|
QList<BranchStruc*> elements;
|
||||||
for(int i=0;i<this->line.length();i++)
|
for(int i=0;i<this->line.length();i++)
|
||||||
{
|
{
|
||||||
|
// std::cout<<this->line[i].fromID.toStdString()<<" "<<this->line[i].id.toStdString()<<" "<<this->line[i].toID.toStdString()<<std::endl;
|
||||||
elements.push_back( &(this->line[i]) );
|
elements.push_back( &(this->line[i]) );
|
||||||
}
|
}
|
||||||
for(int i=0;i<this->sw.length();i++)
|
for(int i=0;i<this->sw.length();i++)
|
||||||
{
|
{
|
||||||
|
// std::cout<<this->sw[i].fromID.toStdString()<<" "<<this->sw[i].id.toStdString()<<" "<<this->sw[i].toID.toStdString()<<std::endl;
|
||||||
elements.push_back( &(this->sw[i]) );
|
elements.push_back( &(this->sw[i]) );
|
||||||
}
|
}
|
||||||
for(int i=0;i<this->tf.length();i++)
|
for(int i=0;i<this->tf.length();i++)
|
||||||
{
|
{
|
||||||
|
// std::cout<<this->tf[i].fromID.toStdString()<<" "<<this->tf[i].id.toStdString()<<" "<<this->tf[i].toID.toStdString()<<std::endl;
|
||||||
elements.push_back( &(this->tf[i]) );
|
elements.push_back( &(this->tf[i]) );
|
||||||
}
|
}
|
||||||
|
for(int i=0;i<this->dg.length();i++)
|
||||||
|
{
|
||||||
|
// std::cout<<this->dg[i].fromID.toStdString()<<" "<<this->dg[i].id.toStdString()<<" "<<this->dg[i].toID.toStdString()<<std::endl;
|
||||||
|
elements.push_back( &(this->dg[i]) );
|
||||||
|
}
|
||||||
ElementReduction elementReduction(elements);
|
ElementReduction elementReduction(elements);
|
||||||
// elementReduction.doIt(rootID);//消除0阻抗支路,把几段线路连成一段
|
elementReduction.doIt(rootID);//消除0阻抗支路,把几段线路连成一段
|
||||||
//先给所有节点都编号
|
//先给所有节点都编号
|
||||||
this->idToNumber(this->line);
|
this->idToNumber(this->line);
|
||||||
this->idToNumber(this->sw);
|
this->idToNumber(this->sw);
|
||||||
this->idToNumber(this->tf);
|
this->idToNumber(this->tf);
|
||||||
|
this->idToNumber(this->dg);
|
||||||
//开始按要求输出
|
//开始按要求输出
|
||||||
//先输出线路
|
//先输出线路
|
||||||
QTextStream writer(&fd);
|
QTextStream writer(&fd);
|
||||||
|
|
@ -285,6 +294,18 @@ bool CIMExporter::topologyTest()
|
||||||
linkage.push_back(QPair<int,int>(ite->fromNum,ite->toNum));
|
linkage.push_back(QPair<int,int>(ite->fromNum,ite->toNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(QList<DGStru>::iterator ite=this->dg.begin();
|
||||||
|
ite!=this->dg.end();
|
||||||
|
ite++)
|
||||||
|
{
|
||||||
|
if(ite->dispose)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
linkage.push_back(QPair<int,int>(ite->fromNum,ite->toNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TopologyTest tpTest(this->number.keys().length());
|
TopologyTest tpTest(this->number.keys().length());
|
||||||
if(tpTest.start(linkage))
|
if(tpTest.start(linkage))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,10 @@ void ElementReduction::doIt(const QString& rootID)
|
||||||
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);
|
||||||
this->reduceSection();
|
this->reduceSection();
|
||||||
|
|
||||||
// QFile file("1.xml");
|
// QFile file("1.xml");
|
||||||
// if(file.open(QFile::WriteOnly))
|
// if(file.open(QFile::WriteOnly))
|
||||||
// {
|
// {
|
||||||
|
|
@ -76,7 +78,15 @@ void ElementReduction::merge(QDomElement &element,QHash<QString,BranchStruc *>&
|
||||||
// return;
|
// return;
|
||||||
QString parentID=idToBranch[element.tagName()]->id;
|
QString parentID=idToBranch[element.tagName()]->id;
|
||||||
QStringList sep=parentID.split('-');
|
QStringList sep=parentID.split('-');
|
||||||
QString toID=sep.at(1)+sep.at(0);
|
QString toID;
|
||||||
|
if(sep.length()>1)
|
||||||
|
{
|
||||||
|
toID=sep.at(1)+sep.at(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toID=sep.at(0)+"_"+sep.at(0);
|
||||||
|
}
|
||||||
idToBranch[element.tagName()]->toID=toID;
|
idToBranch[element.tagName()]->toID=toID;
|
||||||
element.setAttribute("toID",toID);
|
element.setAttribute("toID",toID);
|
||||||
//顺便编号
|
//顺便编号
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,10 @@ bool TopologyRecorder::addDG(const QString& substationID, const QString &fromNod
|
||||||
{
|
{
|
||||||
break;//这个Substation下面已经添加过DG,不用再添加了。
|
break;//这个Substation下面已经添加过DG,不用再添加了。
|
||||||
}
|
}
|
||||||
|
// 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()<<std::endl;
|
||||||
this->usedDG[_DG->getName()]=0;//用过了,做个记号
|
this->usedDG[_DG->getName()]=0;//用过了,做个记号
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue