From c97331d8eca8f9ef6a0c18ffce3518578b5638ff Mon Sep 17 00:00:00 2001
From: lx <ex_lixiang17@cosl.com.cn>
Date: 星期五, 15 八月 2025 10:21:11 +0800
Subject: [PATCH] update cr/or fit line

---
 ErrorAnalysis.UI/ErrorAnalysis.UI.csproj    |    2 
 ErrorAnalysis.UI/FrmMain.resx               |    4 
 ErrorAnalysis.Service/ErrorRatioCalc.cs     |  119 ++++++++++++++-----
 ErrorAnalysis.Service/COMergeCalcService.cs |   32 ++--
 ErrorAnalysis.UI/FrmMain.Designer.cs        |   74 ++++++------
 ErrorAnalysis.Service/Utility.cs            |  125 ++++++++++++++++++++
 6 files changed, 268 insertions(+), 88 deletions(-)

diff --git a/ErrorAnalysis.Service/COMergeCalcService.cs b/ErrorAnalysis.Service/COMergeCalcService.cs
index 7ac3ad8..3f1df05 100644
--- a/ErrorAnalysis.Service/COMergeCalcService.cs
+++ b/ErrorAnalysis.Service/COMergeCalcService.cs
@@ -36,14 +36,14 @@
             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 oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(17).Take(237).Sum();
+            var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(17).Take(237).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).Take(cWinLength).Sum() / waterLineValArr.Sum();
-            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.Sum();
+            var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
+            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
             var waterLineC = 36d / 160d * waterLineCR * yieldCounting / speed * depth * 0.0762d;
             var waterLineO = 36d / 160d * waterLineOR * yieldCounting / speed * depth * 0.0762d;
 
@@ -77,13 +77,13 @@
             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 oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(17).Take(237).Sum();
+            var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(17).Take(237).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).Take(cWinLength).Sum() / waterLineValArr.Sum();
-            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.Sum();
+            var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
+            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
             var waterLineC = (36d / 160d) * waterLineCR * yieldCounting / speed * depth * 0.0762d;
             var waterLineO = (36d / 160d) * waterLineOR * yieldCounting / speed * depth * 0.0762d;
 
@@ -189,11 +189,11 @@
             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 oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(17).Take(237).Sum();
+            var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(17).Take(237).Sum();
 
-            var waterLineCR = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / waterLineValArr.Sum();
-            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.Sum();
+            var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
+            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
 
             double cRes = 0, oRes = 0;
             if (sw == 0)
@@ -225,11 +225,11 @@
             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 oilLineCR = oilLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / oilLineValArr.Skip(17).Take(237).Sum();
+            var oilLineOR = oilLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / oilLineValArr.Skip(17).Take(237).Sum();
 
