用CIMExporter分别处理读到的线路,开关,变压器等元件。
Signed-off-by: facat@lab.com <facat@lab.com>
This commit is contained in:
parent
28e1df38fa
commit
9cb2f5a8f6
|
|
@ -3,3 +3,26 @@
|
|||
CIMExporter::CIMExporter()
|
||||
{
|
||||
}
|
||||
|
||||
void CIMExporter::add(const QPair<QString,QString>& fromTo,Line* line)
|
||||
{
|
||||
CIMExporter::LineStru lineStru;
|
||||
lineStru.line=line;
|
||||
lineStru.fromID=fromTo.first;
|
||||
lineStru.toID=fromTo.second;
|
||||
|
||||
}
|
||||
void CIMExporter::add(const QPair<QString,QString>& fromTo,Switch* sw)
|
||||
{
|
||||
CIMExporter::SwitchStru switchStru;
|
||||
switchStru.sw=sw;
|
||||
switchStru.fromID=fromTo.first;
|
||||
switchStru.toID=fromTo.second;
|
||||
}
|
||||
void CIMExporter::add(const QPair<QString,QString>& fromTo,Transformer* tf)
|
||||
{
|
||||
CIMExporter::TransformerStru tfStru;
|
||||
tfStru.tf=tf;
|
||||
tfStru.fromID=fromTo.first;
|
||||
tfStru.toID=fromTo.second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,43 @@
|
|||
#ifndef CIMEXPORTER_H
|
||||
#define CIMEXPORTER_H
|
||||
|
||||
#include <QList>
|
||||
#include "element/line.h"
|
||||
#include "element/switch.h"
|
||||
#include "element/transformer.h"
|
||||
#include <QPair>
|
||||
class CIMExporter
|
||||
{
|
||||
struct BranchStruc
|
||||
{
|
||||
QString fromID;
|
||||
QString toID;
|
||||
int fromNum;
|
||||
int toNum;
|
||||
};
|
||||
struct LineStru:public BranchStruc
|
||||
{
|
||||
Line *line;
|
||||
|
||||
};
|
||||
struct SwitchStru:public BranchStruc
|
||||
{
|
||||
Switch *sw;
|
||||
|
||||
};
|
||||
struct TransformerStru:public BranchStruc
|
||||
{
|
||||
Transformer *tf;
|
||||
|
||||
};
|
||||
public:
|
||||
CIMExporter();
|
||||
void add(const QPair<QString,QString>& fromTo,Line* line);
|
||||
void add(const QPair<QString,QString>& fromTo,Switch* sw);
|
||||
void add(const QPair<QString,QString>& fromTo,Transformer* tf);
|
||||
private:
|
||||
QList<LineStru> line;
|
||||
QList<Switch> sw;
|
||||
QList<TransformerStru> tf;
|
||||
};
|
||||
|
||||
#endif // CIMEXPORTER_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "branch.h"
|
||||
|
||||
Branch::Branch(const QString& from, const QString& to):from(from),to(to)
|
||||
Branch::Branch(const QString& from, const QString& to, QObject *parent):from(from),to(to)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
#ifndef BRANCH_H
|
||||
#define BRANCH_H
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
class Branch
|
||||
class Branch:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Branch(const QString& from, const QString& to);
|
||||
Branch(const QString& from, const QString& to,QObject* parent=0);
|
||||
protected:
|
||||
double r;
|
||||
double x;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "line.h"
|
||||
|
||||
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac):Branch(fromTo.first,fromTo.second)
|
||||
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac, QObject *parent):Branch(fromTo.first,fromTo.second)
|
||||
{
|
||||
this->ratio=1;
|
||||
this->ac=ac;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
#ifndef LINE_H
|
||||
#define LINE_H
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include "branch.h"
|
||||
#include "./../aclinesegment.h"
|
||||
class Line:public Branch
|
||||
{
|
||||
public:
|
||||
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac);
|
||||
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac,QObject* parent=0);
|
||||
protected:
|
||||
virtual void extract();
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "switch.h"
|
||||
|
||||
Switch::Switch(const QPair<QString,QString>& fromTo):Branch(fromTo.first,fromTo.second)
|
||||
Switch::Switch(const QPair<QString,QString>& fromTo, QObject *parent):Branch(fromTo.first,fromTo.second)
|
||||
{
|
||||
this->extract();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef SWITCH_H
|
||||
#define SWITCH_H
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include "branch.h"
|
||||
class Switch:public Branch
|
||||
{
|
||||
public:
|
||||
Switch(const QPair<QString, QString> &fromTo);
|
||||
Switch(const QPair<QString, QString> &fromTo,QObject *parent=0);
|
||||
protected:
|
||||
virtual void extract();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "transformer.h"
|
||||
|
||||
|
||||
Transformer::Transformer(const QPair<QString,QString>& fromTo, PowerTransformer* tf):Branch(fromTo.first,fromTo.second)
|
||||
Transformer::Transformer(const QPair<QString,QString>& fromTo, PowerTransformer* tf, QObject *parent):Branch(fromTo.first,fromTo.second)
|
||||
{
|
||||
this->ratio=1;
|
||||
this->tf=tf;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
#ifndef TRANSFORMER_H
|
||||
#define TRANSFORMER_H
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include "branch.h"
|
||||
#include "./../powertransformer.h"
|
||||
class Transformer:public Branch
|
||||
{
|
||||
public:
|
||||
Transformer(const QPair<QString, QString> &fromTo, PowerTransformer *tf);
|
||||
Transformer(const QPair<QString, QString> &fromTo, PowerTransformer *tf,QObject *parent=0);
|
||||
protected:
|
||||
virtual void extract();
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "topologyrecorder.h"
|
||||
#include <iostream>
|
||||
TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT):eleHT(elementHT)
|
||||
TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, QObject *parent):eleHT(elementHT)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,9 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
anotherTerminalVector=this->nodeToTerminal.value(node);//一个Node可以找到多个与之相连的Terminal
|
||||
for(int atI=0;atI<anotherTerminalVector.length();atI++)
|
||||
{
|
||||
bool foundCate=false;
|
||||
TopologyRecorder::Type::EleType typ;
|
||||
BasicElementInfo *foundEle=NULL;
|
||||
// bool foundCate=false;
|
||||
anotherTerminal=anotherTerminalVector.at(atI);
|
||||
if(this->reachedTerminal.contains(anotherTerminal))
|
||||
{
|
||||
|
|
@ -65,7 +67,8 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
terminalB=AC->getTerminalB();
|
||||
std::cout<<"find"<<AC->getID().toStdString()<<std::endl;
|
||||
std::cout<<AC->getNamingDescription().toStdString()<<std::endl;
|
||||
foundCate=true;
|
||||
foundEle=AC;
|
||||
typ=TopologyRecorder::Type::AC;
|
||||
}
|
||||
if(ce.startsWith("SW"))
|
||||
{
|
||||
|
|
@ -82,7 +85,6 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
Breaker *SW=static_cast<Breaker *>(ht[swID]);
|
||||
if(!SW)
|
||||
{
|
||||
// std::cout<<"can not SW "<<swID.toStdString()<<std::endl;//@1
|
||||
continue;
|
||||
}
|
||||
//显示开关状态
|
||||
|
|
@ -97,7 +99,8 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
terminalA=SW->getTerminalA();
|
||||
terminalB=SW->getTerminalB();
|
||||
std::cout<<"find"<<SW->getID().toStdString()<<std::endl;
|
||||
foundCate=true;
|
||||
foundEle=SW;
|
||||
typ=TopologyRecorder::Type::BREAKER;
|
||||
}
|
||||
if(bi->getName()=="Disconnector")
|
||||
{
|
||||
|
|
@ -130,7 +133,8 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
terminalA=Dis->getTerminalA();
|
||||
terminalB=Dis->getTerminalB();
|
||||
std::cout<<"find"<<Dis->getID().toStdString()<<std::endl;
|
||||
foundCate=true;
|
||||
foundEle=Dis;
|
||||
typ=TopologyRecorder::Type::DISCONNECTOR;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -174,16 +178,41 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
if(this->isEquipmentNeeded(equipmentContainer))
|
||||
{
|
||||
this->tfs.push_back(tf->getNamingDescription());
|
||||
fromTo.first=node;
|
||||
fromTo.second=tfID;
|
||||
foundEle=tf;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<tf->getNamingDescription().toStdString()<<"not belong"<<std::endl;
|
||||
}
|
||||
typ=TopologyRecorder::Type::TF;
|
||||
|
||||
}
|
||||
if(foundCate)
|
||||
if(foundEle)
|
||||
{
|
||||
this->branch.push_back(fromTo);
|
||||
Branch *branch=NULL;
|
||||
switch(typ)
|
||||
{
|
||||
case TopologyRecorder::Type::AC:
|
||||
branch=new Line(fromTo,static_cast<ACLineSegment *>(foundEle),this);
|
||||
this->cimExporter.add(fromTo,static_cast<Line *>(branch));
|
||||
break;
|
||||
case TopologyRecorder::Type::BREAKER:
|
||||
branch=new Switch(fromTo,this);
|
||||
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
||||
break;
|
||||
case TopologyRecorder::Type::DISCONNECTOR:
|
||||
branch=new Switch(fromTo,this);
|
||||
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
||||
break;
|
||||
case TopologyRecorder::Type::TF:
|
||||
branch=new Transformer(fromTo,static_cast<PowerTransformer *>(foundEle),this);
|
||||
this->cimExporter.add(fromTo,static_cast<Transformer *>(branch));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QString nextTerminal;
|
||||
nextTerminal=(terminalA==anotherTerminal)?terminalB:terminalA;
|
||||
Terminal *nextTerminalP=static_cast<Terminal *>(ht[nextTerminal]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef TOPOLOGYRECORDER_H
|
||||
#define TOPOLOGYRECORDER_H
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
|
|
@ -13,18 +14,30 @@
|
|||
#include "substation.h"
|
||||
#include "busbarsection.h"
|
||||
#include "disconnector.h"
|
||||
class TopologyRecorder
|
||||
#include "cimexporter.h"
|
||||
#include "element/branch.h"
|
||||
#include "element/line.h"
|
||||
#include "element/switch.h"
|
||||
#include "element/transformer.h"
|
||||
class TopologyRecorder:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
class Type
|
||||
{
|
||||
public:
|
||||
TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT);
|
||||
enum EleType{AC=0,BREAKER,DISCONNECTOR,BS,TF};
|
||||
};
|
||||
|
||||
public:
|
||||
TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT,QObject *parent=0);
|
||||
~TopologyRecorder();
|
||||
bool startWithNode(const QString& node);
|
||||
private:
|
||||
NodeToTerminal nodeToTerminal;
|
||||
const QHash<QString,BasicElementInfo *>& eleHT;
|
||||
QVector<QPair<QString,QString> > branch;
|
||||
QHash<QString,char> reachedTerminal;
|
||||
QVector<QString> tfs;
|
||||
CIMExporter cimExporter;
|
||||
bool isEquipmentNeeded(const QString& substatinID);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue