mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7052 Add colors and names for VPF curves.
This commit is contained in:
parent
c51b4ff7cd
commit
1724451c45
@ -46,7 +46,7 @@ public:
|
|||||||
static double meterToMm( double meter ) { return 1000.0 * meter; }
|
static double meterToMm( double meter ) { return 1000.0 * meter; }
|
||||||
|
|
||||||
static double barToPascal( double bar ) { return bar * 100000.0; }
|
static double barToPascal( double bar ) { return bar * 100000.0; }
|
||||||
static double pascalToBar( double pascal ) { return pascal / 100000.0; }
|
static double pascalToBar( double pas ) { return pas / 100000.0; }
|
||||||
|
|
||||||
static double barToPsi( double bar ) { return bar * 14.5038; }
|
static double barToPsi( double bar ) { return bar * 14.5038; }
|
||||||
static double barPerMeterToPsiPerFeet( double barPerMeter ) { return barPerMeter * 4.42075; }
|
static double barPerMeterToPsiPerFeet( double barPerMeter ) { return barPerMeter * 4.42075; }
|
||||||
|
@ -18,35 +18,21 @@
|
|||||||
|
|
||||||
#include "RimVfpPlot.h"
|
#include "RimVfpPlot.h"
|
||||||
|
|
||||||
#include "RimEclipseResultCase.h"
|
|
||||||
#include "RimFlowDiagSolution.h"
|
|
||||||
#include "RimProject.h"
|
|
||||||
#include "RimTools.h"
|
|
||||||
#include "RimVfpTableExtractor.h"
|
#include "RimVfpTableExtractor.h"
|
||||||
|
|
||||||
#include "RigEclipseCaseData.h"
|
#include "RiaColorTables.h"
|
||||||
#include "RigTofWellDistributionCalculator.h"
|
#include "RiaEclipseUnitTools.h"
|
||||||
|
|
||||||
#include "RiaColorTools.h"
|
|
||||||
|
|
||||||
#include "RiuQwtPlotWidget.h"
|
#include "RiuQwtPlotWidget.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
|
||||||
#include "qwt_legend.h"
|
#include "qwt_legend.h"
|
||||||
#include "qwt_legend_label.h"
|
#include "qwt_legend_label.h"
|
||||||
#include "qwt_plot.h"
|
#include "qwt_plot.h"
|
||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
#include "qwt_symbol.h"
|
#include "qwt_symbol.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QTextBrowser>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "cvfDebugTimer.h"
|
|
||||||
#include "cvfTrace.h"
|
|
||||||
|
|
||||||
#include "cafPdmUiComboBoxEditor.h"
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -136,10 +122,12 @@ RimVfpPlot::RimVfpPlot()
|
|||||||
CAF_PDM_InitField( &m_gasLiquidRatioIdx, "GasLiquidRatioIdx", 0, "Gas Liquid Ratio", "", "", "" );
|
CAF_PDM_InitField( &m_gasLiquidRatioIdx, "GasLiquidRatioIdx", 0, "Gas Liquid Ratio", "", "", "" );
|
||||||
m_gasLiquidRatioIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
m_gasLiquidRatioIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||||
|
|
||||||
m_showWindow = false;
|
m_showWindow = true;
|
||||||
m_showPlotLegends = true;
|
m_showPlotLegends = true;
|
||||||
|
|
||||||
setAsPlotMdiWindow();
|
setAsPlotMdiWindow();
|
||||||
|
|
||||||
|
setDeletable( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -162,7 +150,6 @@ RiuQwtPlotWidget* RimVfpPlot::viewer()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::setAutoScaleXEnabled( bool /*enabled*/ )
|
void RimVfpPlot::setAutoScaleXEnabled( bool /*enabled*/ )
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::setAutoScaleXEnabled()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -170,7 +157,6 @@ void RimVfpPlot::setAutoScaleXEnabled( bool /*enabled*/ )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::setAutoScaleYEnabled( bool /*enabled*/ )
|
void RimVfpPlot::setAutoScaleYEnabled( bool /*enabled*/ )
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::setAutoScaleYEnabled()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -178,7 +164,6 @@ void RimVfpPlot::setAutoScaleYEnabled( bool /*enabled*/ )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::updateAxes()
|
void RimVfpPlot::updateAxes()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::updateAxes()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -214,7 +199,6 @@ void RimVfpPlot::updateLegend()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::updateZoomInQwt()
|
void RimVfpPlot::updateZoomInQwt()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::updateZoomInQwt()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -222,7 +206,6 @@ void RimVfpPlot::updateZoomInQwt()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::updateZoomFromQwt()
|
void RimVfpPlot::updateZoomFromQwt()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::updateZoomFromQwt()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -230,7 +213,6 @@ void RimVfpPlot::updateZoomFromQwt()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimVfpPlot::asciiDataForPlotExport() const
|
QString RimVfpPlot::asciiDataForPlotExport() const
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::asciiDataForPlotExport()" );
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +221,6 @@ QString RimVfpPlot::asciiDataForPlotExport() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::reattachAllCurves()
|
void RimVfpPlot::reattachAllCurves()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::reattachAllCurves()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -247,7 +228,6 @@ void RimVfpPlot::reattachAllCurves()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::detachAllCurves()
|
void RimVfpPlot::detachAllCurves()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::detachAllCurves()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -255,7 +235,6 @@ void RimVfpPlot::detachAllCurves()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
caf::PdmObject* RimVfpPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const
|
caf::PdmObject* RimVfpPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::findPdmObjectFromQwtCurve()" );
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +243,6 @@ caf::PdmObject* RimVfpPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*cur
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ )
|
void RimVfpPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ )
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::onAxisSelected()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -280,7 +258,6 @@ QString RimVfpPlot::description() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QWidget* RimVfpPlot::viewWidget()
|
QWidget* RimVfpPlot::viewWidget()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::viewWidget()" );
|
|
||||||
return m_plotWidget;
|
return m_plotWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,8 +266,6 @@ QWidget* RimVfpPlot::viewWidget()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QImage RimVfpPlot::snapshotWindowContent()
|
QImage RimVfpPlot::snapshotWindowContent()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::snapshotWindowContent()" );
|
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
|
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
@ -307,7 +282,6 @@ QImage RimVfpPlot::snapshotWindowContent()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::zoomAll()
|
void RimVfpPlot::zoomAll()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::zoomAll()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -315,7 +289,6 @@ void RimVfpPlot::zoomAll()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::doRemoveFromCollection()
|
void RimVfpPlot::doRemoveFromCollection()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::doRemoveFromCollection()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -323,8 +296,6 @@ void RimVfpPlot::doRemoveFromCollection()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::createViewWidget()" );
|
|
||||||
|
|
||||||
// It seems we risk being called multiple times
|
// It seems we risk being called multiple times
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
{
|
{
|
||||||
@ -333,8 +304,6 @@ RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
|||||||
|
|
||||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||||
|
|
||||||
// m_plotWidget->setAutoReplot( false );
|
|
||||||
|
|
||||||
updateLegend();
|
updateLegend();
|
||||||
onLoadDataAndUpdate();
|
onLoadDataAndUpdate();
|
||||||
|
|
||||||
@ -346,8 +315,6 @@ RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::deleteViewWidget()
|
void RimVfpPlot::deleteViewWidget()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::deleteViewWidget()" );
|
|
||||||
|
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
{
|
{
|
||||||
m_plotWidget->setParent( nullptr );
|
m_plotWidget->setParent( nullptr );
|
||||||
@ -361,9 +328,6 @@ void RimVfpPlot::deleteViewWidget()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::onLoadDataAndUpdate()
|
void RimVfpPlot::onLoadDataAndUpdate()
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::onLoadDataAndUpdate()" );
|
|
||||||
cvf::DebugTimer tim( "RimVfpPlot::onLoadDataAndUpdate()" );
|
|
||||||
|
|
||||||
if ( isMdiWindow() )
|
if ( isMdiWindow() )
|
||||||
{
|
{
|
||||||
updateMdiWindowVisibility();
|
updateMdiWindowVisibility();
|
||||||
@ -411,7 +375,7 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
|||||||
QFileInfo fi( filePath );
|
QFileInfo fi( filePath );
|
||||||
QString wellName = fi.baseName();
|
QString wellName = fi.baseName();
|
||||||
|
|
||||||
const QString plotTitleStr = QString( "%1 Vertical Flow Performance Plot" ).arg( wellName );
|
const QString plotTitleStr = QString( "%1 VFP Plot" ).arg( wellName );
|
||||||
m_plotWidget->setTitle( plotTitleStr );
|
m_plotWidget->setTitle( plotTitleStr );
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||||
@ -426,37 +390,53 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, const Opm::VFPInjTable& table )
|
void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, const Opm::VFPInjTable& table )
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::populatePlotWidgetWithCurves()" );
|
|
||||||
|
|
||||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||||
plotWidget->setAxisTitleText( QwtPlot::xBottom, "Liquid Flow Rate [sm3/d]" );
|
|
||||||
plotWidget->setAxisTitleText( QwtPlot::yLeft, "Bottom Hole Pressure [Bar]" );
|
|
||||||
|
|
||||||
for ( size_t thp = 0; thp < table.getTHPAxis().size(); thp++ )
|
QString xAxisTitle = QString( "%1 [%2]" )
|
||||||
|
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText(
|
||||||
|
RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ),
|
||||||
|
getDisplayUnit( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ) );
|
||||||
|
|
||||||
|
plotWidget->setAxisTitleText( QwtPlot::xBottom, xAxisTitle );
|
||||||
|
|
||||||
|
QString yAxisTitle = QString( "%1 [%2]" )
|
||||||
|
.arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
|
||||||
|
getDisplayUnit( RimVfpPlot::ProductionVariableType::THP ) );
|
||||||
|
plotWidget->setAxisTitleText( QwtPlot::yLeft, yAxisTitle );
|
||||||
|
|
||||||
|
std::vector<double> thpValues = table.getTHPAxis();
|
||||||
|
|
||||||
|
for ( size_t thp = 0; thp < thpValues.size(); thp++ )
|
||||||
{
|
{
|
||||||
// Just create some dummy values for now
|
|
||||||
size_t numValues = table.getFloAxis().size();
|
size_t numValues = table.getFloAxis().size();
|
||||||
std::vector<double> xVals = table.getFloAxis();
|
std::vector<double> xVals = table.getFloAxis();
|
||||||
std::vector<double> yVals( numValues, 0.0 );
|
std::vector<double> yVals( numValues, 0.0 );
|
||||||
for ( size_t y = 0; y < numValues; y++ )
|
for ( size_t y = 0; y < numValues; y++ )
|
||||||
{
|
{
|
||||||
// Convert from Pascal to Bar
|
yVals[y] = table( thp, y );
|
||||||
yVals[y] = RiaEclipseUnitTools::pascalToBar( table( thp, y ) );
|
if ( m_interpolatedVariable == RimVfpPlot::InterpolatedVariableType::BHP_THP_DIFF )
|
||||||
|
{
|
||||||
|
yVals[y] -= thpValues[thp];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cvf::Color3f cvfClr = cvf::Color3::BLUE;
|
double value = convertToDisplayUnit( thpValues[thp], RimVfpPlot::ProductionVariableType::THP );
|
||||||
QColor qtClr = RiaColorTools::toQColor( cvfClr );
|
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 );
|
||||||
|
|
||||||
QwtPlotCurve* curve = new QwtPlotCurve;
|
QColor qtClr = RiaColorTables::wellLogPlotPaletteColors().cycledQColor( thp );
|
||||||
|
QwtPlotCurve* curve = createPlotCurve( title, qtClr );
|
||||||
|
|
||||||
// Convert from Pascal to Bar
|
convertToDisplayUnit( yVals, RimVfpPlot::ProductionVariableType::THP );
|
||||||
curve->setTitle( QString( "THP: %1 Bar" ).arg( RiaEclipseUnitTools::pascalToBar( table.getTHPAxis()[thp] ) ) );
|
convertToDisplayUnit( xVals, RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE );
|
||||||
QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse, QBrush( qtClr ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
|
|
||||||
curve->setSymbol( symbol );
|
|
||||||
|
|
||||||
curve->setSamples( xVals.data(), yVals.data(), numValues );
|
curve->setSamples( xVals.data(), yVals.data(), numValues );
|
||||||
curve->attach( plotWidget );
|
curve->attach( plotWidget );
|
||||||
@ -472,25 +452,20 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget*
|
|||||||
RimVfpPlot::ProductionVariableType primaryVariable,
|
RimVfpPlot::ProductionVariableType primaryVariable,
|
||||||
RimVfpPlot::ProductionVariableType familyVariable )
|
RimVfpPlot::ProductionVariableType familyVariable )
|
||||||
{
|
{
|
||||||
cvf::Trace::show( "RimVfpPlot::populatePlotWidgetWithCurves()" );
|
|
||||||
|
|
||||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||||
|
|
||||||
std::cout << "Datum depth: " << table.getDatumDepth() << std::endl;
|
QString xAxisTitle = QString( "%1 [%2]" )
|
||||||
std::cout << "Table number: " << table.getTableNum() << std::endl;
|
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( primaryVariable ),
|
||||||
std::cout << "Flow type: " << static_cast<int>( table.getFloType() ) << std::endl;
|
getDisplayUnit( primaryVariable ) );
|
||||||
std::cout << "Flo axis: " << table.getFloAxis().size() << std::endl;
|
plotWidget->setAxisTitleText( QwtPlot::xBottom, xAxisTitle );
|
||||||
std::cout << "THP axis: " << table.getTHPAxis().size() << std::endl;
|
QString yAxisTitle = QString( "%1 [%2]" )
|
||||||
std::cout << "WFR axis: " << table.getWFRAxis().size() << std::endl;
|
.arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
|
||||||
std::cout << "GFR axis: " << table.getGFRAxis().size() << std::endl;
|
getDisplayUnit( RimVfpPlot::ProductionVariableType::THP ) );
|
||||||
std::cout << "ALQ axis: " << table.getALQAxis().size() << std::endl;
|
plotWidget->setAxisTitleText( QwtPlot::yLeft, yAxisTitle );
|
||||||
|
|
||||||
plotWidget->setAxisTitleText( QwtPlot::xBottom, "x axis (todo) [x axis unit]" );
|
|
||||||
plotWidget->setAxisTitleText( QwtPlot::yLeft, "y axis [y axis unit]" );
|
|
||||||
|
|
||||||
std::vector<double> primaryAxisValues = getProductionTableData( table, primaryVariable );
|
std::vector<double> primaryAxisValues = getProductionTableData( table, primaryVariable );
|
||||||
std::vector<double> familyVariableValues = getProductionTableData( table, familyVariable );
|
std::vector<double> familyVariableValues = getProductionTableData( table, familyVariable );
|
||||||
@ -533,22 +508,22 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget*
|
|||||||
yVals[y] = table( thp_idx, wfr_idx, gfr_idx, alq_idx, flo_idx );
|
yVals[y] = table( thp_idx, wfr_idx, gfr_idx, alq_idx, flo_idx );
|
||||||
if ( m_interpolatedVariable == RimVfpPlot::InterpolatedVariableType::BHP_THP_DIFF )
|
if ( m_interpolatedVariable == RimVfpPlot::InterpolatedVariableType::BHP_THP_DIFF )
|
||||||
{
|
{
|
||||||
// TODO:
|
yVals[y] -= thpValues[thp_idx];
|
||||||
yVals[y] -= thpValues[familyIdx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert from Pascal to Bar
|
|
||||||
yVals[y] /= 100000.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cvf::Color3f cvfClr = cvf::Color3::BLUE;
|
double familyValue = convertToDisplayUnit( familyVariableValues[familyIdx], familyVariable );
|
||||||
QColor qtClr = RiaColorTools::toQColor( cvfClr );
|
QString familyUnit = getDisplayUnit( familyVariable );
|
||||||
|
QString familyTitle = QString( "%1: %2 %3" )
|
||||||
|
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( familyVariable ) )
|
||||||
|
.arg( familyValue )
|
||||||
|
.arg( familyUnit );
|
||||||
|
|
||||||
QwtPlotCurve* curve = new QwtPlotCurve;
|
QColor qtClr = RiaColorTables::wellLogPlotPaletteColors().cycledQColor( familyIdx );
|
||||||
// Convert from Pascal to Bar
|
QwtPlotCurve* curve = createPlotCurve( familyTitle, qtClr );
|
||||||
curve->setTitle( QString( "family: %1 Bar" ).arg( familyVariableValues[familyIdx] / 100000.0 ) );
|
|
||||||
QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse, QBrush( qtClr ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
|
convertToDisplayUnit( yVals, RimVfpPlot::ProductionVariableType::THP );
|
||||||
curve->setSymbol( symbol );
|
convertToDisplayUnit( primaryAxisValues, primaryVariable );
|
||||||
|
|
||||||
curve->setSamples( primaryAxisValues.data(), yVals.data(), numValues );
|
curve->setSamples( primaryAxisValues.data(), yVals.data(), numValues );
|
||||||
curve->attach( plotWidget );
|
curve->attach( plotWidget );
|
||||||
@ -556,6 +531,65 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QwtPlotCurve* RimVfpPlot::createPlotCurve( const QString title, const QColor& color )
|
||||||
|
{
|
||||||
|
QwtPlotCurve* curve = new QwtPlotCurve;
|
||||||
|
curve->setTitle( title );
|
||||||
|
curve->setPen( QPen( color, 2 ) );
|
||||||
|
curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
|
||||||
|
curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true );
|
||||||
|
curve->setLegendAttribute( QwtPlotCurve::LegendShowBrush, true );
|
||||||
|
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
|
||||||
|
|
||||||
|
QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse );
|
||||||
|
symbol->setSize( 6 );
|
||||||
|
symbol->setColor( color );
|
||||||
|
curve->setSymbol( symbol );
|
||||||
|
|
||||||
|
return curve;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
double RimVfpPlot::convertToDisplayUnit( double value, RimVfpPlot::ProductionVariableType variableType )
|
||||||
|
{
|
||||||
|
if ( variableType == RimVfpPlot::ProductionVariableType::THP )
|
||||||
|
{
|
||||||
|
return RiaEclipseUnitTools::pascalToBar( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimVfpPlot::convertToDisplayUnit( std::vector<double>& values, RimVfpPlot::ProductionVariableType variableType )
|
||||||
|
{
|
||||||
|
for ( size_t i = 0; i < values.size(); i++ )
|
||||||
|
values[i] = convertToDisplayUnit( values[i], variableType );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimVfpPlot::getDisplayUnit( RimVfpPlot::ProductionVariableType variableType )
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( variableType == RimVfpPlot::ProductionVariableType::THP )
|
||||||
|
return "Bar";
|
||||||
|
else if ( variableType == RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE )
|
||||||
|
return "m3/s";
|
||||||
|
else if ( variableType == RimVfpPlot::ProductionVariableType::WATER_CUT ||
|
||||||
|
variableType == RimVfpPlot::ProductionVariableType::GAS_LIQUID_RATIO )
|
||||||
|
return "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -639,10 +673,10 @@ void RimVfpPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiO
|
|||||||
{
|
{
|
||||||
uiOrdering.add( &m_tableType );
|
uiOrdering.add( &m_tableType );
|
||||||
uiOrdering.add( &m_tableNumber );
|
uiOrdering.add( &m_tableNumber );
|
||||||
|
uiOrdering.add( &m_interpolatedVariable );
|
||||||
|
|
||||||
if ( m_tableType == RimVfpPlot::TableType::PRODUCTION )
|
if ( m_tableType == RimVfpPlot::TableType::PRODUCTION )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_interpolatedVariable );
|
|
||||||
uiOrdering.add( &m_primaryVariable );
|
uiOrdering.add( &m_primaryVariable );
|
||||||
uiOrdering.add( &m_familyVariable );
|
uiOrdering.add( &m_familyVariable );
|
||||||
|
|
||||||
@ -722,7 +756,10 @@ void RimVfpPlot::calculateTableValueOptions( RimVfpPlot::ProductionVariableType
|
|||||||
|
|
||||||
for ( size_t i = 0; i < values.size(); i++ )
|
for ( size_t i = 0; i < values.size(); i++ )
|
||||||
{
|
{
|
||||||
options.push_back( caf::PdmOptionItemInfo( QString::number( values[i] ), static_cast<int>( i ) ) );
|
options.push_back( caf::PdmOptionItemInfo( QString( "%1 %2" )
|
||||||
|
.arg( convertToDisplayUnit( values[i], variableType ) )
|
||||||
|
.arg( getDisplayUnit( variableType ) ),
|
||||||
|
static_cast<int>( i ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
#include "opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp"
|
#include "opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp"
|
||||||
#include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp"
|
#include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp"
|
||||||
|
|
||||||
class RimEclipseResultCase;
|
|
||||||
class RimFlowDiagSolution;
|
|
||||||
class RigTofWellDistributionCalculator;
|
|
||||||
class RiuQwtPlotWidget;
|
class RiuQwtPlotWidget;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -123,6 +120,12 @@ private:
|
|||||||
|
|
||||||
void setFixedVariableUiEditability( caf::PdmField<int>& field, RimVfpPlot::ProductionVariableType variableType );
|
void setFixedVariableUiEditability( caf::PdmField<int>& field, RimVfpPlot::ProductionVariableType variableType );
|
||||||
|
|
||||||
|
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 QString getDisplayUnit( RimVfpPlot::ProductionVariableType variableType );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<caf::FilePath> m_filePath;
|
caf::PdmField<caf::FilePath> m_filePath;
|
||||||
caf::PdmField<int> m_tableNumber;
|
caf::PdmField<int> m_tableNumber;
|
||||||
|
Loading…
Reference in New Issue
Block a user