From 0b108f56b2d0c35d01ee361dc593119ac52a14e1 Mon Sep 17 00:00:00 2001
From: lx <ex_lixiang17@cosl.com.cn>
Date: 星期五, 05 九月 2025 16:39:13 +0800
Subject: [PATCH] update

---
 ErrorAnalysis.Service/ErrorRatioCalc.cs               |   90 ++-
 ErrorAnalysis.Service/Template/JobPlanReportTemp.docx |    0 
 ErrorAnalysis.UI/FrmMain.cs                           |   16 
 ErrorAnalysis.Service/COMergeCalcService.cs           |  123 +++++
 ErrorAnalysis.UI/ProcessingData.Designer.cs           |  499 +++++++++++++++++++++++
 ErrorAnalysis.Service/Model/ProcessingDataModel.cs    |   42 ++
 ErrorAnalysis.Service/Model/ReportModel.cs            |    2 
 ErrorAnalysis.UI/ErrorAnalysis.UI.csproj              |    2 
 ErrorAnalysis.UI/ProcessingData.cs                    |  132 ++++++
 ErrorAnalysis.UI/ProcessingData.resx                  |  120 +++++
 ErrorAnalysis.UI/FrmMain.Designer.cs                  |   14 
 ErrorAnalysis.Service/Utility.cs                      |  193 +++++++++
 ErrorAnalysis.Service/PDEVCalcService.cs              |    2 
 13 files changed, 1,191 insertions(+), 44 deletions(-)

diff --git a/ErrorAnalysis.Service/COMergeCalcService.cs b/ErrorAnalysis.Service/COMergeCalcService.cs
index 3f1df05..42bd463 100644
--- a/ErrorAnalysis.Service/COMergeCalcService.cs
+++ b/ErrorAnalysis.Service/COMergeCalcService.cs
@@ -1,4 +1,5 @@
 锘縰sing ErrorAnalysis.Repository;
+using ErrorAnalysis.Repository.Entity;
 using Microsoft.VisualBasic;
 using System;
 using System.Collections.Generic;
@@ -107,7 +108,7 @@
         }
 
         /// <summary>
-        /// 鑾峰彇杩滄帰澶碈鎴朞鍊�
+        /// 鑾峰彇杩滄帰澶碈鎴朞鍊硷紙搴熷純锛�
         /// </summary>
         /// <param name="connectionString">鏁版嵁搴撹繛鎺ュ瓧绗︿覆</param>
         /// <param name="modelId">绠℃煴ID</param>
@@ -143,7 +144,7 @@
         }
 
         /// <summary>
-        /// 鑾峰彇杩戞帰澶碈鎴朞鍊�
+        /// 鑾峰彇杩戞帰澶碈鎴朞鍊硷紙搴熷純锛�
         /// </summary>
         /// <param name="connectionString">鏁版嵁搴撹繛鎺ュ瓧绗︿覆</param>
         /// <param name="modelId">绠℃煴ID</param>
@@ -178,6 +179,124 @@
             return result;
         }
 
+        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)
         {
             var cWinLength = _cWinEndIndex - _cWinStartIndex + 1;
diff --git a/ErrorAnalysis.Service/ErrorRatioCalc.cs b/ErrorAnalysis.Service/ErrorRatioCalc.cs
index d308843..d18109e 100644
--- a/ErrorAnalysis.Service/ErrorRatioCalc.cs
+++ b/ErrorAnalysis.Service/ErrorRatioCalc.cs
@@ -16,26 +16,41 @@
         private static (double slope, double intercept) _lineCoef;
         private static (double a, double b, double c) _parabolaCoef;
 
-        public static ErrorRatioResult GetErrorRatioResult(string modelID, double porosity, double sw, double depth, bool lockSpeed, double speed, double yieldCounting, double targetErrorRatio, out double testSpeed, int pass = 0, double nearCofe = 0.65, double farCofe = 0.35)
+        public static ErrorRatioResult GetErrorRatioResult(string modelID, double porosity, double sw, double depth, bool lockSpeed, double speed, double yieldCounting, double targetErrorRatio, out double testSpeed, out ProcessingDataModel processingData, int pass = 0, double nearCofe = 0.65, double farCofe = 0.35)
         {
+            processingData = new ProcessingDataModel { Depth = depth, NearPDEVCoef = nearCofe, FarPDEVCoef = farCofe, NearTO = yieldCounting };
             var result = new ErrorRatioResult
             {
                 CWOL = new List<double[]>(),
                 OWOL = new List<double[]>(),
                 ErrorRatios = new List<ErrorRatio>()
             };
-
             result.COModel = RepositoryInstance.Instance.COModelRepository?.GetCOModel(modelID);
+            (result.CWOL, result.OWOL) = GetOilWaterLine(modelID);
+            processingData.OilLine = result.CWOL;
+            processingData.WaterLine = result.OWOL;
+            (processingData.OilLineOrigin, processingData.WaterLineOrgin) = GetOilWaterLine(modelID, true);
+            processingData.FarSpecData = COMergeCalcService.GetFarSpectrum(modelID, porosity, sw);
+            processingData.NearSpecData = COMergeCalcService.GetNearSpectrum(modelID, porosity, sw);
+
+            var nearCROR = COMergeCalcService.GetNearCOORResult(modelID, porosity, sw);
+            var farCROR = COMergeCalcService.GetFarCOORResult(modelID, porosity, sw);
+            processingData.NearCR = nearCROR.Item1;
+            processingData.NearOR = nearCROR.Item2;
+            processingData.FarCR = farCROR.Item1;
+            processingData.FarOR = farCROR.Item2;
+
+            var mDelta = GetMDelta(porosity, out double oilPoint, out double waterPoint);
+            processingData.OilPoint = oilPoint;
+            processingData.WaterPoint = waterPoint;
+
             if (lockSpeed)
             {
-                List<double[]> cWOL;
-                List<double[]> oWOL;
-                (cWOL, oWOL) = GetOilWaterLine(modelID);
-                result.CWOL = cWOL;
-                result.OWOL = oWOL;
-                var firstErrorPassM = GetFirstErrorRatio(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
-
+                var mergePDEV = Math.Sqrt(160 * speed / (0.0762 * 36 * depth)) * 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 / 2.2 * (Math.Pow(farCROR.Item1 / farCROR.Item2, 2)) * (1 / farCROR.Item1 + 1 / farCROR.Item2)));
+                var firstErrorPassM = new ErrorRatio { Pass = 1, ErrorRatioValue = mergePDEV / mDelta };
+                result.ErrorRatios.Clear();
                 result.ErrorRatios.Add(firstErrorPassM);
+
                 if (firstErrorPassM.ErrorRatioValue > targetErrorRatio)
                 {
                     var targetPass = Convert.ToInt32(Math.Ceiling(Math.Pow(firstErrorPassM.ErrorRatioValue / targetErrorRatio, 2)));
@@ -44,25 +59,17 @@
                         result.ErrorRatios.Add(new ErrorRatio { Pass = i, ErrorRatioValue = firstErrorPassM.ErrorRatioValue / Math.Sqrt(i) });
                     }
                 }
+                processingData.Speed = speed;
             }
             else
             {
                 var firstTargetErrorRatio = targetErrorRatio * Math.Sqrt(pass);
-                List<double[]> cWOL;
-                List<double[]> oWOL;
-                (cWOL, oWOL) = GetOilWaterLine(modelID);
-                result.CWOL = cWOL;
-                result.OWOL = oWOL;
 
-                var nearCROR = COMergeCalcService.GetNearCOORResult(modelID, porosity, sw);
-                var farCROR = COMergeCalcService.GetFarCOORResult(modelID, porosity, sw);
-                var mDelta = GetMDelta(porosity);
-
-                speed = Math.Pow(firstTargetErrorRatio /
-                    (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);
+                processingData.Speed = speed = Math.Pow(firstTargetErrorRatio /
+                     (Math.Sqrt(160 / (0.0762 * depth * 36d)) *
+                     1d / 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 / 2.2 * (Math.Pow(farCROR.Item1 / farCROR.Item2, 2)) * (1 / farCROR.Item1 + 1 / farCROR.Item2)))
+                     , 2);
 
                 var firstErrorPass = new ErrorRatio { Pass = 1, ErrorRatioValue = firstTargetErrorRatio };
 
@@ -88,36 +95,38 @@
 
         }
 
