diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs index d583bbf7..30d83ecd 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs @@ -235,7 +235,12 @@ public class DetectedOperationService : IDetectedOperationService break; } - positionBegin += 1; + var skip = 1; + + while (IsChangingTelemetryInterval(detectableTelemetries[positionBegin], detectableTelemetries[positionBegin + skip])) + skip++; + + positionBegin += skip; } return (detectableTelemetries[positionBegin].DateTime, detectedOperations); @@ -252,6 +257,21 @@ public class DetectedOperationService : IDetectedOperationService return result; } + private static bool IsChangingTelemetryInterval(DetectableTelemetry telemetryBegin, DetectableTelemetry telemetryEnd) + { + return telemetryBegin.Mode == telemetryEnd.Mode && + EqualParameter(telemetryBegin.WellDepth, telemetryEnd.WellDepth, 0.01f) && + EqualParameter(telemetryBegin.Pressure, telemetryEnd.Pressure, 0.1f) && + EqualParameter(telemetryBegin.HookWeight, telemetryEnd.HookWeight, 0.1f) && + EqualParameter(telemetryBegin.BlockPosition, telemetryEnd.BlockPosition, 0.01f) && + EqualParameter(telemetryBegin.BitDepth, telemetryEnd.BitDepth, 0.01f) && + EqualParameter(telemetryBegin.RotorSpeed, telemetryEnd.RotorSpeed, 0.01f) && + EqualParameter(telemetryBegin.AxialLoad, telemetryEnd.AxialLoad, 0.1f); + + bool EqualParameter(float value, float origin, float tolerance) => + value <= origin + tolerance && value >= origin - tolerance; + } + private static IEnumerable GetOperationsDrillersStat(IEnumerable operations) { var groups = operations.GroupBy(o => o.Driller); diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs index a0adec19..623608d8 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs @@ -48,11 +48,11 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors while (positionEnd < end) { - //TODO: поиск провалов телеметрии - positionEnd += 1; if (positionEnd > end) break; + + //TODO: поиск провалов телеметрий. Следует обсудить, так как алгоритмы теряют в точности. idReasonOfEnd = DetectEnd(telemetry, positionEnd, previousOperation);