5
testHasttable/element/branch.cpp
Normal file
5
testHasttable/element/branch.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "branch.h"
|
||||
|
||||
Branch::Branch(double ratio,const QString& from, const QString& to):ratio(ratio),from(from),to(to)
|
||||
{
|
||||
}
|
||||
22
testHasttable/element/branch.h
Normal file
22
testHasttable/element/branch.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef BRANCH_H
|
||||
#define BRANCH_H
|
||||
#include <QString>
|
||||
class Branch
|
||||
{
|
||||
public:
|
||||
Branch(double ratio,const QString& from, const QString& to);
|
||||
protected:
|
||||
double r;
|
||||
double x;
|
||||
QString from;
|
||||
QString to;
|
||||
double ratio;//变比
|
||||
double b1;
|
||||
double b2;
|
||||
double g1;
|
||||
double g2;
|
||||
protected:
|
||||
virtual void extract()=0;
|
||||
};
|
||||
|
||||
#endif // BRANCH_H
|
||||
24
testHasttable/element/line.cpp
Normal file
24
testHasttable/element/line.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "line.h"
|
||||
|
||||
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac):Branch(1,fromTo.first,fromTo.second)
|
||||
{
|
||||
this->ac=ac;
|
||||
}
|
||||
|
||||
|
||||
void Line::extract()
|
||||
{
|
||||
ACLineSegment *ac=this->ac;
|
||||
double length=ac->getLength();
|
||||
//单位阻抗
|
||||
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;
|
||||
}
|
||||
16
testHasttable/element/line.h
Normal file
16
testHasttable/element/line.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef LINE_H
|
||||
#define LINE_H
|
||||
#include <QPair>
|
||||
#include "branch.h"
|
||||
#include "./../aclinesegment.h"
|
||||
class Line:public Branch
|
||||
{
|
||||
public:
|
||||
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac);
|
||||
protected:
|
||||
virtual void extract();
|
||||
private:
|
||||
ACLineSegment *ac;
|
||||
};
|
||||
|
||||
#endif // LINE_H
|
||||
Reference in New Issue
Block a user