-        private static ErrorRatio GetFirstErrorRatio(string modelID, double porosity, double sw, double speed, double depth, double yieldCounting, double nearCofe, double farCofe)
+        private static ErrorRatio GetFirstErrorRatio(string modelID, double porosity, double sw, double speed, double depth, double yieldCounting, double nearCofe, double farCofe, out double oilPoint, out double waterPoint)
         {
             if (porosity > 40)
                 throw new InvalidDataException("Porosity value out of range!");
 
             try
             {
-                var mDelta = GetMDelta(porosity);
+                var mDelta = GetMDelta(porosity, out oilPoint, out waterPoint);
 
-                //var mergePDEVOld = PDEVCalcService.GetMergePDEV(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
+                var mergePDEVOld = PDEVCalcService.GetMergePDEV(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
 
-                var nearCROR = COMergeCalcService.GetNearCOORResult(modelID, porosity, sw);
-                var farCROR = COMergeCalcService.GetFarCOORResult(modelID, porosity, sw);
+                //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 mergePDEV = Math.Sqrt(160 * speed / (0.0762 * 36 * depth)) * 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 / 2.2 * (Math.Pow(farCROR.Item1 / farCROR.Item2, 2)) * (1 / farCROR.Item1 + 1 / farCROR.Item2)));
 
-                var errorRatio = mergePDEV / mDelta;
+                var errorRatio = mergePDEVOld / mDelta;
 
                 return new ErrorRatio { Pass = 1, ErrorRatioValue = errorRatio };
             }
             catch
             {
+                oilPoint = 0;
+                waterPoint = 0;
                 return new ErrorRatio { Pass = 0, ErrorRatioValue = 0 };
             }
         }
 
-        private static double GetMDelta(double porosity)
+        private static double GetMDelta(double porosity, out double oilPoint, out double waterPoint)
         {
-            var oilRes = Utility.GetParabolaValue(porosity, _parabolaCoef.a, _parabolaCoef.b, _parabolaCoef.c);
-            var waterRes = Utility.GetLineValue(porosity, _lineCoef.slope, _lineCoef.intercept);
+            oilPoint = Utility.GetParabolaValue(porosity, _parabolaCoef.a, _parabolaCoef.b, _parabolaCoef.c);
+            waterPoint = Utility.GetLineValue(porosity, _lineCoef.slope, _lineCoef.intercept);
 
             //var cWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 0);
             //var oWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 100);
@@ -150,15 +159,15 @@
             //    cRes = Utility.Interpolate(porosity, floorPorosity, floorC, ceilingPorosity, ceilingC);
             //    oRes = Utility.Interpolate(porosity, floorPorosity, floorO, ceilingPorosity, ceilingO);
             //}
-            return oilRes - waterRes;
+            return oilPoint - waterPoint;
         }
 
-        private static (List<double[]>, List<double[]>) GetOilWaterLine(string modelID)
+        private static (List<double[]>, List<double[]>) GetOilWaterLine(string modelID, bool original = false)
         {
             var cWOL = new List<double[]>();
             var oWOL = new List<double[]>();
 
-            var fitModel = GetFitModel(modelID);
+            var fitModel = original ? GetModel(modelID) : GetFitModel(modelID);
 
             var cWolRes = fitModel.Item1;
             var oWolRes = fitModel.Item2;
@@ -173,6 +182,13 @@
                 }
             }
             return (cWOL, oWOL);
+        }
+
+        private static (COWOLTable, COWOLTable) GetModel(string modelID)
+        {
+            var oilWol = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 0);
+            var waterWol = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 100);
+            return (oilWol, waterWol);
         }
 
         private static (COWOLTable, COWOLTable) GetFitModel(string modelID)
@@ -198,6 +214,7 @@
 
             _lineCoef = Utility.FitLine(waterPoints.ToArray());
             _parabolaCoef = Utility.FitParabola(oilPoints.ToArray());
+            //var texCoef = Utility.quadraticLine(oilPoints.Select(o => Convert.ToDouble(o.X)).ToArray(), oilPoints.Select(o => Convert.ToDouble(o.Y)).ToArray());
 
             double initDiff = 0;
 
@@ -208,6 +225,7 @@
                     var porosity = double.Parse(wolProperty.Name.Replace("WLPu", ""));
                     var waterVal = Utility.GetLineValue(porosity, _lineCoef.slope, _lineCoef.intercept);
                     var oilVal = Utility.GetParabolaValue(porosity, _parabolaCoef.a, _parabolaCoef.b, _parabolaCoef.c);