-            var waterLineCR = waterLineValArr.Skip(_cWinStartIndex).Take(cWinLength).Sum() / waterLineValArr.Sum();
-            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex).Take(oWinLength).Sum() / waterLineValArr.Sum();
+            var waterLineCR = waterLineValArr.Skip(_cWinStartIndex - 1).Take(cWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
+            var waterLineOR = waterLineValArr.Skip(_oWinStartIndex - 1).Take(oWinLength).Sum() / waterLineValArr.Skip(17).Take(237).Sum();
 
             double crRes = 0, orRes = 0;
             if (sw == 0)
diff --git a/ErrorAnalysis.Service/ErrorRatioCalc.cs b/ErrorAnalysis.Service/ErrorRatioCalc.cs
index 7b8d892..d308843 100644
--- a/ErrorAnalysis.Service/ErrorRatioCalc.cs
+++ b/ErrorAnalysis.Service/ErrorRatioCalc.cs
@@ -1,8 +1,10 @@
 锘縰sing ErrorAnalysis.Repository;
+using ErrorAnalysis.Repository.Entity;
 using ErrorAnalysis.Service;
 using ErrorAnalysis.Service.Model;
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -11,6 +13,9 @@
 {
     public class ErrorRatioCalc
     {
+        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)
         {
             var result = new ErrorRatioResult
@@ -25,10 +30,11 @@
             {
                 List<double[]> cWOL;
                 List<double[]> oWOL;
-                var firstErrorPassM = GetFirstErrorRatio(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
                 (cWOL, oWOL) = GetOilWaterLine(modelID);
                 result.CWOL = cWOL;
                 result.OWOL = oWOL;
+                var firstErrorPassM = GetFirstErrorRatio(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
+
                 result.ErrorRatios.Add(firstErrorPassM);
                 if (firstErrorPassM.ErrorRatioValue > targetErrorRatio)
                 {
@@ -50,7 +56,7 @@
 
                 var nearCROR = COMergeCalcService.GetNearCOORResult(modelID, porosity, sw);
                 var farCROR = COMergeCalcService.GetFarCOORResult(modelID, porosity, sw);
-                var mDelta = GetMDelta(modelID, porosity);
+                var mDelta = GetMDelta(porosity);
 
                 speed = Math.Pow(firstTargetErrorRatio /
                     (Math.Sqrt(160 / (0.0762 * depth * 36d * yieldCounting)) *
@@ -89,7 +95,7 @@
 
             try
             {
-                var mDelta = GetMDelta(modelID, porosity);
+                var mDelta = GetMDelta(porosity);
 
                 //var mergePDEVOld = PDEVCalcService.GetMergePDEV(modelID, porosity, sw, speed, depth, yieldCounting, nearCofe, farCofe);
 
@@ -108,40 +114,43 @@
             }
         }
 
-        private static double GetMDelta(string modelID, double porosity)
+        private static double GetMDelta(double porosity)
         {
-            var cWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 0);
-            var oWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 100);
-            var wolResType = cWolRes?.GetType();
+            var oilRes = Utility.GetParabolaValue(porosity, _parabolaCoef.a, _parabolaCoef.b, _parabolaCoef.c);
+            var waterRes = Utility.GetLineValue(porosity, _lineCoef.slope, _lineCoef.intercept);
 
-            double cRes = 0;
-            double oRes = 0;
+            //var cWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 0);
+            //var oWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 100);
+            //var wolResType = cWolRes?.GetType();
 
-            if (porosity % 5 == 0)
-            {
-                var poroFiledName = $"WLPu" + porosity;
-                var property = wolResType.GetProperty(poroFiledName);
+            //double cRes = 0;
+            //double oRes = 0;
 
-                cRes = Convert.ToDouble(property.GetValue(cWolRes));
-                oRes = Convert.ToDouble(property.GetValue(oWolRes));
-            }
-            else
-            {
-                var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
-                var ceilingProperty = wolResType.GetProperty($"WLPu" + ceilingPorosity);
-                var ceilingC = Convert.ToDouble(ceilingProperty.GetValue(cWolRes));
-                var ceilingO = Convert.ToDouble(ceilingProperty.GetValue(oWolRes));
+            //if (porosity % 5 == 0)
+            //{
+            //    var poroFiledName = $"WLPu" + porosity;
+            //    var property = wolResType.GetProperty(poroFiledName);
+
+            //    cRes = Convert.ToDouble(property.GetValue(cWolRes));
+            //    oRes = Convert.ToDouble(property.GetValue(oWolRes));
+            //}
+            //else
+            //{
+            //    var ceilingPorosity = Math.Ceiling(porosity / 5) * 5;
+            //    var ceilingProperty = wolResType.GetProperty($"WLPu" + ceilingPorosity);
+            //    var ceilingC = Convert.ToDouble(ceilingProperty.GetValue(cWolRes));
+            //    var ceilingO = Convert.ToDouble(ceilingProperty.GetValue(oWolRes));
 
 
-                var floorPorosity = Math.Floor(porosity / 5) * 5;
-                var floorProperty = wolResType.GetProperty($"WLPu" + floorPorosity);
-                var floorC = Convert.ToDouble(floorProperty.GetValue(cWolRes));
-                var floorO = Convert.ToDouble(floorProperty.GetValue(oWolRes));
+            //    var floorPorosity = Math.Floor(porosity / 5) * 5;
+            //    var floorProperty = wolResType.GetProperty($"WLPu" + floorPorosity);
+            //    var floorC = Convert.ToDouble(floorProperty.GetValue(cWolRes));
+            //    var floorO = Convert.ToDouble(floorProperty.GetValue(oWolRes));
 
-                cRes = Utility.Interpolate(porosity, floorPorosity, floorC, ceilingPorosity, ceilingC);
-                oRes = Utility.Interpolate(porosity, floorPorosity, floorO, ceilingPorosity, ceilingO);
-            }
-            return cRes - oRes;
+            //    cRes = Utility.Interpolate(porosity, floorPorosity, floorC, ceilingPorosity, ceilingC);
+            //    oRes = Utility.Interpolate(porosity, floorPorosity, floorO, ceilingPorosity, ceilingO);
+            //}
+            return oilRes - waterRes;
         }
 
         private static (List<double[]>, List<double[]>) GetOilWaterLine(string modelID)
@@ -149,8 +158,10 @@
             var cWOL = new List<double[]>();
             var oWOL = new List<double[]>();
 
-            var cWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 0);
-            var oWolRes = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 100);
+            var fitModel = GetFitModel(modelID);
+
+            var cWolRes = fitModel.Item1;
+            var oWolRes = fitModel.Item2;
             var wolResType = cWolRes?.GetType();
 
             foreach (var wolProperty in wolResType.GetProperties())
@@ -163,5 +174,49 @@
             }
             return (cWOL, oWOL);
         }
+
+        private static (COWOLTable, COWOLTable) GetFitModel(string modelID)
+        {
+            var oilWol = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 0);
+            var waterWol = RepositoryInstance.Instance.COWOLRepository?.GetWOL(modelID, 100);
+            var wolResType = oilWol?.GetType();
+            List<PointF> oilPoints = [];
+            List<PointF> waterPoints = [];
+
+            foreach (var wolProperty in wolResType.GetProperties())
+            {
+                if (wolProperty.Name.Contains("WLPu"))
+                {
+                    var porosity = float.Parse(wolProperty.Name.Replace("WLPu", ""));
+                    var oilVal = (double)wolProperty.GetValue(oilWol);
+                    var waterVal = (double)wolProperty.GetValue(waterWol);
+
+                    oilPoints.Add(new PointF(porosity, (float)oilVal));
+                    waterPoints.Add(new PointF(porosity, (float)waterVal));
+                }
+            }
+
+            _lineCoef = Utility.FitLine(waterPoints.ToArray());
+            _parabolaCoef = Utility.FitParabola(oilPoints.ToArray());
+
+            double initDiff = 0;
+
+            foreach (var wolProperty in wolResType.GetProperties())
+            {
+                if (wolProperty.Name.Contains("WLPu"))
+                {
+                    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);
+                    if (porosity == 0)
+                    {
+                        initDiff = oilVal - waterVal;
+                    }
+                    wolProperty.SetValue(waterWol, waterVal + initDiff);
+                    wolProperty.SetValue(oilWol, oilVal);
+                }
+            }
+            return (oilWol, waterWol);
+        }
     }
 }
