From 0c7aac40ff7332a62b149d93f99cd670e07ee582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Fri, 26 Jul 2024 13:11:03 +0300 Subject: [PATCH] =?UTF-8?q?Skip=20=D1=82=D0=B5=D0=BB=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectedOperationService.cs | 22 ++++++++++++++++++- .../Detectors/DetectorAbstract.cs | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) 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);