using AsbCloudDb.Model; using System.Linq; using System; namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors { #nullable enable /// /// Статический замер телесистемы /// internal class DetectorStaticSurveying: DetectorAbstract { public DetectorStaticSurveying() : base(21) { } protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation) { var point0 = telemetry[position]; if (point0.Pressure < 15) return false; var delta = point0.WellDepth - point0.BitDepth; if (delta > 2.5d || delta < 0.5d) return false; if (point0.RotorSpeed > 30) return false; if (ContainsDeviation(telemetry, t => t.BlockPosition, position, 60, 0.03)) return false; if (ContainsDeviation(telemetry, t => t.Pressure, position, 60, 10)) return false; return true; } protected override bool DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation) { var point0 = telemetry[position]; var delta = point0.WellDepth - point0.BitDepth; if (delta > 2.5d ) return true; if (point0.RotorSpeed > 30) return true; if (RisesFromBegin(telemetry, t => t.Pressure, position, 10, 15)) return true; if (ContainsDeviation(telemetry, t => t.BlockPosition, position, 10, 0.05)) return true; return false; } protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end) => IsValidByWellDepthDoesNotChange(telemetry, begin, end); protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end) => CalcDeltaMinutes(telemetry, begin, end); } #nullable disable }