\ No newline at end of file
diff --git a/ErrorAnalysis.Service/Utility.cs b/ErrorAnalysis.Service/Utility.cs
index 6c10062..e491bad 100644
--- a/ErrorAnalysis.Service/Utility.cs
+++ b/ErrorAnalysis.Service/Utility.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -23,5 +24,129 @@
             double y = y0 + (value - x0) * (y1 - y0) / (x1 - x0);
             return y;
         }
+
+        public static (double slope, double intercept) FitLine(PointF[] points)
+        {
+            // 璁$畻鍚勬眰鍜岄」
+            int n = points.Length;
+            double sumX = 0, sumY = 0, sumXY = 0, sumX2 = 0;
+
+            foreach (var p in points)
+            {
+                sumX += p.X;
+                sumY += p.Y;
+                sumXY += p.X * p.Y;
+                sumX2 += p.X * p.X;
+            }
+
+            // 璁$畻鏂滅巼鍜屾埅璺�
+            double denominator = n * sumX2 - sumX * sumX;
+            if (Math.Abs(denominator) < 1e-10) // 閬垮厤闄や互0
+                throw new InvalidOperationException("鐐归泦杩囦簬闆嗕腑锛屾棤娉曟嫙鍚堢洿绾�");
+
+            double slope = (n * sumXY - sumX * sumY) / denominator;
+            double intercept = (sumY - slope * sumX) / n;
+
+            return (slope, intercept);
+        }
+
+        public static double GetLineValue(double x, double slope, double intercept) => slope * x + intercept;
+
+        public static (double a, double b, double c) FitParabola(PointF[] points)
+        {
+            if (points.Length < 3)
+                throw new ArgumentException("鑷冲皯闇�瑕�3涓偣杩涜鎶涚墿绾挎嫙鍚�");
+
+            // 1. 璁$畻鍚勯」姹傚拰鍊糩1,6](@ref)
+            int n = points.Length;
+            double sx = 0, sy = 0, sx2 = 0, sx3 = 0, sx4 = 0, sxy = 0, sx2y = 0;
+
+            foreach (var p in points)
+            {
+                double x = p.X;
+                double y = p.Y;
+                double x2 = x * x;
+                double x3 = x2 * x;
+                double x4 = x2 * x2;
+
+                sx += x;
+                sy += y;
+                sx2 += x2;
+                sx3 += x3;
+                sx4 += x4;
+                sxy += x * y;
+                sx2y += x2 * y;
+            }
+
+            // 2. 鏋勫缓姝h鏂圭▼鐭╅樀[1,6](@ref)
+            double[,] matrix = {
+            { sx4, sx3, sx2, sx2y },
+            { sx3, sx2, sx,  sxy  },
+            { sx2, sx,  n,   sy   }
+        };
+
+            // 3. 浣跨敤楂樻柉娑堝厓娉曟眰瑙�
+            double[] coefficients = GaussElimination(matrix);
+
+            return (coefficients[0], coefficients[1], coefficients[2]);
+        }
+
+        // 楂樻柉娑堝厓娉曞疄鐜帮紙甯﹂儴鍒嗕富鍏冮�夋嫨锛�
+        private static double[] GaussElimination(double[,] matrix)
+        {
+            int n = matrix.GetLength(0);
+            double[] result = new double[n];
+
+            // 鍓嶅悜娑堝厓
+            for (int i = 0; i < n - 1; i++)
+            {
+                // 閮ㄥ垎涓诲厓閫夋嫨
+                int maxRow = i;
+                for (int k = i + 1; k < n; k++)
+                {
+                    if (Math.Abs(matrix[k, i]) > Math.Abs(matrix[maxRow, i]))
+                        maxRow = k;
+                }
+
+                // 琛屼氦鎹�
+                if (maxRow != i)
+                {
+                    for (int j = 0; j <= n; j++)
+                    {
+                        double temp = matrix[i, j];
+                        matrix[i, j] = matrix[maxRow, j];
+                        matrix[maxRow, j] = temp;
+                    }
+                }
+
+                // 娑堝厓杩囩▼
+                for (int k = i + 1; k < n; k++)
+                {
+                    double factor = matrix[k, i] / matrix[i, i];
+                    for (int j = i; j <= n; j++)
+                    {
+                        matrix[k, j] -= factor * matrix[i, j];
+                    }
+                }
+            }
+
+            // 鍥炰唬姹傝В
+            for (int i = n - 1; i >= 0; i--)
+            {
+                result[i] = matrix[i, n];
+                for (int j = i + 1; j < n; j++)
+                {
+                    result[i] -= matrix[i, j] * result[j];
+                }
+                result[i] /= matrix[i, i];
+            }
+
+            return result;
+        }
+
+        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 a14685f..d187776 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.0</Version>
+		<Version>1.1.1</Version>
 	</PropertyGroup>
 
 	<ItemGroup>
