feat(nmSubWxs): 统一数值模型时间步组件与单位换算

- 使用 nmParameterField 重构时间步设置
- 接入底层单位框架并增加完整校验
- 将最小时间步默认值调整为 0.0025 h
- 补充参数定义及中文翻译资源
feature/refactor-numerical-model-panel-20260824
lh 2 weeks ago
parent db15e20eab
commit 1770047183

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -5062,13 +5062,17 @@ Please check your input coordinates.</source>
<source>Forecast</source> <source>Forecast</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Invalid time step</source>
<translation></translation>
</message>
<message> <message>
<source>Warning</source> <source>Warning</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<source>No data manager available.</source> <source>No data manager available.</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<source>Failed to reset from diagnostic. Please check if log-log data is available.</source> <source>Failed to reset from diagnostic. Please check if log-log data is available.</source>
@ -5084,7 +5088,19 @@ Please check your input coordinates.</source>
</message> </message>
<message> <message>
<source>Dt min must be less than Dt max.</source> <source>Dt min must be less than Dt max.</source>
<translation type="unfinished"></translation> <translation></translation>
</message>
<message>
<source>Time step settings are unavailable.</source>
<translation></translation>
</message>
<message>
<source>Time step fields are unavailable.</source>
<translation></translation>
</message>
<message>
<source>Please correct the invalid time step values.</source>
<translation></translation>
</message> </message>
<message> <message>
<source>Sensitive</source> <source>Sensitive</source>

@ -14,6 +14,12 @@
<Root> <Root>
<ParaGroup Name="" Alias="时间步设置">
<ParaItem Name="NM_TimeGrowthExponent" Alias="时间增长指数" Unit="" Default="1.05" Max="10" Min="1" Digit="6" Desc="time growth exponent" />
<ParaItem Name="NM_DtMin" Alias="最小时间步" Unit="h" Default="0.0025" Max="1e+30" Min="1e-12" Digit="6" Desc="minimum time step" />
<ParaItem Name="NM_DtMax" Alias="最大时间步" Unit="h" Default="12.5" Max="1e+30" Min="1e-12" Digit="6" Desc="maximum time step" />
</ParaGroup>
<ParaGroup Name="" Alias="储层参数"> <ParaGroup Name="" Alias="储层参数">
<ParaItem Name="h" Alias="储层厚度" Unit="m" Default="10" Max="10000" Min="1e-05" Digit="6" Desc="reservoir thickness" /> <ParaItem Name="h" Alias="储层厚度" Unit="m" Default="10" Max="10000" Min="1e-05" Digit="6" Desc="reservoir thickness" />
<ParaItem Name="Pi" Alias="初始压力" Unit="MPa" Default="40" Max="500" Min="0.1" Digit="6" Desc="initial formation pressure" /> <ParaItem Name="Pi" Alias="初始压力" Unit="MPa" Default="40" Max="500" Min="0.1" Digit="6" Desc="initial formation pressure" />

@ -15,6 +15,12 @@
<Root> <Root>
<ParaGroup Name="" Alias="Time Step Settings">
<ParaItem Name="NM_TimeGrowthExponent" Alias="Time Growth Exponent" Unit="" Default="1.05" Max="10" Min="1" Digit="6" Desc="time growth exponent" />
<ParaItem Name="NM_DtMin" Alias="Minimum Time Step" Unit="hr" Default="0.0025" Max="1e+30" Min="1e-12" Digit="6" Desc="minimum time step" />
<ParaItem Name="NM_DtMax" Alias="Maximum Time Step" Unit="hr" Default="12.5" Max="1e+30" Min="1e-12" Digit="6" Desc="maximum time step" />
</ParaGroup>
<ParaGroup Name="" Alias="Reservoir Parameters"> <ParaGroup Name="" Alias="Reservoir Parameters">
<ParaItem Name="h" Alias="Reservoir Thickness" Unit="m" Default="10" Max="10000" Min="1e-05" Digit="3" Desc="reservoir thickness" /> <ParaItem Name="h" Alias="Reservoir Thickness" Unit="m" Default="10" Max="10000" Min="1e-05" Digit="3" Desc="reservoir thickness" />
<ParaItem Name="Pi" Alias="Initial Pressure" Unit="MPa" Default="40" Max="500" Min="0.1" Digit="5" Desc="initial formation pressure" /> <ParaItem Name="Pi" Alias="Initial Pressure" Unit="MPa" Default="40" Max="500" Min="0.1" Digit="5" Desc="initial formation pressure" />

