#3527 Implement multiple ICD/AICDs for perforation intervals.

This commit is contained in:
Gaute Lindkvist 2018-10-19 14:44:17 +02:00
parent 43552fde88
commit 2194821609
11 changed files with 309 additions and 127 deletions

View File

@ -29,8 +29,8 @@ void RicNewValveFeature::onActionTriggered(bool isChecked)
if (perfInterval) if (perfInterval)
{ {
RimWellPathValve* valve = new RimWellPathValve; RimWellPathValve* valve = new RimWellPathValve;
valve->setMeasuredDepth(perfInterval->startMD());
perfInterval->addValve(valve); perfInterval->addValve(valve);
valve->setMeasuredDepthAndCount(perfInterval->startMD(), perfInterval->endMD() - perfInterval->startMD(), 1);
RimWellPathCollection* wellPathCollection = nullptr; RimWellPathCollection* wellPathCollection = nullptr;
perfInterval->firstAncestorOrThisOfType(wellPathCollection); perfInterval->firstAncestorOrThisOfType(wellPathCollection);

View File

@ -52,6 +52,7 @@
#include "RimAsciiDataCurve.h" #include "RimAsciiDataCurve.h"
#include "RimWellLogRftCurve.h" #include "RimWellLogRftCurve.h"
#include "RimWellRftPlot.h" #include "RimWellRftPlot.h"
#include "RimWellPathValve.h"
#include "RimEllipseFractureTemplate.h" #include "RimEllipseFractureTemplate.h"
#include "RimSimWellFracture.h" #include "RimSimWellFracture.h"
@ -123,6 +124,7 @@ bool isDeletable(caf::PdmUiItem* uiItem)
if (dynamic_cast<RimEnsembleCurveSet*>(uiItem)) return true; if (dynamic_cast<RimEnsembleCurveSet*>(uiItem)) return true;
if (dynamic_cast<RimEnsembleCurveFilter*>(uiItem)) return true; if (dynamic_cast<RimEnsembleCurveFilter*>(uiItem)) return true;
if (dynamic_cast<RimDerivedEnsembleCaseCollection*>(uiItem)) return true; if (dynamic_cast<RimDerivedEnsembleCaseCollection*>(uiItem)) return true;
if (dynamic_cast<RimWellPathValve*>(uiItem)) return true;
return false; return false;
} }

View File

@ -396,59 +396,81 @@ void RivWellPathPartMgr::appendPerforationValvesToModel(cvf::ModelBasicList* mod
radii = { wellPathRadius, wellPathRadius * 1.8, wellPathRadius * 2.0, radii = { wellPathRadius, wellPathRadius * 1.8, wellPathRadius * 2.0,
wellPathRadius * 2.0, wellPathRadius * 1.8, wellPathRadius * 2.0, wellPathRadius * 1.8,
wellPathRadius * 1.7, wellPathRadius * 1.7, wellPathRadius }; wellPathRadius * 1.7, wellPathRadius * 1.7, wellPathRadius };
double startMD = valve->startMD();
std::vector<cvf::Vec3d> displayCoords;
for (double mdRelativeToStart : measuredDepthsRelativeToStartMD)
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(mdRelativeToStart * 0.333 * wellPathRadius + startMD)));
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(valve);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, valveColor);
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
}
} }
else if (valve->componentType() == RiaDefines::ICD || valve->componentType() == RiaDefines::AICD) else if (valve->componentType() == RiaDefines::ICD || valve->componentType() == RiaDefines::AICD)
{ {
int size = 16; std::vector<double> valveLocations = valve->valveLocations();
for (double startMD : valveLocations)
measuredDepthsRelativeToStartMD.resize(size);
radii.resize(size);
for (int i = 0; i < size; i += 2)
{ {
measuredDepthsRelativeToStartMD[i] = double(i / 2); int size = 16;
measuredDepthsRelativeToStartMD[i + 1] = double(i / 2 + 0.5);
measuredDepthsRelativeToStartMD.resize(size);
radii.resize(size);
for (int i = 0; i < size; i += 2)
{
measuredDepthsRelativeToStartMD[i] = double(i / 2);
measuredDepthsRelativeToStartMD[i + 1] = double(i / 2 + 0.5);
}
radii[0] = wellPathRadius;
bool inner = false;
int nInners = 0;
for (int i = 1; i < size - 1; i += 2)
{
if (inner && valve->componentType() == RiaDefines::AICD && nInners > 0)
{
radii[i + 1] = radii[i] = wellPathRadius * 1.7;
nInners = 0;
}
else if (inner)
{
radii[i + 1] = radii[i] = wellPathRadius * 1.9;
nInners++;
}
else
{
radii[i + 1] = radii[i] = wellPathRadius * 2.0;
}
inner = !inner;
}
radii[size - 1] = wellPathRadius;
std::vector<cvf::Vec3d> displayCoords;
for (double mdRelativeToStart : measuredDepthsRelativeToStartMD)
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(mdRelativeToStart * 0.333 * wellPathRadius + startMD)));
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(valve);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, valveColor);
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
}
} }
radii[0] = wellPathRadius;
bool inner = false;
int nInners = 0;
for (int i = 1; i < size - 1; i += 2)
{
if (inner && valve->componentType() == RiaDefines::AICD && nInners > 0)
{
radii[i + 1] = radii[i] = wellPathRadius * 1.7;
nInners = 0;
}
else if (inner)
{
radii[i + 1] = radii[i] = wellPathRadius * 1.9;
nInners++;
}
else
{
radii[i + 1] = radii[i] = wellPathRadius * 2.0;
}
inner = !inner;
}
radii[size - 1] = wellPathRadius;
}
double startMD = valve->startMD();
std::vector<cvf::Vec3d> displayCoords;
for (double mdRelativeToStart : measuredDepthsRelativeToStartMD)
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(mdRelativeToStart * 0.333 * wellPathRadius + startMD)));
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(valve);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, valveColor);
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
} }
} }
} }
} }