diff --git a/ErrorAnalysis.UI/FrmMain.Designer.cs b/ErrorAnalysis.UI/FrmMain.Designer.cs
index f506c3c..41001ae 100644
--- a/ErrorAnalysis.UI/FrmMain.Designer.cs
+++ b/ErrorAnalysis.UI/FrmMain.Designer.cs
@@ -171,7 +171,7 @@
             btnAnalysis.Location = new Point(716, 580);
             btnAnalysis.Name = "btnAnalysis";
             btnAnalysis.Size = new Size(75, 23);
-            btnAnalysis.TabIndex = 0;
+            btnAnalysis.TabIndex = 37;
             btnAnalysis.Text = "Analysis";
             btnAnalysis.UseVisualStyleBackColor = true;
             btnAnalysis.Click += btnAnalysis_Click;
@@ -237,7 +237,7 @@
             nudSoPrecisionRequired.Location = new Point(185, 43);
             nudSoPrecisionRequired.Name = "nudSoPrecisionRequired";
             nudSoPrecisionRequired.Size = new Size(54, 23);
-            nudSoPrecisionRequired.TabIndex = 13;
+            nudSoPrecisionRequired.TabIndex = 25;
             // 
             // label21
             // 
@@ -263,7 +263,7 @@
             nudPass.Location = new Point(45, 16);
             nudPass.Name = "nudPass";
             nudPass.Size = new Size(72, 23);