@ -1,8 +1,9 @@
#ifndef NMWXANALYTICALDESIGN_H #ifndef NMWXNUMERICALDESIGN_H
#define NMWXANALYTICALDESIGN_H #define NMWXNUMERICALDESIGN_H
#include "nmSubWxs_global.h" #include "nmSubWxs_global.h"
#include "iDlgBase.h" #include "iDlgBase.h"
#include "nmParameterField.h"
#include <QWidget> #include <QWidget>
// 前向声明 // 前向声明
@ -16,22 +17,46 @@ class QLabel;
class QRadioButton; class QRadioButton;
class QComboBox; class QComboBox;
class QSpinBox; class QSpinBox;
class QDateTimeEdit;
class QStackedLayout;
class nmDataWellBase; class nmDataWellBase;
class nmDataDiagnostic; class nmDataDiagnostic;
class nmDataReservoir; class nmDataReservoir;
class nmGUIComponentLineEdit;
class nmDataAnalyzeManager; class nmDataAnalyzeManager;
class NM_SUB_WXS_EXPORT nmWxNumericalDesign : public iDlgBase /**
* @brief Dock
* @note
*/
class NM_SUB_WXS_EXPORT nmWxNumericalDesign :
public iDlgBase,
public nmIParameterUnitService
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit nmWxNumericalDesign(QWidget *parent = nullptr); explicit nmWxNumericalDesign(nmDataAnalyzeManager* pDataManager,
QWidget* pParent = nullptr);
~nmWxNumericalDesign(); ~nmWxNumericalDesign();
/** @brief 通过iDlgBase按NM参数系列绑定单位控件。 */
virtual bool bindUnitField(QLineEdit* pLineEdit,
QComboBox* pUnitComboBox,
const QString& sBaseParameterId);
/** @brief 将业务基准单位值写入字段。 */
virtual void setUnitBaseValue(QLineEdit* pLineEdit,
double dBaseValue);
/** @brief 读取字段的业务基准单位值。 */
virtual double unitBaseValue(QLineEdit* pLineEdit) const;
/** @brief 使用参数定义校验单位字段输入。 */
virtual bool isUnitInputValid(QLineEdit* pLineEdit);
/** @brief 返回字段当前显示单位。 */
virtual QString currentUnit(QLineEdit* pLineEdit) const;
/** @brief 返回字段单位组,不转移所有权。 */
virtual iUnitGroup* unitGroup(QLineEdit* pLineEdit) const;
// 静态方法,供外部调用以通知时间变表皮状态变化 // 静态方法,供外部调用以通知时间变表皮状态变化
static void notifyTimeDependentSkinChanged(const QString& wellName, bool checked); static void notifyTimeDependentSkinChanged(const QString& wellName, bool checked);
// 刷新查看井结果下拉框 // 刷新查看井结果下拉框
@ -44,8 +69,6 @@ signals:
void sigIncludeWells(); // 包含其他井后刷新参数栏的信号 void sigIncludeWells(); // 包含其他井后刷新参数栏的信号
// 切换查看井结果时发出的信号 // 切换查看井结果时发出的信号
void sigResultWellChanged(const QString& wellName); void sigResultWellChanged(const QString& wellName);
//void sigUpdateWellPlot(nmDataAnalyzeManager*); // 更新井图元
//void sigIncludeWells(); // 包含其他井后刷新参数栏的信号
private slots: private slots:
// 新增的槽函数 // 新增的槽函数
@ -66,8 +89,6 @@ signals:
void onOutputResultFieldsAutomaticToggled(bool checked); // "输出结果字段"自动单选按钮状态改变槽 void onOutputResultFieldsAutomaticToggled(bool checked); // "输出结果字段"自动单选按钮状态改变槽
void onOutputResultFieldsManualToggled(bool checked); // "输出结果字段"手动单选按钮状态改变槽 void onOutputResultFieldsManualToggled(bool checked); // "输出结果字段"手动单选按钮状态改变槽
// 处理 m_pIgnoreCheck 状态变化的槽
//void onIgnoreCheckToggled(bool checked);
// 处理 Output result fields 复选框的切换 // 处理 Output result fields 复选框的切换
void onOutputResultFieldsToggled(bool checked); void onOutputResultFieldsToggled(bool checked);
// 查看井结果下拉框切换槽 // 查看井结果下拉框切换槽
@ -79,14 +100,10 @@ signals:
/** @brief 将求解器设置同步到当前数据管理器。 */ /** @brief 将求解器设置同步到当前数据管理器。 */
void onPebiSolverSettingsChanged(); void onPebiSolverSettingsChanged();
// 处理时间参考系单选按钮切换 /** @brief 输入变化时刷新时间步校验状态。 */
//void onTimeReferenceSystemToggled(bool checked); void onTimeStepValueChanged(const QString& sText);
// 时间步组件值改变时,同步更新数据模型 /** @brief 编辑完成后提交完整且合法的时间步设置。 */
//void onTimeSteppingUiChanged(); void onTimeStepEditingFinished();
// 时间单位更新
//void onTimeUnitChanged(const QString& newUnit);
// 重置时间步数据
//void onResetTimeStep();
// 保存时间变表皮状态 // 保存时间变表皮状态
void onTimeDependentCheck(bool checked); void onTimeDependentCheck(bool checked);
@ -113,14 +130,25 @@ private:
// 根据当前数据中心的数据更新时间步设置组件的值 // 根据当前数据中心的数据更新时间步设置组件的值
void updateUiFromData(); void updateUiFromData();
// 根据UI更新模型数据 // 根据UI更新模型数据任何字段非法时不产生部分写入
void updateDataFromUi(); bool updateDataFromUi(QString& sError);
// 收集并校验时间步字段,返回值均为求解器使用的小时基准值
bool collectTimeStepValues(double& dTimeGrowthExponent,
double& dDtMin,
double& dDtMax,
QString& sError);
// 将焦点定位到第一个非法时间步字段
void focusFirstInvalidTimeStepField();
// 填充查看井结果下拉框 // 填充查看井结果下拉框
void fillResultWellCombo(const QString& selectedWellName = QString()); void fillResultWellCombo(const QString& selectedWellName = QString());
// 刷新当前模型显示 // 刷新当前模型显示
void updateCurrentModelDisplay(); void updateCurrentModelDisplay();
// 刷新当前井的时间变表皮状态
void updateTimeDependentSkinDisplay();
private: private:
/** @brief 当前Dock所属数据管理器不拥有所有权。 */
nmDataAnalyzeManager* m_pDataManager;
// 主选项组件 // 主选项组件
QGroupBox* m_pMainOptionsGroup; // 主选项分组框 QGroupBox* m_pMainOptionsGroup; // 主选项分组框
@ -162,25 +190,9 @@ private:
// 时间步进组件 // 时间步进组件
QGroupBox* m_pTimeSteppingGroup; // 时间步进分组框 QGroupBox* m_pTimeSteppingGroup; // 时间步进分组框
nmGUIComponentLineEdit* m_pTimeGrowthExponentCom; nmParameterField* m_pTimeGrowthExponentField; ///< 时间增长指数字段。
nmGUIComponentLineEdit* m_pDtMinCom; nmParameterField* m_pDtMinField; ///< 最小时间步字段。
nmGUIComponentLineEdit* m_pDtMaxCom; nmParameterField* m_pDtMaxField; ///< 最大时间步字段。
//QCheckBox* m_pUseCoarseSteppingCheck;
//QPushButton* m_pResetTimeStep; // 重置时间步设置
//QRadioButton* m_pAbsoluteRadio; // "绝对"时间单选按钮
//QRadioButton* m_pElapsedRadio; // "流逝"时间单选按钮
//QComboBox* m_pTimeUnitComboBox; // 固定的时间单位标签,显示"hr"
// 切换不同状态下的时间输入框
//QStackedLayout* m_pFromStackedLayout;
//QStackedLayout* m_pSimulateUntilStackedLayout;
//QLineEdit* m_pTimeGrowthExponentLineEdit; // 流逝时间输入框
//QDateTimeEdit* m_pFromAbsoluteDateTimeEdit; // 绝对时间输入框
//QLineEdit* m_pSimulateUntilElapsedLineEdit; // 流逝时间输入框
//QDateTimeEdit* m_pSimulateUntilAbsoluteDateTimeEdit; // 绝对时间输入框
// 数值设置组件 // 数值设置组件
QGroupBox* m_pNumericalSettingsGroup; // 数值设置分组框 QGroupBox* m_pNumericalSettingsGroup; // 数值设置分组框
@ -214,4 +226,4 @@ private:
}; };
#endif // NMWXANALYTICALDESIGN_H #endif // NMWXNUMERICALDESIGN_H

