From e5a570db2036a6b155c2ddc289b42bd050b9ad3c Mon Sep 17 00:00:00 2001
From: lx <ex_lixiang17@cosl.com.cn>
Date: 星期一, 24 十一月 2025 13:49:16 +0800
Subject: [PATCH] update 1.4
---
ErrorAnalysis.Service/COMergeCalcService.cs | 410 +++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 343 insertions(+), 67 deletions(-)
diff --git a/ErrorAnalysis.Service/COMergeCalcService.cs b/ErrorAnalysis.Service/COMergeCalcService.cs
index 7dd3fe1..beda9e4 100644
--- a/ErrorAnalysis.Service/COMergeCalcService.cs
+++ b/ErrorAnalysis.Service/COMergeCalcService.cs
@@ -1,4 +1,6 @@
锘縰sing ErrorAnalysis.Repository;
+using ErrorAnalysis.Repository.Entity;
+using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,56 +24,129 @@
const int _oWinStartIndex = (int)(4.88 / _gg + _offset); // org
const int _oWinEndIndex = (int)(6.36 / _gg + _offset); // width = 6.36-4.88=1.48
- private static double GetFarInterplolateResult(string modelId, double porosity, double sw, int readSw, double speed, double depth)
- {
- double result = 0;
- var cResult = RepositoryInstance.Instance.COFarResultRepository?.GetCOFarResult(modelId, (int)porosity, readSw);
- if (cResult == null)
- throw new InvalidDataException("COFarResult not found");
- var cArr = cResult.InelasticSpec?.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- if (cArr == null)
- throw new InvalidDataException("COFarResult InelasticSpec is null");
+ //const double _coef = 1e8 * 2.54 * 2.54 * 4 * 6 * 2 * 11 * 77 * 0.2 / 0.6;
- var length = readSw == 0 ? _cWinEndIndex - _cWinStartIndex + 1 : _oWinEndIndex - _oWinStartIndex + 1;
- var originC = cArr.Skip(readSw == 0 ? _cWinStartIndex : _oWinStartIndex).Take(length).Sum();
- var coef = originC * 1e8 * 2.54 * 2.54 * 4 * 6 * 2 * 11 * 77 * 0.2 / 0.6 / speed * depth * 0.07;
- result = coef;
- if (sw > 0 && sw < 100)
+ private static (double, double) GetFarInterplolateResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting, int countStart, int countEnd)
+ {
+ var countLen = countEnd - countStart + 1;
+ var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
+ var oWinLength = _oWinEndIndex - _oWinStartIndex + 1;
+ var oilLine = RepositoryInstance.Instance.COFarResultRepository?.GetCOFarResult(modelId, (int)porosity, 0);
+ var waterLine = RepositoryInstance.Instance.COFarResultRepository?.GetCOFarResult(modelId, (int)porosity, 100);
+ if (oilLine == null || waterLine == null)
+ throw new InvalidDataException("COFarResult Line is null");
+ var oilLineValArr = oilLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var waterLineValArr = waterLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ var oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+
+ var oilLineC = 36d / 160d * oilLineCR * yieldCounting / speed * depth * 0.0762d;
+ var oilLineO = 36d / 160d * oilLineOR * yieldCounting / speed * depth * 0.0762d;
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+ var waterLineC = 36d / 160d * waterLineCR * yieldCounting / speed * depth * 0.0762d;
+ var waterLineO = 36d / 160d * waterLineOR * yieldCounting / speed * depth * 0.0762d;
+
+ double cRes = 0, oRes = 0;
+ if (sw == 0)
{
- if (readSw == 0)
- result = Utility.Interpolate(sw, 100, 0, 0, coef);
- else
- result = Utility.Interpolate(sw, 0, 0, 100, coef);
+ cRes = oilLineC;
+ oRes = oilLineO;
}
- return result;
+ else if (sw == 100)
+ {
+ cRes = waterLineC;
+ oRes = waterLineO;
+ }
+ else if (sw > 0 && sw < 100)
+ {
+ cRes = Utility.Interpolate(sw, 100, waterLineC, 0, oilLineC);
+ oRes = Utility.Interpolate(sw, 0, oilLineO, 100, waterLineO);
+ }
+ return (cRes, oRes);
}
- private static double GetNearInterplolateResult(string modelId, double porosity, double sw, int readSw, double speed, double depth)
+ private static (double, double) GetNearInterplolateResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting, int countStart, int countEnd)
{
- double result = 0;
- var cResult = RepositoryInstance.Instance.CONearResultRepository?.GetCONearResult(modelId, (int)porosity, readSw);
- if (cResult == null)
- throw new InvalidDataException("CONearResult not found");
- var cArr = cResult.InelasticSpec?.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- if (cArr == null)
- throw new InvalidDataException("CONearResult InelasticSpec is null");
+ var countLen = countEnd - countStart + 1;
+ var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
+ var oWinLength = _oWinEndIndex - _oWinStartIndex + 1;
+ var oilLine = RepositoryInstance.Instance.CONearResultRepository?.GetCONearResult(modelId, (int)porosity, 0);
+ var waterLine = RepositoryInstance.Instance.CONearResultRepository?.GetCONearResult(modelId, (int)porosity, 100);
+ if (oilLine == null || waterLine == null)
+ throw new InvalidDataException("COFarResult Line is null");
+ var oilLineValArr = oilLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var waterLineValArr = waterLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- var length = readSw == 0 ? _cWinEndIndex - _cWinStartIndex + 1 : _oWinEndIndex - _oWinStartIndex + 1;
- var originC = cArr.Skip(readSw == 0 ? _cWinStartIndex : _oWinStartIndex).Take(length).Sum();
- var coef = originC * 1e8 * 2.54 * 2.54 * 2 * 6 * 11 * 2 * 77 * 0.2 / 0.6 / speed * depth * 0.07;
- result = coef;
- if (sw > 0 && sw < 100)
+ var oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+ var oilLineC = (36d / 160d) * oilLineCR * yieldCounting / speed * depth * 0.0762d;
+ var oilLineO = (36d / 160d) * oilLineOR * yieldCounting / speed * depth * 0.0762d;
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+ var waterLineC = (36d / 160d) * waterLineCR * yieldCounting / speed * depth * 0.0762d;
+ var waterLineO = (36d / 160d) * waterLineOR * yieldCounting / speed * depth * 0.0762d;
+
+ double cRes = 0, oRes = 0;
+ if (sw == 0)
{
- if (readSw == 0)
- result = Utility.Interpolate(sw, 100, 0, 0, coef);
- else
- result = Utility.Interpolate(sw, 0, 0, 100, coef);
+ cRes = waterLineC;
+ oRes = waterLineO;
+ }
+ else if (sw == 100)
+ {
+ cRes = waterLineC;
+ oRes = waterLineO;
+ }
+ else if (sw > 0 && sw < 100)
+ {
+ cRes = Utility.Interpolate(sw, 100, waterLineC, 0, oilLineC);
+ oRes = Utility.Interpolate(sw, 0, oilLineO, 100, waterLineO);
+ }
+ return (cRes, oRes);
+ }
+
+ /// <summary>
+ /// 鑾峰彇杩滄帰澶碈鎴朞鍊硷紙搴熷純锛�
+ /// </summary>
+ /// <param name="connectionString">鏁版嵁搴撹繛鎺ュ瓧绗︿覆</param>
+ /// <param name="modelId">绠℃煴ID</param>
+ /// <param name="porosity">瀛旈殭搴�</param>
+ /// <param name="sw">鍚按楗卞拰搴�</param>
+ /// <param name="readSw">璇诲彇鍚按楗卞拰搴︼紙0涓虹⒊锛�100涓烘哀锛�</param>
+ /// <param name="speed">娴嬮��</param>
+ /// <param name="depth">娣卞害</param>
+ /// <returns>纰冲拰姘у��</returns>
+ /// <exception cref="InvalidDataException">瀛旈殭搴﹁秴杩囪寖鍥�</exception>
+ public static (double, double) GetFarMergeCOResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting, int countStart, int countEnd)
+ {
+ if (porosity > 40)
+ throw new InvalidDataException("Porosity value out of range!");
+
+ (double, double) result = (0, 0);
+ if (porosity % 5 == 0)
+ {
+ result = GetFarInterplolateResult(modelId, porosity, sw, speed, depth, yieldCounting, countStart, countEnd);
+ }
+ else
+ {
+ var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+ var ceilingResult = GetFarInterplolateResult(modelId, ceilingPorosity, sw, speed, depth, yieldCounting, countStart, countEnd);
+
+ var floorPorosity = Math.Floor(porosity / 5) * 5;
+ var floorResult = GetFarInterplolateResult(modelId, floorPorosity, sw, speed, depth, yieldCounting, countStart, countEnd);
+
+ result.Item1 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item1, ceilingPorosity, ceilingResult.Item1);
+ result.Item2 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item2, ceilingPorosity, ceilingResult.Item2);
}
return result;
}
/// <summary>
- /// 鑾峰彇杩滄帰澶碈鎴朞鍊�
+ /// 鑾峰彇杩戞帰澶碈鎴朞鍊硷紙搴熷純锛�
/// </summary>
/// <param name="connectionString">鏁版嵁搴撹繛鎺ュ瓧绗︿覆</param>
/// <param name="modelId">绠℃煴ID</param>
@@ -82,68 +157,269 @@
/// <param name="depth">娣卞害</param>
/// <returns>纰虫垨姘у��</returns>
/// <exception cref="InvalidDataException">瀛旈殭搴﹁秴杩囪寖鍥�</exception>
- public static double GetFarMergeCOResult(string modelId, double porosity, double sw, int readSw, double speed, double depth)
+ public static (double, double) GetNearMergeCOResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting, int countStart, int countEnd)
{
if (porosity > 40)
throw new InvalidDataException("Porosity value out of range!");
- double result = 0;
+ (double, double) result = (0, 0);
if (porosity % 5 == 0)
{
- result = GetFarInterplolateResult(modelId, porosity, sw, readSw, speed, depth);
+ result = GetNearInterplolateResult(modelId, porosity, sw, speed, depth, yieldCounting, countStart, countEnd);
}
else
{
- double ceilingResult = 0;
var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
- ceilingResult = GetFarInterplolateResult(modelId, ceilingPorosity, sw, readSw, speed, depth);
+ var ceilingResult = GetNearInterplolateResult(modelId, ceilingPorosity, sw, speed, depth, yieldCounting, countStart, countEnd);
-
- double floorResult = 0;
var floorPorosity = Math.Floor(porosity / 5) * 5;
- floorResult = GetFarInterplolateResult(modelId, floorPorosity, sw, readSw, speed, depth);
+ var floorResult = GetNearInterplolateResult(modelId, floorPorosity, sw, speed, depth, yieldCounting, countStart, countEnd);
- result = Utility.Interpolate(porosity, floorPorosity, floorResult, ceilingPorosity, ceilingResult);
+ result.Item1 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item1, ceilingPorosity, ceilingResult.Item1);
+ result.Item2 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item2, ceilingPorosity, ceilingResult.Item2);
}
return result;
}
- /// <summary>
- /// 鑾峰彇杩戞帰澶碈鎴朞鍊�
- /// </summary>
- /// <param name="connectionString">鏁版嵁搴撹繛鎺ュ瓧绗︿覆</param>
- /// <param name="modelId">绠℃煴ID</param>
- /// <param name="porosity">瀛旈殭搴�</param>
- /// <param name="sw">鍚按楗卞拰搴�</param>
- /// <param name="readSw">璇诲彇鍚按楗卞拰搴︼紙0涓虹⒊锛�100涓烘哀锛�</param>
- /// <param name="speed">娴嬮��</param>
- /// <param name="depth">娣卞害</param>
- /// <returns>纰虫垨姘у��</returns>
- /// <exception cref="InvalidDataException">瀛旈殭搴﹁秴杩囪寖鍥�</exception>
- public static double GetNearMergeCOResult(string modelId, double porosity, double sw, int readSw, double speed, double depth)
+ public static List<double[]> GetFarSpectrum(string modelId, double porosity, double sw)
+ {
+ var result = new List<double[]>();
+ if (porosity > 40)
+ throw new InvalidDataException("Porosity value out of range!");
+
+ double[] oilLineSpec;
+ double[] waterLineSpec;
+
+ if (porosity % 5 == 0)
+ {
+ oilLineSpec = RepositoryInstance.Instance.COFarResultRepository.GetCOFarResult(modelId, (int)porosity, 0).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ waterLineSpec = RepositoryInstance.Instance.COFarResultRepository.GetCOFarResult(modelId, (int)porosity, 100).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ }
+ else
+ {
+ var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+ double[] ceilingOilLineSpec = RepositoryInstance.Instance.COFarResultRepository.GetCOFarResult(modelId, (int)ceilingPorosity, 0).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ double[] ceilingWaterLineSpec = RepositoryInstance.Instance.COFarResultRepository.GetCOFarResult(modelId, (int)ceilingPorosity, 100).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ var floorPorosity = Math.Floor(porosity / 5) * 5;
+ double[] floorOilLineSpec = RepositoryInstance.Instance.COFarResultRepository.GetCOFarResult(modelId, (int)floorPorosity, 0).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ double[] floorWaterLineSpec = RepositoryInstance.Instance.COFarResultRepository.GetCOFarResult(modelId, (int)floorPorosity, 100).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ oilLineSpec = ceilingOilLineSpec;
+ waterLineSpec = ceilingWaterLineSpec;
+
+ for (int i = 0; i < ceilingOilLineSpec.Length; i++)
+ {
+ oilLineSpec[i] = Utility.Interpolate(porosity, floorPorosity, floorOilLineSpec[i], ceilingPorosity, ceilingOilLineSpec[i]);
+ waterLineSpec[i] = Utility.Interpolate(porosity, floorPorosity, floorWaterLineSpec[i], ceilingPorosity, ceilingWaterLineSpec[i]);
+ }
+ }
+ if (sw == 0)
+ {
+ for (int i = 0; i < oilLineSpec.Length; i++)
+ {
+ result.Add([i, oilLineSpec[i]]);
+ }
+ }
+ else if (sw == 100)
+ {
+ for (int i = 0; i < waterLineSpec.Length; i++)
+ {
+ result.Add([i, waterLineSpec[i]]);
+ }
+ }
+ else if (sw > 0 && sw < 100)
+ {
+ for (int i = 0; i < waterLineSpec.Length; i++)
+ {
+ var val = Utility.Interpolate(sw, 0, oilLineSpec[i], 100, waterLineSpec[i]);
+ result.Add([i, val]);
+ }
+ }
+
+ return result;
+ }
+
+ public static List<double[]> GetNearSpectrum(string modelId, double porosity, double sw)
+ {
+ var result = new List<double[]>();
+ if (porosity > 40)
+ throw new InvalidDataException("Porosity value out of range!");
+
+ double[] oilLineSpec;
+ double[] waterLineSpec;
+
+ if (porosity % 5 == 0)
+ {
+ oilLineSpec = RepositoryInstance.Instance.CONearResultRepository.GetCONearResult(modelId, (int)porosity, 0).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ waterLineSpec = RepositoryInstance.Instance.CONearResultRepository.GetCONearResult(modelId, (int)porosity, 100).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ }
+ else
+ {
+ var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+ double[] ceilingOilLineSpec = RepositoryInstance.Instance.CONearResultRepository.GetCONearResult(modelId, (int)ceilingPorosity, 0).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ double[] ceilingWaterLineSpec = RepositoryInstance.Instance.CONearResultRepository.GetCONearResult(modelId, (int)ceilingPorosity, 100).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ var floorPorosity = Math.Floor(porosity / 5) * 5;
+ double[] floorOilLineSpec = RepositoryInstance.Instance.CONearResultRepository.GetCONearResult(modelId, (int)floorPorosity, 0).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ double[] floorWaterLineSpec = RepositoryInstance.Instance.CONearResultRepository.GetCONearResult(modelId, (int)floorPorosity, 100).CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ oilLineSpec = ceilingOilLineSpec;
+ waterLineSpec = ceilingWaterLineSpec;
+
+ for (int i = 0; i < ceilingOilLineSpec.Length; i++)
+ {
+ oilLineSpec[i] = Utility.Interpolate(porosity, floorPorosity, floorOilLineSpec[i], ceilingPorosity, ceilingOilLineSpec[i]);
+ waterLineSpec[i] = Utility.Interpolate(porosity, floorPorosity, floorWaterLineSpec[i], ceilingPorosity, ceilingWaterLineSpec[i]);
+ }
+ }
+ if (sw == 0)
+ {
+ for (int i = 0; i < oilLineSpec.Length; i++)
+ {
+ result.Add([i, oilLineSpec[i]]);
+ }
+ }
+ else if (sw == 100)
+ {
+ for (int i = 0; i < waterLineSpec.Length; i++)
+ {
+ result.Add([i, waterLineSpec[i]]);
+ }
+ }
+ else if (sw > 0 && sw < 100)
+ {
+ for (int i = 0; i < waterLineSpec.Length; i++)
+ {
+ var val = Utility.Interpolate(sw, 0, oilLineSpec[i], 100, waterLineSpec[i]);
+ result.Add([i, val]);
+ }
+ }
+
+ return result;
+ }
+
+ public static (double, double) GetFarCROR(string modelId, double porosity, double sw, int countStart, int countEnd)
+ {
+ int countLen = countEnd - countStart + 1;
+ var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
+ var oWinLength = _oWinEndIndex - _oWinStartIndex + 1;
+ var oilLine = RepositoryInstance.Instance.COFarResultRepository?.GetCOFarResult(modelId, (int)porosity, 0);
+ var waterLine = RepositoryInstance.Instance.COFarResultRepository?.GetCOFarResult(modelId, (int)porosity, 100);
+ if (oilLine == null || waterLine == null)
+ throw new InvalidDataException("COFarResult Line is null");
+ var oilLineValArr = oilLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var waterLineValArr = waterLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ var oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+
+ double cRes = 0, oRes = 0;
+ if (sw == 0)
+ {
+ cRes = oilLineCR;
+ oRes = oilLineOR;
+ }
+ else if (sw == 100)
+ {
+ cRes = waterLineCR;
+ oRes = waterLineOR;
+ }
+ else if (sw > 0 && sw < 100)
+ {
+ cRes = Utility.Interpolate(sw, 100, waterLineCR, 0, oilLineCR);
+ oRes = Utility.Interpolate(sw, 0, oilLineOR, 100, waterLineOR);
+ }
+ return (cRes, oRes);
+ }
+
+ public static (double, double) GetNearCROR(string modelId, double porosity, double sw, int countStart, int countEnd)
+ {
+ int countLen = countEnd - countStart + 1;
+ var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
+ var oWinLength = _oWinEndIndex - _oWinStartIndex + 1;
+ var oilLine = RepositoryInstance.Instance.CONearResultRepository?.GetCONearResult(modelId, (int)porosity, 0);
+ var waterLine = RepositoryInstance.Instance.CONearResultRepository?.GetCONearResult(modelId, (int)porosity, 100);
+ if (oilLine == null || waterLine == null)
+ throw new InvalidDataException("COFarResult Line is null");
+ var oilLineValArr = oilLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var waterLineValArr = waterLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+
+ var oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(countStart).Take(countLen).Sum();
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(countStart).Take(countLen).Sum();
+
+ double crRes = 0, orRes = 0;
+ if (sw == 0)
+ {
+ crRes = oilLineCR;
+ orRes = oilLineOR;
+ }
+ else if (sw == 100)
+ {
+ crRes = waterLineCR;
+ orRes = waterLineOR;
+ }
+ else if (sw > 0 && sw < 100)
+ {
+ crRes = Utility.Interpolate(sw, 100, waterLineCR, 0, oilLineCR);
+ orRes = Utility.Interpolate(sw, 0, oilLineOR, 100, waterLineOR);
+ }
+ return (crRes, orRes);
+ }
+
+ public static (double, double) GetFarCOORResult(string modelId, double porosity, double sw, int countStart, int countEnd)
{
if (porosity > 40)
throw new InvalidDataException("Porosity value out of range!");
- double result = 0;
+ (double, double) result = (0, 0);
if (porosity % 5 == 0)
{
- result = GetNearInterplolateResult(modelId, porosity, sw, readSw, speed, depth);
+ result = GetFarCROR(modelId, porosity, sw, countStart, countEnd);
}
else
{
- double ceilingResult = 0;
var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
- ceilingResult = GetNearInterplolateResult(modelId, ceilingPorosity, sw, readSw, speed, depth);
+ var ceilingResult = GetFarCROR(modelId, ceilingPorosity, sw, countStart, countEnd);
-
- double floorResult = 0;
var floorPorosity = Math.Floor(porosity / 5) * 5;
- floorResult = GetNearInterplolateResult(modelId, floorPorosity, sw, readSw, speed, depth);
+ var floorResult = GetFarCROR(modelId, floorPorosity, sw, countStart, countEnd);
- result = Utility.Interpolate(porosity, floorPorosity, floorResult, ceilingPorosity, ceilingResult);
+ result.Item1 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item1, ceilingPorosity, ceilingResult.Item1);
+ result.Item2 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item2, ceilingPorosity, ceilingResult.Item2);
}
return result;
}
+
+ public static (double, double) GetNearCOORResult(string modelId, double porosity, double sw, int countStart, int countEnd)
+ {
+ if (porosity > 40)
+ throw new InvalidDataException("Porosity value out of range!");
+
+ (double, double) result = (0, 0);
+ if (porosity % 5 == 0)
+ {
+ result = GetNearCROR(modelId, porosity, sw, countStart, countEnd);
+ }
+ else
+ {
+ var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+ var ceilingResult = GetNearCROR(modelId, ceilingPorosity, sw, countStart, countEnd);
+
+ var floorPorosity = Math.Floor(porosity / 5) * 5;
+ var floorResult = GetNearCROR(modelId, floorPorosity, sw, countStart, countEnd);
+
+ result.Item1 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item1, ceilingPorosity, ceilingResult.Item1);
+ result.Item2 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item2, ceilingPorosity, ceilingResult.Item2);
+ }
+ return result;
+ }
+
}
}
--
Gitblit v1.9.3