|
|
|
|
@ -5,6 +5,7 @@
|
|
|
|
|
#include "nmDataReservoir.h"
|
|
|
|
|
#include "nmDataWellBase.h"
|
|
|
|
|
#include "nmDataPerforation.h"
|
|
|
|
|
#include "nmPebiResultSnapshot.h"
|
|
|
|
|
#include "nmCalculationDllPebiSolverTask.h"
|
|
|
|
|
#include "iSubWndFitting.h"
|
|
|
|
|
#include "mGui/mGuiAnal/iAnalRun.h"
|
|
|
|
|
@ -613,8 +614,10 @@ nmWxSensitive::nmWxSensitive(QWidget *parent, nmDataAnalyzeManager* manager)
|
|
|
|
|
m_loading = false;
|
|
|
|
|
onTreeItemChanged(nullptr, 0);
|
|
|
|
|
// 已有批次可直接重新打开,结果发布后同步入口与列表。
|
|
|
|
|
if(m_pDataManager)
|
|
|
|
|
if(m_pDataManager) {
|
|
|
|
|
connect(m_pDataManager, SIGNAL(sigSensitiveResultsChanged()), this, SLOT(onResultsChanged()));
|
|
|
|
|
connect(m_pDataManager, SIGNAL(sigPebiResultSnapshotChanged()), this, SLOT(onModelResultChanged()));
|
|
|
|
|
}
|
|
|
|
|
onResultsChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -648,10 +651,16 @@ void nmWxSensitive::closeEvent(QCloseEvent* event)
|
|
|
|
|
|
|
|
|
|
void nmWxSensitive::refreshModelValues()
|
|
|
|
|
{
|
|
|
|
|
// 仅将本期六个参数绑定到主井和储层,旧采样范围按显示单位迁移一次。
|
|
|
|
|
// 六个参数以最后成功求解的快照为准,编辑中的模型只提供属性类型和显示单位。
|
|
|
|
|
const QSharedPointer<const nmPebiResultSnapshot> snapshot = m_pDataManager
|
|
|
|
|
? m_pDataManager->getPebiResultSnapshot() : QSharedPointer<const nmPebiResultSnapshot>();
|
|
|
|
|
const bool resetRanges = !snapshot.isNull() &&
|
|
|
|
|
snapshot->getSnapshotId() != m_sensitiveData.getModelSnapshotId();
|
|
|
|
|
nmDataWellBase* well = m_pDataManager
|
|
|
|
|
? m_pDataManager->findWellByCode(m_pDataManager->getPrimaryWellCode()) : nullptr;
|
|
|
|
|
nmDataReservoir* reservoir = m_pDataManager ? m_pDataManager->getReservoirData() : nullptr;
|
|
|
|
|
const nmPebiResultWellSnapshot* solvedWell = !snapshot.isNull() && well
|
|
|
|
|
? snapshot->findWell(well->getWellInstanceId()) : nullptr;
|
|
|
|
|
const QStringList names = QStringList() << "Skin" << "C" << "Pi" << "k" << "h" << QString(QChar(0x03c6));
|
|
|
|
|
for (int n = 0; n < names.size(); ++n) {
|
|
|
|
|
nmDataAttribute* attribute = nullptr;
|
|
|
|
|
@ -677,6 +686,20 @@ void nmWxSensitive::refreshModelValues()
|
|
|
|
|
index = m_sensitiveData.getVariableCount() - 1;
|
|
|
|
|
}
|
|
|
|
|
nmDataSensitive::VariableSampling& variable = m_sensitiveData.getVariable(index);
|
|
|
|
|
// 在局部属性上替换数值,不能把未求解的编辑值带入 Model value 或默认范围。
|
|
|
|
|
nmDataAttribute solvedAttribute;
|
|
|
|
|
if (attribute && !snapshot.isNull()) {
|
|
|
|
|
solvedAttribute = *attribute;
|
|
|
|
|
const nmPebiResultReservoirParameters& solvedReservoir = snapshot->getReservoirParameters();
|
|
|
|
|
if (name == "Skin" || name == "C") {
|
|
|
|
|
if (!solvedWell || (name == "Skin" && !solvedWell->m_bHasSkin)) attribute = nullptr;
|
|
|
|
|
else solvedAttribute.setValue(name == "Skin" ? solvedWell->m_dSkin : solvedWell->m_dWellboreStorage);
|
|
|
|
|
} else if (name == "Pi") solvedAttribute.setValue(solvedReservoir.m_dInitialPressure);
|
|
|
|
|
else if (name == "k") solvedAttribute.setValue(solvedReservoir.m_dPermeability);
|
|
|
|
|
else if (name == "h") solvedAttribute.setValue(solvedReservoir.m_dThickness);
|
|
|
|
|
else if (name == QString(QChar(0x03c6))) solvedAttribute.setValue(solvedReservoir.m_dPorosity);
|
|
|
|
|
if (attribute) attribute = &solvedAttribute;
|
|
|
|
|
}
|
|
|
|
|
double physicalMin = 0.0, physicalMax = 0.0;
|
|
|
|
|
if (!attribute || !samplingPhysicalRange(name, physicalMin, physicalMax)) {
|
|
|
|
|
variable.setEnabled(false);
|
|
|
|
|
@ -715,7 +738,8 @@ void nmWxSensitive::refreshModelValues()
|
|
|
|
|
variable.getModelValue().getMaxValue().isValid() &&
|
|
|
|
|
nearlyEqualSamplingValue(minimum, variable.getModelValue().getMinValue().toDouble()) &&
|
|
|
|
|
nearlyEqualSamplingValue(maximum, variable.getModelValue().getMaxValue().toDouble())));
|
|
|
|
|
if (!migrated || ((name == "Skin" || name == "Pi") && previousDefault)) {
|
|
|
|
|
// 新的正式求解结果重新建立范围,采样数量、模式及手动值保持原设置。
|
|
|
|
|
if (resetRanges || !migrated || ((name == "Skin" || name == "Pi") && previousDefault)) {
|
|
|
|
|
const double model = attribute->getValue().toDouble();
|
|
|
|
|
minimum = qMin(model / 2.0, model * 2.0);
|
|
|
|
|
maximum = qMax(model / 2.0, model * 2.0);
|
|
|
|
|
@ -750,11 +774,25 @@ void nmWxSensitive::refreshModelValues()
|
|
|
|
|
if (!isSupportedSamplingVariable(m_sensitiveData.getVariable(i).getVarName()))
|
|
|
|
|
m_sensitiveData.getVariable(i).setEnabled(false);
|
|
|
|
|
m_sensitiveData.setUsesBaseUnits(true);
|
|
|
|
|
if (!snapshot.isNull()) m_sensitiveData.setModelSnapshotId(snapshot->getSnapshotId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxSensitive::loadDataToUI()
|
|
|
|
|
void nmWxSensitive::onModelResultChanged()
|
|
|
|
|
{
|
|
|
|
|
// 查看井切换也会发送快照通知;只有新求解快照才刷新已打开窗口。
|
|
|
|
|
const QSharedPointer<const nmPebiResultSnapshot> snapshot = m_pDataManager->getPebiResultSnapshot();
|
|
|
|
|
if (snapshot.isNull() || snapshot->getSnapshotId() == m_sensitiveData.getModelSnapshotId()) return;
|
|
|
|
|
m_loading = true;
|
|
|
|
|
refreshModelValues();
|
|
|
|
|
loadDataToUI(true);
|
|
|
|
|
m_loading = false;
|
|
|
|
|
updateModelCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxSensitive::loadDataToUI(bool refreshRangesOnly)
|
|
|
|
|
{
|
|
|
|
|
// 加载过程中阻止联动刷新,先恢复设置,再一次生成各参数表格。
|
|
|
|
|
if (!refreshRangesOnly)
|
|
|
|
|
calculationTypeCombo->setCurrentIndex(int(m_sensitiveData.getCalculationType()));
|
|
|
|
|
for (int i = 0; i < m_sensitiveData.getVariableCount(); ++i) {
|
|
|
|
|
nmDataSensitive::VariableSampling& variable = m_sensitiveData.getVariable(i);
|
|
|
|
|
@ -769,14 +807,20 @@ void nmWxSensitive::loadDataToUI()
|
|
|
|
|
QTreeWidgetItem* item = parent->child(child);
|
|
|
|
|
if (item->text(0) != name) continue;
|
|
|
|
|
item->setDisabled(!available);
|
|
|
|
|
if (!refreshRangesOnly)
|
|
|
|
|
item->setCheckState(0, available && variable.getEnabled() ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
detailStack->widget(idx + 1)->setEnabled(available);
|
|
|
|
|
// 求解后的刷新只更新模型值和范围,不覆盖窗口中尚未提交的采样设置。
|
|
|
|
|
if (!refreshRangesOnly) {
|
|
|
|
|
m_modeCombos[idx]->setCurrentIndex(int(variable.getMode()));
|
|
|
|
|
m_logChecks[idx]->setChecked(variable.getLog());
|
|
|
|
|
m_numSpins[idx]->setValue(qMax(1, variable.getNumber()));
|
|
|
|
|
const QString unit = variable.getModelValue().getUnit();
|
|
|
|
|
}
|
|
|
|
|
// 已打开窗口沿用原显示单位,避免手动表格的数值被换成另一种单位解释。
|
|
|
|
|
const QString unit = refreshRangesOnly ? m_unitLabels[idx]->text() : variable.getModelValue().getUnit();
|
|
|
|
|
variable.getModelValue().setUnit(unit);
|
|
|
|
|
m_unitLabels[idx]->setText(unit);
|
|
|
|
|
double model = variable.getModelValue().getValue().toDouble();
|
|
|
|
|
double minimum = variable.getMinValue().getValue().toDouble();
|
|
|
|
|
@ -795,7 +839,7 @@ void nmWxSensitive::loadDataToUI()
|
|
|
|
|
.arg(formatSamplingValue(displayMin, 6)).arg(formatSamplingValue(displayMax, 6)).arg(unit);
|
|
|
|
|
m_minSpins[idx]->setToolTip(rangeHint);
|
|
|
|
|
m_maxSpins[idx]->setToolTip(rangeHint);
|
|
|
|
|
if (variable.getMode() == nmDataSensitive::VariableSampling::MODE_MANUAL) {
|
|
|
|
|
if (!refreshRangesOnly && variable.getMode() == nmDataSensitive::VariableSampling::MODE_MANUAL) {
|
|
|
|
|
QTableWidget* table = m_valueTables[idx];
|
|
|
|
|
table->setRowCount(variable.getNumber());
|
|
|
|
|
const QVector<double>& values = variable.getValues();
|
|
|
|
|
|