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/nmNum/nmData/nmDataWellBase.h

261 lines
9.1 KiB
C

#pragma once
#include "nmData_global.h"
#include "nmDefines.h"
#include "nmDataAttribute.h"
#include "ZxDataObjectDbl.h"
#include "nmDataPerforation.h"
//#include "nmDataReservoir.h"
//#include "nmDataAnalyzeManager.h"
class nmDataReservoir;
class nmDataAnalyzeManager;
class NM_DATA_EXPORT nmDataWellBase : public nmDataBase
{
Q_OBJECT
public:
nmDataWellBase();
nmDataWellBase(const nmDataWellBase& other);
~nmDataWellBase();
nmDataWellBase& operator=(const nmDataWellBase& other);
// 创建当前对象的深拷贝
virtual nmDataWellBase* clone() const = 0;
// 实现 nmDataBase 的抽象方法:将当前 C++ 对象序列化为 RapidJSON Value
virtual rapidjson::Value ToJsonValue(rapidjson::Document::AllocatorType& allocator) const override;
// 实现 nmDataBase 的抽象方法:从 RapidJSON Value 反序列化数据到当前 C++ 对象
virtual void FromJsonValue(const rapidjson::Value& jsonValue) override;
// 统一连接 nmDataAttribute 的信号
virtual void connectAttributeSignals();
// 用于获取某个射孔的允许MD范围
virtual void getPerforationAllowedMdRange(nmDataPerforation* pPerfToValidate,
double& dUpperAllowedMd,
double& dLowerAllowedMd) = 0;
public:
// 手动发送信号,通知参数视图进行更新
void notifyParameterChanged();
signals:
// 数据模型发生改变时发出的信号,通知所有监听者刷新视图
void sigWellDataChanged();
// 专门用于通知参数视图更新,通常在模型视图完成交互后发出。
void sigParameterChanged();
public slots:
// 井身长度变化,更新射孔位置
void slotWellLengthChanged();
public:
// 属性的 set 和 get 方法
void setWellName(const QString& name);
QString getWellName() const;
void setX(const nmDataAttribute& attr);
nmDataAttribute& getX(); // 修改为返回引用
void setY(const nmDataAttribute& attr);
nmDataAttribute& getY(); // 修改为返回引用
void setRadius(const nmDataAttribute& attr);
nmDataAttribute& getRadius(); // 修改为返回引用
void setDrillFloorElevation(const nmDataAttribute& attr);
nmDataAttribute& getDrillFloorElevation(); // 修改为返回引用
void setZw(const nmDataAttribute& attr);
nmDataAttribute& getZw(); // 修改为返回引用
void setWellLength(const nmDataAttribute& attr);
nmDataAttribute& getWellLength(); // 修改为返回引用
void setRateDependentSkin(const nmDataAttribute& attr);
nmDataAttribute& getRateDependentSkin(); // 修改为返回引用
void setdSdQ(const nmDataAttribute& attr);
nmDataAttribute& getdSdQ(); // 修改为返回引用
void setWellboreModel(const nmDataAttribute& attr);
nmDataAttribute& getWellboreModel(); // 修改为返回引用
void setWellboreStorage(const nmDataAttribute& attr);
nmDataAttribute& getWellboreStorage(); // 修改为返回引用
void setBottomholeMD(const nmDataAttribute& attr);
nmDataAttribute& getBottomholeMD(); // 修改为返回引用
// Location---位置
void setInputWellHead(const nmDataAttribute& attr);
nmDataAttribute& getInputWellHead();
void setWellHeadX(const nmDataAttribute& attr);
nmDataAttribute& getWellHeadX();
void setWellHeadY(const nmDataAttribute& attr);
nmDataAttribute& getWellHeadY();
// Wellbore---井储
void setCInitialCFinal(const nmDataAttribute& attr);
nmDataAttribute& getCInitialCFinal();
void setDtChangingStorage(const nmDataAttribute& attr);
nmDataAttribute& getDtChangingStorage();
void setLeakSkin(const nmDataAttribute& attr);
nmDataAttribute& getLeakSkin();
// Wellbore---井储
void setFinalWellboreStorage(const nmDataAttribute& attr);
nmDataAttribute& getFinalWellboreStorage();
// 获取压力曲线点数据
QVector<QPointF> getPressurePoints() const;
// 设置压力曲线点数据
void setPressurePoints(const QVector<QPointF>& points);
// 获取流量曲线点数据
QVector<QPointF> getFlowPoints() const;
// 设置流量曲线点数据
void setFlowPoints(const QVector<QPointF>& points);
int getIndexF() const;
void setIndexF(const int newIndex);
bool getPlotVisible() const;
void setPlotVisible(const bool newState);
// 历史数据相关方法
QVector<QVector<double>> getHistoryPressure();
void setHistoryPressure(QVector<QVector<double>> pressureData);
QVector<QVector<double>> getHistoryLogLog();
void setHistoryLogLog(QVector<QVector<double>> loglogData);
QVector<QVector<double>> getHistorySemiLog();
void setHistorySemiLog(QVector<QVector<double>> semiLogData);
void setWellType(NM_WELL_MODEL newWellType);
NM_WELL_MODEL getWellType() const;
// 计算结果相关方法
QVector<QVector<double>> getResultPressure();
void setResultPressure(QVector<QVector<double>> pressureData);
QVector<QVector<double>> getResultLogLog();
void setResultLogLog(QVector<QVector<double>> loglogData);
QVector<QVector<double>> getResultSemiLog();
void setResultSemiLog(QVector<QVector<double>> semiLogData);
// 时间变表皮状态的getter和setter
bool isTimeDependentSkin() const;
void setTimeDependentSkin(bool enabled);
// 管理射孔段的方法
void addPerforation(nmDataPerforation* perforation); // 接受指针
void removePerforation(int index); // 根据索引移除
nmDataPerforation* getPerforation(int index); // 获取单个射孔段
nmDataPerforation getPerforationCopy(int index); // 获取单个射孔段副本
void updatePerforation(int index, const nmDataPerforation& newData); // 更新单个射孔段数据
int getPerforationCount(); // 获取射孔段数量
QVector<nmDataPerforation*>& getPerforations(); // 获取所有射孔段(返回指针的引用)
void clearPerforations(); // 清空所有射孔段数据
// 井级别的流量和时间查询方法
double getTotalTimeRange() const;
double getFlowRateAtTime(double time) const;
QVector<double> getAllFlowStepBoundaries() const;
QVector<QPointF> getFlowStepsInTimeRange(double startTime, double endTime) const;
double findFlowStepBoundaryAtTime(double timePoint) const;
double findSmartFlowStepBoundary(double targetTime) const;
double findNearestFlowStepBoundary(double targetTime) const;
bool isTimeInFlowStepFirstHalf(double time) const;
// 射孔段相关的查询方法
QVector<double> getFlowStepBoundariesInSegment(int segmentIndex, int perforationIndex) const;
QVector<double> getAllBoundariesInSegment(int segmentIndex, int perforationIndex) const;
int countFlowStepsInSegment(int segmentIndex, int perforationIndex) const;
bool canFlowSegmentBeSplit(int segmentIndex, int perforationIndex) const;
double findNearestFlowStepBoundaryBeforeSegment(int segmentIndex, int perforationIndex) const;
// 判断是否基础射孔段
bool isBasePerforation();
void resetToDefaults(); // 重置所有参数为构造函数默认值
// 导出双对数历史曲线到 CSV
bool exportHistoryLogLogToCsv(const QString& outDir);
// 导出流量数据到 CSV
bool exportHistoryRateToCsv(const QString& outDir);
// 导出历史压力数据到 CSV
bool exportHistoryPressureToCsv(const QString& outDir);
// 导出求解结果双对数曲线到 CSV
bool exportResultLogLogToCsv(const QString& outDir);
// 导出求解结果压力数据到 CSV
bool exportResultPressureToCsv(const QString& outDir);
protected:
QString m_wellName; // 井名
// Location---位置
nmDataAttribute m_inputWellHead; //井口坐标输入
nmDataAttribute m_wellHeadX; //井口坐标X
nmDataAttribute m_wellHeadY; //井口坐标Y
nmDataAttribute m_x; // X
nmDataAttribute m_y; // Y
// Geometry and properties---几何与属性
nmDataAttribute m_drillFloorElevation; // 钻台标高
nmDataAttribute m_radius; // 井径
nmDataAttribute m_zw; // Zw
nmDataAttribute m_wellLength; // 井身长度
nmDataAttribute m_rateDependentSkin; // 速度表皮
nmDataAttribute m_dSdQ; // dS/dQ 表皮关于产量的变化率
// Wellbore---井储
nmDataAttribute m_wellboreModel; // 井储模型
nmDataAttribute m_wellboreStorage; // 井筒储集系数
nmDataAttribute m_finalWellboreStorage; // 最终井储
nmDataAttribute m_cInitialCFinal; // 初始井储/最终井储
nmDataAttribute m_dtChangingStorage; //井储变化时间
nmDataAttribute m_leakSkin; // 漏失表皮
// Bottomhole conditions---井底条件
nmDataAttribute m_bottomholeMD; // 井底测量深度
QVector<QPointF> m_vecPtsP; // 压力曲线点数据
QVector<QPointF> m_vecPtsF; // 流量曲线点数据
int m_nIndexF; // 当前流量段的索引
bool m_bPlotVisible; // 图元是否可见
// 添加时间变表皮状态字段
bool m_bTimeDependentSkin;
// 井类型
NM_WELL_MODEL m_eWellType;
// 历史数据
QVector<QVector<double>> m_vvecHsyPressure; // 历史压力数据
QVector<QVector<double>> m_vvecHsyLogLog; // 历史双对数数据
QVector<QVector<double>> m_vvecHsySemiLog; // 历史半对数数据
// 计算结果数据
QVector<QVector<double>> m_vvecRstPressure; // 计算结果压力数据
QVector<QVector<double>> m_vvecRstLogLog; // 计算结果双对数数据
QVector<QVector<double>> m_vvecRstSemiLog; // 计算结果半对数数据
// 射孔段集合
QVector<nmDataPerforation*> m_vecPerforations;
// 记录原始井身长度,用于计算更新井身长度之后射孔段的位置
double m_dLastWellLength;
nmDataReservoir* m_pReservoir;
};