@ -1,4 +1,4 @@
# include "zxLogInstance.h"
# include "ZxResolutionHelper.h"
# include "zxSysUtils.h"
@ -17,8 +17,11 @@
# include "nmDataRegion.h"
# include "nmDataRegionMark.h"
# include "nmDataOutline.h"
# include "nmDataReservoir.h"
# include "nmDataPvtParaForPebi.h"
# include "nmAttrRegistry.h"
# include <QCoreApplication>
# include <QSet>
# include "nmWxParaPropertyPebi.h"
@ -62,6 +65,75 @@ QStringList wellParasOf(const QString& wellCode, bool hasPerforation, NM_WELL_MO
return paras ;
}
QStringList resultWellParasOf ( bool hasPerforation , NM_WELL_MODEL wellType )
{
QStringList paras ;
if ( wellType = = NM_WELL_MODEL : : Vertical_Well )
{
paras < < " Result_W_Rw " ;
}
else if ( wellType = = NM_WELL_MODEL : : Vertical_Fractured_Well | |
wellType = = NM_WELL_MODEL : : Horizontal_Fractured_Well )
{
paras < < " Result_W_Dfc " ;
}
else
{
return paras ;
}
paras < < " Result_W_C " ;
if ( hasPerforation )
{
paras < < " Result_W_Skin " ;
}
return paras ;
}
QStringList resultReservoirParas ( )
{
return QStringList ( ) < < " Result_Pi " < < " Result_K " < < " Result_h "
< < " Result_phi " < < " Result_Cti " < < " Result_Cf "
< < " Result_Soi " < < " Result_Sgi " < < " Result_Swi " ;
}
QString resultParaName ( const QString & groupCode , const QString & para )
{
return groupCode + " _ " + para ;
}
void appendResultPara ( QStringList & paras ,
QMap < QString , QVariant > & values ,
const QString & groupCode ,
const QString & para ,
const QVariant & value )
{
const QString name = resultParaName ( groupCode , para ) ;
paras < < name ;
values [ name ] = value ;
}
void appendPvtVectorPara ( QStringList & paras ,
QMap < QString , QVariant > & values ,
const QString & groupCode ,
const QString & para ,
const QVector < double > & pvtValues )
{
// 结果面板是标量列表; 变化PVT仅展示曲线首值, 求解器仍使用完整数组。
if ( ! pvtValues . isEmpty ( ) )
{
appendResultPara ( paras , values , groupCode , para , pvtValues . first ( ) ) ;
}
}
QString resultModelTitlePrefix ( )
{
// 沿用旧结果面板已有的翻译,并统一为“模型-xxx”的标题格式。
QString prefix = QCoreApplication : : translate ( " nmWxResultParameters " , " Model - " ) ;
prefix . replace ( " - " , " - " ) ;
return prefix ;
}
// XML 只定义基础参数名,运行时拼接对象编码以区分多个同类对象。
QStringList fractureParasOf ( const QString & fractureCode )
{
@ -432,6 +504,180 @@ void nmWxParaPropertyPebi::rebuildAllParas()
}
}
void nmWxParaPropertyPebi : : rebuildResultParas ( )
{
if ( m_pMainLayout = = nullptr | | m_pDataManager = = nullptr )
return ;
m_pDataManager - > syncWellAttrs ( ) ;
QStringList listParas ;
QMap < QString , QVariant > mapValues ;
QMap < QString , QString > mapObjectNames ;
QSet < QString > addedWellCodes ;
nmAttrRegistry * pReg = m_pDataManager - > getAttrRegistry ( ) ;
// 每口井单独建立“模型-井名”分组,只保留该井型传给求解器的参数。
int wellIndex = 0 ;
const QVector < nmDataWellBase * > wells = m_pDataManager - > getWellDataList ( ) ;
foreach ( nmDataWellBase * pWell , wells )
{
if ( pWell = = nullptr )
continue ;
const QString sCode = pWell - > getWellCode ( ) ;
if ( sCode . isEmpty ( ) | | addedWellCodes . contains ( sCode ) )
continue ;
const QStringList resultParas = resultWellParasOf (
pWell - > getPerforationCount ( ) > 0 , pWell - > getWellType ( ) ) ;
if ( resultParas . isEmpty ( ) )
continue ;
const QString groupCode = QString ( " RESULT_01_WELL_%1 " )
. arg ( + + wellIndex , 4 , 10 , QChar ( ' 0 ' ) ) ;
addedWellCodes . insert ( sCode ) ;
mapObjectNames [ groupCode ] = resultModelTitlePrefix ( ) + pWell - > getWellName ( ) ;
QStringList sourceParas ;
foreach ( const QString & resultPara , resultParas )
{
sourceParas < < sCode + " _ " + resultPara . mid ( QString ( " Result_ " ) . length ( ) ) ;
}
const QMap < QString , QVariant > sourceValues =
pReg ! = nullptr ? pReg - > collect ( sourceParas ) : QMap < QString , QVariant > ( ) ;
for ( int i = 0 ; i < resultParas . size ( ) ; + + i )
{
if ( sourceValues . contains ( sourceParas [ i ] ) )
{
appendResultPara ( listParas , mapValues , groupCode ,
resultParas [ i ] , sourceValues . value ( sourceParas [ i ] ) ) ;
}
}
}
// 储层分组使用独立结果参数名,避免改变左侧属性面板的别名和单位。
nmDataReservoir * pReservoir = m_pDataManager - > getReservoirData ( ) ;
if ( pReservoir ! = nullptr )
{
const QString groupCode = " RESULT_02_RESERVOIR " ;
QString reservoirTitle = QCoreApplication : : translate (
" nmWxResultParameters " , " Model - Reservoir " ) ;
reservoirTitle . replace ( " - " , " - " ) ;
mapObjectNames [ groupCode ] = reservoirTitle ;
const QStringList resultParas = resultReservoirParas ( ) ;
const QVariant reservoirValues [ ] = {
pReservoir - > getInitialPressure ( ) . getValue ( ) ,
pReservoir - > getPermeability ( ) . getValue ( ) ,
pReservoir - > getThickness ( ) . getValue ( ) ,
pReservoir - > getPorosity ( ) . getValue ( ) ,
pReservoir - > getCt ( ) . getValue ( ) ,
pReservoir - > getCf ( ) . getValue ( ) ,
pReservoir - > getSoi ( ) . getValue ( ) ,
pReservoir - > getSgi ( ) . getValue ( ) ,
pReservoir - > getSwi ( ) . getValue ( )
} ;
for ( int i = 0 ; i < resultParas . size ( ) ; + + i )
{
appendResultPara ( listParas , mapValues , groupCode ,
resultParas [ i ] , reservoirValues [ i ] ) ;
}
}
// PVT 分组按本次求解模型选择实际提交的油、水或气参数。
const QString pvtGroupCode = " RESULT_03_PVT " ;
nmDataPvtParaForPebi * pPvt = m_pDataManager - > getPebiPvtPara ( ) ;
if ( pReservoir ! = nullptr )
{
switch ( m_pDataManager - > getSolverModelType ( ) )
{
case SMT_Oil_ConstPvt :
appendResultPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bo " , pReservoir - > getBo ( ) . getValue ( ) ) ;
appendResultPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miuo " , pReservoir - > getMiuo ( ) . getValue ( ) ) ;
break ;
case SMT_Water_ConstPvt :
appendResultPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bw " , pReservoir - > getBw ( ) . getValue ( ) ) ;
appendResultPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miuw " , pReservoir - > getMiuw ( ) . getValue ( ) ) ;
break ;
case SMT_Oil_VariablePvt :
if ( pPvt ! = nullptr )
{
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bo " , pPvt - > getBo ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miuo " , pPvt - > getMiuo ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Co " , pPvt - > getCo ( ) ) ;
}
break ;
case SMT_Water_VariablePvt :
if ( pPvt ! = nullptr )
{
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bw " , pPvt - > getBw ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miuw " , pPvt - > getMiuw ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Cw " , pPvt - > getCw ( ) ) ;
}
break ;
case SMT_Gas_VariablePvt :
case SMT_Gas_PseudoPressure :
if ( pPvt ! = nullptr )
{
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bg " , pPvt - > getBg ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miug " , pPvt - > getMiug ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Cg " , pPvt - > getCg ( ) ) ;
}
break ;
case SMT_Oil_Water_TwoPhase :
if ( pPvt ! = nullptr )
{
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bo " , pPvt - > getBo ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miuo " , pPvt - > getMiuo ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Bw " , pPvt - > getBw ( ) ) ;
appendPvtVectorPara ( listParas , mapValues , pvtGroupCode ,
" Result_Miuw " , pPvt - > getMiuw ( ) ) ;
}
break ;
default :
break ;
}
}
if ( listParas . contains ( resultParaName ( pvtGroupCode , " Result_Bo " ) ) | |
listParas . contains ( resultParaName ( pvtGroupCode , " Result_Bg " ) ) | |
listParas . contains ( resultParaName ( pvtGroupCode , " Result_Bw " ) ) )
{
mapObjectNames [ pvtGroupCode ] = resultModelTitlePrefix ( ) + " PVT " ;
}
// 与左侧面板一致:先按 XML 构建控件并回填实际值,再统一设为只读。
refreshUIs ( listParas , false , mapObjectNames ) ;
restoreOldParas ( mapValues ) ;
if ( m_pGridItemUtils ! = nullptr )
{
m_pGridItemUtils - > setItemsReadonly ( true ) ;
}
if ( m_pHelpBox ! = nullptr )
{
m_pHelpBox - > hide ( ) ;
}
}
bool nmWxParaPropertyPebi : : getParaValue ( QString sPara , QVariant & o )
{
if ( nullptr ! = m_pGridItemUtils )