1.把负荷文件路径加入CIMParser中。

2.把变压器也处理成双端支路。

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab
2015-01-20 13:19:28 +08:00
parent 07cfaef632
commit 8d5fcf9c95
12 changed files with 154 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
#include "topologyrecorder.h"
#include <iostream>
//#include <iostream>
#include <QList>
TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, const QVector<QString> &FDSet, QObject *parent):eleHT(elementHT),FDSet(FDSet)
TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, const QVector<QString> &FDSet,const QString& loadFilePath, QObject *parent):QObject(parent),eleHT(elementHT),FDSet(FDSet),cimExporter(elementHT,loadFilePath)
{
}
@@ -141,9 +141,7 @@ bool TopologyRecorder::startWithNode(const QString& node)
{
// std::cout<<"sw "<<SW->getNamingDescription().toStdString()<<"is close"<<std::endl;
}
Substation *sbb=static_cast<Substation *>(ht[SW->getEquipmentMemberOf_EquipmentContainer()]);
// std::cout<<"sw container"<<sbb->getNamingDescription().toLocal8Bit().data()<<std::endl;
// std::cout<<SW->getID().toStdString()<<std::endl;
terminalA=SW->getTerminalA();
terminalB=SW->getTerminalB();
// std::cout<<"find"<<SW->getID().toStdString()<<std::endl;
@@ -231,8 +229,7 @@ bool TopologyRecorder::startWithNode(const QString& node)
if(this->isEquipmentNeeded(equipmentContainer))
{
this->tfs.push_back(tfID);
// fromTo.first=node;
// fromTo.second=tfID;
foundEle=tf;
}
else
@@ -245,23 +242,41 @@ bool TopologyRecorder::startWithNode(const QString& node)
}
if(foundEle)
{
Branch *branch=NULL;
QString nextTerminal;
nextTerminal=(terminalA==anotherTerminal)?terminalB:terminalA;
Terminal *nextTerminalP=static_cast<Terminal *>(ht[nextTerminal]);
if(!nextTerminalP)
{
continue;
}
//有可能会访问到重复的元件,所以这里判断一下,如果是已经访问过的就不添加了。
if(this->hasAdded.contains(foundEle->getID()))
{
continue;
}
this->hasAdded[foundEle->getID()]=0;
QString nextNode=nextTerminalP->getConnectivityNode();
fromTo.first=node;
fromTo.second=nextNode;
Branch *branch=NULL;
QString nextTerminal;
Terminal *nextTerminalP;
QString nextNode;
if(typ!=TopologyRecorder::Type::TF)
{
nextTerminal=(terminalA==anotherTerminal)?terminalB:terminalA;
nextTerminalP=static_cast<Terminal *>(ht[nextTerminal]);
if(!nextTerminalP)
{
continue;
}
else
{
nextNode=nextTerminalP->getConnectivityNode();
fromTo.first=node;
fromTo.second=nextNode;
}
}
else
{
nextNode="";
fromTo.first=node;
fromTo.second=foundEle->getID();//用变压器编号做虚拟节点
}
// std::cout<<typ<<" "<<ce.toStdString()<<std::endl;
switch(typ)
{
case TopologyRecorder::Type::AC:
@@ -278,13 +293,15 @@ bool TopologyRecorder::startWithNode(const QString& node)
break;
case TopologyRecorder::Type::TF:
branch=new Transformer(fromTo,static_cast<PowerTransformer *>(foundEle),this);
// std::cout<<"add tf"<<std::endl;
this->cimExporter.add(fromTo,static_cast<Transformer *>(branch));
break;
default:
break;
}
// std::cout<<nextNode.toStdString()<<std::endl;
this->startWithNode(nextNode);
if(nextNode!="")
this->startWithNode(nextNode);
}
else
{