-            nudPass.TabIndex = 14;
+            nudPass.TabIndex = 36;
             // 
             // label23
             // 
@@ -292,7 +292,7 @@
             cmbSpeedUnit.Location = new Point(132, 16);
             cmbSpeedUnit.Name = "cmbSpeedUnit";
             cmbSpeedUnit.Size = new Size(87, 25);
-            cmbSpeedUnit.TabIndex = 13;
+            cmbSpeedUnit.TabIndex = 35;
             // 
             // nudSpeed
             // 
@@ -302,7 +302,7 @@
             nudSpeed.Maximum = new decimal(new int[] { 9999999, 0, 0, 0 });
             nudSpeed.Name = "nudSpeed";
             nudSpeed.Size = new Size(72, 23);
-            nudSpeed.TabIndex = 12;
+            nudSpeed.TabIndex = 34;
             // 
             // label20
             // 
@@ -329,7 +329,7 @@
             rdoLockSpeed.Location = new Point(3, 3);
             rdoLockSpeed.Name = "rdoLockSpeed";
             rdoLockSpeed.Size = new Size(94, 21);
-            rdoLockSpeed.TabIndex = 7;
+            rdoLockSpeed.TabIndex = 32;
             rdoLockSpeed.TabStop = true;
             rdoLockSpeed.Text = "Lock Speed";
             rdoLockSpeed.UseVisualStyleBackColor = true;
@@ -341,7 +341,7 @@
             rdoLockPass.Location = new Point(103, 4);
             rdoLockPass.Name = "rdoLockPass";
             rdoLockPass.Size = new Size(83, 21);
-            rdoLockPass.TabIndex = 8;
+            rdoLockPass.TabIndex = 33;
             rdoLockPass.Text = "Lock Pass";
             rdoLockPass.UseVisualStyleBackColor = true;
             rdoLockPass.CheckedChanged += rdoMode_CheckedChanged;
@@ -407,7 +407,7 @@
             btnReport.Location = new Point(797, 580);
             btnReport.Name = "btnReport";
             btnReport.Size = new Size(75, 23);
-            btnReport.TabIndex = 4;
+            btnReport.TabIndex = 38;
             btnReport.Text = "Report";
             btnReport.UseVisualStyleBackColor = true;
             btnReport.Click += btnReport_Click;
@@ -503,7 +503,7 @@
             nudTubeHoldUp.Location = new Point(449, 87);
             nudTubeHoldUp.Name = "nudTubeHoldUp";
             nudTubeHoldUp.Size = new Size(44, 23);
