2022-08-17 03:04:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2022-08-18 00:12:23 -05:00
|
|
|
#include "RicNewRftSegmentWellLogPlotFeature.h"
|
2022-08-17 03:04:10 -05:00
|
|
|
|
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
#include "RicWellLogTools.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RiaRftDefines.h"
|
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
#include "RifReaderOpmRft.h"
|
|
|
|
|
2022-08-17 03:04:10 -05:00
|
|
|
#include "RimRftCase.h"
|
2022-10-07 05:37:23 -05:00
|
|
|
#include "RimRftTopologyCurve.h"
|
2022-08-17 03:04:10 -05:00
|
|
|
#include "RimSummaryCase.h"
|
|
|
|
#include "RimWellLogTrack.h"
|
|
|
|
|
|
|
|
#include "RiuPlotMainWindow.h"
|
|
|
|
#include "RiuPlotMainWindowTools.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2022-08-18 01:09:05 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewRftSegmentWellLogPlotFeature, "RicNewRftSegmentWellLogPlotFeature" );
|
2022-08-17 03:04:10 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-08-18 00:12:23 -05:00
|
|
|
bool RicNewRftSegmentWellLogPlotFeature::isCommandEnabled()
|
2022-08-17 03:04:10 -05:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-08-18 00:12:23 -05:00
|
|
|
void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
|
2022-08-17 03:04:10 -05:00
|
|
|
{
|
|
|
|
auto rftCase = caf::SelectionManager::instance()->selectedItemOfType<RimRftCase>();
|
|
|
|
if ( !rftCase ) return;
|
|
|
|
|
|
|
|
RimSummaryCase* summaryCase = nullptr;
|
|
|
|
rftCase->firstAncestorOfType( summaryCase );
|
2022-10-07 05:37:23 -05:00
|
|
|
if ( !summaryCase ) return;
|
2022-08-17 03:04:10 -05:00
|
|
|
|
|
|
|
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
|
2022-10-12 05:41:08 -05:00
|
|
|
plot->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
|
|
|
QString templateText = RiaDefines::namingVariableCase() + ", " + RiaDefines::namingVariableWell() + " - Branch " +
|
|
|
|
RiaDefines::namingVariableWellBranch() + ", " + RiaDefines::namingVariableTime();
|
|
|
|
plot->setNameTemplateText( templateText );
|
|
|
|
plot->setPlotTitleVisible( true );
|
2022-10-13 06:03:55 -05:00
|
|
|
plot->setLegendItemsClickable( false );
|
2022-08-17 03:04:10 -05:00
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
QString wellName = "Unknown";
|
2022-08-17 03:04:10 -05:00
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
auto rftReader = summaryCase->rftReader();
|
|
|
|
if ( rftReader )
|
2022-08-17 03:04:10 -05:00
|
|
|
{
|
2022-10-07 05:37:23 -05:00
|
|
|
auto wellNames = rftReader->wellNames();
|
|
|
|
if ( !wellNames.empty() ) wellName = *wellNames.begin();
|
2022-08-17 03:04:10 -05:00
|
|
|
}
|
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
QString resultName = "SEGGRAT";
|
2022-08-17 03:04:10 -05:00
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
std::vector<RiaDefines::RftBranchType> branchTypes{ RiaDefines::RftBranchType::RFT_ANNULUS,
|
|
|
|
RiaDefines::RftBranchType::RFT_DEVICE,
|
|
|
|
RiaDefines::RftBranchType::RFT_TUBING };
|
|
|
|
|
|
|
|
for ( auto branchType : branchTypes )
|
|
|
|
{
|
|
|
|
appendTrackAndCurveForBranchType( plot, resultName, wellName, branchType, summaryCase );
|
2022-08-17 03:04:10 -05:00
|
|
|
}
|
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
appendTopologyTrack( plot, wellName, summaryCase );
|
|
|
|
plot->loadDataAndUpdate();
|
|
|
|
|
2022-08-18 05:37:51 -05:00
|
|
|
RiuPlotMainWindowTools::onObjectAppended( plot );
|
2022-08-17 03:04:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-08-18 00:12:23 -05:00
|
|
|
void RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
|
|
|
|
const QString& resultName,
|
2022-10-07 05:37:23 -05:00
|
|
|
const QString& wellName,
|
2022-08-18 00:12:23 -05:00
|
|
|
RiaDefines::RftBranchType branchType,
|
|
|
|
RimSummaryCase* summaryCase )
|
2022-08-17 03:04:10 -05:00
|
|
|
{
|
|
|
|
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
|
|
|
plot->addPlot( plotTrack );
|
|
|
|
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
|
|
|
|
|
|
|
|
plot->loadDataAndUpdate();
|
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase );
|
2022-10-12 05:41:08 -05:00
|
|
|
curve->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
|
|
|
|
|
|
|
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
|
|
|
|
curve->setCurveNameTemplateText( templateText );
|
|
|
|
|
2022-08-17 03:04:10 -05:00
|
|
|
curve->loadDataAndUpdate( true );
|
|
|
|
|
|
|
|
curve->updateAllRequiredEditors();
|
|
|
|
RiuPlotMainWindowTools::setExpanded( curve );
|
|
|
|
}
|
|
|
|
|
2022-10-07 05:37:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* plot,
|
|
|
|
const QString& wellName,
|
|
|
|
RimSummaryCase* summaryCase )
|
|
|
|
{
|
|
|
|
QDateTime dateTime;
|
|
|
|
int branchIndex = 1;
|
|
|
|
|
|
|
|
auto rftReader = dynamic_cast<RifReaderOpmRft*>( summaryCase->rftReader() );
|
|
|
|
if ( rftReader )
|
|
|
|
{
|
|
|
|
auto timeSteps = rftReader->availableTimeSteps( wellName );
|
|
|
|
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto track = new RimWellLogTrack();
|
|
|
|
track->setDescription( "Topology" );
|
2022-10-13 06:03:55 -05:00
|
|
|
track->enablePropertyAxis( false );
|
2022-10-07 05:37:23 -05:00
|
|
|
|
|
|
|
plot->addPlot( track );
|
|
|
|
|
|
|
|
std::vector<RiaDefines::RftBranchType> branchTypes{ RiaDefines::RftBranchType::RFT_TUBING,
|
|
|
|
RiaDefines::RftBranchType::RFT_DEVICE,
|
|
|
|
RiaDefines::RftBranchType::RFT_ANNULUS };
|
|
|
|
|
|
|
|
for ( auto branchType : branchTypes )
|
|
|
|
{
|
2022-10-13 06:03:55 -05:00
|
|
|
auto curve = RimRftTopologyCurve::createTopologyCurve( summaryCase, dateTime, wellName, branchIndex, branchType );
|
|
|
|
curve->applyDefaultAppearance();
|
|
|
|
track->addCurve( curve );
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
auto curve = RimRftTopologyCurve::createPackerCurve( summaryCase, dateTime, wellName, branchIndex );
|
2022-10-07 05:37:23 -05:00
|
|
|
curve->applyDefaultAppearance();
|
|
|
|
track->addCurve( curve );
|
|
|
|
}
|
|
|
|
|
|
|
|
track->updateAllRequiredEditors();
|
|
|
|
}
|
|
|
|
|
2022-08-17 03:04:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-08-18 00:12:23 -05:00
|
|
|
void RicNewRftSegmentWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
|
2022-08-17 03:04:10 -05:00
|
|
|
{
|
2022-08-18 00:12:23 -05:00
|
|
|
actionToSetup->setText( "Create RFT Segment Plot" );
|
2022-08-17 03:04:10 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
|
|
|
}
|