+                    //var testoilVal = Utility.GetParabolaValue(porosity, texCoef.a, texCoef.b, texCoef.c);
                     if (porosity == 0)
                     {
                         initDiff = oilVal - waterVal;
diff --git a/ErrorAnalysis.Service/Model/ProcessingDataModel.cs b/ErrorAnalysis.Service/Model/ProcessingDataModel.cs
new file mode 100644
index 0000000..dc9539f
--- /dev/null
+++ b/ErrorAnalysis.Service/Model/ProcessingDataModel.cs
@@ -0,0 +1,42 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ErrorAnalysis.Service.Model
+{
+    public class ProcessingDataModel
+    {
+        public double Speed { get; set; }
+        public double Depth { get; set; }
+        public double NearCR { get; set; }
+        public double NearOR { get; set; }
+        public double FarCR { get; set; }
+        public double FarOR { get; set; }
+        public double NearTO { get; set; }
+        public double NearPDEVCoef { get; set; }
+        public double FarPDEVCoef { get; set; }
+
+        public double NearCC { get { return 0.0762 / Speed * Depth * 36 / 160 * NearTO * NearCR; } }
+        public double NearOC { get { return 0.0762 / Speed * Depth * 36 / 160 * NearTO * NearOR; } }
+        public double FarCC { get { return 0.0762 / Speed * Depth * 36 / 160 * FarTO * FarCR; } }
+        public double FarOC { get { return 0.0762 / Speed * Depth * 36 / 160 * FarTO * FarOR; } }
+        public double FarTO { get { return NearTO / 2.2; } }
+
+        public double FarPDEV { get { return FarCC / FarOC * Math.Sqrt(1 / FarCC + 1 / FarOC); } }
+        public double NearPDEV { get { return NearCC / NearOC * Math.Sqrt(1 / NearCC + 1 / NearOC); } }
+
+        public double MergePDEV { get { return Math.Sqrt(NearPDEVCoef * NearPDEVCoef * NearPDEV * NearPDEV + FarPDEVCoef * FarPDEVCoef * FarPDEV * FarPDEV); } }
+        public double OilPoint { get; set; }
+        public double WaterPoint { get; set; }
+        public double MergeDelta { get{ return OilPoint - WaterPoint; } }
+
+        public List<double[]> OilLine { get; set; }
+        public List<double[]> OilLineOrigin { get; set; }
+        public List<double[]> WaterLine { get; set; }
+        public List<double[]> WaterLineOrgin { get; set; }
+        public List<double[]> FarSpecData { get; set; }
+        public List<double[]> NearSpecData { get; set; }
+    }
+}
diff --git a/ErrorAnalysis.Service/Model/ReportModel.cs b/ErrorAnalysis.Service/Model/ReportModel.cs
index c19cfb5..2b17157 100644
--- a/ErrorAnalysis.Service/Model/ReportModel.cs
+++ b/ErrorAnalysis.Service/Model/ReportModel.cs
@@ -35,6 +35,8 @@
         public string ReserviorSalinity { get; set; }
         public string VSH { get; set; }
 
+        public string FarYieldCounting { get; set; }
+        public string NearYieldCounting { get; set; }
         public string SoPrecisionRequired { get; set; }
         public string Pass { get; set; }
         public string DepthAveraging { get; set; }
diff --git a/ErrorAnalysis.Service/PDEVCalcService.cs b/ErrorAnalysis.Service/PDEVCalcService.cs
index e6bf20d..1bb718f 100644
--- a/ErrorAnalysis.Service/PDEVCalcService.cs
+++ b/ErrorAnalysis.Service/PDEVCalcService.cs
@@ -8,6 +8,7 @@
 {
     public class PDEVCalcService
     {
+        //搴熷純
         public static double GetMergePDEV(string modelId, double porosity, double sw, double speed, double depth, double yieldCounting, double nearCofe, double farCofe)
         {
             var farResult = COMergeCalcService.GetFarMergeCOResult(modelId, porosity, sw, speed, depth, yieldCounting);
@@ -19,6 +20,7 @@
             return Math.Sqrt(Math.Pow(nearPDEV * nearCofe, 2) + Math.Pow(farPDEV * farCofe, 2));
         }
 
+        //搴熷純
         private static double CalcPDEV(double c, double o) => c / o * Math.Sqrt((1 / c + 1 / o));
     }
 }
diff --git a/ErrorAnalysis.Service/Template/JobPlanReportTemp.docx b/ErrorAnalysis.Service/Template/JobPlanReportTemp.docx
index 1a8a4de..3a2dec6 100644
--- a/ErrorAnalysis.Service/Template/JobPlanReportTemp.docx
+++ b/ErrorAnalysis.Service/Template/JobPlanReportTemp.docx
Binary files differ
diff --git a/ErrorAnalysis.Service/Utility.cs b/ErrorAnalysis.Service/Utility.cs
index e491bad..66b5738 100644
--- a/ErrorAnalysis.Service/Utility.cs
+++ b/ErrorAnalysis.Service/Utility.cs
@@ -144,6 +144,199 @@
             return result;
         }
 
