| | |
| | | using OxyPlot.Series; |
| | | using OxyPlot.WindowsForms; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Runtime.InteropServices; |
| | | using System.Security.Cryptography; |
| | | using System.Windows.Forms; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.Menu; |
| | |
| | | { |
| | | public partial class FrmMain : Form |
| | | { |
| | | [DllImport("user32.dll")] |
| | | private static extern short GetAsyncKeyState(Keys vKey); |
| | | |
| | | private string? _connectionString; |
| | | private List<COModelTable> _models; |
| | | private Dictionary<string, string> _filters; |
| | | private COModelTable _model; |
| | | private ReportModel _reportModel; |
| | | |
| | | public FrmMain() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | 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) |
| | |
| | | } |
| | | 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); |
| | |
| | | AppendText(txtAnalysisResult, $"{errorRate}%", ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" error rate. With the tool operating at "); |
| | | AppendText(txtAnalysisResult, $"{speed} {cmbSpeedUnit.Text}", ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" the estimated total job duration is "); |
| | | txtAnalysisResult.AppendText(" the estimated one pass duration is "); |
| | | AppendText(txtAnalysisResult, $"{totalTime} hours.", ColorTranslator.FromHtml("#8B0000")); |
| | | |
| | | _reportModel = CreateReportModel(totalTime.ToString(), result.ErrorRatios.Count.ToString(), Math.Round(UnitConvert.MS2FtHr(calcSpeed), 2).ToString(), errorRate.ToString()); |
| | |
| | | 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); |
| | |
| | | |
| | | _reportModel = CreateReportModel(totalTime.ToString(), result.ErrorRatios.Count.ToString(), speedFr.ToString(), errorRate.ToString()); |
| | | } |
| | | |
| | | |
| | | if ((Control.ModifierKeys & Keys.Control) == Keys.Control && (GetAsyncKeyState(Keys.D) & 0x8000) != 0) |
| | | new ProcessingData(processingData).Show(); |
| | | } |
| | | private void btnReport_Click(object sender, EventArgs e) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | 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(), |
| | | }; |
| | | } |
| | | |