-            nudTubeHoldUp.TabIndex = 26;
+            nudTubeHoldUp.TabIndex = 18;
             // 
             // label10
             // 
@@ -530,7 +530,7 @@
             nudScreenHoldUp.Location = new Point(449, 57);
             nudScreenHoldUp.Name = "nudScreenHoldUp";
             nudScreenHoldUp.Size = new Size(44, 23);
-            nudScreenHoldUp.TabIndex = 26;
+            nudScreenHoldUp.TabIndex = 16;
             // 
             // nudBHSalinity
             // 
@@ -540,7 +540,7 @@
             nudBHSalinity.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudBHSalinity.Name = "nudBHSalinity";
             nudBHSalinity.Size = new Size(55, 23);
-            nudBHSalinity.TabIndex = 16;
+            nudBHSalinity.TabIndex = 10;
             // 
             // label49
             // 
@@ -567,7 +567,7 @@
             nudCasingHoldUp.Location = new Point(449, 26);
             nudCasingHoldUp.Name = "nudCasingHoldUp";
             nudCasingHoldUp.Size = new Size(44, 23);
-            nudCasingHoldUp.TabIndex = 26;
+            nudCasingHoldUp.TabIndex = 14;
             // 
             // label50
             // 
@@ -613,7 +613,7 @@
             nudOilDensity.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudOilDensity.Name = "nudOilDensity";
             nudOilDensity.Size = new Size(56, 23);
-            nudOilDensity.TabIndex = 16;
+            nudOilDensity.TabIndex = 11;
             // 
             // nudGasDensity
             // 
@@ -623,7 +623,7 @@
             nudGasDensity.Maximum = new decimal(new int[] { 9999999, 0, 0, 0 });
             nudGasDensity.Name = "nudGasDensity";
             nudGasDensity.Size = new Size(56, 23);
-            nudGasDensity.TabIndex = 16;
+            nudGasDensity.TabIndex = 12;
             // 
             // label48
             // 
@@ -642,7 +642,7 @@
             cmbScreenHoldUp.Location = new Point(384, 56);
             cmbScreenHoldUp.Name = "cmbScreenHoldUp";
             cmbScreenHoldUp.Size = new Size(59, 25);
-            cmbScreenHoldUp.TabIndex = 1;
+            cmbScreenHoldUp.TabIndex = 15;
             cmbScreenHoldUp.Tag = "ScreenFluid";
             cmbScreenHoldUp.SelectedIndexChanged += holdUp_cmb_SelectedIndexChanged;
             // 
@@ -663,7 +663,7 @@
             cmbTubeHoldUp.Location = new Point(384, 85);
             cmbTubeHoldUp.Name = "cmbTubeHoldUp";
             cmbTubeHoldUp.Size = new Size(59, 25);
-            cmbTubeHoldUp.TabIndex = 1;
+            cmbTubeHoldUp.TabIndex = 17;
             cmbTubeHoldUp.Tag = "TubeFluid";
             cmbTubeHoldUp.SelectedIndexChanged += holdUp_cmb_SelectedIndexChanged;
             // 
@@ -675,7 +675,7 @@
             cmbCasingHoldUp.Location = new Point(385, 25);
             cmbCasingHoldUp.Name = "cmbCasingHoldUp";
             cmbCasingHoldUp.Size = new Size(58, 25);
-            cmbCasingHoldUp.TabIndex = 1;
+            cmbCasingHoldUp.TabIndex = 13;
             cmbCasingHoldUp.Tag = "CasingFluid";
             cmbCasingHoldUp.SelectedIndexChanged += holdUp_cmb_SelectedIndexChanged;
             // 
@@ -752,7 +752,7 @@
             cmbCasingOD.Location = new Point(143, 43);
             cmbCasingOD.Name = "cmbCasingOD";
             cmbCasingOD.Size = new Size(55, 25);