+        public static (double a, double b, double c) quadraticLine(double[] arrX, double[] arrY)
+        {
+            double[] coef = new double[3];
+            double[,] AA = new double[3, 3];
+            double[,] TAA = new double[3, 3];
+            double[,] BAA = new double[3, 1];
+            double[] B = new double[3];
+            int m = arrX.Length;
+
+            double[] arrXp = new double[m];
+            double[] arrXc = new double[m];
+            double[] arrXv = new double[m];
+            double[] y = new double[m];
+
+            for (int i = 0; i < m; i++)
+            {
+                arrXp[i] = arrX[i] * arrX[i];
+            }
+            for (int i = 0; i < m; i++)
+            {
+                arrXc[i] = arrX[i] * arrX[i] * arrX[i];
+            }
+            for (int i = 0; i < m; i++)
+            {
+                arrXv[i] = arrX[i] * arrX[i] * arrX[i] * arrX[i];
+            }
+            double a1 = mysum(arrX);
+            double a2 = mysum(arrXp);
+            double a3 = mysum(arrXc);
+            double a4 = mysum(arrXv);
+
+            AA[0, 0] = m;
+            AA[0, 1] = a1;
+            AA[0, 2] = a2;
+            AA[1, 0] = a1;
+            AA[1, 1] = a2;
+            AA[1, 2] = a3;
+            AA[2, 0] = a2;
+            AA[2, 1] = a3;
+            AA[2, 2] = a4;
+            double[] xy = new double[m];
+            double[] xxy = new double[m];
+            for (int i = 0; i < m; i++)
+            {
+                xy[i] = arrX[i] * arrY[i];
+            }
+            for (int i = 0; i < m; i++)
+            {
+                xxy[i] = arrX[i] * arrX[i] * arrY[i];
+            }
+            double b1 = mysum(arrY);
+            double b2 = mysum(xy);
+            double b3 = mysum(xxy);
+            B[0] = b1;
+            B[1] = b2;
+            B[2] = b3;
+            TAA = ReverseMatrix(AA, 3);
+            for (int i = 0; i < 3; i++)
+            {
+                for (int j = 0; j < 3; j++)
+                {
+                    coef[i] = coef[i] + TAA[i, j] * B[j];
+                }
+            }
+            return (coef[2], coef[1], coef[0]);
+
+        }
+
+        public static double[,] ReverseMatrix(double[,] dMatrix, int Level)
+        {
+            double dMatrixValue = MatrixValue(dMatrix, Level);
+            if (dMatrixValue == 0) return null;
+            double[,] dReverseMatrix = new double[Level, 2 * Level];
+            double x, c;
+            // Init Reverse matrix
+            for (int i = 0; i < Level; i++)
+            {
+                for (int j = 0; j < 2 * Level; j++)
+                {
+                    if (j < Level)
+                        dReverseMatrix[i, j] = dMatrix[i, j];
+                    else
+                        dReverseMatrix[i, j] = 0;
+                }
+                dReverseMatrix[i, Level + i] = 1;
+            }
+            for (int i = 0, j = 0; i < Level && j < Level; i++, j++)
+            {
+                if (dReverseMatrix[i, j] == 0)
+                {
+                    int m = i;
+                    for (; dMatrix[m, j] == 0; m++) ;
+                    if (m == Level)
+                        return null;
+                    else
+                    {
+                        // Add i-row with m-row
+                        for (int n = j; n < 2 * Level; n++)
+                            dReverseMatrix[i, n] += dReverseMatrix[m, n];
+                    }
+                }
+                // Format the i-row with "1" start
+                x = dReverseMatrix[i, j];
+                if (x != 1)
+                {
+                    for (int n = j; n < 2 * Level; n++)
+                        if (dReverseMatrix[i, n] != 0)
+                            dReverseMatrix[i, n] /= x;
+                }
+                // Set 0 to the current column in the rows after current row
+                for (int s = Level - 1; s > i; s--)
+                {
+                    x = dReverseMatrix[s, j];
+                    for (int t = j; t < 2 * Level; t++)
+                        dReverseMatrix[s, t] -= (dReverseMatrix[i, t] * x);
+                }
+            }
+            // Format the first matrix into unit-matrix
+            for (int i = Level - 2; i >= 0; i--)
+            {
+                for (int j = i + 1; j < Level; j++)
+                    if (dReverseMatrix[i, j] != 0)
+                    {
+                        c = dReverseMatrix[i, j];
+                        for (int n = j; n < 2 * Level; n++)
+                            dReverseMatrix[i, n] -= (c * dReverseMatrix[j, n]);
+                    }
+            }
+            double[,] dReturn = new double[Level, Level];
+            for (int i = 0; i < Level; i++)
+                for (int j = 0; j < Level; j++)
+                    dReturn[i, j] = dReverseMatrix[i, j + Level];
+            return dReturn;
+        }
+        private static double MatrixValue(double[,] MatrixList, int Level)
+        {
+            double[,] dMatrix = new double[Level, Level];
+            for (int i = 0; i < Level; i++)
+                for (int j = 0; j < Level; j++)
+                    dMatrix[i, j] = MatrixList[i, j];
+            double c, x;
+            int k = 1;
+            for (int i = 0, j = 0; i < Level && j < Level; i++, j++)
+            {
+                if (dMatrix[i, j] == 0)
+                {
+                    int m = i;
+                    for (; dMatrix[m, j] == 0; m++) ;
+                    if (m == Level)
+                        return 0;
+                    else
+                    {
+                        // Row change between i-row and m-row
+                        for (int n = j; n < Level; n++)
+                        {
+                            c = dMatrix[i, n];
+                            dMatrix[i, n] = dMatrix[m, n];
+                            dMatrix[m, n] = c;
+                        }
+                        // Change value pre-value
+                        k *= (-1);
+                    }
+                }
+                // Set 0 to the current column in the rows after current row
+                for (int s = Level - 1; s > i; s--)
+                {
+                    x = dMatrix[s, j];
+                    for (int t = j; t < Level; t++)
+                        dMatrix[s, t] -= dMatrix[i, t] * (x / dMatrix[i, j]);
+                }
+            }
+            double sn = 1;
+            for (int i = 0; i < Level; i++)
+            {
+                if (dMatrix[i, i] != 0)
+                    sn *= dMatrix[i, i];
+                else
+                    return 0;
+            }
+            return k * sn;
+        }
+
+        public static double mysum(double[] XX)
+        {
+            double reout = 0;
+            int mm = XX.Length;
+            for (int i = 0; i < mm; i++)
+            {
+                reout = reout + XX[i];
+            }
+            return reout;
+        }
+
         public static double GetParabolaValue(double x, double a, double b, double c)
         {
             return a * x * x + b * x + c;
diff --git a/ErrorAnalysis.UI/ErrorAnalysis.UI.csproj b/ErrorAnalysis.UI/ErrorAnalysis.UI.csproj
index d187776..dd2cca1 100644
--- a/ErrorAnalysis.UI/ErrorAnalysis.UI.csproj
+++ b/ErrorAnalysis.UI/ErrorAnalysis.UI.csproj
@@ -10,7 +10,7 @@
 		<Authors>Casing Research Insitute</Authors>
 		<Product>JobPlanner</Product>
 		<Copyright>COSL</Copyright>
-		<Version>1.1.1</Version>
+		<Version>1.2.0</Version>
 	</PropertyGroup>
 
 	<ItemGroup>
diff --git a/ErrorAnalysis.UI/FrmMain.Designer.cs b/ErrorAnalysis.UI/FrmMain.Designer.cs
index 41001ae..9000c8c 100644
--- a/ErrorAnalysis.UI/FrmMain.Designer.cs
+++ b/ErrorAnalysis.UI/FrmMain.Designer.cs
@@ -133,6 +133,7 @@
             label53 = new Label();
             label52 = new Label();
             pbLoadDB = new ProgressBar();
+            chkProcessing = new CheckBox();
             ((System.ComponentModel.ISupportInitialize)nudSoPrecisionRequired).BeginInit();
             pnlLockPass.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)nudPass).BeginInit();
@@ -1240,11 +1241,23 @@
             pbLoadDB.TabIndex = 8;
             pbLoadDB.Visible = false;
             // 
+            // chkProcessing
+            // 
+            chkProcessing.AutoSize = true;
+            chkProcessing.CheckAlign = ContentAlignment.MiddleRight;
+            chkProcessing.Location = new Point(581, 582);
+            chkProcessing.Name = "chkProcessing";
+            chkProcessing.Size = new Size(129, 21);
+            chkProcessing.TabIndex = 39;
+            chkProcessing.Text = "Check Processing";
+            chkProcessing.UseVisualStyleBackColor = true;
+            // 
             // FrmMain
             // 
             AutoScaleDimensions = new SizeF(7F, 17F);
             AutoScaleMode = AutoScaleMode.Font;
             ClientSize = new Size(884, 611);
+            Controls.Add(chkProcessing);
             Controls.Add(pbLoadDB);
             Controls.Add(tabEditInfo);
             Controls.Add(btnSelectDataSource);
@@ -1405,5 +1418,6 @@
         private RichTextBox txtAnalysisResult;
         private Label label7;
         private NumericUpDown nudYieldCounting;
+        private CheckBox chkProcessing;
     }
 }
diff --git a/ErrorAnalysis.UI/FrmMain.cs b/ErrorAnalysis.UI/FrmMain.cs
index f1cd5f2..ce31e28 100644
--- a/ErrorAnalysis.UI/FrmMain.cs
+++ b/ErrorAnalysis.UI/FrmMain.cs
@@ -162,6 +162,7 @@
             if (cmbTargetLoggingIntervalUnit.Text == "ft")
                 targetLoggingInterval = UnitConvert.Ft2M(targetLoggingInterval);
             txtAnalysisResult.Clear();
