mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add parsing of *.DATA and add zoom to VFP plots
Parse *.DATA and create VFP plots for all tables Add zoom in VFP plots
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpDeck.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpDeck.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
|
||||
|
||||
source_group(
|
||||
"VFP Plots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake
|
||||
)
|
||||
@@ -0,0 +1,139 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimVfpDeck.h"
|
||||
|
||||
#include "RiaOpmParserTools.h"
|
||||
|
||||
#include "RimVfpPlotCollection.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimVfpDeck, "RimVfpDeck" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpDeck::RimVfpDeck()
|
||||
{
|
||||
CAF_PDM_InitObject( "VFP Plot", ":/VfpPlot.svg" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpPlotCollection, "VfpPlotCollection", "Plot Collection" );
|
||||
m_vfpPlotCollection = new RimVfpPlotCollection();
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpDeck::setFileName( const QString& filename )
|
||||
{
|
||||
m_filePath = filename;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpDeck::loadDataAndUpdate()
|
||||
{
|
||||
updateObjectName();
|
||||
|
||||
auto createRimVfpPlot = [&]() -> RimVfpPlot*
|
||||
{
|
||||
auto plot = new RimVfpPlot();
|
||||
plot->setFileName( m_filePath().path() );
|
||||
return plot;
|
||||
};
|
||||
|
||||
std::vector<RimVfpPlot*> currentPlots = m_vfpPlotCollection->plots();
|
||||
|
||||
auto [vfpProdTables, vfpInjTables] = RiaOpmParserTools::extractVfpTablesFromDataFile( m_filePath().path().toStdString() );
|
||||
for ( const auto& prodTable : vfpProdTables )
|
||||
{
|
||||
RimVfpPlot* plot = m_vfpPlotCollection->plotForTableNumber( prodTable.getTableNum() );
|
||||
if ( !plot )
|
||||
{
|
||||
plot = createRimVfpPlot();
|
||||
m_vfpPlotCollection->addPlot( plot );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::erase( currentPlots, plot );
|
||||
}
|
||||
plot->setProductionTable( prodTable );
|
||||
plot->setDataIsImportedExternally( true );
|
||||
plot->setDeletable( false );
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
for ( const auto& injTable : vfpInjTables )
|
||||
{
|
||||
RimVfpPlot* plot = m_vfpPlotCollection->plotForTableNumber( injTable.getTableNum() );
|
||||
if ( !plot )
|
||||
{
|
||||
plot = createRimVfpPlot();
|
||||
m_vfpPlotCollection->addPlot( plot );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::erase( currentPlots, plot );
|
||||
}
|
||||
plot->setInjectionTable( injTable );
|
||||
plot->setDataIsImportedExternally( true );
|
||||
plot->setDeletable( false );
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
for ( auto plotToDelete : currentPlots )
|
||||
{
|
||||
m_vfpPlotCollection->removePlot( plotToDelete );
|
||||
delete plotToDelete;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpDeck::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
for ( auto p : m_vfpPlotCollection->plots() )
|
||||
{
|
||||
uiTreeOrdering.add( p );
|
||||
}
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpDeck::updateObjectName()
|
||||
{
|
||||
QString name = "VFP Plots";
|
||||
|
||||
QFileInfo fileInfo( m_filePath().path() );
|
||||
auto fileName = fileInfo.fileName();
|
||||
if ( !fileName.isEmpty() )
|
||||
{
|
||||
name += " - " + fileName;
|
||||
}
|
||||
setName( name );
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimNamedObject.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
|
||||
class RimVfpPlotCollection;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// RimVfpDeck parses a deck file (*.DATA) containing VFP data and creates a collection of VFP plots.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimVfpDeck : public RimNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimVfpDeck();
|
||||
|
||||
void setFileName( const QString& filename );
|
||||
void loadDataAndUpdate();
|
||||
|
||||
private:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void updateObjectName();
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
caf::PdmChildField<RimVfpPlotCollection*> m_vfpPlotCollection;
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimVfpDefines.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpDefines::InterpolatedVariableType>::setUp()
|
||||
{
|
||||
addItem( RimVfpDefines::InterpolatedVariableType::BHP, "BHP", "Bottom Hole Pressure" );
|
||||
addItem( RimVfpDefines::InterpolatedVariableType::BHP_THP_DIFF, "BHP_THP_DIFF", "BHP-THP" );
|
||||
setDefault( RimVfpDefines::InterpolatedVariableType::BHP );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpDefines::TableType>::setUp()
|
||||
{
|
||||
addItem( RimVfpDefines::TableType::INJECTION, "INJECTION", "Injection" );
|
||||
addItem( RimVfpDefines::TableType::PRODUCTION, "PRODUCTION", "Production" );
|
||||
setDefault( RimVfpDefines::TableType::INJECTION );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpDefines::ProductionVariableType>::setUp()
|
||||
{
|
||||
addItem( RimVfpDefines::ProductionVariableType::FLOW_RATE, "LIQUID_FLOW_RATE", "Flow Rate" );
|
||||
addItem( RimVfpDefines::ProductionVariableType::THP, "THP", "THP" );
|
||||
addItem( RimVfpDefines::ProductionVariableType::WATER_CUT, "WATER_CUT", "Water Cut" );
|
||||
addItem( RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO, "GAS_LIQUID_RATIO", "Gas Liquid Ratio" );
|
||||
addItem( RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY, "ALQ", "Artificial Lift Quantity" );
|
||||
setDefault( RimVfpDefines::ProductionVariableType::FLOW_RATE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpDefines::FlowingPhaseType>::setUp()
|
||||
{
|
||||
addItem( RimVfpDefines::FlowingPhaseType::OIL, "OIL", "Oil" );
|
||||
addItem( RimVfpDefines::FlowingPhaseType::GAS, "GAS", "Gas" );
|
||||
addItem( RimVfpDefines::FlowingPhaseType::WATER, "WATER", "Water" );
|
||||
addItem( RimVfpDefines::FlowingPhaseType::LIQUID, "LIQUID", "Liquid (Oil and Water)" );
|
||||
addItem( RimVfpDefines::FlowingPhaseType::INVALID, "INVALID", "Invalid" );
|
||||
setDefault( RimVfpDefines::FlowingPhaseType::INVALID );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpDefines::FlowingWaterFractionType>::setUp()
|
||||
{
|
||||
addItem( RimVfpDefines::FlowingWaterFractionType::WOR, "WOR", "Water-Oil Ratio" );
|
||||
addItem( RimVfpDefines::FlowingWaterFractionType::WCT, "WCT", "Water Cut" );
|
||||
addItem( RimVfpDefines::FlowingWaterFractionType::WGR, "WGR", "Water-Gas Ratio" );
|
||||
addItem( RimVfpDefines::FlowingWaterFractionType::INVALID, "INVALID", "Invalid" );
|
||||
setDefault( RimVfpDefines::FlowingWaterFractionType::INVALID );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpDefines::FlowingGasFractionType>::setUp()
|
||||
{
|
||||
addItem( RimVfpDefines::FlowingGasFractionType::GOR, "GOR", "Gas-Oil Ratio" );
|
||||
addItem( RimVfpDefines::FlowingGasFractionType::GLR, "GLR", "Gas-Liquid Ratio" );
|
||||
addItem( RimVfpDefines::FlowingGasFractionType::OGR, "OGR", "Oil-Gas Ratio" );
|
||||
addItem( RimVfpDefines::FlowingGasFractionType::INVALID, "INVALID", "Invalid" );
|
||||
setDefault( RimVfpDefines::FlowingGasFractionType::INVALID );
|
||||
}
|
||||
} // namespace caf
|
||||
@@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace RimVfpDefines
|
||||
{
|
||||
enum class InterpolatedVariableType
|
||||
{
|
||||
BHP,
|
||||
BHP_THP_DIFF
|
||||
};
|
||||
|
||||
enum class TableType
|
||||
{
|
||||
INJECTION,
|
||||
PRODUCTION
|
||||
};
|
||||
|
||||
enum class ProductionVariableType
|
||||
{
|
||||
FLOW_RATE,
|
||||
THP,
|
||||
ARTIFICIAL_LIFT_QUANTITY,
|
||||
WATER_CUT,
|
||||
GAS_LIQUID_RATIO
|
||||
};
|
||||
|
||||
enum class FlowingPhaseType
|
||||
{
|
||||
OIL,
|
||||
GAS,
|
||||
WATER,
|
||||
LIQUID,
|
||||
INVALID
|
||||
};
|
||||
|
||||
enum class FlowingWaterFractionType
|
||||
{
|
||||
WOR,
|
||||
WCT,
|
||||
WGR,
|
||||
INVALID
|
||||
};
|
||||
|
||||
enum class FlowingGasFractionType
|
||||
{
|
||||
GOR,
|
||||
GLR,
|
||||
OGR,
|
||||
INVALID
|
||||
};
|
||||
}; // namespace RimVfpDefines
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,181 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimVfpDefines.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include "opm/input/eclipse/Schedule/VFPInjTable.hpp"
|
||||
#include "opm/input/eclipse/Schedule/VFPProdTable.hpp"
|
||||
|
||||
class RiuPlotWidget;
|
||||
class VfpPlotData;
|
||||
class RimPlotAxisProperties;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Vertical Flow Performance Plot
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimVfpPlot : public RimPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimVfpPlot();
|
||||
~RimVfpPlot() override;
|
||||
|
||||
void setFileName( const QString& filename );
|
||||
|
||||
// RimPlot implementations
|
||||
RiuPlotWidget* plotWidget() override;
|
||||
bool isCurveHighlightSupported() const override;
|
||||
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
void updateAxes() override;
|
||||
void updateLegend() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
void reattachAllCurves() override;
|
||||
void detachAllCurves() override;
|
||||
|
||||
// RimPlotWindow implementations
|
||||
QString description() const override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
QWidget* viewWidget() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
|
||||
void setProductionTable( const Opm::VFPProdTable& table );
|
||||
void setInjectionTable( const Opm::VFPInjTable& table );
|
||||
void setDataIsImportedExternally( bool dataIsImportedExternally );
|
||||
int tableNumber() const;
|
||||
|
||||
private:
|
||||
// RimPlot implementations
|
||||
void doRemoveFromCollection();
|
||||
|
||||
// RimViewWindow implementations
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
// PDM methods
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override;
|
||||
|
||||
void populatePlotWidgetWithCurveData( RiuPlotWidget* plotWidget, const Opm::VFPInjTable& table );
|
||||
void populatePlotWidgetWithCurveData( RiuPlotWidget* plotWidget,
|
||||
const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable );
|
||||
std::vector<double> getProductionTableData( const Opm::VFPProdTable& table, RimVfpDefines::ProductionVariableType variableType ) const;
|
||||
size_t getVariableIndex( const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType targetVariable,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
size_t primaryValue,
|
||||
RimVfpDefines::ProductionVariableType familyVariable,
|
||||
size_t familyValue ) const;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void calculateTableValueOptions( RimVfpDefines::ProductionVariableType variableType, QList<caf::PdmOptionItemInfo>& options );
|
||||
|
||||
void setFixedVariableUiEditability( caf::PdmField<int>& field, RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
void updatePlotTitle( const QString& plotTitle );
|
||||
static QString generatePlotTitle( const QString& wellName,
|
||||
int tableNumber,
|
||||
RimVfpDefines::TableType tableType,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable );
|
||||
|
||||
static double convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType );
|
||||
static void convertToDisplayUnit( std::vector<double>& values, RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
static QString getDisplayUnit( RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
static QString getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
static RimVfpDefines::FlowingPhaseType getFlowingPhaseType( const Opm::VFPProdTable& table );
|
||||
static RimVfpDefines::FlowingPhaseType getFlowingPhaseType( const Opm::VFPInjTable& table );
|
||||
static RimVfpDefines::FlowingWaterFractionType getFlowingWaterFractionType( const Opm::VFPProdTable& table );
|
||||
static RimVfpDefines::FlowingGasFractionType getFlowingGasFractionType( const Opm::VFPProdTable& table );
|
||||
|
||||
void populatePlotData( const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpDefines::FlowingPhaseType flowingPhase,
|
||||
VfpPlotData& plotData ) const;
|
||||
|
||||
static void populatePlotData( const Opm::VFPInjTable& table,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpDefines::FlowingPhaseType flowingPhase,
|
||||
VfpPlotData& plotData );
|
||||
|
||||
void populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData );
|
||||
|
||||
static QString axisTitle( RimVfpDefines::ProductionVariableType variableType, RimVfpDefines::FlowingPhaseType flowingPhase );
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
void updatePlotWidgetFromAxisRanges() override;
|
||||
void updateAxisRangesFromPlotWidget() override;
|
||||
|
||||
void onPlotZoomed();
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_plotTitle;
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
caf::PdmField<int> m_tableNumber;
|
||||
caf::PdmField<double> m_referenceDepth;
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::FlowingPhaseType>> m_flowingPhase;
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::FlowingWaterFractionType>> m_flowingWaterFraction;
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::FlowingGasFractionType>> m_flowingGasFraction;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::TableType>> m_tableType;
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::InterpolatedVariableType>> m_interpolatedVariable;
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::ProductionVariableType>> m_primaryVariable;
|
||||
caf::PdmField<caf::AppEnum<RimVfpDefines::ProductionVariableType>> m_familyVariable;
|
||||
|
||||
caf::PdmField<int> m_flowRateIdx;
|
||||
caf::PdmField<int> m_thpIdx;
|
||||
caf::PdmField<int> m_articifialLiftQuantityIdx;
|
||||
caf::PdmField<int> m_waterCutIdx;
|
||||
caf::PdmField<int> m_gasLiquidRatioIdx;
|
||||
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
||||
|
||||
QPointer<RiuPlotWidget> m_plotWidget;
|
||||
std::unique_ptr<Opm::VFPProdTable> m_prodTable;
|
||||
std::unique_ptr<Opm::VFPInjTable> m_injectionTable;
|
||||
|
||||
bool m_dataIsImportedExternally;
|
||||
};
|
||||
@@ -0,0 +1,164 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimVfpPlotCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimVfpDeck.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimVfpPlotCollection, "RimVfpPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlotCollection::RimVfpPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "VFP Plots", ":/VfpPlotCollection.svg" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpPlots, "VfpPlots", "Vertical Flow Performance Plots" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpDecks, "VfpDecks", "Vertical Flow Performance Decks" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlotCollection::~RimVfpPlotCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::addPlot( RimVfpPlot* newPlot )
|
||||
{
|
||||
m_vfpPlots.push_back( newPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::insertPlot( RimVfpPlot* vfpPlot, size_t index )
|
||||
{
|
||||
m_vfpPlots.insert( index, vfpPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimVfpPlot*> RimVfpPlotCollection::plots() const
|
||||
{
|
||||
return m_vfpPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::deleteChildren()
|
||||
{
|
||||
m_vfpPlots.deleteChildren();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot* RimVfpPlotCollection::plotForTableNumber( int tableNumber ) const
|
||||
{
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
if ( plot->tableNumber() == tableNumber )
|
||||
{
|
||||
return plot;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimVfpPlotCollection::plotCount() const
|
||||
{
|
||||
return m_vfpPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::removePlot( RimVfpPlot* vfpPlot )
|
||||
{
|
||||
m_vfpPlots.removeChild( vfpPlot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpDeck* RimVfpPlotCollection::addDeck( const QString& filename )
|
||||
{
|
||||
RimVfpDeck* deck = new RimVfpDeck();
|
||||
deck->setFileName( filename );
|
||||
m_vfpDecks.push_back( deck );
|
||||
|
||||
return deck;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects )
|
||||
{
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
plot->updateMdiWindowVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::loadDataAndUpdateAllPlots()
|
||||
{
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
for ( auto deck : m_vfpDecks.childrenByType() )
|
||||
{
|
||||
deck->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
|
||||
{
|
||||
menuBuilder << "RicNewVfpPlotFeature";
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimVfpPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimVfpDeck;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimVfpPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimVfpPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimVfpPlotCollection();
|
||||
~RimVfpPlotCollection() override;
|
||||
|
||||
void addPlot( RimVfpPlot* newPlot ) override;
|
||||
std::vector<RimVfpPlot*> plots() const override;
|
||||
void deleteChildren();
|
||||
RimVfpPlot* plotForTableNumber( int tableNumber ) const;
|
||||
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimVfpPlot* vfpPlot, size_t index ) final;
|
||||
void removePlot( RimVfpPlot* vfpPlot ) final;
|
||||
|
||||
RimVfpDeck* addDeck( const QString& filename );
|
||||
|
||||
private:
|
||||
void loadDataAndUpdateAllPlots() override;
|
||||
void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects ) override;
|
||||
|
||||
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimVfpPlot*> m_vfpPlots;
|
||||
caf::PdmChildArrayField<RimVfpDeck*> m_vfpDecks;
|
||||
};
|
||||
Reference in New Issue
Block a user