@ -3,7 +3,7 @@
nmDataTimeStepSetting::nmDataTimeStepSetting() nmDataTimeStepSetting::nmDataTimeStepSetting()
{ {
m_TimeGrowthExponent = nmDataAttribute("Time Growth Exponent", 1.05, ""); m_TimeGrowthExponent = nmDataAttribute("Time Growth Exponent", 1.05, "");
m_MinDeltaT = nmDataAttribute("Min Delta T", 0.0008, "hr", UNIT_TYPE_TIME, QStringList(), QStringList() << "hr" << "day" << "min" << "sec" << "ms" << "Week" << "Month" << "Year"); m_MinDeltaT = nmDataAttribute("Min Delta T", 0.0025, "hr", UNIT_TYPE_TIME, QStringList(), QStringList() << "hr" << "day" << "min" << "sec" << "ms" << "Week" << "Month" << "Year");
m_MaxDeltaT = nmDataAttribute("Max Delta T", 12.5, "hr", UNIT_TYPE_TIME, QStringList(), QStringList() << "hr" << "day" << "min" << "sec" << "ms" << "Week" << "Month" << "Year"); m_MaxDeltaT = nmDataAttribute("Max Delta T", 12.5, "hr", UNIT_TYPE_TIME, QStringList(), QStringList() << "hr" << "day" << "min" << "sec" << "ms" << "Week" << "Month" << "Year");
} }

@ -403,7 +403,11 @@ void nmSubWndUtils::setupNumericalDockWidgets(nmDataAnalyzeManager* pDataManager
pWxDockNm2->setWindowTitle(tr("Parameters")); pWxDockNm2->setWindowTitle(tr("Parameters"));
// 参数面板绑定数据管理器后再重建,确保首次显示使用当前分析数据。 // 参数面板绑定数据管理器后再重建,确保首次显示使用当前分析数据。
nmWxNumericalDesign* pAnalWx = new nmWxNumericalDesign(); // Dock首次创建时保证时间步配置存在已有成果中的配置保持不变。
if(pDataManager->getTimeStep() == nullptr) {
pDataManager->createTimeStep();
}
nmWxNumericalDesign* pAnalWx = new nmWxNumericalDesign(pDataManager);
nmWxParaPropertyPebi* pParaWx = new nmWxParaPropertyPebi(); nmWxParaPropertyPebi* pParaWx = new nmWxParaPropertyPebi();
pParaWx->initUI(); pParaWx->initUI();
pParaWx->setDataManager(pDataManager); pParaWx->setDataManager(pDataManager);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save