+            ProcessingDataModel processingData;
             if (rdoLockSpeed.Checked)
             {
                 if (!double.TryParse(nudSpeed.Value.ToString(), out double speed) || nudSpeed.Value <= 0)
@@ -171,7 +172,8 @@
                 }
                 var calcSpeed = cmbSpeedUnit.Text == "ft/hr" ? UnitConvert.FtHr2MS(speed) : UnitConvert.MHR2MS(speed);
 
-                var result = ErrorRatioCalc.GetErrorRatioResult(_model.ModelID, porosity, sw, depth, true, calcSpeed, yieldCounting, targetErrorRatio / 100, out _);
+                var result = ErrorRatioCalc.GetErrorRatioResult(_model.ModelID, porosity, sw, depth, true, calcSpeed, yieldCounting, targetErrorRatio / 100, out _, out processingData);
+
                 Plot(result);
 
                 double totalTime = Math.Round((targetLoggingInterval / calcSpeed / 60 / 60), 2);
@@ -195,7 +197,7 @@
                     return;
                 }
                 double speed;
-                var result = ErrorRatioCalc.GetErrorRatioResult(_model.ModelID, porosity, sw, depth, false, 0, yieldCounting, targetErrorRatio / 100, out speed, pass);
+                var result = ErrorRatioCalc.GetErrorRatioResult(_model.ModelID, porosity, sw, depth, false, 0, yieldCounting, targetErrorRatio / 100, out speed, out processingData, pass);
                 Plot(result);
 
                 double totalTime = Math.Round((targetLoggingInterval / speed / 60 / 60), 2);
@@ -213,6 +215,8 @@
 
                 _reportModel = CreateReportModel(totalTime.ToString(), result.ErrorRatios.Count.ToString(), speedFr.ToString(), errorRate.ToString());
             }
+            if (chkProcessing.Checked)
+                new ProcessingData(processingData).Show();
 
 
         }
@@ -405,9 +409,9 @@
 
             var property = control.Tag.ToString();
             var filterVal = control.Text == "water" ? "0" : control.Text == "oil" ? "100" : control.Text == "gas" ? "200" : "999";
-            if (_filters==null)
+            if (_filters == null)
                 return;
-            
+
             if (_filters.ContainsKey(property))
                 _filters[property] = filterVal;
             else
@@ -604,7 +608,9 @@
                 TubeID = cmbTubeID.Text,
                 TubeOD = cmbTubeOD.Text,
                 VSH = nudVSH.Value.ToString(),
-                WaterSaturation = nudSw.Value.ToString()
+                WaterSaturation = nudSw.Value.ToString(),
+                NearYieldCounting = nudYieldCounting.Value.ToString(),
+                FarYieldCounting = Math.Round(nudYieldCounting.Value / 2.2m, 2).ToString(),
             };
         }
 
