From 09c1d78e98e01881f5abec85b75b52149b9b35f8 Mon Sep 17 00:00:00 2001
From: lx <ex_lixiang17@cols.com.cn>
Date: 星期五, 08 八月 2025 02:55:01 +0800
Subject: [PATCH] upload

---
 ErrorAnalysis.UI/FrmMain.resx               |    4 ++--
 ErrorAnalysis.Service/ErrorRatioCalc.cs     |   16 +++++++++++-----
 ErrorAnalysis.UI/FrmMain.cs                 |    3 +++
 ErrorAnalysis.Service/COMergeCalcService.cs |   16 ++++++++--------
 ErrorAnalysis.UI/FrmMain.Designer.cs        |    2 +-
 ErrorAnalysis.Service/PDEVCalcService.cs    |    2 +-
 6 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/ErrorAnalysis.Service/COMergeCalcService.cs b/ErrorAnalysis.Service/COMergeCalcService.cs
index f3d90d5..7ac3ad8 100644
--- a/ErrorAnalysis.Service/COMergeCalcService.cs
+++ b/ErrorAnalysis.Service/COMergeCalcService.cs
@@ -39,13 +39,13 @@
             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 oilLineC = 36d / 160d * oilLineCR * yieldCounting / speed * depth * 0.0762d;
+            var oilLineO = 36d / 160d * oilLineOR * yieldCounting / speed * depth * 0.0762d;
 
             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;
+            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)
@@ -79,13 +79,13 @@
 
             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 oilLineC = (36d / 160d) * oilLineCR * yieldCounting / speed * depth * 0.0762d;
+            var oilLineO = (36d / 160d) * oilLineOR * yieldCounting / speed * depth * 0.0762d;
 
             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;
+            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)
diff --git a/ErrorAnalysis.Service/ErrorRatioCalc.cs b/ErrorAnalysis.Service/ErrorRatioCalc.cs
index 045af5c..7b8d892 100644
--- a/ErrorAnalysis.Service/ErrorRatioCalc.cs
+++ b/ErrorAnalysis.Service/ErrorRatioCalc.cs
@@ -53,9 +53,9 @@
                 var mDelta = GetMDelta(modelID, porosity);
 
                 speed = Math.Pow(firstTargetErrorRatio /
-                    Math.Sqrt(1 / (0.0762 * depth * (36d / 160))) *
-                    mDelta /
-                    Math.Sqrt(((Math.Pow(nearCofe, 2) / yieldCounting) * (Math.Pow(nearCROR.Item1 / nearCROR.Item2, 2)) * (1 / nearCROR.Item1 + 1 / nearCROR.Item2)) + (Math.Pow(farCofe, 2) / yieldCounting) * (Math.Pow(farCROR.Item1 / farCROR.Item2, 2)) * (1 / farCROR.Item1 + 1 / farCROR.Item2))
+                    (Math.Sqrt(160 / (0.0762 * depth * 36d * yieldCounting)) *
+                    1d / mDelta) /
+                    Math.Sqrt((Math.Pow(nearCofe, 2) * (Math.Pow(nearCROR.Item1 / nearCROR.Item2, 2)) * (1 / nearCROR.Item1 + 1 / nearCROR.Item2)) + (Math.Pow(farCofe, 2) * (Math.Pow(farCROR.Item1 / farCROR.Item2, 2)) * (1 / farCROR.Item1 + 1 / farCROR.Item2)))
                     , 2);
 
                 var firstErrorPass = new ErrorRatio { Pass = 1, ErrorRatioValue = firstTargetErrorRatio };