-            cmbCasingOD.TabIndex = 1;
+            cmbCasingOD.TabIndex = 2;
             cmbCasingOD.Tag = "CasingOD";
             cmbCasingOD.SelectedIndexChanged += borehole_cmb_SelectedIndexChanged;
             // 
@@ -772,7 +772,7 @@
             cmbScreenOD.Location = new Point(143, 70);
             cmbScreenOD.Name = "cmbScreenOD";
             cmbScreenOD.Size = new Size(55, 25);
-            cmbScreenOD.TabIndex = 1;
+            cmbScreenOD.TabIndex = 4;
             cmbScreenOD.Tag = "ScreenOD";
             cmbScreenOD.SelectedIndexChanged += borehole_cmb_SelectedIndexChanged;
             // 
@@ -783,7 +783,7 @@
             cmbScreenID.Location = new Point(388, 72);
             cmbScreenID.Name = "cmbScreenID";
             cmbScreenID.Size = new Size(55, 25);
-            cmbScreenID.TabIndex = 1;
+            cmbScreenID.TabIndex = 5;
             cmbScreenID.Tag = "ScreenID";
             cmbScreenID.SelectedIndexChanged += borehole_cmb_SelectedIndexChanged;
             // 
@@ -810,7 +810,7 @@
             nudGravelFIllPercent.Location = new Point(143, 124);
             nudGravelFIllPercent.Name = "nudGravelFIllPercent";
             nudGravelFIllPercent.Size = new Size(55, 23);
-            nudGravelFIllPercent.TabIndex = 26;
+            nudGravelFIllPercent.TabIndex = 8;
             // 
             // cmbTubeID
             // 
@@ -819,7 +819,7 @@
             cmbTubeID.Location = new Point(388, 98);
             cmbTubeID.Name = "cmbTubeID";
             cmbTubeID.Size = new Size(55, 25);
-            cmbTubeID.TabIndex = 1;
+            cmbTubeID.TabIndex = 7;
             cmbTubeID.Tag = "TubeID";
             cmbTubeID.SelectedIndexChanged += borehole_cmb_SelectedIndexChanged;
             // 
@@ -848,7 +848,7 @@
             cmbCasingID.Location = new Point(388, 46);
             cmbCasingID.Name = "cmbCasingID";
             cmbCasingID.Size = new Size(55, 25);
-            cmbCasingID.TabIndex = 1;
+            cmbCasingID.TabIndex = 3;
             cmbCasingID.Tag = "CasingID";
             cmbCasingID.SelectedIndexChanged += borehole_cmb_SelectedIndexChanged;
             // 
@@ -884,7 +884,7 @@
             nudCementBond.Location = new Point(388, 124);
             nudCementBond.Name = "nudCementBond";
             nudCementBond.Size = new Size(55, 23);
-            nudCementBond.TabIndex = 26;
+            nudCementBond.TabIndex = 9;
             nudCementBond.Value = new decimal(new int[] { 100, 0, 0, 0 });
             // 
             // cmbTubeOD
@@ -894,7 +894,7 @@
             cmbTubeOD.Location = new Point(143, 97);
             cmbTubeOD.Name = "cmbTubeOD";
             cmbTubeOD.Size = new Size(55, 25);
-            cmbTubeOD.TabIndex = 1;
+            cmbTubeOD.TabIndex = 6;
             cmbTubeOD.Tag = "TubeOD";
             cmbTubeOD.SelectedIndexChanged += borehole_cmb_SelectedIndexChanged;
             // 
@@ -974,7 +974,7 @@
             nudReservoirSalinity.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudReservoirSalinity.Name = "nudReservoirSalinity";
             nudReservoirSalinity.Size = new Size(71, 23);
-            nudReservoirSalinity.TabIndex = 34;
+            nudReservoirSalinity.TabIndex = 22;
             // 
             // label40
             // 
@@ -1019,7 +1019,7 @@
             nudVSH.Location = new Point(145, 148);
             nudVSH.Name = "nudVSH";
             nudVSH.Size = new Size(72, 23);
-            nudVSH.TabIndex = 29;
+            nudVSH.TabIndex = 23;
             // 
             // label42
             // 
@@ -1037,7 +1037,7 @@
             nudSw.Location = new Point(146, 88);
             nudSw.Name = "nudSw";
             nudSw.Size = new Size(72, 23);
-            nudSw.TabIndex = 29;
+            nudSw.TabIndex = 21;
             // 
             // label18
             // 
@@ -1055,7 +1055,7 @@
             nudPorosity.Location = new Point(146, 58);
             nudPorosity.Name = "nudPorosity";
             nudPorosity.Size = new Size(72, 23);
-            nudPorosity.TabIndex = 26;
+            nudPorosity.TabIndex = 20;
             // 
             // label17
             // 
@@ -1083,7 +1083,7 @@
             cmbLithology.Location = new Point(146, 26);
             cmbLithology.Name = "cmbLithology";
             cmbLithology.Size = new Size(119, 25);
-            cmbLithology.TabIndex = 25;
+            cmbLithology.TabIndex = 19;
             cmbLithology.Tag = "Lithology";
             cmbLithology.SelectedIndexChanged += cmbLithology_SelectedIndexChanged;
             // 
@@ -1140,7 +1140,7 @@
             cmbTargetLoggingIntervalUnit.Location = new Point(243, 98);
             cmbTargetLoggingIntervalUnit.Name = "cmbTargetLoggingIntervalUnit";
             cmbTargetLoggingIntervalUnit.Size = new Size(46, 25);
-            cmbTargetLoggingIntervalUnit.TabIndex = 13;
+            cmbTargetLoggingIntervalUnit.TabIndex = 28;
             // 
             // label5
             // 
@@ -1157,7 +1157,7 @@
             chkAlphaProcessing.Location = new Point(419, 43);
             chkAlphaProcessing.Name = "chkAlphaProcessing";
             chkAlphaProcessing.Size = new Size(128, 21);
-            chkAlphaProcessing.TabIndex = 15;
+            chkAlphaProcessing.TabIndex = 29;
             chkAlphaProcessing.Text = "Alpha processing";
             chkAlphaProcessing.UseVisualStyleBackColor = true;
             // 
@@ -1169,7 +1169,7 @@
             nudYieldCounting.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudYieldCounting.Name = "nudYieldCounting";
             nudYieldCounting.Size = new Size(82, 23);
-            nudYieldCounting.TabIndex = 13;
+            nudYieldCounting.TabIndex = 31;
             // 
             // nudAlphaProcessingWin
             // 
@@ -1177,7 +1177,7 @@
             nudAlphaProcessingWin.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudAlphaProcessingWin.Name = "nudAlphaProcessingWin";
             nudAlphaProcessingWin.Size = new Size(47, 23);
-            nudAlphaProcessingWin.TabIndex = 13;
+            nudAlphaProcessingWin.TabIndex = 30;
             // 
             // nudDepth
             // 
@@ -1185,7 +1185,7 @@
             nudDepth.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudDepth.Name = "nudDepth";
             nudDepth.Size = new Size(54, 23);
-            nudDepth.TabIndex = 13;
+            nudDepth.TabIndex = 26;
             // 
             // nudTargetLoggingInterval
             // 
@@ -1194,7 +1194,7 @@
             nudTargetLoggingInterval.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
             nudTargetLoggingInterval.Name = "nudTargetLoggingInterval";
             nudTargetLoggingInterval.Size = new Size(54, 23);
-            nudTargetLoggingInterval.TabIndex = 13;
+            nudTargetLoggingInterval.TabIndex = 27;
             // 
             // label54
             // 
@@ -1211,7 +1211,7 @@
             txtToolType.Name = "txtToolType";
             txtToolType.ReadOnly = true;
             txtToolType.Size = new Size(88, 23);
-            txtToolType.TabIndex = 6;
+            txtToolType.TabIndex = 24;
             // 
             // label53
             // 
diff --git a/ErrorAnalysis.UI/FrmMain.resx b/ErrorAnalysis.UI/FrmMain.resx
index 4253ee1..0808268 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