View File

@ -147,9 +147,10 @@ QString RimFishbonesMultipleSubs::generatedName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount) void RimFishbonesMultipleSubs::setMeasuredDepthAndCount(double startMD, double spacing, int subCount)
{ {
m_valveLocations->setMeasuredDepthAndCount(measuredDepth, spacing, subCount); double endMD = startMD + spacing * subCount;
m_valveLocations->initFields(RimMultipleValveLocations::VALVE_COUNT, startMD, endMD, spacing, subCount, {});
computeRangesAndLocations(); computeRangesAndLocations();
computeRotationAngles(); computeRotationAngles();
@ -328,11 +329,10 @@ std::vector<double> RimFishbonesMultipleSubs::lateralLengths() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::valveLocationsUpdated() void RimFishbonesMultipleSubs::geometryUpdated()
{ {
RimFishbonesCollection* collection; RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted(collection); this->firstAncestorOrThisOfTypeAsserted(collection);
computeSubLateralIndices();
collection->recalculateStartMD(); collection->recalculateStartMD();
computeRotationAngles(); computeRotationAngles();
@ -446,9 +446,9 @@ cvf::Color3f RimFishbonesMultipleSubs::defaultComponentColor() const
double RimFishbonesMultipleSubs::startMD() const double RimFishbonesMultipleSubs::startMD() const
{ {
double measuredDepth = 0.0; double measuredDepth = 0.0;
if (!m_valveLocations->locationOfValves().empty()) if (!m_valveLocations->valveLocations().empty())
{ {
measuredDepth = m_valveLocations->locationOfValves().front(); measuredDepth = m_valveLocations->valveLocations().front();
} }
return measuredDepth; return measuredDepth;
@ -460,9 +460,9 @@ double RimFishbonesMultipleSubs::startMD() const
double RimFishbonesMultipleSubs::endMD() const double RimFishbonesMultipleSubs::endMD() const
{ {
double measuredDepth = 0.0; double measuredDepth = 0.0;
if (!m_valveLocations->locationOfValves().empty()) if (!m_valveLocations->valveLocations().empty())
{ {
measuredDepth = m_valveLocations->locationOfValves().back(); measuredDepth = m_valveLocations->valveLocations().back();
} }
return measuredDepth; return measuredDepth;
@ -484,7 +484,7 @@ void RimFishbonesMultipleSubs::fieldChangedByUi(const caf::PdmFieldHandle* chang
computeSubLateralIndices(); computeSubLateralIndices();
} }
valveLocationsUpdated(); geometryUpdated();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -509,7 +509,7 @@ caf::PdmFieldHandle* RimFishbonesMultipleSubs::objectToggleField()
void RimFishbonesMultipleSubs::computeRangesAndLocations() void RimFishbonesMultipleSubs::computeRangesAndLocations()
{ {
m_valveLocations->computeRangesAndLocations(); m_valveLocations->computeRangesAndLocations();
valveLocationsUpdated(); geometryUpdated();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -602,7 +602,7 @@ void RimFishbonesMultipleSubs::initAfterRead()
{ {
initValveLocationFromLegacyData(); initValveLocationFromLegacyData();
if (m_valveLocations->locationOfValves().size() != m_installationRotationAngles().size()) if (m_valveLocations->valveLocations().size() != m_installationRotationAngles().size())
{ {
computeRotationAngles(); computeRotationAngles();
} }
@ -639,7 +639,7 @@ void RimFishbonesMultipleSubs::computeRotationAngles()
{ {
std::vector<double> vals; std::vector<double> vals;
for (size_t i = 0; i < m_valveLocations->locationOfValves().size(); i++) for (size_t i = 0; i < m_valveLocations->valveLocations().size(); i++)
{ {
vals.push_back(RimFishbonesMultipleSubs::randomValueFromRange(0, 360)); vals.push_back(RimFishbonesMultipleSubs::randomValueFromRange(0, 360));
} }
@ -653,7 +653,7 @@ void RimFishbonesMultipleSubs::computeRotationAngles()
void RimFishbonesMultipleSubs::computeSubLateralIndices() void RimFishbonesMultipleSubs::computeSubLateralIndices()
{ {
m_subLateralIndices.clear(); m_subLateralIndices.clear();
for (size_t subIndex = 0; subIndex < m_valveLocations->locationOfValves().size(); ++subIndex) for (size_t subIndex = 0; subIndex < m_valveLocations->valveLocations().size(); ++subIndex)
{ {
SubLateralIndex subLateralIndex; SubLateralIndex subLateralIndex;
subLateralIndex.subIndex = subIndex; subLateralIndex.subIndex = subIndex;
@ -664,7 +664,7 @@ void RimFishbonesMultipleSubs::computeSubLateralIndices()
} }
m_subLateralIndices.push_back(subLateralIndex); m_subLateralIndices.push_back(subLateralIndex);
} }
double numLaterals = static_cast<double>(m_valveLocations->locationOfValves().size() * m_lateralCountPerSub); double numLaterals = static_cast<double>(m_valveLocations->valveLocations().size() * m_lateralCountPerSub);
int numToRemove = static_cast<int>(std::round((1 - m_lateralInstallSuccessFraction) * numLaterals)); int numToRemove = static_cast<int>(std::round((1 - m_lateralInstallSuccessFraction) * numLaterals));
srand(m_randomSeed()); srand(m_randomSeed());
while (numToRemove > 0) while (numToRemove > 0)
@ -737,7 +737,7 @@ void RimFishbonesMultipleSubs::initValveLocationFromLegacyData()
locationType = RimMultipleValveLocations::VALVE_CUSTOM; locationType = RimMultipleValveLocations::VALVE_CUSTOM;
} }
m_valveLocations->initFieldsFromFishbones(locationType, m_valveLocations->initFields(locationType,
m_rangeStart_OBSOLETE(), m_rangeStart_OBSOLETE(),
m_rangeEnd_OBSOLETE(), m_rangeEnd_OBSOLETE(),
m_rangeSubSpacing_OBSOLETE(), m_rangeSubSpacing_OBSOLETE(),

View File

@ -79,7 +79,7 @@ public:
bool isActive() const; bool isActive() const;
QString generatedName() const; QString generatedName() const;
void setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount); void setMeasuredDepthAndCount(double startMD, double spacing, int subCount);
double measuredDepth(size_t subIndex) const; double measuredDepth(size_t subIndex) const;
double rotationAngle(size_t subIndex) const; double rotationAngle(size_t subIndex) const;
@ -97,7 +97,7 @@ public:
size_t icdCount() const { return m_icdCount(); } size_t icdCount() const { return m_icdCount(); }
std::vector<double> lateralLengths() const; std::vector<double> lateralLengths() const;
void valveLocationsUpdated(); void geometryUpdated();
const std::vector<SubLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; }; const std::vector<SubLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; };
std::vector<cvf::Vec3d> coordsForLateral(size_t subIndex, size_t lateralIndex) const; std::vector<cvf::Vec3d> coordsForLateral(size_t subIndex, size_t lateralIndex) const;

View File

@ -21,7 +21,9 @@
#include "RigWellPath.h" #include "RigWellPath.h"
#include "RimFishbonesMultipleSubs.h" #include "RimFishbonesMultipleSubs.h"
#include "RimPerforationInterval.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimWellPathValve.h"
#include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiListEditor.h" #include "cafPdmUiListEditor.h"
@ -76,7 +78,23 @@ double RimMultipleValveLocations::measuredDepth(size_t valveIndex) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<double>& RimMultipleValveLocations::locationOfValves() const double RimMultipleValveLocations::rangeStart() const
{
return m_rangeStart;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeEnd() const
{
return m_rangeEnd;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimMultipleValveLocations::valveLocations() const
{ {
return m_locationOfValves(); return m_locationOfValves();
} }
@ -89,19 +107,6 @@ void RimMultipleValveLocations::setLocationType(LocationType locationType)
m_locationType = locationType; m_locationType = locationType;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultipleValveLocations::setMeasuredDepthAndCount(double measuredDepth, double spacing, int valveCount)
{
m_locationType = RimMultipleValveLocations::VALVE_SPACING;
m_rangeStart = measuredDepth;
m_rangeEnd = measuredDepth + spacing * valveCount;
m_rangeValveCount = valveCount;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -113,15 +118,15 @@ void RimMultipleValveLocations::computeRangesAndLocations()
if (m_rangeValveCount > 2) divisor = m_rangeValveCount - 1; if (m_rangeValveCount > 2) divisor = m_rangeValveCount - 1;
m_rangeValveSpacing = fabs(m_rangeStart - m_rangeEnd) / divisor; m_rangeValveSpacing = fabs(m_rangeStart - m_rangeEnd) / divisor;
if (m_rangeValveSpacing < minimumSpacingMeters())
{
m_rangeValveSpacing = minimumSpacingMeters();
m_rangeValveCount = rangeCountFromSpacing();
}
} }
else if (m_locationType == VALVE_SPACING) else if (m_locationType == VALVE_SPACING)
{ {
m_rangeValveCount = (fabs(m_rangeStart - m_rangeEnd) / m_rangeValveSpacing) + 1; m_rangeValveCount = rangeCountFromSpacing();
if (m_rangeValveCount < 1)
{
m_rangeValveCount = 1;
}
} }
if (m_locationType == VALVE_COUNT || m_locationType == VALVE_SPACING) if (m_locationType == VALVE_COUNT || m_locationType == VALVE_SPACING)
@ -155,7 +160,7 @@ void RimMultipleValveLocations::computeRangesAndLocations()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimMultipleValveLocations::initFieldsFromFishbones(LocationType locationType, double rangeStart, double rangeEnd, double valveSpacing, int valveCount, const std::vector<double>& locationOfValves) void RimMultipleValveLocations::initFields(LocationType locationType, double rangeStart, double rangeEnd, double valveSpacing, int valveCount, const std::vector<double>& locationOfValves)
{ {
if (locationType != VALVE_UNDEFINED) if (locationType != VALVE_UNDEFINED)
{ {
@ -284,26 +289,13 @@ void RimMultipleValveLocations::fieldChangedByUi(const caf::PdmFieldHandle* chan
changedField == &m_rangeValveSpacing) changedField == &m_rangeValveSpacing)
{ {
recomputeLocations = true; recomputeLocations = true;
m_rangeStart = cvf::Math::clamp(m_rangeStart(), rangeMin(), rangeMax());
RimWellPath* wellPath = nullptr; m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), rangeMin(), rangeMax());
this->firstAncestorOrThisOfTypeAsserted(wellPath);
RigWellPath* rigWellPathGeo = wellPath->wellPathGeometry();
if (rigWellPathGeo && !rigWellPathGeo->m_measuredDepths.empty())
{
double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back();
m_rangeStart = cvf::Math::clamp(m_rangeStart(), 0.0, lastWellPathMD);
m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), m_rangeStart(), lastWellPathMD);
}
} }
if (changedField == &m_rangeValveSpacing) if (changedField == &m_rangeValveSpacing)
{ {
// Minimum distance between fishbones is 13.0m double minimumDistanceMeter = minimumSpacingMeters();
// Use 10.0m to allow for some flexibility
double minimumDistanceMeter = 10.0;
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted(wellPath); this->firstAncestorOrThisOfTypeAsserted(wellPath);
@ -332,10 +324,16 @@ void RimMultipleValveLocations::fieldChangedByUi(const caf::PdmFieldHandle* chan
if (parentCompletion) if (parentCompletion)
{ {
RimFishbonesMultipleSubs* fishbones = dynamic_cast<RimFishbonesMultipleSubs*>(parentCompletion); RimFishbonesMultipleSubs* fishbones = dynamic_cast<RimFishbonesMultipleSubs*>(parentCompletion);
RimWellPathValve* valve = dynamic_cast<RimWellPathValve*>(parentCompletion);
if (fishbones) if (fishbones)
{ {
fishbones->valveLocationsUpdated(); fishbones->geometryUpdated();
} }
else if (valve)
{
valve->geometryUpdated();
}
} }
} }
@ -345,6 +343,71 @@ void RimMultipleValveLocations::fieldChangedByUi(const caf::PdmFieldHandle* chan
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimMultipleValveLocations::rangeCountFromSpacing() const
{
int rangeCount = (fabs(m_rangeStart - m_rangeEnd) / m_rangeValveSpacing) + 1;
if (rangeCount < 1)
{
rangeCount = 1;
}
return rangeCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::minimumSpacingMeters() const
{
// Minimum distance between fishbones is 13.0m
// Use 10.0m to allow for some flexibility
return 10.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeMin() const
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval);
if (perfInterval)
{
return perfInterval->startMD();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeMax() const
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval);
if (perfInterval)
{
return perfInterval->endMD();
}
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted(wellPath);
RigWellPath* rigWellPathGeo = wellPath->wellPathGeometry();
if (rigWellPathGeo && !rigWellPathGeo->m_measuredDepths.empty())
{
double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back();
return lastWellPathMD;
}
return std::numeric_limits<double>::infinity();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -42,23 +42,28 @@ public:
RimMultipleValveLocations(); RimMultipleValveLocations();
double measuredDepth(size_t valveIndex) const; double measuredDepth(size_t valveIndex) const;
const std::vector<double>& locationOfValves() const; double rangeStart() const;
double rangeEnd() const;
const std::vector<double>& valveLocations() const;
void setLocationType(LocationType locationType); void setLocationType(LocationType locationType);
void setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount);
void computeRangesAndLocations(); void computeRangesAndLocations();
void initFieldsFromFishbones(LocationType locationType, void initFields(LocationType locationType,
double rangeStart, double rangeStart,
double rangeEnd, double rangeEnd,
double valveSpacing, double valveSpacing,
int valveCount, int valveCount,
const std::vector<double>& locationOfValves); const std::vector<double>& locationOfValves);
protected: protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private: private:
int rangeCountFromSpacing() const;
double minimumSpacingMeters() const;
double rangeMin() const;
double rangeMax() const;
static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count); static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count);
private: private:
@ -68,5 +73,5 @@ private:
caf::PdmField<double> m_rangeValveSpacing; caf::PdmField<double> m_rangeValveSpacing;
caf::PdmField<int> m_rangeValveCount; caf::PdmField<int> m_rangeValveCount;
caf::PdmField<std::vector<double>> m_locationOfValves; // Given in measured depth caf::PdmField<std::vector<double>> m_locationOfValves; // Given in measured depth
}; };

View File

@ -24,6 +24,7 @@
#include "RigWellPath.h" #include "RigWellPath.h"
#include "RimMultipleValveLocations.h"
#include "RimPerforationInterval.h" #include "RimPerforationInterval.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimWellPath.h" #include "RimWellPath.h"
@ -38,11 +39,19 @@ CAF_PDM_SOURCE_INIT(RimWellPathValve, "WellPathValve");
RimWellPathValve::RimWellPathValve() RimWellPathValve::RimWellPathValve()
{ {
CAF_PDM_InitObject("WellPathValve", ":/PerforationInterval16x16.png", "", ""); CAF_PDM_InitObject("WellPathValve", ":/PerforationInterval16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_type, "CompletionType", "Type ", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_type, "CompletionType", "Type ", "", "", "");
m_type = RiaDefines::ICD;
CAF_PDM_InitField(&m_measuredDepth, "StartMeasuredDepth", 0.0, "Start MD", "", "", ""); CAF_PDM_InitField(&m_measuredDepth, "StartMeasuredDepth", 0.0, "Start MD", "", "", "");
m_measuredDepth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName()); m_measuredDepth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_multipleValveLocations, "ValveLocations", "Valve Locations", "", "", "");
m_multipleValveLocations = new RimMultipleValveLocations;
m_multipleValveLocations.uiCapability()->setUiTreeHidden(true);
m_multipleValveLocations.uiCapability()->setUiTreeChildrenHidden(true);
nameField()->uiCapability()->setUiReadOnly(true); nameField()->uiCapability()->setUiReadOnly(true);
m_type = RiaDefines::ICD;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -56,9 +65,42 @@ RimWellPathValve::~RimWellPathValve()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPathValve::setMeasuredDepth(double measuredDepth) void RimWellPathValve::setMeasuredDepthAndCount(double startMD, double spacing, int valveCount)
{ {
m_measuredDepth = measuredDepth; m_measuredDepth = startMD;
double endMD = startMD + spacing * valveCount;
m_multipleValveLocations->initFields(RimMultipleValveLocations::VALVE_COUNT, startMD, endMD, spacing, valveCount, {});
m_multipleValveLocations->computeRangesAndLocations();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathValve::geometryUpdated()
{
m_measuredDepth = m_multipleValveLocations->valveLocations().front();
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->reloadCompletionTypeResultsInAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellPathValve::valveLocations() const
{
std::vector<double> valveDepths;
if (m_type() == RiaDefines::ICV)
{
valveDepths.push_back(m_measuredDepth);
}
else
{
valveDepths = m_multipleValveLocations->valveLocations();
}
return valveDepths;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -98,7 +140,18 @@ cvf::Color3f RimWellPathValve::defaultComponentColor() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimWellPathValve::startMD() const double RimWellPathValve::startMD() const
{ {
return m_measuredDepth; if (m_type() == RiaDefines::ICV)
{
return m_measuredDepth;
}
else if (m_multipleValveLocations()->valveLocations().empty())
{
return m_multipleValveLocations->rangeStart();
}
else
{
return m_multipleValveLocations()->valveLocations().front();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -106,7 +159,18 @@ double RimWellPathValve::startMD() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimWellPathValve::endMD() const double RimWellPathValve::endMD() const
{ {
return m_measuredDepth + 0.5; if (m_type() == RiaDefines::ICV)
{
return m_measuredDepth + 0.5;
}
else if (m_multipleValveLocations()->valveLocations().empty())
{
return m_multipleValveLocations->rangeEnd();
}
else
{
return m_multipleValveLocations()->valveLocations().back();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -144,6 +208,7 @@ void RimWellPathValve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
{ {
uiOrdering.add(&m_type); uiOrdering.add(&m_type);
if (m_type() == RiaDefines::ICV)
{ {
RimWellPath* wellPath; RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath); firstAncestorOrThisOfType(wellPath);
@ -158,9 +223,14 @@ void RimWellPathValve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
m_measuredDepth.uiCapability()->setUiName("Measured Depth [ft]"); m_measuredDepth.uiCapability()->setUiName("Measured Depth [ft]");
} }
} }
uiOrdering.add(&m_measuredDepth);
} }
else
uiOrdering.add(&m_measuredDepth); {
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Multiple Valve Locations");
m_multipleValveLocations->uiOrdering(uiConfigName, *group);
}
uiOrdering.skipRemainingFields(true);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -23,11 +23,13 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafAppEnum.h" #include "cafAppEnum.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include <QList> #include <QList>
#include <QString> #include <QString>
class RimMultipleValveLocations;
class RimWellPath; class RimWellPath;
class RimWellPathValve : public RimCheckableNamedObject, public RimWellPathComponentInterface class RimWellPathValve : public RimCheckableNamedObject, public RimWellPathComponentInterface
@ -39,7 +41,9 @@ public:
RimWellPathValve(); RimWellPathValve();
~RimWellPathValve() override; ~RimWellPathValve() override;
void setMeasuredDepth(double measuredDepth); void setMeasuredDepthAndCount(double startMD, double spacing, int valveCount);
void geometryUpdated();
std::vector<double> valveLocations() const;
// Overrides from RimWellPathCompletionInterface // Overrides from RimWellPathCompletionInterface
RiaDefines::WellPathComponentType componentType() const override; RiaDefines::WellPathComponentType componentType() const override;
@ -48,7 +52,7 @@ public:
cvf::Color3f defaultComponentColor() const override; cvf::Color3f defaultComponentColor() const override;
double startMD() const override; double startMD() const override;
double endMD() const override; double endMD() const override;
private: private:
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
@ -57,10 +61,10 @@ private:
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
private: private:
caf::PdmField<CompletionTypeEnum> m_type; caf::PdmField<CompletionTypeEnum> m_type;
caf::PdmField<double> m_measuredDepth; caf::PdmField<double> m_measuredDepth;
caf::PdmChildField<RimMultipleValveLocations*> m_multipleValveLocations;
protected:
}; };

View File

@ -30,6 +30,7 @@
#include "RimWellPathAttribute.h" #include "RimWellPathAttribute.h"
#include "RimWellPathAttributeCollection.h" #include "RimWellPathAttributeCollection.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimWellPathValve.h"
#include "RigWellPath.h" #include "RigWellPath.h"
@ -78,6 +79,11 @@ RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem(const RimWellPath* we
m_endMD = component->endMD(); m_endMD = component->endMD();
calculateColumnOffsets(component); calculateColumnOffsets(component);
const RimWellPathValve* valve = dynamic_cast<const RimWellPathValve*>(component);
if (valve)
{
m_subMDs = valve->valveLocations();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -223,17 +229,26 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate(bool updateParentPlot)
} }
else if (m_componentType == RiaDefines::ICD) else if (m_componentType == RiaDefines::ICD)
{ {
addMarker(0.0, startDepth, 26, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), label(), Qt::AlignCenter, Qt::Horizontal, false, true); for (double md : m_subMDs)
{
addMarker(0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true);
}
m_combinedComponentGroup.addLegendItem(createMarker(0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor())); m_combinedComponentGroup.addLegendItem(createMarker(0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor()));
} }
else if (m_componentType == RiaDefines::ICV) else if (m_componentType == RiaDefines::ICV)
{ {
addMarker(0.0, startDepth, 26, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), label(), Qt::AlignCenter, Qt::Horizontal, false, true); for (double md : m_subMDs)
{
addMarker(0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true);
}
m_combinedComponentGroup.addLegendItem(createMarker(0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor())); m_combinedComponentGroup.addLegendItem(createMarker(0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor()));
} }
else if (m_componentType == RiaDefines::AICD) else if (m_componentType == RiaDefines::AICD)
{ {
addMarker(0.0, startDepth, 26, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), label(), Qt::AlignCenter, Qt::Horizontal, false, true); for (double md : m_subMDs)
{
addMarker(0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true);
}
m_combinedComponentGroup.addLegendItem(createMarker(0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor())); m_combinedComponentGroup.addLegendItem(createMarker(0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor()));
} }
else if (m_componentType == RiaDefines::PACKER) else if (m_componentType == RiaDefines::PACKER)

View File

@ -126,6 +126,7 @@ private:
RiaDefines::WellPathComponentType m_componentType; RiaDefines::WellPathComponentType m_componentType;
double m_startMD; double m_startMD;
double m_endMD; double m_endMD;
std::vector<double> m_subMDs;
QString m_label; QString m_label;
QString m_legendTitle; QString m_legendTitle;
double m_columnOffset; double m_columnOffset;