From 9827a8864ba0df0a4e148b4a7ac3225df7b80728 Mon Sep 17 00:00:00 2001
From: lx <ex_lixiang17@cosl.com.cn>
Date: 星期四, 07 八月 2025 18:09:41 +0800
Subject: [PATCH] upload
---
ErrorAnalysis.Service/COMergeCalcService.cs | 181 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 156 insertions(+), 25 deletions(-)
diff --git a/ErrorAnalysis.Service/COMergeCalcService.cs b/ErrorAnalysis.Service/COMergeCalcService.cs
index 08c53d8..f3d90d5 100644
--- a/ErrorAnalysis.Service/COMergeCalcService.cs
+++ b/ErrorAnalysis.Service/COMergeCalcService.cs
@@ -1,4 +1,5 @@
锘縰sing ErrorAnalysis.Repository;
+using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,9 +23,9 @@
const int _oWinStartIndex = (int)(4.88 / _gg + _offset); // org
const int _oWinEndIndex = (int)(6.36 / _gg + _offset); // width = 6.36-4.88=1.48
- const double _coef = 1e8 * 2.54 * 2.54 * 4 * 6 * 2 * 11 * 77 * 0.2 / 0.6;
+ //const double _coef = 1e8 * 2.54 * 2.54 * 4 * 6 * 2 * 11 * 77 * 0.2 / 0.6;
- private static (double, double) GetFarInterplolateResult(string modelId, double porosity, double sw, double speed, double depth)
+ private static (double, double) GetFarInterplolateResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting)
{
var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
var oWinLength = _oWinEndIndex - _oWinStartIndex + 1;
@@ -32,20 +33,25 @@
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.InelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- var waterLineValArr = waterLine.InelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var oilLineValArr = oilLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var waterLineValArr = waterLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- var oilLineC = oilLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() * _coef / speed * depth * 0.07;
- var oilLineO = oilLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() * _coef / speed * depth * 0.07;
+ var oilLineCR = oilLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / oilLineValArr.Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / oilLineValArr.Sum();
- var waterLineC = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() * _coef / speed * depth * 0.07;
- var waterLineO = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() * _coef / speed * depth * 0.07;
+ var oilLineC = 36d / 160 * oilLineCR * yieldCounting / speed * depth * 0.0762;
+ var oilLineO = 36d / 160 * oilLineOR * yieldCounting / speed * depth * 0.0762;
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / waterLineValArr.Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.Sum();
+ var waterLineC = 36d / 160 * waterLineCR * yieldCounting / speed * depth * 0.0762;
+ var waterLineO = 36d / 160 * waterLineOR * yieldCounting / speed * depth * 0.0762;
double cRes = 0, oRes = 0;
if (sw == 0)
{
- cRes = waterLineC;
- oRes = waterLineO;
+ cRes = oilLineC;
+ oRes = oilLineO;
}
else if (sw == 100)
{
@@ -60,7 +66,7 @@
return (cRes, oRes);
}
- private static (double, double) GetNearInterplolateResult(string modelId, double porosity, double sw, double speed, double depth)
+ private static (double, double) GetNearInterplolateResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting)
{
var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
var oWinLength = _oWinEndIndex - _oWinStartIndex + 1;
@@ -68,14 +74,18 @@
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.InelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- var waterLineValArr = waterLine.InelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var oilLineValArr = oilLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
+ var waterLineValArr = waterLine.CInelasticSpec.Split(',').Select(v => Convert.ToDouble(v)).ToArray();
- var oilLineC = oilLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() * _coef / speed * depth * 0.07;
- var oilLineO = oilLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() * _coef / speed * depth * 0.07;
+ var oilLineCR = oilLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / oilLineValArr.Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / oilLineValArr.Sum();
+ var oilLineC = (36d / 160) * oilLineCR * yieldCounting / speed * depth * 0.0762;
+ var oilLineO = (36d / 160) * oilLineOR * yieldCounting / speed * depth * 0.0762;
- var waterLineC = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() * _coef / speed * depth * 0.07;
- var waterLineO = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() * _coef / speed * depth * 0.07;
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / waterLineValArr.Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.Sum();
+ var waterLineC = (36d / 160) * waterLineCR * yieldCounting / speed * depth * 0.0762;
+ var waterLineO = (36d / 160) * waterLineOR * yieldCounting / speed * depth * 0.0762;
double cRes = 0, oRes = 0;
if (sw == 0)
@@ -108,7 +118,7 @@
/// <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)
+ public static (double, double) GetFarMergeCOResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting)
{
if (porosity > 40)
throw new InvalidDataException("Porosity value out of range!");
@@ -116,15 +126,15 @@
(double, double) result = (0, 0);
if (porosity % 5 == 0)
{
- result = GetFarInterplolateResult(modelId, porosity, sw, speed, depth);
+ result = GetFarInterplolateResult(modelId, porosity, sw, speed, depth, yieldCounting);
}
else
{
var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
- var ceilingResult = GetFarInterplolateResult(modelId, ceilingPorosity, sw, speed, depth);
+ var ceilingResult = GetFarInterplolateResult(modelId, ceilingPorosity, sw, speed, depth, yieldCounting);
var floorPorosity = Math.Floor(porosity / 5) * 5;
- var floorResult = GetFarInterplolateResult(modelId, floorPorosity, sw, speed, depth);
+ var floorResult = GetFarInterplolateResult(modelId, floorPorosity, sw, speed, depth, yieldCounting);
result.Item1 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item1, ceilingPorosity, ceilingResult.Item1);
result.Item2 = Utility.Interpolate(porosity, floorPorosity, floorResult.Item2, ceilingPorosity, ceilingResult.Item2);
@@ -144,7 +154,7 @@
/// <param name="depth">娣卞害</param>
/// <returns>纰虫垨姘у��</returns>
/// <exception cref="InvalidDataException">瀛旈殭搴﹁秴杩囪寖鍥�</exception>
- public static (double, double) GetNearMergeCOResult(string modelId, double porosity, double sw, double speed, double depth)
+ public static (double, double) GetNearMergeCOResult(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting)
{
if (porosity > 40)
throw new InvalidDataException("Porosity value out of range!");
@@ -152,20 +162,141 @@
(double, double) result = (0, 0);
if (porosity % 5 == 0)
{
- result = GetNearInterplolateResult(modelId, porosity, sw, speed, depth);
+ result = GetNearInterplolateResult(modelId, porosity, sw, speed, depth, yieldCounting);
}
else
{
var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
- var ceilingResult = GetNearInterplolateResult(modelId, ceilingPorosity, sw, speed, depth);
+ var ceilingResult = GetNearInterplolateResult(modelId, ceilingPorosity, sw, speed, depth, yieldCounting);
var floorPorosity = Math.Floor(porosity / 5) * 5;
- var floorResult = GetNearInterplolateResult(modelId, floorPorosity, sw, speed, depth);
+ var floorResult = GetNearInterplolateResult(modelId, floorPorosity, sw, speed, depth, yieldCounting);
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) GetFarCROR(string modelId, double porosity, double sw)
+ {
+ 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).Take(cWinLength).Sum() / oilLineValArr.Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / oilLineValArr.Sum();
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / waterLineValArr.Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.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)
+ {
+ 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).Take(cWinLength).Sum() / oilLineValArr.Sum();
+ var oilLineOR = oilLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / oilLineValArr.Sum();
+
+ var waterLineCR = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / waterLineValArr.Sum();
+ var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.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)
+ {
+ if (porosity > 40)
+ throw new InvalidDataException("Porosity value out of range!");
+
+ (double, double) result = (0, 0);
+ if (porosity % 5 == 0)
+ {
+ result = GetFarCROR(modelId, porosity, sw);
+ }
+ else
+ {
+ var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+ var ceilingResult = GetFarCROR(modelId, ceilingPorosity, sw);
+
+ var floorPorosity = Math.Floor(porosity / 5) * 5;
+ var floorResult = GetFarCROR(modelId, floorPorosity, sw);
+
+ 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)
+ {
+ 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);
+ }
+ else
+ {
+ var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+ var ceilingResult = GetNearCROR(modelId, ceilingPorosity, sw);
+
+ var floorPorosity = Math.Floor(porosity / 5) * 5;
+ var floorResult = GetNearCROR(modelId, floorPorosity, sw);
+
+ 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