@@ -89,10 +89,16 @@
 
             try
             {
+                var mDelta = GetMDelta(modelID, porosity);
 
-                var mergePDEV = PDEVCalcService.GetMergePDEV(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
+                //var mergePDEVOld = PDEVCalcService.GetMergePDEV(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
 
-                var errorRatio = mergePDEV / GetMDelta(modelID, porosity);
+                var nearCROR = COMergeCalcService.GetNearCOORResult(modelID, porosity, sw);
+                var farCROR = COMergeCalcService.GetFarCOORResult(modelID, porosity, sw);
+
+                var mergePDEV = Math.Sqrt(160 * speed / (0.0762 * 36 * depth * yieldCounting)) * Math.Sqrt((Math.Pow(nearCofe, 2) * (Math.Pow(nearCROR.Item1 / nearCROR.Item2, 2)) * (1 / nearCROR.Item1 + 1 / nearCROR.Item2)) + (Math.Pow(farCofe, 2) * (Math.Pow(farCROR.Item1 / farCROR.Item2, 2)) * (1 / farCROR.Item1 + 1 / farCROR.Item2)));
+
+                var errorRatio = mergePDEV / mDelta;
 
                 return new ErrorRatio { Pass = 1, ErrorRatioValue = errorRatio };
             }
diff --git a/ErrorAnalysis.Service/PDEVCalcService.cs b/ErrorAnalysis.Service/PDEVCalcService.cs
index d198b27..e6bf20d 100644
--- a/ErrorAnalysis.Service/PDEVCalcService.cs
+++ b/ErrorAnalysis.Service/PDEVCalcService.cs
@@ -19,6 +19,6 @@
             return Math.Sqrt(Math.Pow(nearPDEV * nearCofe, 2) + Math.Pow(farPDEV * farCofe, 2));
         }
 
-        private static double CalcPDEV(double c, double o) => Math.Sqrt(Math.Pow(c / o, 2) * (1 / c + 1 / o));
+        private static double CalcPDEV(double c, double o) => c / o * Math.Sqrt((1 / c + 1 / o));
     }
 }
diff --git a/ErrorAnalysis.UI/FrmMain.Designer.cs b/ErrorAnalysis.UI/FrmMain.Designer.cs
index ff9c9d3..f506c3c 100644
--- a/ErrorAnalysis.UI/FrmMain.Designer.cs
+++ b/ErrorAnalysis.UI/FrmMain.Designer.cs
@@ -232,7 +232,7 @@
             // 
             // nudSoPrecisionRequired
             // 
-            nudSoPrecisionRequired.DecimalPlaces = 1;
+            nudSoPrecisionRequired.DecimalPlaces = 2;
             nudSoPrecisionRequired.Increment = new decimal(new int[] { 2, 0, 0, 0 });
             nudSoPrecisionRequired.Location = new Point(185, 43);
             nudSoPrecisionRequired.Name = "nudSoPrecisionRequired";
diff --git a/ErrorAnalysis.UI/FrmMain.cs b/ErrorAnalysis.UI/FrmMain.cs
index 5b0a9e4..f1cd5f2 100644
--- a/ErrorAnalysis.UI/FrmMain.cs
+++ b/ErrorAnalysis.UI/FrmMain.cs
@@ -405,6 +405,9 @@
 
             var property = control.Tag.ToString();
             var filterVal = control.Text == "water" ? "0" : control.Text == "oil" ? "100" : control.Text == "gas" ? "200" : "999";
+            if (_filters==null)
+                return;
+            
             if (_filters.ContainsKey(property))
                 _filters[property] = filterVal;
             else
diff --git a/ErrorAnalysis.UI/FrmMain.resx b/ErrorAnalysis.UI/FrmMain.resx
index 0808268..4253ee1 100644
--- a/ErrorAnalysis.UI/FrmMain.resx
+++ b/ErrorAnalysis.UI/FrmMain.resx
@@ -1,7 +1,7 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
 <root>
   <!--
-    Microsoft ResX Schema 
+    Microsoft ResX Schema
 
     Version 2.0
 
@@ -48,7 +48,7 @@
     value   : The object must be serialized with
             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
-    
+
     mimetype: application/x-microsoft.net.object.soap.base64
     value   : The object must be serialized with
             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter

--
Gitblit v1.9.3