diff --git a/ErrorAnalysis.UI/ProcessingData.Designer.cs b/ErrorAnalysis.UI/ProcessingData.Designer.cs
new file mode 100644
index 0000000..0d5fec2
--- /dev/null
+++ b/ErrorAnalysis.UI/ProcessingData.Designer.cs
@@ -0,0 +1,499 @@
+锘縩amespace ErrorAnalysis.UI
+{
+    partial class ProcessingData
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            tableLayoutPanel1 = new TableLayoutPanel();
+            panel1 = new Panel();
+            txtFarCC = new TextBox();
+            txtMergeDelta = new TextBox();
+            txtNearCC = new TextBox();
+            txtWaterLinePoint = new TextBox();
+            label16 = new Label();
+            txtOilLinePoint = new TextBox();
+            label1 = new Label();
+            txtMergePDEV = new TextBox();
+            label15 = new Label();
+            txtNearPDEV = new TextBox();
+            label2 = new Label();
+            txtFarPDEV = new TextBox();
+            label14 = new Label();
+            txtFarTO = new TextBox();
+            label3 = new Label();
+            txtNearTO = new TextBox();
+            label13 = new Label();
+            label12 = new Label();
+            label4 = new Label();
+            label11 = new Label();
+            txtFarOC = new TextBox();
+            txtNearOC = new TextBox();
+            label10 = new Label();
+            txtFarCR = new TextBox();
+            label9 = new Label();
+            txtNearOR = new TextBox();
+            label8 = new Label();
+            txtFarOR = new TextBox();
+            label7 = new Label();
+            txtNearCR = new TextBox();
+            label6 = new Label();
+            label5 = new Label();
+            pnlCO = new Panel();
+            pnlData = new Panel();
+            panel2 = new Panel();
+            btnClose = new Button();
+            tableLayoutPanel1.SuspendLayout();
+            panel1.SuspendLayout();
+            SuspendLayout();
+            // 
+            // tableLayoutPanel1
+            // 
+            tableLayoutPanel1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+            tableLayoutPanel1.ColumnCount = 2;
+            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+            tableLayoutPanel1.Controls.Add(panel1, 0, 0);
+            tableLayoutPanel1.Controls.Add(pnlCO, 0, 1);
+            tableLayoutPanel1.Controls.Add(pnlData, 1, 1);
+            tableLayoutPanel1.Controls.Add(panel2, 1, 0);
+            tableLayoutPanel1.Location = new Point(2, 2);
+            tableLayoutPanel1.Name = "tableLayoutPanel1";
+            tableLayoutPanel1.RowCount = 2;
+            tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 260F));
+            tableLayoutPanel1.RowStyles.Add(new RowStyle());
+            tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
+            tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
+            tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
+            tableLayoutPanel1.Size = new Size(857, 576);
+            tableLayoutPanel1.TabIndex = 0;
+            // 
+            // panel1
+            // 
+            panel1.Controls.Add(txtFarCC);
+            panel1.Controls.Add(txtMergeDelta);
+            panel1.Controls.Add(txtNearCC);
+            panel1.Controls.Add(txtWaterLinePoint);
+            panel1.Controls.Add(label16);
+            panel1.Controls.Add(txtOilLinePoint);
+            panel1.Controls.Add(label1);
+            panel1.Controls.Add(txtMergePDEV);
+            panel1.Controls.Add(label15);
+            panel1.Controls.Add(txtNearPDEV);
+            panel1.Controls.Add(label2);
+            panel1.Controls.Add(txtFarPDEV);
+            panel1.Controls.Add(label14);
+            panel1.Controls.Add(txtFarTO);
+            panel1.Controls.Add(label3);
+            panel1.Controls.Add(txtNearTO);
+            panel1.Controls.Add(label13);
+            panel1.Controls.Add(label12);
+            panel1.Controls.Add(label4);
+            panel1.Controls.Add(label11);
+            panel1.Controls.Add(txtFarOC);
+            panel1.Controls.Add(txtNearOC);
+            panel1.Controls.Add(label10);
+            panel1.Controls.Add(txtFarCR);
+            panel1.Controls.Add(label9);
+            panel1.Controls.Add(txtNearOR);
+            panel1.Controls.Add(label8);
+            panel1.Controls.Add(txtFarOR);
+            panel1.Controls.Add(label7);
+            panel1.Controls.Add(txtNearCR);
+            panel1.Controls.Add(label6);
+            panel1.Controls.Add(label5);
+            panel1.Dock = DockStyle.Fill;
+            panel1.Location = new Point(3, 3);
+            panel1.Name = "panel1";
+            panel1.Size = new Size(422, 254);
+            panel1.TabIndex = 0;
+            // 
+            // txtFarCC
+            // 
+            txtFarCC.Location = new Point(78, 137);
+            txtFarCC.Name = "txtFarCC";
+            txtFarCC.ReadOnly = true;
+            txtFarCC.Size = new Size(114, 23);
+            txtFarCC.TabIndex = 16;
+            // 
+            // txtMergeDelta
+            // 
+            txtMergeDelta.Location = new Point(300, 218);
+            txtMergeDelta.Name = "txtMergeDelta";
+            txtMergeDelta.ReadOnly = true;
+            txtMergeDelta.Size = new Size(114, 23);
+            txtMergeDelta.TabIndex = 27;
+            // 
+            // txtNearCC
+            // 
+            txtNearCC.Location = new Point(78, 14);
+            txtNearCC.Name = "txtNearCC";
+            txtNearCC.ReadOnly = true;
+            txtNearCC.Size = new Size(114, 23);
+            txtNearCC.TabIndex = 12;
+            // 
+            // txtWaterLinePoint
+            // 
+            txtWaterLinePoint.Location = new Point(300, 189);
+            txtWaterLinePoint.Name = "txtWaterLinePoint";
+            txtWaterLinePoint.ReadOnly = true;
+            txtWaterLinePoint.Size = new Size(114, 23);
+            txtWaterLinePoint.TabIndex = 26;
+            // 
+            // label16
+            // 
+            label16.AutoSize = true;
+            label16.Location = new Point(19, 140);
+            label16.Name = "label16";
+            label16.Size = new Size(42, 17);
+            label16.TabIndex = 0;
+            label16.Text = "FarCC";
+            // 
+            // txtOilLinePoint
+            // 
+            txtOilLinePoint.Location = new Point(300, 163);
+            txtOilLinePoint.Name = "txtOilLinePoint";
+            txtOilLinePoint.ReadOnly = true;
+            txtOilLinePoint.Size = new Size(114, 23);
+            txtOilLinePoint.TabIndex = 25;
+            // 
+            // label1
+            // 
+            label1.AutoSize = true;
+            label1.Location = new Point(19, 17);
+            label1.Name = "label1";
+            label1.Size = new Size(53, 17);
+            label1.TabIndex = 0;
+            label1.Text = "NearCC";
+            // 
+            // txtMergePDEV
+            // 
+            txtMergePDEV.Location = new Point(300, 121);
+            txtMergePDEV.Name = "txtMergePDEV";
+            txtMergePDEV.ReadOnly = true;
+            txtMergePDEV.Size = new Size(114, 23);
+            txtMergePDEV.TabIndex = 24;
+            // 
+            // label15
+            // 
+            label15.AutoSize = true;
+            label15.Location = new Point(19, 166);
+            label15.Name = "label15";
+            label15.Size = new Size(44, 17);
+            label15.TabIndex = 1;
+            label15.Text = "FarOC";
+            // 
+            // txtNearPDEV
+            // 
+            txtNearPDEV.Location = new Point(300, 92);
+            txtNearPDEV.Name = "txtNearPDEV";
+            txtNearPDEV.ReadOnly = true;
+            txtNearPDEV.Size = new Size(114, 23);
+            txtNearPDEV.TabIndex = 23;
+            // 
+            // label2
+            // 
+            label2.AutoSize = true;
+            label2.Location = new Point(19, 43);
+            label2.Name = "label2";
+            label2.Size = new Size(55, 17);
+            label2.TabIndex = 1;
+            label2.Text = "NearOC";
+            // 
+            // txtFarPDEV
+            // 
+            txtFarPDEV.Location = new Point(300, 66);
+            txtFarPDEV.Name = "txtFarPDEV";
+            txtFarPDEV.ReadOnly = true;
+            txtFarPDEV.Size = new Size(114, 23);
+            txtFarPDEV.TabIndex = 22;
+            // 
+            // label14
+            // 
+            label14.AutoSize = true;
+            label14.Location = new Point(21, 218);
+            label14.Name = "label14";
+            label14.Size = new Size(44, 17);
+            label14.TabIndex = 2;
+            label14.Text = "FarOR";
+            // 
+            // txtFarTO
+            // 
+            txtFarTO.Location = new Point(300, 40);
+            txtFarTO.Name = "txtFarTO";
+            txtFarTO.ReadOnly = true;
+            txtFarTO.Size = new Size(114, 23);
+            txtFarTO.TabIndex = 21;
+            // 
+            // label3
+            // 
+            label3.AutoSize = true;
+            label3.Location = new Point(21, 69);
+            label3.Name = "label3";
+            label3.Size = new Size(53, 17);
+            label3.TabIndex = 2;
+            label3.Text = "NearCR";
+            // 
+            // txtNearTO
+            // 
+            txtNearTO.Location = new Point(300, 14);
+            txtNearTO.Name = "txtNearTO";
+            txtNearTO.ReadOnly = true;
+            txtNearTO.Size = new Size(114, 23);
+            txtNearTO.TabIndex = 20;
+            // 
+            // label13
+            // 
+            label13.AutoSize = true;
+            label13.Location = new Point(19, 192);
+            label13.Name = "label13";
+            label13.Size = new Size(42, 17);
+            label13.TabIndex = 3;
+            label13.Text = "FarCR";
+            // 
+            // label12
+            // 
+            label12.AutoSize = true;
+            label12.Location = new Point(217, 221);
+            label12.Name = "label12";
+            label12.Size = new Size(77, 17);
+            label12.TabIndex = 11;
+            label12.Text = "MergeDelta";
+            // 
+            // label4
+            // 
+            label4.AutoSize = true;
+            label4.Location = new Point(19, 95);
+            label4.Name = "label4";
+            label4.Size = new Size(55, 17);
+            label4.TabIndex = 3;
+            label4.Text = "NearOR";
+            // 
+            // label11
+            // 
+            label11.AutoSize = true;
+            label11.Location = new Point(216, 124);
+            label11.Name = "label11";
+            label11.Size = new Size(78, 17);
+            label11.TabIndex = 10;
+            label11.Text = "MergePDEV";
+            // 
+            // txtFarOC
+            // 
+            txtFarOC.Location = new Point(78, 163);
+            txtFarOC.Name = "txtFarOC";
+            txtFarOC.ReadOnly = true;
+            txtFarOC.Size = new Size(114, 23);
+            txtFarOC.TabIndex = 17;
+            // 
+            // txtNearOC
+            // 
+            txtNearOC.Location = new Point(78, 40);
+            txtNearOC.Name = "txtNearOC";
+            txtNearOC.ReadOnly = true;
+            txtNearOC.Size = new Size(114, 23);
+            txtNearOC.TabIndex = 13;
+            // 
+            // label10
+            // 
+            label10.AutoSize = true;
+            label10.Location = new Point(237, 69);
+            label10.Name = "label10";
+            label10.Size = new Size(57, 17);
+            label10.TabIndex = 9;
+            label10.Text = "FarPDEV";
+            // 
+            // txtFarCR
+            // 
+            txtFarCR.Location = new Point(78, 189);
+            txtFarCR.Name = "txtFarCR";
+            txtFarCR.ReadOnly = true;
+            txtFarCR.Size = new Size(114, 23);
+            txtFarCR.TabIndex = 18;
+            // 
+            // label9
+            // 
+            label9.AutoSize = true;
+            label9.Location = new Point(226, 95);
+            label9.Name = "label9";
+            label9.Size = new Size(68, 17);
+            label9.TabIndex = 8;
+            label9.Text = "NearPDEV";
+            // 
+            // txtNearOR
+            // 
+            txtNearOR.Location = new Point(78, 92);
+            txtNearOR.Name = "txtNearOR";
+            txtNearOR.ReadOnly = true;
+            txtNearOR.Size = new Size(114, 23);
+            txtNearOR.TabIndex = 15;
+            // 
+            // label8
+            // 
+            label8.AutoSize = true;
+            label8.Location = new Point(199, 192);
+            label8.Name = "label8";
+            label8.Size = new Size(95, 17);
+            label8.TabIndex = 7;
+            label8.Text = "WaterLinePoint";
+            // 
+            // txtFarOR
+            // 
+            txtFarOR.Location = new Point(78, 215);
+            txtFarOR.Name = "txtFarOR";
+            txtFarOR.ReadOnly = true;
+            txtFarOR.Size = new Size(114, 23);
+            txtFarOR.TabIndex = 19;
+            // 
+            // label7
+            // 
+            label7.AutoSize = true;
+            label7.Location = new Point(218, 166);
+            label7.Name = "label7";
+            label7.Size = new Size(76, 17);
+            label7.TabIndex = 6;
+            label7.Text = "OilLinePoint";
+            // 
+            // txtNearCR
+            // 
+            txtNearCR.Location = new Point(78, 66);
+            txtNearCR.Name = "txtNearCR";
+            txtNearCR.ReadOnly = true;
+            txtNearCR.Size = new Size(114, 23);
+            txtNearCR.TabIndex = 14;
+            // 
+            // label6
+            // 
+            label6.AutoSize = true;
+            label6.Location = new Point(251, 43);
+            label6.Name = "label6";
+            label6.Size = new Size(43, 17);
+            label6.TabIndex = 5;
+            label6.Text = "FarTO";
+            // 
+            // label5
+            // 
+            label5.AutoSize = true;
+            label5.Location = new Point(240, 17);
+            label5.Name = "label5";
+            label5.Size = new Size(54, 17);
+            label5.TabIndex = 4;
+            label5.Text = "NearTO";
+            // 
+            // pnlCO
+            // 
+            pnlCO.Dock = DockStyle.Fill;
+            pnlCO.Location = new Point(3, 263);
+            pnlCO.Name = "pnlCO";
+            pnlCO.Size = new Size(422, 310);
+            pnlCO.TabIndex = 2;
+            // 
+            // pnlData
+            // 
+            pnlData.Dock = DockStyle.Fill;
+            pnlData.Location = new Point(431, 263);
+            pnlData.Name = "pnlData";
+            pnlData.Size = new Size(423, 310);
+            pnlData.TabIndex = 1;
+            // 
+            // panel2
+            // 
+            panel2.Dock = DockStyle.Fill;
+            panel2.Location = new Point(431, 3);
+            panel2.Name = "panel2";
+            panel2.Size = new Size(423, 254);
+            panel2.TabIndex = 3;
+            // 
+            // btnClose
+            // 
+            btnClose.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+            btnClose.Location = new Point(784, 584);
+            btnClose.Name = "btnClose";
+            btnClose.Size = new Size(75, 23);
+            btnClose.TabIndex = 1;
+            btnClose.Text = "Close";
+            btnClose.UseVisualStyleBackColor = true;
+            btnClose.Click += btnClose_Click;
+            // 
+            // ProcessingData
+            // 
+            AutoScaleDimensions = new SizeF(7F, 17F);
+            AutoScaleMode = AutoScaleMode.Font;
+            ClientSize = new Size(861, 610);
+            Controls.Add(btnClose);
+            Controls.Add(tableLayoutPanel1);
+            Name = "ProcessingData";
+            StartPosition = FormStartPosition.CenterScreen;
+            Text = "ProcessingData";
+            Load += ProcessingData_Load;
+            tableLayoutPanel1.ResumeLayout(false);
+            panel1.ResumeLayout(false);
+            panel1.PerformLayout();
+            ResumeLayout(false);
+        }
+
+        #endregion
+
+        private TableLayoutPanel tableLayoutPanel1;
+        private Panel panel1;
+        private Panel pnlData;
+        private Panel pnlCO;
+        private Button btnClose;
+        private Label label1;
+        private Label label2;
+        private Label label4;
+        private Label label3;
+        private Label label6;
+        private Label label5;
+        private Label label8;
+        private Label label7;
+        private TextBox txtNearCC;
+        private Label label12;
+        private Label label11;
+        private Label label10;
+        private Label label9;
+        private TextBox txtFarTO;
+        private TextBox txtNearTO;
+        private TextBox txtNearCR;
+        private TextBox txtNearOR;
+        private TextBox txtNearOC;
+        private TextBox txtMergeDelta;
+        private TextBox txtWaterLinePoint;
+        private TextBox txtOilLinePoint;
+        private TextBox txtMergePDEV;
+        private TextBox txtNearPDEV;
+        private TextBox txtFarPDEV;
+        private Panel panel2;
+        private TextBox txtFarCC;
+        private Label label16;
+        private Label label15;
+        private Label label14;
+        private Label label13;
+        private TextBox txtFarOC;
+        private TextBox txtFarCR;
+        private TextBox txtFarOR;
+    }
+}
\ No newline at end of file
diff --git a/ErrorAnalysis.UI/ProcessingData.cs b/ErrorAnalysis.UI/ProcessingData.cs
new file mode 100644
index 0000000..0ea8b4c
--- /dev/null
+++ b/ErrorAnalysis.UI/ProcessingData.cs
@@ -0,0 +1,132 @@
+锘縰sing ErrorAnalysis.Service.Model;
+using OxyPlot.Axes;
+using OxyPlot.Legends;
+using OxyPlot.Series;
+using OxyPlot.WindowsForms;
+using OxyPlot;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ErrorAnalysis.UI
+{
+    public partial class ProcessingData : Form
+    {
+        ProcessingDataModel _model;
+        public ProcessingData(ProcessingDataModel model)
+        {
+            _model = model;
+            InitializeComponent();
+        }
+
+        private void Plot(ProcessingDataModel model)
+        {
+            pnlCO.Controls.Clear();
+            pnlData.Controls.Clear();
+            var plotModel = new PlotModel();
+
+            var xAxis = new LinearAxis { Position = AxisPosition.Bottom, Title = "Porosity(%)" };
+            var yAxis = new LinearAxis { Position = AxisPosition.Left, Title = "C/O" };
+            xAxis.MajorGridlineStyle = LineStyle.DashDashDotDot;
+            yAxis.MajorGridlineStyle = LineStyle.DashDot;
+
+
+            plotModel.Axes.Add(xAxis);
+            plotModel.Axes.Add(yAxis);
+
+            // 鍒涘缓鏇茬嚎绯诲垪
+            var oSeries = new LineSeries { Title = "Water Line", Color = OxyColors.MediumBlue };
+            var cSeries = new LineSeries { Title = "Oil Line", Color = OxyColors.DarkRed };
+            var oOriginSeries = new LineSeries { Title = "Water Line Origin", Color = OxyColors.MediumPurple };
+            var cOriginSeries = new LineSeries { Title = "Oil Line Origin", Color = OxyColors.DarkOrange };
+
+            foreach (var o in model.WaterLine)
+                oSeries.Points.Add(new DataPoint(o[0], o[1]));
+            foreach (var c in model.OilLine)
+                cSeries.Points.Add(new DataPoint(c[0], c[1]));
+            foreach (var o in model.WaterLineOrgin)
+                oOriginSeries.Points.Add(new DataPoint(o[0], o[1]));
+            foreach (var c in model.OilLineOrigin)
+                cOriginSeries.Points.Add(new DataPoint(c[0], c[1]));
+
+            plotModel.Legends.Add(new Legend { LegendPosition = LegendPosition.TopLeft });
+            // 娣诲姞鏇茬嚎鍒板浘琛ㄦā鍨�
+            plotModel.Series.Add(oSeries);
+            plotModel.Series.Add(cSeries);
+            plotModel.Series.Add(cOriginSeries);
+            plotModel.Series.Add(oOriginSeries);
+
+            // 鍙鍖栦唬鐮�
+            // 鍒涘缓 Windows 绐椾綋浠ユ樉绀哄浘琛�
+            var plotView = new PlotView { Model = plotModel };
+            plotView.Dock = DockStyle.Fill;
+            pnlCO.Controls.Add(plotView);
+
+
+            pnlData.Controls.Clear();
+            plotModel = new PlotModel();
+            xAxis = new LinearAxis { Position = AxisPosition.Bottom, Title = "Track" };
+            xAxis.MajorGridlineStyle = LineStyle.Dash;
+           var logYAxis = new LogarithmicAxis { Position = AxisPosition.Left, Title = "Counting" };
+            logYAxis.MajorGridlineStyle = LineStyle.Dash;
+            plotModel.Axes.Add(xAxis);
+            plotModel.Axes.Add(logYAxis);
+
+            var farSeries = new LineSeries { Title = "Far Spectrum", Color = OxyColors.MediumBlue };
+            var nearSeries = new LineSeries { Title = "Near Spectrum", Color = OxyColors.MediumPurple };
+            foreach (var item in model.FarSpecData)
+                farSeries.Points.Add(new DataPoint(item[0], item[1]));
+            foreach (var item in model.NearSpecData)
+                nearSeries.Points.Add(new DataPoint(item[0], item[1]));
+
+            plotModel.Legends.Add(new Legend { LegendPosition = LegendPosition.TopRight });
+            plotModel.Series.Add(farSeries);
+            plotModel.Series.Add(nearSeries);
+            plotView = new PlotView { Model = plotModel };
+
+            plotView.Dock = DockStyle.Fill;
+            pnlData.Controls.Add(plotView);
+        }
+
+        private void btnClose_Click(object sender, EventArgs e)
+        {
+            Close();
+            Dispose();
+        }
+
+        private void ProcessingData_Load(object sender, EventArgs e)
+        {
+            txtNearCC.Text = _model.NearCC.ToString();
+            txtNearOC.Text = _model.NearOC.ToString();
+            txtNearCR.Text = _model.NearCR.ToString();
+            txtNearOR.Text = _model.NearOR.ToString();
+
+            txtFarCC.Text = _model.FarCC.ToString();
+            txtFarOC.Text = _model.FarOC.ToString();
+            txtFarCR.Text = _model.FarCR.ToString();
+            txtFarOR.Text = _model.FarOR.ToString();
+
+            txtNearTO.Text = _model.NearTO.ToString();
+            txtFarTO.Text = _model.FarTO.ToString();
+
+            txtNearPDEV.Text = _model.NearPDEV.ToString();
+            txtFarPDEV.Text = _model.FarPDEV.ToString();
+            txtMergePDEV.Text = _model.MergePDEV.ToString();
+
+            txtOilLinePoint.Text = _model.OilPoint.ToString();
+            txtWaterLinePoint.Text = _model.WaterPoint.ToString();
+            txtMergeDelta.Text = _model.MergeDelta.ToString();
+
+            txtFarTO.Text = _model.FarTO.ToString();
+            txtNearTO.Text = _model.NearTO.ToString();
+            Plot(_model);
+            pnlCO.Focus();
+        }
+    }
+}
diff --git a/ErrorAnalysis.UI/ProcessingData.resx b/ErrorAnalysis.UI/ProcessingData.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ErrorAnalysis.UI/ProcessingData.resx
@@ -0,0 +1,120 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!--
+    Microsoft ResX Schema 
+
+    Version 2.0
+
+    The primary goals of this format is to allow a simple XML format
+    that is mostly human readable. The generation and parsing of the
+    various data types are done through the TypeConverter classes
+    associated with the data types.
+
+    Example:
+
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+
+    There are any number of "resheader" rows that contain simple
+    name/value pairs.
+
+    Each data row contains a name, and value. The row also contains a
+    type or mimetype. Type corresponds to a .NET class that support
+    text/value conversion through the TypeConverter architecture.
+    Classes that don't support this are serialized and stored with the
+    mimetype set.
+
+    The mimetype is used for serialized objects, and tells the
+    ResXResourceReader how to depersist the object. This is currently not
+    extensible. For a given mimetype the value must be set accordingly:
+
+    Note - application/x-microsoft.net.object.binary.base64 is the format
+    that the ResXResourceWriter will generate, however the reader can
+    read any of the formats listed below.
+
+    mimetype: application/x-microsoft.net.object.binary.base64
+    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
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

--
Gitblit v1.9.3