用类处理变压器阻抗数据。

Signed-off-by: facat@lab.com <facat@lab.com>
This commit is contained in:
facat@lab.com 2014-12-27 21:45:46 +08:00
parent 57dc9e9728
commit 84d5330628
9 changed files with 78 additions and 8 deletions

View File

@ -35,7 +35,7 @@ bool ACLineSegment::derivedParse(QXmlStreamReader &reader)
if("Conductor.length"==reader.name())
{
bool ok;
this->conductorLength=reader.readElementText().toInt(&ok);
this->conductorLength=reader.readElementText().toDouble(&ok);
if(!ok)
{
this->conductorLength=-100000;

View File

@ -1,5 +1,5 @@
#include "branch.h"
Branch::Branch(double ratio,const QString& from, const QString& to):ratio(ratio),from(from),to(to)
Branch::Branch(const QString& from, const QString& to):from(from),to(to)
{
}

View File

@ -4,7 +4,7 @@
class Branch
{
public:
Branch(double ratio,const QString& from, const QString& to);
Branch(const QString& from, const QString& to);
protected:
double r;
double x;

View File

@ -1,7 +1,8 @@
#include "line.h"
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac):Branch(1,fromTo.first,fromTo.second)
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac):Branch(fromTo.first,fromTo.second)
{
this->ratio=1;
this->ac=ac;
}

View File

@ -0,0 +1,26 @@
#include "transformer.h"
Transformer::Transformer(const QPair<QString,QString>& fromTo, PowerTransformer* tf):Branch(fromTo.first,fromTo.second)
{
this->ratio=1;
this->tf=tf;
}
void Transformer::extract()
{
// PowerTransformer *tf=this->tf;
double length=10;
//单位阻抗
double r0=0.01;
double x0=0.01;
double g0=0;
double b0=0;
this->r=r0*length;
this->x=x0*length;
this->g1=g0*length;
this->g2=g0*length;
this->b1=b0*length;
this->b2=b0*length;
}

View File

@ -0,0 +1,16 @@
#ifndef TRANSFORMER_H
#define TRANSFORMER_H
#include <QPair>
#include "branch.h"
#include "./../powertransformer.h"
class Transformer:public Branch
{
public:
Transformer(const QPair<QString, QString> &fromTo, PowerTransformer *tf);
protected:
virtual void extract();
private:
PowerTransformer *tf;
};
#endif // TRANSFORMER_H

View File

@ -33,6 +33,20 @@ bool PowerTransformer::derivedParse(QXmlStreamReader &reader)
{
this->namingDescription=reader.readElementText();
}
if("PowerTransformer.KV_H"==reader.name())
{
QString ratedkV=reader.readElementText();
bool ok;
double _ratedkV=ratedkV.toDouble(&ok);
this->powerTransformerKV_H=ok?_ratedkV:-10000;
}
if("PowerTransformer.ratedMVA_H"==reader.name())
{
QString ratedMVA=reader.readElementText();
bool ok;
double _ratedMVA=ratedMVA.toDouble(&ok);
this->powerTransformerRatedMVA_H=ok?_ratedMVA:-10000;
}
return true;
}
@ -46,7 +60,14 @@ QString PowerTransformer::getNamingDescription()
return this->namingDescription;
}
double PowerTransformer::getMVA()
{
return this->powerTransformerRatedMVA_H;
}
double PowerTransformer::getRatedkV()
{
return this->powerTransformerKV_H;
}
bool PowerTransformer::parse(QXmlStreamReader &reader)
{

View File

@ -7,13 +7,17 @@ class PowerTransformer:public BasicElementInfo
public:
explicit PowerTransformer(QObject *parent = 0);
virtual bool parse(QXmlStreamReader& reader);
QString getNamingDescription();
QString getEquipmentMemberOf_EquipmentContainer();
QString getNamingDescription();
double getMVA();
double getRatedkV();
protected:
QString terminalA;
QString terminalB;
QString equipmentContainer;
QString namingDescription;
double powerTransformerRatedMVA_H;
double powerTransformerKV_H;
virtual bool derivedParse(QXmlStreamReader& reader);
private:
bool isTerminalA;

View File

@ -34,7 +34,8 @@ SOURCES += main.cpp \
substation.cpp \
cimexporter.cpp \
element/branch.cpp \
element/line.cpp
element/line.cpp \
element/transformer.cpp
HEADERS += \
elementhashtable.h \
@ -54,7 +55,8 @@ HEADERS += \
substation.h \
cimexporter.h \
element/branch.h \
element/line.h
element/line.h \
element/transformer.h
#release{
DEFINES += QT_NO_DEBUG_OUTPUT