修复LoadInfo中成员变量没有初始化的bug
Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
parent
29828700d2
commit
1f9734d727
|
|
@ -3,6 +3,11 @@
|
||||||
LoadInfo::LoadInfo(double powerFactor):powerFactor(powerFactor)
|
LoadInfo::LoadInfo(double powerFactor):powerFactor(powerFactor)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
this->pqA=QPair<double,double>(0,0);
|
||||||
|
this->pqB=QPair<double,double>(0,0);
|
||||||
|
this->pqC=QPair<double,double>(0,0);
|
||||||
|
this->ph3P=0;
|
||||||
|
this->ph3Q=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadInfo::~LoadInfo()
|
LoadInfo::~LoadInfo()
|
||||||
|
|
@ -30,6 +35,18 @@ QPair<double,double> LoadInfo::getPQ(double current)
|
||||||
return QPair<double,double>(p,q);
|
return QPair<double,double>(p,q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double LoadInfo::get3PhP()
|
||||||
|
{
|
||||||
|
// std::cout<<"get p "<<this->ph3P<<std::endl;
|
||||||
|
return this->ph3P;
|
||||||
|
}
|
||||||
|
|
||||||
|
double LoadInfo::get3PhQ()
|
||||||
|
{
|
||||||
|
// std::cout<<"get q "<<this->ph3Q<<std::endl;
|
||||||
|
return this->ph3Q;
|
||||||
|
}
|
||||||
|
|
||||||
double LoadInfo::getPA()
|
double LoadInfo::getPA()
|
||||||
{
|
{
|
||||||
return this->pqA.first;
|
return this->pqA.first;
|
||||||
|
|
@ -128,6 +145,22 @@ bool LoadInfo::updateByTime(const QTime& time)
|
||||||
this->pqA=pqA;
|
this->pqA=pqA;
|
||||||
this->pqB=pqB;
|
this->pqB=pqB;
|
||||||
this->pqC=pqC;
|
this->pqC=pqC;
|
||||||
|
bool ok3PhP;
|
||||||
|
bool ok3PhQ;
|
||||||
|
this->ph3P=this->trimDoubleQuotation(sep.at(5)).toDouble(&ok3PhP);
|
||||||
|
if(!ok3PhP)
|
||||||
|
{
|
||||||
|
this->ph3P=0;
|
||||||
|
}
|
||||||
|
// std::cout<<"nb "<<sep.at(5).toStdString()<<std::endl;
|
||||||
|
// std::cout<<this->ph3P<<std::endl;
|
||||||
|
this->ph3Q=this->trimDoubleQuotation(sep.at(6)).toDouble(&ok3PhQ);
|
||||||
|
if(!ok3PhQ)
|
||||||
|
{
|
||||||
|
this->ph3Q=0;
|
||||||
|
}
|
||||||
|
// std::cout<<"nb "<<sep.at(6).toStdString()<<std::endl;
|
||||||
|
// std::cout<<this->ph3Q<<std::endl;
|
||||||
ret=true;
|
ret=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,15 @@ public:
|
||||||
void setLoadName(const QString &name);
|
void setLoadName(const QString &name);
|
||||||
void setLoadPath(const QString &path);
|
void setLoadPath(const QString &path);
|
||||||
bool updateByTime(const QTime& time);
|
bool updateByTime(const QTime& time);
|
||||||
|
double get3PhP();
|
||||||
|
double get3PhQ();
|
||||||
double getPA();
|
double getPA();
|
||||||
double getPB();
|
double getPB();
|
||||||
double getPC();
|
double getPC();
|
||||||
double getQA();
|
double getQA();
|
||||||
double getQB();
|
double getQB();
|
||||||
double getQC();
|
double getQC();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isStartWithTime(const QString& str);
|
bool isStartWithTime(const QString& str);
|
||||||
QString trimDoubleQuotation(const QString& str);
|
QString trimDoubleQuotation(const QString& str);
|
||||||
|
|
@ -33,6 +36,8 @@ private:
|
||||||
QPair<double,double> pqA;
|
QPair<double,double> pqA;
|
||||||
QPair<double,double> pqB;
|
QPair<double,double> pqB;
|
||||||
QPair<double,double> pqC;
|
QPair<double,double> pqC;
|
||||||
|
double ph3P;
|
||||||
|
double ph3Q;
|
||||||
QPair<double,double> getPQ(double current);
|
QPair<double,double> getPQ(double current);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||||
Task task;
|
Task task;
|
||||||
task.doAgainstTaskFile(eleReader);
|
task.doAgainstTaskFile(eleReader);
|
||||||
LoadExporter loadExporter;
|
LoadExporter loadExporter;
|
||||||
loadExporter.toSingleFile("D:/MyPro/cimforreduceloss/testHasttable/output/pan/load/singlefile.txt");
|
loadExporter.toSingleFile("D:/MyPro/cimforreduceloss/testHasttable/output/pan/load/singlefile.csv");
|
||||||
std::cout<<"Finished."<<std::endl;
|
std::cout<<"Finished."<<std::endl;
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ void LoadExporter::toSingleFile(const QString& filePath)
|
||||||
foreach(QString key, keys)
|
foreach(QString key, keys)
|
||||||
{
|
{
|
||||||
QSharedPointer<LoadInfo> p=this->ht.get(key);
|
QSharedPointer<LoadInfo> p=this->ht.get(key);
|
||||||
double P=p->getPA()+p->getPB()+p->getPC();
|
double P=p->get3PhP();//p->getPA()+p->getPB()+p->getPC();
|
||||||
double Q=p->getQA()+p->getQB()+p->getQC();
|
double Q=p->get3PhQ();//p->getQA()+p->getQB()+p->getQC();
|
||||||
loadSequence[key].push_back(QPair<double,double>(P,Q) );
|
loadSequence[key].push_back(QPair<double,double>(P,Q) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ void LoadExporter::toSingleFile(const QString& filePath)
|
||||||
int seq=0;
|
int seq=0;
|
||||||
for(QList<QPair<double,double> >::iterator ite=loadList.begin();ite!=loadList.end();ite++)
|
for(QList<QPair<double,double> >::iterator ite=loadList.begin();ite!=loadList.end();ite++)
|
||||||
{
|
{
|
||||||
stream<<"["<<seq++<<"]"<<"("<<ite->first<<"&&"<<ite->second<<")"<<",";
|
stream<<"["<<seq++<<"],"<<ite->first<<","<<ite->second<<",";
|
||||||
}
|
}
|
||||||
stream<<"\t\n";
|
stream<<"\t\n";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue