| | |
| | | { |
| | | public class ErrorRatioCalc |
| | | { |
| | | public static ErrorRatioResult GetErrorRatioResult(string modelID, double porosity, double sw, double depth, bool lockSpeed, double speed, double targetErrorRatio, int pass = 0) |
| | | public static ErrorRatioResult GetErrorRatioResult(string modelID, double porosity, double sw, double depth, bool lockSpeed, double speed, double targetErrorRatio, out double testSpeed, int pass = 0) |
| | | { |
| | | var result = new ErrorRatioResult |
| | | { |
| | |
| | | { |
| | | List<double[]> cWOL; |
| | | List<double[]> oWOL; |
| | | var firsErrorPass = GetFirstErrorRatio(modelID, porosity, sw, speed, depth, out cWOL, out oWOL); |
| | | var firstErrorPassM = GetFirstErrorRatio(modelID, porosity, sw, speed, depth, out cWOL, out oWOL); |
| | | result.CWOL = cWOL; |
| | | result.OWOL = oWOL; |
| | | result.ErrorRatios.Add(firsErrorPass); |
| | | if (firsErrorPass.ErrorRatioValue > targetErrorRatio) |
| | | result.ErrorRatios.Add(firstErrorPassM); |
| | | if (firstErrorPassM.ErrorRatioValue > targetErrorRatio) |
| | | { |
| | | var targetPass = Convert.ToInt32(Math.Ceiling(Math.Pow(firsErrorPass.ErrorRatioValue / targetErrorRatio, 2))); |
| | | var targetPass = Convert.ToInt32(Math.Ceiling(Math.Pow(firstErrorPassM.ErrorRatioValue / targetErrorRatio, 2))); |
| | | for (int i = 2; i <= targetPass; i++) |
| | | { |
| | | result.ErrorRatios.Add(new ErrorRatio { Pass = i, ErrorRatioValue = firsErrorPass.ErrorRatioValue / Math.Sqrt(i) }); |
| | | result.ErrorRatios.Add(new ErrorRatio { Pass = i, ErrorRatioValue = firstErrorPassM.ErrorRatioValue / Math.Sqrt(i) }); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<double[]> oWOL; |
| | | var firstErrorPass = new ErrorRatio(); |
| | | speed = 0.6; |
| | | while (firstErrorPass.ErrorRatioValue != 0 && firstErrorPass.ErrorRatioValue > firstTargetErrorRatio) |
| | | do |
| | | { |
| | | firstErrorPass = GetFirstErrorRatio(modelID, porosity, sw, speed, depth, out cWOL, out oWOL); |
| | | result.CWOL = cWOL; |
| | | result.OWOL = oWOL; |
| | | speed -= 0.01; |
| | | } while (firstErrorPass.ErrorRatioValue != 0 && firstErrorPass.ErrorRatioValue > firstTargetErrorRatio); |
| | | result.ErrorRatios.Clear(); |
| | | result.ErrorRatios.Add(firstErrorPass); |
| | | for (int i = 2; i <= pass; i++) |
| | | { |
| | | result.ErrorRatios.Add(new ErrorRatio { Pass = i, ErrorRatioValue = firstErrorPass.ErrorRatioValue / Math.Sqrt(i) }); |
| | | } |
| | | } |
| | | testSpeed = speed; |
| | | |
| | | return result; |
| | | |