///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RimPlot.h" #include "cafFilePath.h" #include "cafPdmPtrField.h" #include #include "opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp" #include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp" class RiuQwtPlotWidget; //-------------------------------------------------------------------------------------------------- /// Vertical Flow Performance Plot //-------------------------------------------------------------------------------------------------- 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; // RimPlot implementations RiuQwtPlotWidget* viewer() override; void setAutoScaleXEnabled( bool enabled ) override; void setAutoScaleYEnabled( bool enabled ) override; void updateAxes() override; void updateLegend() override; void updateZoomInQwt() override; void updateZoomFromQwt() override; QString asciiDataForPlotExport() const override; void reattachAllCurves() override; void detachAllCurves() override; caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; void onAxisSelected( int axis, bool toggle ) override; // RimPlotWindow implementations QString description() const override; // RimViewWindow implementations QWidget* viewWidget() override; QImage snapshotWindowContent() override; void zoomAll() override; private: // RimPlot implementations void doRemoveFromCollection(); // RimViewWindow implementations void deleteViewWidget() override; void onLoadDataAndUpdate() override; // PDM methods caf::PdmFieldHandle* userDescriptionField() override; 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 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 defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; void calculateTableValueOptions( RimVfpPlot::ProductionVariableType variableType, QList& options ); void setFixedVariableUiEditability( caf::PdmField& field, RimVfpPlot::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 QwtPlotCurve* createPlotCurve( const QString title, const QColor& color ); static double convertToDisplayUnit( double value, RimVfpPlot::ProductionVariableType variableType ); static void convertToDisplayUnit( std::vector& values, RimVfpPlot::ProductionVariableType variableType ); static QString getDisplayUnit( RimVfpPlot::ProductionVariableType variableType ); static QString getDisplayUnitWithBracket( RimVfpPlot::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 ); private: caf::PdmField m_plotTitle; caf::PdmField m_filePath; caf::PdmField m_tableNumber; caf::PdmField m_referenceDepth; caf::PdmField> m_flowingPhase; caf::PdmField> m_flowingWaterFraction; caf::PdmField> m_flowingGasFraction; caf::PdmField> m_tableType; caf::PdmField> m_interpolatedVariable; caf::PdmField> m_primaryVariable; caf::PdmField> m_familyVariable; caf::PdmField m_liquidFlowRateIdx; caf::PdmField m_thpIdx; caf::PdmField m_articifialLiftQuantityIdx; caf::PdmField m_waterCutIdx; caf::PdmField m_gasLiquidRatioIdx; QPointer m_plotWidget; std::unique_ptr m_prodTable; };