You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/mAlg/mAlgPvt/iAlgPvtBase.h

115 lines
3.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "Defines.h"
#include "mAlgPVT_global.h"
//#ifndef QT_DEBUG
// 这个定义是专门为编写算法时测试用的
// MPA+WTAI调用时需要屏蔽该定义
//#define PVT_TESTONLY_MODE
//#endif
class zxAlgRegressLinear;
// PVT相关算法的基类
class M_PVT_EXPORT iAlgPvtBase
{
public:
iAlgPvtBase();
~iAlgPvtBase();
// 绑定成员变量
virtual void bindMembers() = 0;
// 建立并绑定关联的算法类如gasOilRatio需要调用bubblePre
// 在调用cal函数之前调用该函数
void bindBrother(QString sName, iAlgPvtBase* pBrother);
QMap<QString, iAlgPvtBase*>* getBrothers() { return &m_mapBrothers; }
// 统一的初始化函数
virtual void init();
// 统一传值函数/取值函数
virtual void setMemValue(QString sKey, double d);
double getMemValue(QString sKey);
virtual void setMemValues(QMap<QString, double> map);
void getMemValues(QMap<QString, double>& map);
// 设置内部的算法类型
// 为了统一此处用了整形各子类内部转换为enum
void setSubType(int n);
int getSubType();
// 虚函数,计算函数
virtual bool cal(VecDouble vecIns, VecDouble& vecOuts);
// 虚函数,计算函数
//virtual bool cal(double dIn, double& dOut);
// 获取错误信息
QString getLastError();
//Pseudo
QString getPvtName();
///////////////////////////////////////////////////////////////////////////////
// Match功能
public:
// vecIns:P(in)
// vecOuts:Z(out)
// vecExps:实验数据 (in)
virtual bool match(VecDouble vecIns, VecDouble& vecOuts, \
VecPointF& vecExps, double* pExtParas = nullptr);
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Match功能尝试2 20210715
public:
// vecMatches:拟合点(编辑+新增)
// vecExps:实验数据201
// bool match1(VecPointF& vecMatches, VecPointF& vecExps);
//virtual double getValue(VecDouble& vMatrixX);
protected:
// 全部转换为线性进行处理
// double m_dK; //乘积项系数
// double m_dB; //指数项系数
// 在转换成线性回归时,约束方式可能发生改变,在当前条件为指定参数约束,
// 转换时可能变成约束矩阵约束。因此不采用当前计算类由CLinearRegressAlgo派生
// 而记录CLinearRegressAlgo作为成员的方式。以免其它成员变量受到影响。
// zxAlgRegressLinear* m_pLinearRegress;
///////////////////////////////////////////////////////////////////////////////
protected:
// PVT名称
QString m_sPvtName;
// 内部的算法类型,为了统一此处用了整形各子类内部转换为enum
int m_nSubType;
// 各个参数需要外界传入的Key值
// 注意Key为英文、在ModelParaDefinesLP.xml等文件中配置
QMap<QString, void*> m_mapMemPtrs;
// 这是关联的算法如gasOilRatio需要调用bubblePre
QMap<QString, iAlgPvtBase*> m_mapBrothers;
bool m_bMatching; //match过程也调用cal函数通过该变量进行区分
// 出错信息
QString m_sLastError;
};