mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
7147 vfp show plot data (#7154)
* #7147 VFP plots: refactor to separate data extraction and display. * #7147 VFP Plots: Add "Show Plot Data" functionality. * #7147 VFP plots: Move defines to separate file * #7147 VFP plots: Minor adjustments * #7147 VFP Plot: Show table number in title and auto-generated name. * #7147 VFP Plot: Add "Show Plot Data" to context menu. * Remove unused member. * #7147 VFP Plot: Disable broken curve selection. * Revert "#7147 VFP Plot: Add "Show Plot Data" to context menu." This reverts commit 5f3b2f362fcea7fc6de5fd2c614919079629bf1c. * #7147 VFP Plot: Use event filter to show context menu * Janitor : Use context menu launcher for WellAllocationPlot and CrossPlot Co-authored-by: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
This commit is contained in:
parent
7b5bc5c2cd
commit
1f7cb2b973
@ -27,6 +27,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCrossPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimVfpPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
@ -193,6 +194,9 @@ bool RicShowPlotDataFeature::isCommandEnabled()
|
||||
auto gridCrossPlots = caf::selectedObjectsByType<RimGridCrossPlot*>();
|
||||
if ( gridCrossPlots.size() > 0 ) return true;
|
||||
|
||||
auto vfpPlots = caf::selectedObjectsByType<RimVfpPlot*>();
|
||||
if ( vfpPlots.size() > 0 ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -220,7 +224,8 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots = caf::selectedObjectsByType<RimSummaryPlot*>();
|
||||
std::vector<RimWellLogPlot*> wellLogPlots = caf::selectedObjectsByType<RimWellLogPlot*>();
|
||||
std::vector<RimGridCrossPlot*> crossPlots = caf::selectedObjectsByType<RimGridCrossPlot*>();
|
||||
if ( selectedSummaryPlots.size() == 0 && wellLogPlots.size() == 0 && crossPlots.size() == 0 )
|
||||
std::vector<RimVfpPlot*> vfpPlots = caf::selectedObjectsByType<RimVfpPlot*>();
|
||||
if ( selectedSummaryPlots.empty() && wellLogPlots.empty() && crossPlots.empty() && vfpPlots.empty() )
|
||||
{
|
||||
CVF_ASSERT( false );
|
||||
|
||||
@ -243,6 +248,13 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
|
||||
for ( RimVfpPlot* vfpPlot : vfpPlots )
|
||||
{
|
||||
QString title = vfpPlot->description();
|
||||
QString text = vfpPlot->asciiDataForPlotExport();
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
|
||||
for ( RimGridCrossPlot* crossPlot : crossPlots )
|
||||
{
|
||||
auto textProvider = new RiuTabbedGridCrossPlotTextProvider( crossPlot );
|
||||
|
@ -76,6 +76,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.h
|
||||
@ -245,6 +246,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp
|
||||
|
82
ApplicationLibCode/ProjectDataModel/RimVfpDefines.cpp
Normal file
82
ApplicationLibCode/ProjectDataModel/RimVfpDefines.cpp
Normal file
@ -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::LIQUID_FLOW_RATE, "LIQUID_FLOW_RATE", "Liquid 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::LIQUID_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
|
68
ApplicationLibCode/ProjectDataModel/RimVfpDefines.h
Normal file
68
ApplicationLibCode/ProjectDataModel/RimVfpDefines.h
Normal file
@ -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
|
||||
{
|
||||
LIQUID_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
|
@ -18,13 +18,17 @@
|
||||
|
||||
#include "RimVfpPlot.h"
|
||||
|
||||
#include "RimVfpDefines.h"
|
||||
#include "RimVfpTableExtractor.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
@ -35,75 +39,49 @@
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <memory>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
class VfpPlotData
|
||||
{
|
||||
public:
|
||||
void setXAxisTitle( const QString& xAxisTitle ) { m_xAxisTitle = xAxisTitle; }
|
||||
void setYAxisTitle( const QString& yAxisTitle ) { m_yAxisTitle = yAxisTitle; }
|
||||
|
||||
const QString& xAxisTitle() const { return m_xAxisTitle; }
|
||||
const QString& yAxisTitle() const { return m_yAxisTitle; }
|
||||
|
||||
void appendCurve( const QString& curveTitle, const std::vector<double>& xData, const std::vector<double>& yData )
|
||||
{
|
||||
m_curveTitles.push_back( curveTitle );
|
||||
m_xData.push_back( xData );
|
||||
m_yData.push_back( yData );
|
||||
}
|
||||
|
||||
const QString& curveTitle( size_t idx ) const { return m_curveTitles[idx]; }
|
||||
|
||||
size_t size() const { return m_xData.size(); }
|
||||
|
||||
size_t curveSize( size_t idx ) const { return m_xData[idx].size(); }
|
||||
|
||||
const std::vector<double>& xData( size_t idx ) const { return m_xData[idx]; }
|
||||
const std::vector<double>& yData( size_t idx ) const { return m_yData[idx]; }
|
||||
|
||||
private:
|
||||
QString m_xAxisTitle;
|
||||
QString m_yAxisTitle;
|
||||
std::vector<QString> m_curveTitles;
|
||||
std::vector<std::vector<double>> m_xData;
|
||||
std::vector<std::vector<double>> m_yData;
|
||||
};
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimVfpPlot, "VfpPlot" );
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::setUp()
|
||||
{
|
||||
addItem( RimVfpPlot::InterpolatedVariableType::BHP, "BHP", "Bottom Hole Pressure" );
|
||||
addItem( RimVfpPlot::InterpolatedVariableType::BHP_THP_DIFF, "BHP_THP_DIFF", "BHP-THP" );
|
||||
setDefault( RimVfpPlot::InterpolatedVariableType::BHP );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpPlot::TableType>::setUp()
|
||||
{
|
||||
addItem( RimVfpPlot::TableType::INJECTION, "INJECTION", "Injection" );
|
||||
addItem( RimVfpPlot::TableType::PRODUCTION, "PRODUCTION", "Production" );
|
||||
setDefault( RimVfpPlot::TableType::INJECTION );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpPlot::ProductionVariableType>::setUp()
|
||||
{
|
||||
addItem( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE, "LIQUID_FLOW_RATE", "Liquid Flow Rate" );
|
||||
addItem( RimVfpPlot::ProductionVariableType::THP, "THP", "THP" );
|
||||
addItem( RimVfpPlot::ProductionVariableType::WATER_CUT, "WATER_CUT", "Water Cut" );
|
||||
addItem( RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO, "GAS_LIQUID_RATIO", "Gas Liquid Ratio" );
|
||||
addItem( RimVfpPlot::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY, "ALQ", "Artificial Lift Quantity" );
|
||||
setDefault( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpPlot::FlowingPhaseType>::setUp()
|
||||
{
|
||||
addItem( RimVfpPlot::FlowingPhaseType::OIL, "OIL", "Oil" );
|
||||
addItem( RimVfpPlot::FlowingPhaseType::GAS, "GAS", "Gas" );
|
||||
addItem( RimVfpPlot::FlowingPhaseType::WATER, "WATER", "Water" );
|
||||
addItem( RimVfpPlot::FlowingPhaseType::LIQUID, "LIQUID", "Liquid (Oil and Water)" );
|
||||
addItem( RimVfpPlot::FlowingPhaseType::INVALID, "INVALID", "Invalid" );
|
||||
setDefault( RimVfpPlot::FlowingPhaseType::INVALID );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpPlot::FlowingWaterFractionType>::setUp()
|
||||
{
|
||||
addItem( RimVfpPlot::FlowingWaterFractionType::WOR, "WOR", "Water-Oil Ratio" );
|
||||
addItem( RimVfpPlot::FlowingWaterFractionType::WCT, "WCT", "Water Cut" );
|
||||
addItem( RimVfpPlot::FlowingWaterFractionType::WGR, "WGR", "Water-Gas Ratio" );
|
||||
addItem( RimVfpPlot::FlowingWaterFractionType::INVALID, "INVALID", "Invalid" );
|
||||
setDefault( RimVfpPlot::FlowingWaterFractionType::INVALID );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimVfpPlot::FlowingGasFractionType>::setUp()
|
||||
{
|
||||
addItem( RimVfpPlot::FlowingGasFractionType::GOR, "GOR", "Gas-Oil Ratio" );
|
||||
addItem( RimVfpPlot::FlowingGasFractionType::GLR, "GLR", "Gas-Liquid Ratio" );
|
||||
addItem( RimVfpPlot::FlowingGasFractionType::OGR, "OGR", "Oil-Gas Ratio" );
|
||||
addItem( RimVfpPlot::FlowingGasFractionType::INVALID, "INVALID", "Invalid" );
|
||||
setDefault( RimVfpPlot::FlowingGasFractionType::INVALID );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -117,7 +95,7 @@ RimVfpPlot::RimVfpPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" );
|
||||
|
||||
caf::AppEnum<RimVfpPlot::TableType> defaultTableType = RimVfpPlot::TableType::INJECTION;
|
||||
caf::AppEnum<RimVfpDefines::TableType> defaultTableType = RimVfpDefines::TableType::INJECTION;
|
||||
CAF_PDM_InitField( &m_tableType, "TableType", defaultTableType, "Table Type", "", "", "" );
|
||||
m_tableType.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
@ -127,7 +105,7 @@ RimVfpPlot::RimVfpPlot()
|
||||
CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepth", 0.0, "Reference Depth", "", "", "" );
|
||||
m_referenceDepth.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
caf::AppEnum<RimVfpPlot::FlowingPhaseType> defaultFlowingPhase = RimVfpPlot::FlowingPhaseType::WATER;
|
||||
caf::AppEnum<RimVfpDefines::FlowingPhaseType> defaultFlowingPhase = RimVfpDefines::FlowingPhaseType::WATER;
|
||||
CAF_PDM_InitField( &m_flowingPhase, "FlowingPhase", defaultFlowingPhase, "Flowing Phase", "", "", "" );
|
||||
m_flowingPhase.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
@ -137,8 +115,8 @@ RimVfpPlot::RimVfpPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowingGasFraction, "FlowingGasFraction", "Flowing Gas Fraction", "", "", "" );
|
||||
m_flowingGasFraction.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
caf::AppEnum<RimVfpPlot::InterpolatedVariableType> defaultInterpolatedVariable =
|
||||
RimVfpPlot::InterpolatedVariableType::BHP;
|
||||
caf::AppEnum<RimVfpDefines::InterpolatedVariableType> defaultInterpolatedVariable =
|
||||
RimVfpDefines::InterpolatedVariableType::BHP;
|
||||
CAF_PDM_InitField( &m_interpolatedVariable,
|
||||
"InterpolatedVariable",
|
||||
defaultInterpolatedVariable,
|
||||
@ -147,11 +125,11 @@ RimVfpPlot::RimVfpPlot()
|
||||
"",
|
||||
"" );
|
||||
|
||||
caf::AppEnum<RimVfpPlot::ProductionVariableType> defaultPrimaryVariable =
|
||||
RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE;
|
||||
caf::AppEnum<RimVfpDefines::ProductionVariableType> defaultPrimaryVariable =
|
||||
RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE;
|
||||
CAF_PDM_InitField( &m_primaryVariable, "PrimaryVariable", defaultPrimaryVariable, "Primary Variable", "", "", "" );
|
||||
|
||||
caf::AppEnum<RimVfpPlot::ProductionVariableType> defaultFamilyVariable = RimVfpPlot::ProductionVariableType::THP;
|
||||
caf::AppEnum<RimVfpDefines::ProductionVariableType> defaultFamilyVariable = RimVfpDefines::ProductionVariableType::THP;
|
||||
CAF_PDM_InitField( &m_familyVariable, "FamilyVariable", defaultFamilyVariable, "Family Variable", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_liquidFlowRateIdx, "LiquidFlowRateIdx", 0, "Liquid Flow Rate", "", "", "" );
|
||||
@ -262,6 +240,75 @@ void RimVfpPlot::updateZoomFromQwt()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimVfpPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString filePath = m_filePath.v().path();
|
||||
if ( !filePath.isEmpty() )
|
||||
{
|
||||
QFileInfo fi( filePath );
|
||||
QString wellName = fi.baseName();
|
||||
|
||||
VfpPlotData plotData;
|
||||
if ( m_tableType() == RimVfpDefines::TableType::PRODUCTION )
|
||||
{
|
||||
if ( m_prodTable )
|
||||
{
|
||||
populatePlotData( *m_prodTable, m_primaryVariable(), m_familyVariable(), m_interpolatedVariable(), plotData );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_injectionTable )
|
||||
{
|
||||
populatePlotData( *m_injectionTable.get(), m_interpolatedVariable(), plotData );
|
||||
}
|
||||
}
|
||||
|
||||
QString plotTitle = generatePlotTitle( wellName,
|
||||
m_tableNumber(),
|
||||
m_tableType(),
|
||||
m_interpolatedVariable(),
|
||||
m_primaryVariable(),
|
||||
m_familyVariable() );
|
||||
|
||||
QString dataText;
|
||||
|
||||
if ( plotData.size() > 0 )
|
||||
{
|
||||
// The curves should have same dimensions
|
||||
const size_t curveSize = plotData.curveSize( 0 );
|
||||
|
||||
// Generate the headers for the columns
|
||||
// First column is the primary variable
|
||||
QString columnTitleLine( plotData.xAxisTitle() );
|
||||
|
||||
// Then one column per "family"
|
||||
for ( size_t s = 0; s < plotData.size(); s++ )
|
||||
{
|
||||
columnTitleLine.append( QString( "\t%1" ).arg( plotData.curveTitle( s ) ) );
|
||||
}
|
||||
columnTitleLine.append( "\n" );
|
||||
|
||||
dataText.append( columnTitleLine );
|
||||
|
||||
// Add the rows: one row per primary variable value
|
||||
for ( size_t idx = 0; idx < curveSize; idx++ )
|
||||
{
|
||||
QString line;
|
||||
|
||||
// First item on each line is the primary variable
|
||||
line.append( QString( "%1" ).arg( plotData.xData( 0 )[idx] ) );
|
||||
|
||||
for ( size_t s = 0; s < plotData.size(); s++ )
|
||||
{
|
||||
line.append( QString( "\t%1" ).arg( plotData.yData( s )[idx] ) );
|
||||
}
|
||||
dataText.append( line );
|
||||
dataText.append( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
return QString( "%1\n\n%2" ).arg( plotTitle ).arg( dataText );
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -351,7 +398,21 @@ RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
{
|
||||
auto plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
// Remove event filter to disable unwanted highlighting on left click in plot.
|
||||
plotWidget->removeEventFilter( plotWidget );
|
||||
plotWidget->canvas()->removeEventFilter( plotWidget );
|
||||
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( plotWidget );
|
||||
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
new RiuContextMenuLauncher( plotWidget, menuBuilder );
|
||||
|
||||
m_plotWidget = plotWidget;
|
||||
}
|
||||
|
||||
updateLegend();
|
||||
onLoadDataAndUpdate();
|
||||
@ -406,9 +467,8 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
||||
RimVfpTableExtractor::extractVfpProductionTables( filePath.toStdString() );
|
||||
if ( !tables.empty() )
|
||||
{
|
||||
// populateVariabelWidgets( tables[0] );
|
||||
m_prodTable.reset( new Opm::VFPProdTable( tables[0] ) );
|
||||
m_tableType = RimVfpPlot::TableType::PRODUCTION;
|
||||
m_prodTable = std::make_unique<Opm::VFPProdTable>( tables[0] );
|
||||
m_tableType = RimVfpDefines::TableType::PRODUCTION;
|
||||
m_tableNumber = tables[0].getTableNum();
|
||||
m_referenceDepth = tables[0].getDatumDepth();
|
||||
m_flowingPhase = getFlowingPhaseType( tables[0] );
|
||||
@ -422,7 +482,8 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
||||
RimVfpTableExtractor::extractVfpInjectionTables( filePath.toStdString() );
|
||||
if ( !tables.empty() )
|
||||
{
|
||||
m_tableType = RimVfpPlot::TableType::INJECTION;
|
||||
m_injectionTable = std::make_unique<Opm::VFPInjTable>( tables[0] );
|
||||
m_tableType = RimVfpDefines::TableType::INJECTION;
|
||||
m_tableNumber = tables[0].getTableNum();
|
||||
m_referenceDepth = tables[0].getDatumDepth();
|
||||
m_flowingPhase = getFlowingPhaseType( tables[0] );
|
||||
@ -430,8 +491,12 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
updatePlotTitle(
|
||||
generatePlotTitle( wellName, m_tableType(), m_interpolatedVariable(), m_primaryVariable(), m_familyVariable() ) );
|
||||
updatePlotTitle( generatePlotTitle( wellName,
|
||||
m_tableNumber(),
|
||||
m_tableType(),
|
||||
m_interpolatedVariable(),
|
||||
m_primaryVariable(),
|
||||
m_familyVariable() ) );
|
||||
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
@ -445,23 +510,29 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, const Opm::VFPInjTable& table )
|
||||
{
|
||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
VfpPlotData plotData;
|
||||
populatePlotData( table, m_interpolatedVariable(), plotData );
|
||||
populatePlotWidgetWithPlotData( plotWidget, plotData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::populatePlotData( const Opm::VFPInjTable& table,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
VfpPlotData& plotData ) const
|
||||
{
|
||||
QString xAxisTitle =
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText(
|
||||
RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ),
|
||||
getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ) );
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpDefines::ProductionVariableType>::uiText(
|
||||
RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE ),
|
||||
getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE ) );
|
||||
|
||||
plotWidget->setAxisTitleText( QwtPlot::xBottom, xAxisTitle );
|
||||
plotData.setXAxisTitle( xAxisTitle );
|
||||
|
||||
QString yAxisTitle =
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
|
||||
getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType::THP ) );
|
||||
plotWidget->setAxisTitleText( QwtPlot::yLeft, yAxisTitle );
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpDefines::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
|
||||
getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType::THP ) );
|
||||
plotData.setYAxisTitle( yAxisTitle );
|
||||
|
||||
std::vector<double> thpValues = table.getTHPAxis();
|
||||
|
||||
@ -473,27 +544,60 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget,
|
||||
for ( size_t y = 0; y < numValues; y++ )
|
||||
{
|
||||
yVals[y] = table( thp, y );
|
||||
if ( m_interpolatedVariable == RimVfpPlot::InterpolatedVariableType::BHP_THP_DIFF )
|
||||
if ( m_interpolatedVariable == RimVfpDefines::InterpolatedVariableType::BHP_THP_DIFF )
|
||||
{
|
||||
yVals[y] -= thpValues[thp];
|
||||
}
|
||||
}
|
||||
|
||||
double value = convertToDisplayUnit( thpValues[thp], RimVfpPlot::ProductionVariableType::THP );
|
||||
QString unit = getDisplayUnit( RimVfpPlot::ProductionVariableType::THP );
|
||||
QString title =
|
||||
QString( "%1: %2 %3" )
|
||||
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( RimVfpPlot::ProductionVariableType::THP ) )
|
||||
.arg( value )
|
||||
.arg( unit );
|
||||
double value = convertToDisplayUnit( thpValues[thp], RimVfpDefines::ProductionVariableType::THP );
|
||||
QString unit = getDisplayUnit( RimVfpDefines::ProductionVariableType::THP );
|
||||
QString title = QString( "%1: %2 %3" )
|
||||
.arg( caf::AppEnum<RimVfpDefines::ProductionVariableType>::uiText(
|
||||
RimVfpDefines::ProductionVariableType::THP ) )
|
||||
.arg( value )
|
||||
.arg( unit );
|
||||
|
||||
QColor qtClr = RiaColorTables::wellLogPlotPaletteColors().cycledQColor( thp );
|
||||
QwtPlotCurve* curve = createPlotCurve( title, qtClr );
|
||||
convertToDisplayUnit( yVals, RimVfpDefines::ProductionVariableType::THP );
|
||||
convertToDisplayUnit( xVals, RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE );
|
||||
|
||||
convertToDisplayUnit( yVals, RimVfpPlot::ProductionVariableType::THP );
|
||||
convertToDisplayUnit( xVals, RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE );
|
||||
plotData.appendCurve( title, xVals, yVals );
|
||||
}
|
||||
}
|
||||
|
||||
curve->setSamples( xVals.data(), yVals.data(), numValues );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget,
|
||||
const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable )
|
||||
{
|
||||
VfpPlotData plotData;
|
||||
populatePlotData( table, primaryVariable, familyVariable, m_interpolatedVariable(), plotData );
|
||||
populatePlotWidgetWithPlotData( plotWidget, plotData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::populatePlotWidgetWithPlotData( RiuQwtPlotWidget* plotWidget, const VfpPlotData& plotData )
|
||||
{
|
||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
plotWidget->setAxisTitleText( QwtPlot::xBottom, plotData.xAxisTitle() );
|
||||
plotWidget->setAxisTitleText( QwtPlot::yLeft, plotData.yAxisTitle() );
|
||||
|
||||
for ( auto idx = 0u; idx < plotData.size(); idx++ )
|
||||
{
|
||||
QColor qtClr = RiaColorTables::summaryCurveDefaultPaletteColors().cycledQColor( idx );
|
||||
QwtPlotCurve* curve = createPlotCurve( plotData.curveTitle( idx ), qtClr );
|
||||
curve->setSamples( plotData.xData( idx ).data(),
|
||||
plotData.yData( idx ).data(),
|
||||
static_cast<int>( plotData.curveSize( idx ) ) );
|
||||
curve->attach( plotWidget );
|
||||
curve->show();
|
||||
}
|
||||
@ -502,32 +606,27 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget,
|
||||
const Opm::VFPProdTable& table,
|
||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||
RimVfpPlot::ProductionVariableType familyVariable )
|
||||
void RimVfpPlot::populatePlotData( const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
VfpPlotData& plotData ) const
|
||||
{
|
||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
|
||||
QString xAxisTitle =
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( primaryVariable ),
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpDefines::ProductionVariableType>::uiText( primaryVariable ),
|
||||
getDisplayUnitWithBracket( primaryVariable ) );
|
||||
plotWidget->setAxisTitleText( QwtPlot::xBottom, xAxisTitle );
|
||||
plotData.setXAxisTitle( xAxisTitle );
|
||||
QString yAxisTitle =
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
|
||||
getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType::THP ) );
|
||||
plotWidget->setAxisTitleText( QwtPlot::yLeft, yAxisTitle );
|
||||
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpDefines::InterpolatedVariableType>::uiText( interpolatedVariable ),
|
||||
getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType::THP ) );
|
||||
plotData.setYAxisTitle( yAxisTitle );
|
||||
|
||||
size_t numFamilyValues = getProductionTableData( table, familyVariable ).size();
|
||||
for ( size_t familyIdx = 0; familyIdx < numFamilyValues; familyIdx++ )
|
||||
{
|
||||
std::vector<double> primaryAxisValues = getProductionTableData( table, primaryVariable );
|
||||
std::vector<double> familyVariableValues = getProductionTableData( table, familyVariable );
|
||||
std::vector<double> thpValues = getProductionTableData( table, RimVfpPlot::ProductionVariableType::THP );
|
||||
std::vector<double> thpValues = getProductionTableData( table, RimVfpDefines::ProductionVariableType::THP );
|
||||
|
||||
size_t numValues = primaryAxisValues.size();
|
||||
std::vector<double> yVals( numValues, 0.0 );
|
||||
@ -535,34 +634,38 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget*
|
||||
for ( size_t y = 0; y < numValues; y++ )
|
||||
{
|
||||
size_t wfr_idx = getVariableIndex( table,
|
||||
RimVfpPlot::ProductionVariableType::WATER_CUT,
|
||||
RimVfpDefines::ProductionVariableType::WATER_CUT,
|
||||
primaryVariable,
|
||||
y,
|
||||
familyVariable,
|
||||
familyIdx );
|
||||
size_t gfr_idx = getVariableIndex( table,
|
||||
RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO,
|
||||
RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO,
|
||||
primaryVariable,
|
||||
y,
|
||||
familyVariable,
|
||||
familyIdx );
|
||||
size_t alq_idx = getVariableIndex( table,
|
||||
RimVfpPlot::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY,
|
||||
RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY,
|
||||
primaryVariable,
|
||||
y,
|
||||
familyVariable,
|
||||
familyIdx );
|
||||
size_t flo_idx = getVariableIndex( table,
|
||||
RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE,
|
||||
RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE,
|
||||
primaryVariable,
|
||||
y,
|
||||
familyVariable,
|
||||
familyIdx );
|
||||
size_t thp_idx = getVariableIndex( table,
|
||||
RimVfpDefines::ProductionVariableType::THP,
|
||||
primaryVariable,
|
||||
y,
|
||||
familyVariable,
|
||||
familyIdx );
|
||||
size_t thp_idx =
|
||||
getVariableIndex( table, RimVfpPlot::ProductionVariableType::THP, primaryVariable, y, familyVariable, familyIdx );
|
||||
|
||||
yVals[y] = table( thp_idx, wfr_idx, gfr_idx, alq_idx, flo_idx );
|
||||
if ( m_interpolatedVariable == RimVfpPlot::InterpolatedVariableType::BHP_THP_DIFF )
|
||||
if ( m_interpolatedVariable == RimVfpDefines::InterpolatedVariableType::BHP_THP_DIFF )
|
||||
{
|
||||
yVals[y] -= thpValues[thp_idx];
|
||||
}
|
||||
@ -571,19 +674,14 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget*
|
||||
double familyValue = convertToDisplayUnit( familyVariableValues[familyIdx], familyVariable );
|
||||
QString familyUnit = getDisplayUnit( familyVariable );
|
||||
QString familyTitle = QString( "%1: %2 %3" )
|
||||
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( familyVariable ) )
|
||||
.arg( caf::AppEnum<RimVfpDefines::ProductionVariableType>::uiText( familyVariable ) )
|
||||
.arg( familyValue )
|
||||
.arg( familyUnit );
|
||||
|
||||
QColor qtClr = RiaColorTables::wellLogPlotPaletteColors().cycledQColor( familyIdx );
|
||||
QwtPlotCurve* curve = createPlotCurve( familyTitle, qtClr );
|
||||
|
||||
convertToDisplayUnit( yVals, RimVfpPlot::ProductionVariableType::THP );
|
||||
convertToDisplayUnit( yVals, RimVfpDefines::ProductionVariableType::THP );
|
||||
convertToDisplayUnit( primaryAxisValues, primaryVariable );
|
||||
|
||||
curve->setSamples( primaryAxisValues.data(), yVals.data(), numValues );
|
||||
curve->attach( plotWidget );
|
||||
curve->show();
|
||||
plotData.appendCurve( familyTitle, primaryAxisValues, yVals );
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,13 +709,13 @@ QwtPlotCurve* RimVfpPlot::createPlotCurve( const QString title, const QColor& co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimVfpPlot::convertToDisplayUnit( double value, RimVfpPlot::ProductionVariableType variableType )
|
||||
double RimVfpPlot::convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType )
|
||||
{
|
||||
if ( variableType == RimVfpPlot::ProductionVariableType::THP )
|
||||
if ( variableType == RimVfpDefines::ProductionVariableType::THP )
|
||||
{
|
||||
return RiaEclipseUnitTools::pascalToBar( value );
|
||||
}
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
{
|
||||
// Convert to m3/sec to m3/day
|
||||
return value * static_cast<double>( 24 * 60 * 60 );
|
||||
@ -629,16 +727,16 @@ double RimVfpPlot::convertToDisplayUnit( double value, RimVfpPlot::ProductionVar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::convertToDisplayUnit( std::vector<double>& values, RimVfpPlot::ProductionVariableType variableType )
|
||||
void RimVfpPlot::convertToDisplayUnit( std::vector<double>& values, RimVfpDefines::ProductionVariableType variableType )
|
||||
{
|
||||
for ( size_t i = 0; i < values.size(); i++ )
|
||||
values[i] = convertToDisplayUnit( values[i], variableType );
|
||||
for ( double& value : values )
|
||||
value = convertToDisplayUnit( value, variableType );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimVfpPlot::getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType variableType )
|
||||
QString RimVfpPlot::getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType variableType )
|
||||
{
|
||||
QString unit = getDisplayUnit( variableType );
|
||||
if ( !unit.isEmpty() )
|
||||
@ -650,15 +748,15 @@ QString RimVfpPlot::getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableTyp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimVfpPlot::getDisplayUnit( RimVfpPlot::ProductionVariableType variableType )
|
||||
QString RimVfpPlot::getDisplayUnit( RimVfpDefines::ProductionVariableType variableType )
|
||||
|
||||
{
|
||||
if ( variableType == RimVfpPlot::ProductionVariableType::THP )
|
||||
if ( variableType == RimVfpDefines::ProductionVariableType::THP )
|
||||
return "Bar";
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
return "m3/day";
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::WATER_CUT ||
|
||||
variableType == RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::WATER_CUT ||
|
||||
variableType == RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
@ -666,27 +764,27 @@ QString RimVfpPlot::getDisplayUnit( RimVfpPlot::ProductionVariableType variableT
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimVfpPlot::getProductionTableData( const Opm::VFPProdTable& table,
|
||||
RimVfpPlot::ProductionVariableType variableType ) const
|
||||
std::vector<double> RimVfpPlot::getProductionTableData( const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType variableType ) const
|
||||
{
|
||||
std::vector<double> xVals;
|
||||
if ( variableType == RimVfpPlot::ProductionVariableType::WATER_CUT )
|
||||
if ( variableType == RimVfpDefines::ProductionVariableType::WATER_CUT )
|
||||
{
|
||||
xVals = table.getWFRAxis();
|
||||
}
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||
{
|
||||
xVals = table.getGFRAxis();
|
||||
}
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY )
|
||||
{
|
||||
xVals = table.getALQAxis();
|
||||
}
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
{
|
||||
xVals = table.getFloAxis();
|
||||
}
|
||||
else if ( variableType == RimVfpPlot::ProductionVariableType::THP )
|
||||
else if ( variableType == RimVfpDefines::ProductionVariableType::THP )
|
||||
{
|
||||
xVals = table.getTHPAxis();
|
||||
}
|
||||
@ -697,12 +795,12 @@ std::vector<double> RimVfpPlot::getProductionTableData( const Opm::VFPProdTable&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimVfpPlot::getVariableIndex( const Opm::VFPProdTable& table,
|
||||
RimVfpPlot::ProductionVariableType targetVariable,
|
||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||
size_t primaryValue,
|
||||
RimVfpPlot::ProductionVariableType familyVariable,
|
||||
size_t familyValue ) const
|
||||
size_t RimVfpPlot::getVariableIndex( const Opm::VFPProdTable& table,
|
||||
RimVfpDefines::ProductionVariableType targetVariable,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
size_t primaryValue,
|
||||
RimVfpDefines::ProductionVariableType familyVariable,
|
||||
size_t familyValue ) const
|
||||
{
|
||||
if ( targetVariable == primaryVariable )
|
||||
return primaryValue;
|
||||
@ -710,23 +808,23 @@ size_t RimVfpPlot::getVariableIndex( const Opm::VFPProdTable& table,
|
||||
return familyValue;
|
||||
else
|
||||
{
|
||||
if ( targetVariable == RimVfpPlot::ProductionVariableType::WATER_CUT )
|
||||
if ( targetVariable == RimVfpDefines::ProductionVariableType::WATER_CUT )
|
||||
{
|
||||
return m_waterCutIdx;
|
||||
}
|
||||
else if ( targetVariable == RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||
else if ( targetVariable == RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||
{
|
||||
return m_gasLiquidRatioIdx;
|
||||
}
|
||||
else if ( targetVariable == RimVfpPlot::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY )
|
||||
else if ( targetVariable == RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY )
|
||||
{
|
||||
return m_articifialLiftQuantityIdx;
|
||||
}
|
||||
else if ( targetVariable == RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
else if ( targetVariable == RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||
{
|
||||
return m_liquidFlowRateIdx;
|
||||
}
|
||||
else if ( targetVariable == RimVfpPlot::ProductionVariableType::THP )
|
||||
else if ( targetVariable == RimVfpDefines::ProductionVariableType::THP )
|
||||
{
|
||||
return m_thpIdx;
|
||||
}
|
||||
@ -750,7 +848,7 @@ void RimVfpPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
uiOrdering.add( &m_interpolatedVariable );
|
||||
uiOrdering.add( &m_flowingPhase );
|
||||
|
||||
if ( m_tableType == RimVfpPlot::TableType::PRODUCTION )
|
||||
if ( m_tableType == RimVfpDefines::TableType::PRODUCTION )
|
||||
{
|
||||
uiOrdering.add( &m_flowingWaterFraction );
|
||||
uiOrdering.add( &m_flowingGasFraction );
|
||||
@ -766,12 +864,12 @@ void RimVfpPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
fixedVariablesGroup->add( &m_gasLiquidRatioIdx );
|
||||
|
||||
// Disable the choices for variables as primary or family
|
||||
setFixedVariableUiEditability( m_liquidFlowRateIdx, RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE );
|
||||
setFixedVariableUiEditability( m_thpIdx, RimVfpPlot::ProductionVariableType::THP );
|
||||
setFixedVariableUiEditability( m_liquidFlowRateIdx, RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE );
|
||||
setFixedVariableUiEditability( m_thpIdx, RimVfpDefines::ProductionVariableType::THP );
|
||||
setFixedVariableUiEditability( m_articifialLiftQuantityIdx,
|
||||
RimVfpPlot::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY );
|
||||
setFixedVariableUiEditability( m_waterCutIdx, RimVfpPlot::ProductionVariableType::WATER_CUT );
|
||||
setFixedVariableUiEditability( m_gasLiquidRatioIdx, RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO );
|
||||
RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY );
|
||||
setFixedVariableUiEditability( m_waterCutIdx, RimVfpDefines::ProductionVariableType::WATER_CUT );
|
||||
setFixedVariableUiEditability( m_gasLiquidRatioIdx, RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO );
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,7 +879,8 @@ void RimVfpPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::setFixedVariableUiEditability( caf::PdmField<int>& field, RimVfpPlot::ProductionVariableType variableType )
|
||||
void RimVfpPlot::setFixedVariableUiEditability( caf::PdmField<int>& field,
|
||||
RimVfpDefines::ProductionVariableType variableType )
|
||||
{
|
||||
field.uiCapability()->setUiReadOnly( variableType == m_primaryVariable.v() || variableType == m_familyVariable.v() );
|
||||
}
|
||||
@ -796,27 +895,27 @@ QList<caf::PdmOptionItemInfo> RimVfpPlot::calculateValueOptions( const caf::PdmF
|
||||
|
||||
if ( fieldNeedingOptions == &m_liquidFlowRateIdx )
|
||||
{
|
||||
calculateTableValueOptions( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE, options );
|
||||
calculateTableValueOptions( RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE, options );
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_thpIdx )
|
||||
{
|
||||
calculateTableValueOptions( RimVfpPlot::ProductionVariableType::THP, options );
|
||||
calculateTableValueOptions( RimVfpDefines::ProductionVariableType::THP, options );
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_articifialLiftQuantityIdx )
|
||||
{
|
||||
calculateTableValueOptions( RimVfpPlot::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY, options );
|
||||
calculateTableValueOptions( RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY, options );
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_waterCutIdx )
|
||||
{
|
||||
calculateTableValueOptions( RimVfpPlot::ProductionVariableType::WATER_CUT, options );
|
||||
calculateTableValueOptions( RimVfpDefines::ProductionVariableType::WATER_CUT, options );
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_gasLiquidRatioIdx )
|
||||
{
|
||||
calculateTableValueOptions( RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO, options );
|
||||
calculateTableValueOptions( RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO, options );
|
||||
}
|
||||
|
||||
return options;
|
||||
@ -825,80 +924,80 @@ QList<caf::PdmOptionItemInfo> RimVfpPlot::calculateValueOptions( const caf::PdmF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot::FlowingPhaseType RimVfpPlot::getFlowingPhaseType( const Opm::VFPProdTable& table )
|
||||
RimVfpDefines::FlowingPhaseType RimVfpPlot::getFlowingPhaseType( const Opm::VFPProdTable& table )
|
||||
{
|
||||
switch ( table.getFloType() )
|
||||
{
|
||||
case Opm::VFPProdTable::FLO_OIL:
|
||||
return RimVfpPlot::FlowingPhaseType::OIL;
|
||||
return RimVfpDefines::FlowingPhaseType::OIL;
|
||||
case Opm::VFPProdTable::FLO_GAS:
|
||||
return RimVfpPlot::FlowingPhaseType::GAS;
|
||||
return RimVfpDefines::FlowingPhaseType::GAS;
|
||||
case Opm::VFPProdTable::FLO_LIQ:
|
||||
return RimVfpPlot::FlowingPhaseType::LIQUID;
|
||||
return RimVfpDefines::FlowingPhaseType::LIQUID;
|
||||
default:
|
||||
return FlowingPhaseType::INVALID;
|
||||
return RimVfpDefines::FlowingPhaseType::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot::FlowingPhaseType RimVfpPlot::getFlowingPhaseType( const Opm::VFPInjTable& table )
|
||||
RimVfpDefines::FlowingPhaseType RimVfpPlot::getFlowingPhaseType( const Opm::VFPInjTable& table )
|
||||
{
|
||||
switch ( table.getFloType() )
|
||||
{
|
||||
case Opm::VFPInjTable::FLO_OIL:
|
||||
return RimVfpPlot::FlowingPhaseType::OIL;
|
||||
return RimVfpDefines::FlowingPhaseType::OIL;
|
||||
case Opm::VFPInjTable::FLO_GAS:
|
||||
return RimVfpPlot::FlowingPhaseType::GAS;
|
||||
return RimVfpDefines::FlowingPhaseType::GAS;
|
||||
case Opm::VFPInjTable::FLO_WAT:
|
||||
return RimVfpPlot::FlowingPhaseType::WATER;
|
||||
return RimVfpDefines::FlowingPhaseType::WATER;
|
||||
default:
|
||||
return RimVfpPlot::FlowingPhaseType::INVALID;
|
||||
return RimVfpDefines::FlowingPhaseType::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot::FlowingGasFractionType RimVfpPlot::getFlowingGasFractionType( const Opm::VFPProdTable& table )
|
||||
RimVfpDefines::FlowingGasFractionType RimVfpPlot::getFlowingGasFractionType( const Opm::VFPProdTable& table )
|
||||
{
|
||||
switch ( table.getGFRType() )
|
||||
{
|
||||
case Opm::VFPProdTable::GFR_GOR:
|
||||
return RimVfpPlot::FlowingGasFractionType::GOR;
|
||||
return RimVfpDefines::FlowingGasFractionType::GOR;
|
||||
case Opm::VFPProdTable::GFR_GLR:
|
||||
return RimVfpPlot::FlowingGasFractionType::GLR;
|
||||
return RimVfpDefines::FlowingGasFractionType::GLR;
|
||||
case Opm::VFPProdTable::GFR_OGR:
|
||||
return RimVfpPlot::FlowingGasFractionType::OGR;
|
||||
return RimVfpDefines::FlowingGasFractionType::OGR;
|
||||
default:
|
||||
return RimVfpPlot::FlowingGasFractionType::INVALID;
|
||||
return RimVfpDefines::FlowingGasFractionType::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot::FlowingWaterFractionType RimVfpPlot::getFlowingWaterFractionType( const Opm::VFPProdTable& table )
|
||||
RimVfpDefines::FlowingWaterFractionType RimVfpPlot::getFlowingWaterFractionType( const Opm::VFPProdTable& table )
|
||||
{
|
||||
switch ( table.getWFRType() )
|
||||
{
|
||||
case Opm::VFPProdTable::WFR_WOR:
|
||||
return RimVfpPlot::FlowingWaterFractionType::WOR;
|
||||
return RimVfpDefines::FlowingWaterFractionType::WOR;
|
||||
case Opm::VFPProdTable::WFR_WCT:
|
||||
return RimVfpPlot::FlowingWaterFractionType::WCT;
|
||||
return RimVfpDefines::FlowingWaterFractionType::WCT;
|
||||
case Opm::VFPProdTable::WFR_WGR:
|
||||
return RimVfpPlot::FlowingWaterFractionType::WGR;
|
||||
return RimVfpDefines::FlowingWaterFractionType::WGR;
|
||||
default:
|
||||
return RimVfpPlot::FlowingWaterFractionType::INVALID;
|
||||
return RimVfpDefines::FlowingWaterFractionType::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::calculateTableValueOptions( RimVfpPlot::ProductionVariableType variableType,
|
||||
QList<caf::PdmOptionItemInfo>& options )
|
||||
void RimVfpPlot::calculateTableValueOptions( RimVfpDefines::ProductionVariableType variableType,
|
||||
QList<caf::PdmOptionItemInfo>& options )
|
||||
{
|
||||
if ( m_prodTable )
|
||||
{
|
||||
@ -942,17 +1041,23 @@ void RimVfpPlot::updatePlotTitle( const QString& plotTitle )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimVfpPlot::generatePlotTitle( const QString& wellName,
|
||||
RimVfpPlot::TableType tableType,
|
||||
RimVfpPlot::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||
RimVfpPlot::ProductionVariableType familyVariable )
|
||||
QString RimVfpPlot::generatePlotTitle( const QString& wellName,
|
||||
int tableNumber,
|
||||
RimVfpDefines::TableType tableType,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable )
|
||||
{
|
||||
QString tableTypeText = caf::AppEnum<RimVfpPlot::TableType>::uiText( tableType );
|
||||
QString interpolatedVariableText = caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( interpolatedVariable );
|
||||
QString primaryVariableText = caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( primaryVariable );
|
||||
QString plotTitleStr =
|
||||
QString( "VFP: %1 (%2) - %3 x %4" ).arg( wellName ).arg( tableTypeText ).arg( interpolatedVariableText ).arg( primaryVariableText );
|
||||
QString tableTypeText = caf::AppEnum<RimVfpDefines::TableType>::uiText( tableType );
|
||||
QString interpolatedVariableText =
|
||||
caf::AppEnum<RimVfpDefines::InterpolatedVariableType>::uiText( interpolatedVariable );
|
||||
QString primaryVariableText = caf::AppEnum<RimVfpDefines::ProductionVariableType>::uiText( primaryVariable );
|
||||
QString plotTitleStr = QString( "VFP: %1 (%2) #%3 - %4 x %5" )
|
||||
.arg( wellName )
|
||||
.arg( tableTypeText )
|
||||
.arg( tableNumber )
|
||||
.arg( interpolatedVariableText )
|
||||
.arg( primaryVariableText );
|
||||
|
||||
return plotTitleStr;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimVfpDefines.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
@ -29,6 +30,7 @@
|
||||
#include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp"
|
||||
|
||||
class RiuQwtPlotWidget;
|
||||
class VfpPlotData;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Vertical Flow Performance Plot
|
||||
@ -38,52 +40,6 @@ class RimVfpPlot : public RimPlot
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class InterpolatedVariableType
|
||||
{
|
||||
BHP,
|
||||
BHP_THP_DIFF
|
||||
};
|
||||
|
||||
enum class TableType
|
||||
{
|
||||
INJECTION,
|
||||
PRODUCTION
|
||||
};
|
||||
|
||||
enum class ProductionVariableType
|
||||
{
|
||||
LIQUID_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
|
||||
};
|
||||
|
||||
RimVfpPlot();
|
||||
~RimVfpPlot() override;
|
||||
|
||||
@ -124,18 +80,18 @@ private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override;
|
||||
|
||||
void populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, const Opm::VFPInjTable& table );
|
||||
void populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget,
|
||||
const Opm::VFPProdTable& table,
|
||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||
RimVfpPlot::ProductionVariableType familyVariable );
|
||||
std::vector<double> getProductionTableData( const Opm::VFPProdTable& table,
|
||||
RimVfpPlot::ProductionVariableType variableType ) const;
|
||||
size_t getVariableIndex( const Opm::VFPProdTable& table,
|
||||
RimVfpPlot::ProductionVariableType targetVariable,
|
||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||
size_t primaryValue,
|
||||
RimVfpPlot::ProductionVariableType familyVariable,
|
||||
size_t familyValue ) const;
|
||||
void populatePlotWidgetWithCurveData( RiuQwtPlotWidget* 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;
|
||||
@ -143,44 +99,57 @@ private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void calculateTableValueOptions( RimVfpPlot::ProductionVariableType variableType,
|
||||
QList<caf::PdmOptionItemInfo>& options );
|
||||
void calculateTableValueOptions( RimVfpDefines::ProductionVariableType variableType,
|
||||
QList<caf::PdmOptionItemInfo>& options );
|
||||
|
||||
void setFixedVariableUiEditability( caf::PdmField<int>& field, RimVfpPlot::ProductionVariableType variableType );
|
||||
void setFixedVariableUiEditability( caf::PdmField<int>& field, RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
void updatePlotTitle( const QString& plotTitle );
|
||||
static QString generatePlotTitle( const QString& wellName,
|
||||
RimVfpPlot::TableType tableType,
|
||||
RimVfpPlot::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||
RimVfpPlot::ProductionVariableType familyVariable );
|
||||
static QString generatePlotTitle( const QString& wellName,
|
||||
int tableNumber,
|
||||
RimVfpDefines::TableType tableType,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
RimVfpDefines::ProductionVariableType primaryVariable,
|
||||
RimVfpDefines::ProductionVariableType familyVariable );
|
||||
|
||||
static QwtPlotCurve* createPlotCurve( const QString title, const QColor& color );
|
||||
static double convertToDisplayUnit( double value, RimVfpPlot::ProductionVariableType variableType );
|
||||
static void convertToDisplayUnit( std::vector<double>& values, RimVfpPlot::ProductionVariableType variableType );
|
||||
static double convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType );
|
||||
static void convertToDisplayUnit( std::vector<double>& values, RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
static QString getDisplayUnit( RimVfpPlot::ProductionVariableType variableType );
|
||||
static QString getDisplayUnit( RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
static QString getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType variableType );
|
||||
static QString getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType variableType );
|
||||
|
||||
static RimVfpPlot::FlowingPhaseType getFlowingPhaseType( const Opm::VFPProdTable& table );
|
||||
static RimVfpPlot::FlowingPhaseType getFlowingPhaseType( const Opm::VFPInjTable& table );
|
||||
static RimVfpPlot::FlowingWaterFractionType getFlowingWaterFractionType( const Opm::VFPProdTable& table );
|
||||
static RimVfpPlot::FlowingGasFractionType getFlowingGasFractionType( const Opm::VFPProdTable& table );
|
||||
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,
|
||||
VfpPlotData& plotData ) const;
|
||||
|
||||
void populatePlotData( const Opm::VFPInjTable& table,
|
||||
RimVfpDefines::InterpolatedVariableType interpolatedVariable,
|
||||
VfpPlotData& plotData ) const;
|
||||
|
||||
void populatePlotWidgetWithPlotData( RiuQwtPlotWidget* plotWidget, const VfpPlotData& plotData );
|
||||
|
||||
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<RimVfpPlot::FlowingPhaseType>> m_flowingPhase;
|
||||
caf::PdmField<caf::AppEnum<RimVfpPlot::FlowingWaterFractionType>> m_flowingWaterFraction;
|
||||
caf::PdmField<caf::AppEnum<RimVfpPlot::FlowingGasFractionType>> m_flowingGasFraction;
|
||||
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<RimVfpPlot::TableType>> m_tableType;
|
||||
caf::PdmField<caf::AppEnum<RimVfpPlot::InterpolatedVariableType>> m_interpolatedVariable;
|
||||
caf::PdmField<caf::AppEnum<RimVfpPlot::ProductionVariableType>> m_primaryVariable;
|
||||
caf::PdmField<caf::AppEnum<RimVfpPlot::ProductionVariableType>> m_familyVariable;
|
||||
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_liquidFlowRateIdx;
|
||||
caf::PdmField<int> m_thpIdx;
|
||||
@ -190,4 +159,5 @@ private:
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
std::unique_ptr<Opm::VFPProdTable> m_prodTable;
|
||||
std::unique_ptr<Opm::VFPInjTable> m_injectionTable;
|
||||
};
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuPlotAnnotationTool.h"
|
||||
#include "RiuQwtCurvePointTracker.h"
|
||||
@ -105,6 +106,16 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren
|
||||
this->canvas()->installEventFilter( this );
|
||||
|
||||
setInternalQwtLegendVisible( true );
|
||||
|
||||
{
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
|
||||
new RiuContextMenuLauncher( this, menuBuilder );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -170,28 +181,6 @@ void RiuGridCrossQwtPlot::setInternalQwtLegendVisible( bool visible )
|
||||
this->insertLegend( nullptr );
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridCrossQwtPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
{
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
emit plotSelected( false );
|
||||
|
||||
menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
|
||||
menuBuilder.appendToMenu( &menu );
|
||||
|
||||
if ( menu.actions().size() > 0 )
|
||||
{
|
||||
menu.exec( event->globalPos() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,8 +62,6 @@ public:
|
||||
void setInternalQwtLegendVisible( bool visible );
|
||||
|
||||
protected:
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
|
||||
bool curveText( const QwtPlotCurve* curve, QString* curveTitle, QString* xParamName, QString* yParamName ) const;
|
||||
bool isZoomerActive() const override;
|
||||
void endZoomOperations() override;
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "qwt_plot_grid.h"
|
||||
#include "qwt_plot_layout.h"
|
||||
#include "qwt_plot_marker.h"
|
||||
#include "qwt_plot_picker.h"
|
||||
#include "qwt_plot_renderer.h"
|
||||
#include "qwt_plot_shapeitem.h"
|
||||
#include "qwt_scale_draw.h"
|
||||
|
@ -40,7 +40,6 @@ class QwtPlotCurve;
|
||||
class QwtPlotGrid;
|
||||
class QwtPlotItem;
|
||||
class QwtPlotMarker;
|
||||
class QwtPlotPicker;
|
||||
|
||||
class QEvent;
|
||||
class QLabel;
|
||||
@ -179,7 +178,6 @@ private:
|
||||
QPoint m_clickPosition;
|
||||
std::map<QwtPlot::Axis, QString> m_axisTitles;
|
||||
std::map<QwtPlot::Axis, bool> m_axisTitlesEnabled;
|
||||
QPointer<QwtPlotPicker> m_plotPicker;
|
||||
const int m_overlayMargins;
|
||||
QString m_plotTitle;
|
||||
bool m_plotTitleEnabled;
|
||||
|
63
ApplicationLibCode/UserInterface/RiuVfpQwtPlot.cpp
Normal file
63
ApplicationLibCode/UserInterface/RiuVfpQwtPlot.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiuVfpQwtPlot.h"
|
||||
|
||||
#include "RiuQwtPlotTools.h"
|
||||
|
||||
#include "RimVfpPlot.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuVfpQwtPlot::RiuVfpQwtPlot( RimVfpPlot* plot, QWidget* parent /*= nullptr*/ )
|
||||
: RiuQwtPlotWidget( plot, parent )
|
||||
{
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( this );
|
||||
|
||||
// Remove event filter to disable unwanted highlighting
|
||||
// on left click in plot.
|
||||
removeEventFilter( this );
|
||||
canvas()->removeEventFilter( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuVfpQwtPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
{
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
emit plotSelected( false );
|
||||
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
|
||||
menuBuilder.appendToMenu( &menu );
|
||||
|
||||
if ( menu.actions().size() > 0 )
|
||||
{
|
||||
menu.exec( event->globalPos() );
|
||||
}
|
||||
}
|
38
ApplicationLibCode/UserInterface/RiuVfpQwtPlot.h
Normal file
38
ApplicationLibCode/UserInterface/RiuVfpQwtPlot.h
Normal file
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RiuInterfaceToViewWindow.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
class RimVfpPlot;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuVfpQwtPlot : public RiuQwtPlotWidget
|
||||
{
|
||||
public:
|
||||
RiuVfpQwtPlot( RimVfpPlot* plot, QWidget* parent = nullptr );
|
||||
|
||||
protected:
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
};
|
@ -32,7 +32,6 @@
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
|
||||
@ -75,16 +74,16 @@ RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinit
|
||||
m_legendWidget = new RiuNightchartsWidget( this );
|
||||
new RiuPlotObjectPicker( m_legendWidget, m_plotDefinition->plotLegend() );
|
||||
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
new RiuContextMenuLauncher( m_legendWidget, menuBuilder );
|
||||
caf::CmdFeatureMenuBuilder menuForSubWidgets;
|
||||
menuForSubWidgets << "RicShowTotalAllocationDataFeature";
|
||||
new RiuContextMenuLauncher( m_legendWidget, menuForSubWidgets );
|
||||
|
||||
leftColumnLayout->addWidget( m_legendWidget );
|
||||
m_legendWidget->showPie( false );
|
||||
|
||||
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget( this );
|
||||
new RiuPlotObjectPicker( totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot() );
|
||||
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
|
||||
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuForSubWidgets );
|
||||
|
||||
leftColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
|
||||
leftColumnLayout->addWidget( m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ),
|
||||
@ -94,6 +93,16 @@ RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinit
|
||||
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget();
|
||||
|
||||
plotWidgetsLayout->addWidget( wellFlowWidget );
|
||||
|
||||
{
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
menuBuilder << "RicShowCumulativePhasePlotFeature";
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
|
||||
new RiuContextMenuLauncher( this, menuBuilder );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -176,25 +185,6 @@ QSize RiuWellAllocationPlot::minimumSizeHint() const
|
||||
return QSize( 0, 100 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
{
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
menuBuilder << "RicShowCumulativePhasePlotFeature";
|
||||
|
||||
menuBuilder.appendToMenu( &menu );
|
||||
|
||||
if ( menu.actions().size() > 0 )
|
||||
{
|
||||
menu.exec( event->globalPos() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -63,8 +63,6 @@ protected:
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
|
||||
private:
|
||||
void setDefaults();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user