修复了合并线路后没用重新计算阻抗的问题

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab 2015-03-09 16:26:47 +08:00
parent 4df79fa6fb
commit 46f890b77b
6 changed files with 33 additions and 11 deletions

View File

@ -64,6 +64,11 @@ QString ACLineSegment::getTerminalB()
return this->terminalB; return this->terminalB;
} }
void ACLineSegment::setLength(double length)
{
this->conductorLength=length;
}
bool ACLineSegment::parse(QXmlStreamReader &reader) bool ACLineSegment::parse(QXmlStreamReader &reader)
{ {
return this->parseBasicInfo(reader); return this->parseBasicInfo(reader);

View File

@ -10,6 +10,7 @@ public:
QString getTerminalB(); QString getTerminalB();
double getLength(); double getLength();
QString getNamingDescription(); QString getNamingDescription();
void setLength(double length);
protected: protected:
QString terminalA; QString terminalA;
QString terminalB; QString terminalB;

View File

@ -136,20 +136,20 @@ void CIMExporter::exportTo(const QString& path,const QString &rootID)
writer<<seqN++<<seperator; writer<<seqN++<<seperator;
writer<<l.fromNum<<seperator; writer<<l.fromNum<<seperator;
writer<<l.toNum<<seperator; writer<<l.toNum<<seperator;
if(l.id==rootID && static_cast<int>(l.length)==0) // if(l.id==rootID && static_cast<int>(l.length)==0)
{ // {
writer<<0.01<<seperator; // writer<<0.01<<seperator;
writer<<0.01<<seperator; // writer<<0.01<<seperator;
writer<<0<<seperator; // writer<<0<<seperator;
writer<<0<<seperator; // writer<<0<<seperator;
} // }
else // else
{ // {
writer<<l.line->r<<seperator; writer<<l.line->r<<seperator;
writer<<l.line->x<<seperator; writer<<l.line->x<<seperator;
writer<<l.line->b1<<seperator; writer<<l.line->b1<<seperator;
writer<<l.line->b2<<seperator; writer<<l.line->b2<<seperator;
} // }
writer<<endLine; writer<<endLine;
// writer<<"type"<<seperator; // writer<<"type"<<seperator;
// writer<<l.id<<"\t"; // writer<<l.id<<"\t";

View File

@ -8,12 +8,17 @@ Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac, QObject *par
} }
void Line::re_extract()
{
this->extract();
}
void Line::extract() void Line::extract()
{ {
//用YJV22-3x240 //用YJV22-3x240
ACLineSegment *ac=this->ac; ACLineSegment *ac=this->ac;
double length=ac->getLength(); double length=ac->getLength();
this->length=length;
// if((int)length==0) // if((int)length==0)
// { // {
// std::cout<<"line length zeros "<<ac->getID().toStdString()<<std::endl; // std::cout<<"line length zeros "<<ac->getID().toStdString()<<std::endl;
@ -31,5 +36,5 @@ void Line::extract()
this->g2=g0*length/1000; this->g2=g0*length/1000;
this->b1=b0*length/1000; this->b1=b0*length/1000;
this->b2=b0*length/1000; this->b2=b0*length/1000;
this->length=length/1000;
} }

View File

@ -8,6 +8,7 @@ class Line:public Branch
{ {
public: public:
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac,QObject* parent=0); Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac,QObject* parent=0);
void re_extract();
double length; double length;
ACLineSegment *ac; ACLineSegment *ac;

View File

@ -59,6 +59,15 @@ void ElementReduction::doIt(const QString& rootID)
this->merge(element,idToBranch); this->merge(element,idToBranch);
this->reduceSection(); this->reduceSection();
//因为有线路合并,线路长度变了,所以要重新计算参数
foreach(BranchStruc* v,this->branchList)
{
LineStru *line=static_cast<LineStru*>(v);
if(line!=NULL)
{
line->line->re_extract();
}
}
// QFile file("1.xml"); // QFile file("1.xml");
// if(file.open(QFile::WriteOnly)) // if(file.open(QFile::WriteOnly))
@ -274,6 +283,7 @@ void ElementReduction::reduceSection()
if(lineBranch) if(lineBranch)
{ {
lineBranch->line->length=branch->length; lineBranch->line->length=branch->length;
lineBranch->line->ac->setLength(branch->length);//TODO:线路的这个长度还是要统一一下,否则很容易出错。
}else }else
{ {
std::cout<<"can not conver from BranchStruc to LineStru"<<std::endl; std::cout<<"can not conver from BranchStruc to LineStru"<<std::endl;