From a7c5935cc49c078d8238b8e8d43cdfd2d7ba1b82 Mon Sep 17 00:00:00 2001
From: Olga Nemt <on.nemtina@digitaldrilling.ru>
Date: Thu, 14 Mar 2024 14:45:47 +0500
Subject: [PATCH 1/7] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BE=D0=BF=D1=80?=
 =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=BF?=
 =?UTF-8?q?=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20"=D0=9F=D1=80=D0=BE?=
 =?UTF-8?q?=D0=BC=D1=8B=D0=B2=D0=BA=D0=B0"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../DetectOperations/DetectableTelemetry.cs   |  28 ++++
 .../Detectors/DetectorFlashing.cs             | 126 ++++++++++--------
 .../Specifications/Промывка.md                |  33 +++--
 3 files changed, 114 insertions(+), 73 deletions(-)

diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs
index aeb18fe2..372cda3c 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs
@@ -7,11 +7,39 @@ public class DetectableTelemetry
     public DateTimeOffset DateTime { get; set; }
     public int Mode { get; set; }
     public int? IdUser { get; set; }
+
+    /// <summary>
+    /// Глубина забоя
+    /// </summary>
     public float WellDepth { get; set; }
+
+    /// <summary>
+    /// Давление
+    /// </summary>
     public float Pressure { get; set; }
+
+    /// <summary>
+    /// Вес на крюке
+    /// </summary>
     public float HookWeight { get; set; }
+
+    /// <summary>
+    /// Положение талевого блока
+    /// </summary>
     public float BlockPosition { get; set; }
+
+    /// <summary>
+    /// Глубина долота
+    /// </summary>
     public float BitDepth { get; set; }
+
+    /// <summary>
+    /// Обороты ротора
+    /// </summary>
     public float RotorSpeed { get; set; }
+
+    /// <summary>
+    /// Осевая нагрузка
+    /// </summary>
     public float AxialLoad { get; set; }
 }
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
index ac93fd45..2e73e65a 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
@@ -1,59 +1,67 @@
-// using AsbCloudDb.Model;
-//
-// namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
-// {
-//
-//     /// <summary>
-//     /// Промывка
-//     /// </summary>
-//     internal class DetectorFlashing : DetectorAbstract
-//     {
-//         public DetectorFlashing()
-//             : base(WellOperationCategory.IdFlashing)
-//         { }
-//
-//         protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
-//             => CalcDeltaMinutes(telemetry, begin, end);
-//
-//         protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
-//         {
-//             if (!((previousOperation?.IdCategory == WellOperationCategory.IdRotor) ||
-//                 (previousOperation?.IdCategory == WellOperationCategory.IdSlide)))
-//                 return false;
-//
-//             var point0 = telemetry[position];
-//             var delta = point0.WellDepth - point0.BitDepth;
-//             if (delta > 0.05d)
-//                 return false;
-//
-//             if (point0.Pressure < 15)
-//                 return false;
-//
-//             if (point0.BlockPosition < 3)
-//                 return false;
-//
-//             if (ContainsDeviationApprox(telemetry, t => t.WellDepth, position, 150, 0.0001))
-//                 return false;
-//
-//             return true;
-//         }
-//
-//         protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
-//         {
-//             var point0 = telemetry[position];
-//             var delta = point0.WellDepth - point0.BitDepth;
-//             if ((delta > 0.03d ) 
-//                 && (point0.Pressure > 15)
-//                 && ContainsDeviationApprox(telemetry, t=>t.BlockPosition, position, 60, 0.03))
-//                 return IdReasonOfEnd_Custom1;
-//
-//             return IdReasonOfEnd_NotDetected;
-//         }
-//
-//         protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
-//             => IsValidByWellDepthDoesNotChange(telemetry, begin, end);
-//     }
-//
-//
-// }
-//
+using AsbCloudApp.Data.DetectedOperation;
+using AsbCloudDb.Model;
+using System;
+using System.Collections.Generic;
+
+namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
+{
+
+    /// <summary>
+    /// Промывка
+    /// </summary>
+    internal class DetectorFlashing : DetectorAbstract
+    {
+
+        protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
+            => CalcDeltaMinutes(telemetry, begin, end);
+
+        protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperationDto? previousOperation)
+        {
+
+            var currentPoint = telemetry[position];
+            if (currentPoint.Pressure <= 20)
+                return false;
+
+            var delta = currentPoint.WellDepth - currentPoint.BitDepth;
+            if (delta < 0.03d)
+                return false;
+
+            if (currentPoint.RotorSpeed >= 10)
+                return false;
+
+            var nextIndexPoint = telemetry.Length <= position ? position : position + 1;
+            var nextPoint = telemetry[nextIndexPoint];
+            if (Math.Abs(currentPoint.WellDepth - nextPoint.WellDepth) > 0)
+                return false;
+
+            if (currentPoint.WellDepth <= 150)
+                return false;
+
+            return true;
+
+        }
+
+        protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperationDto? previousOperation)
+        {
+            var currentPoint = telemetry[position];
+
+            if (currentPoint.Pressure < 20)
+                return IdReasonOfEnd_PressureIsLo;
+            if ((currentPoint.WellDepth - currentPoint.BitDepth) < 0.03d)
+                return 0;
+            if (currentPoint.RotorSpeed >= 10)
+                return IdReasonOfEnd_RotorSpeedIsHi;
+            if (currentPoint.BitDepth < 150)
+                return 0;
+            return IdReasonOfEnd_NotDetected;
+        }
+
+        protected override (int IdCategory, IDictionary<string, object> ExtraData) GetSpecificInformation(DetectableTelemetry[] telemetry,
+            int begin,
+            int end)
+        {
+            return (WellOperationCategory.IdFlashing, new Dictionary<string, object>());
+        }
+    }
+}
+
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
index 9a57a784..c4ca9bac 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
@@ -2,26 +2,31 @@
 
 ## Описание
 
-Промывка  – операция, во время которой после добуривания очередной трубы происходит снижение осевой нагрузки и дифференциального давления, талевый блок остается условно неподвижным.
+Промывка  – операция, во время которой давление условно постоянное, а вращение колонны отсутствует, талевый блок при этом может быть как в движении, так и статичным.
 
-Проработка перед наращиванием определяется как время между:
-- окончанием операции бурения (ротор/ слайд/ ручное бурение)
-- началом операции проработки/ шаблонировки перед наращивании 
+Промывка определяется как время между:
+- окончанием операции бурения или выходом на режим буровых насосов
+- началом операции проработки/шаблонировки перед наращиванием или остановкой буровых насосов
 
 ## Метод определения
 
 	Признак начала операции = 
-		( предыдущая операция == бурение в роторе или слайде) 
-		( расстояние от долота до забоя < 0,05м ) И
-		( давление > 15 атм ) И		
-		( положение блока > 3м ) И
-		( глубина забоя изменяется менее чем на 0,0001м в течении 150 сек)
-	
+       	( давление > 20 атм ) И
+		( расстояние от долота до забоя >= 0.03 м) И
+        	( обороты ротора < 10 об/мин) И 
+		( глубина забоя не изменяется) И 
+		( глубина долота > 150 м) И
+ 		( положение блока не меняется) ИЛИ
+ 		( положение блока уменьшается) ИЛИ
+ 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора < 10 об/мин);
+
 	Признак окончания операции = 
-		( расстояние от долота до забоя > 0.03м ) И
-		( давление > 15 атм ) И
-		( высота блока изменяется больше чем на 0.03м в течении 60 сек с начала операции);
+		( давление < 20 атм ) ИЛИ
+		( расстояние от долота до забоя < 0.03 м ) ИЛИ
+		( обороты ротора >= 10 об/мин) ИЛИ 
+		( глубина долота < 150 м) ИЛИ
+		(положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора >= 10 об/мин);
 		
 
 ## Ключевой параметр
-Продолжительность операции.
+Продолжительность операции.
\ No newline at end of file

From 55be94620f8625674e0b11f89ff68e6d39e832f7 Mon Sep 17 00:00:00 2001
From: Olga Nemt <on.nemtina@digitaldrilling.ru>
Date: Fri, 15 Mar 2024 14:51:13 +0500
Subject: [PATCH 2/7] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=82=D0=B5=D1=81?=
 =?UTF-8?q?=D1=82=D1=8B=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BE=D0=BF=D1=80=D0=B5?=
 =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D0=BF=D0=B5?=
 =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF=D1=80=D0=BE=D0=BC=D1=8B?=
 =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20+=20=D1=81=D0=BA=D0=BE=D1=80=D1=80=D0=B5?=
 =?UTF-8?q?=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=B0=D0=BB?=
 =?UTF-8?q?=D0=B3=D0=BE=D1=80=D0=B8=D1=82=D0=BC=20=D0=B0=D0=B2=D1=82=D0=BE?=
 =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8?=
 =?UTF-8?q?=D1=8F=20+=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=202-=D1=85=20?=
 =?UTF-8?q?=D0=BD=D0=B0=D0=B9=D0=B4=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B1?=
 =?UTF-8?q?=D0=B0=D0=B3=D0=BE=D0=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../DetectedOperationService.cs               |   7 +-
 .../Detectors/DetectorAbstract.cs             |   4 +
 .../Detectors/DetectorFlashing.cs             |  12 +-
 .../Specifications/Промывка.md                |  14 +-
 .../WorkOperationDetection.cs                 |   2 +-
 .../Detectors/DetectorFlashingTests.cs        | 128 ++++++++++++++++++
 6 files changed, 150 insertions(+), 17 deletions(-)
 create mode 100644 AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs

diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
index b53b1cd0..86c9aea0 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
@@ -25,7 +25,8 @@ public class DetectedOperationService : IDetectedOperationService
 
     private static readonly DetectorAbstract[] detectors = {
         new DetectorDrilling(),
-        new DetectorSlipsTime()
+        new DetectorSlipsTime(),
+        new DetectorFlashing(),
     };
         
     public DetectedOperationService(
@@ -167,13 +168,13 @@ public class DetectedOperationService : IDetectedOperationService
                         AxialLoad = t.AxialLoad,
                     }).ToArray();
             
-            if (detectableTelemetries.Length < gap)
+            if (detectableTelemetries.Length <= gap)
                 break;
 
             var isDetected = false;
             var positionBegin = 0;
             var positionEnd = detectableTelemetries.Length - gap;
-            while (positionEnd > positionBegin)
+              while (positionEnd > positionBegin)
             {
                 foreach (var detector in detectors)
                 {
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs
index 559e1dc4..44b47554 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorAbstract.cs
@@ -32,6 +32,10 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
 
         protected const int IdReasonOfEnd_ChangeBithDepthAndAxiloadLessHookWeight = 700;
 
+        protected const int IdReasonOfEnd_DeltaWellDepthAndBithDepthIsLo = 800;
+
+        protected const int IdReasonOfEnd_BithDepthIsLo = 900;
+
         public bool TryDetect(int idTelemetry, DetectableTelemetry[] telemetry, int begin, int end, DetectedOperationDto? previousOperation,
             out OperationDetectorResult? result)
         {
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
index 2e73e65a..0718d447 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
@@ -9,7 +9,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
     /// <summary>
     /// Промывка
     /// </summary>
-    internal class DetectorFlashing : DetectorAbstract
+    public class DetectorFlashing : DetectorAbstract
     {
 
         protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
@@ -19,7 +19,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
         {
 
             var currentPoint = telemetry[position];
-            if (currentPoint.Pressure <= 20)
+            if (currentPoint.Pressure <= 10)
                 return false;
 
             var delta = currentPoint.WellDepth - currentPoint.BitDepth;
@@ -34,7 +34,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
             if (Math.Abs(currentPoint.WellDepth - nextPoint.WellDepth) > 0)
                 return false;
 
-            if (currentPoint.WellDepth <= 150)
+            if (currentPoint.BitDepth <= 150)
                 return false;
 
             return true;
@@ -45,14 +45,14 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
         {
             var currentPoint = telemetry[position];
 
-            if (currentPoint.Pressure < 20)
+            if (currentPoint.Pressure < 10)
                 return IdReasonOfEnd_PressureIsLo;
             if ((currentPoint.WellDepth - currentPoint.BitDepth) < 0.03d)
-                return 0;
+                return IdReasonOfEnd_DeltaWellDepthAndBithDepthIsLo;
             if (currentPoint.RotorSpeed >= 10)
                 return IdReasonOfEnd_RotorSpeedIsHi;
             if (currentPoint.BitDepth < 150)
-                return 0;
+                return IdReasonOfEnd_BithDepthIsLo;
             return IdReasonOfEnd_NotDetected;
         }
 
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
index c4ca9bac..0dd385fd 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
@@ -11,9 +11,9 @@
 ## Метод определения
 
 	Признак начала операции = 
-       	( давление > 20 атм ) И
-		( расстояние от долота до забоя >= 0.03 м) И
+       	( давление > 10 атм ) И
         	( обороты ротора < 10 об/мин) И 
+		( расстояние от долота до забоя >= 0.03 м) И
 		( глубина забоя не изменяется) И 
 		( глубина долота > 150 м) И
  		( положение блока не меняется) ИЛИ
@@ -21,12 +21,12 @@
  		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора < 10 об/мин);
 
 	Признак окончания операции = 
-		( давление < 20 атм ) ИЛИ
+		( давление < 10 атм ) ИЛИ
 		( расстояние от долота до забоя < 0.03 м ) ИЛИ
-		( обороты ротора >= 10 об/мин) ИЛИ 
-		( глубина долота < 150 м) ИЛИ
-		(положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора >= 10 об/мин);
+		( обороты ротора >= 10 об/мин) ИЛИ
+ 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора >= 10 об/мин) ИЛИ 
+		( глубина долота < 150 м);
 		
 
 ## Ключевой параметр
-Продолжительность операции.
\ No newline at end of file
+Продолжительность операции.
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs b/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs
index f562e744..d001471e 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs
@@ -44,7 +44,7 @@ public class WorkOperationDetection: Work
             
             var beginDate = lastDetectedDates.TryGetValue(telemetryId, out var date) ? date : (DateTimeOffset?)null; 
             
-            onProgressCallback($"Start detecting telemetry: {telemetryId} from {beginDate}", i++ / telemetryIds.Length);
+            onProgressCallback($"Start detecting telemetry: {telemetryId} from {beginDate}", i / telemetryIds.Length);
             var detectedOperations = await detectedOperationService.DetectOperationsAsync(telemetryId, beginDate, token);
 
             if (detectedOperations.Any())
diff --git a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
new file mode 100644
index 00000000..f93edd8f
--- /dev/null
+++ b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
@@ -0,0 +1,128 @@
+using System.Collections.Generic;
+using System.Linq;
+using AsbCloudApp.Data.DetectedOperation;
+using AsbCloudDb.Model;
+using AsbCloudInfrastructure.Services.DetectOperations;
+using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
+using Xunit;
+
+namespace AsbCloudWebApi.Tests.Services.DetectedOperations.Detectors;
+
+/// <summary>
+/// ������������ ��������������� �������� "��������"
+/// </summary>
+public class DetectorFlashingTests : DetectorFlashing
+{
+    private readonly DetectorFlashing detector = new();
+
+    /// <summary>
+    /// ��������, ���������� ��� ��������������� �������� ��������
+    /// </summary>
+    private readonly DetectableTelemetry telemetry = new()
+    {
+        Pressure = 21,
+        WellDepth = 152,
+        BitDepth = 151,
+        RotorSpeed = 9,
+        DateTime = System.DateTimeOffset.Now
+    };
+
+
+    /// <summary>
+    /// ������������ ��������, ���������� ��� ��������������� �������� ��������, ��� ����
+    /// - ������ ������� ������ ��������
+    /// - �� ������ ������� ��������� ��������
+    /// </summary>
+    [Fact]
+    public void DetectOperation_find_startOperation_notFind_endOperation()
+    {
+        //arrange
+        var point0 = telemetry.Copy();
+        var point1 = telemetry.Copy();
+        point1.DateTime = System.DateTimeOffset.Now.AddMinutes(5);
+
+        var telemetries = new[] { point0, point1 };
+
+        //act
+        var isDetectOperation = detector.TryDetect(0, telemetries, 0, telemetries.Length - 1, null, out var result);
+
+        //assert
+        Assert.True(isDetectOperation);
+        Assert.NotNull(result);
+        Assert.Equal(WellOperationCategory.IdFlashing, result.Operation.IdCategory);
+        Assert.Equal(IdReasonOfEnd_NotDetected, result.Operation.ExtraData["IdReasonOfEnd"]);
+    }
+
+    /// <summary>
+    /// ��������, � ������� ������� ������ = 150�, �� �������� ��������� 
+    /// </summary>
+    [Fact]
+    public void DetectOperation_with_BitDepth_LE_150_is_fail()
+    {
+        //arrange
+        var point0 = telemetry.Copy();
+        point0.BitDepth = 150;
+
+        var point1 = telemetry.Copy();
+
+        var telemetries = new[] { point0, point1 };
+
+		//act
+
+        var isDetectOperation = detector.TryDetect(0, telemetries, 0, telemetries.Length - 1, null, out var result);
+
+        //assert
+        Assert.False(isDetectOperation);
+        Assert.Null(result);
+    }
+
+
+    /// <summary>
+    /// ��������, � ������� �������� ������� �����, �� �������� ��������� 
+    /// </summary>
+    [Fact]
+    public void DetectOperation_with_DeltaWellDepth_NotEqual_0_is_fail()
+    {
+        //arrange
+        var point0 = telemetry.Copy();
+        var point1 = telemetry.Copy();
+        point1.WellDepth = point0.WellDepth + 10;
+
+        var telemetries = new[] { point0, point1 };
+
+        //act
+        var isDetectOperation = detector.TryDetect(0, telemetries, 0, telemetries.Length - 1, null, out var result);
+
+        //assert
+        Assert.False(isDetectOperation);
+        Assert.Null(result);
+    }
+
+    /// <summary>
+    /// ������� ��������� � �������� �������� ��������,
+    /// ������� ��������� �������� - �������� �������� ����� 10 ���
+    /// </summary>
+    [Fact]
+    public void DetectOperations_Begin_And_End_by_Pressure_Less_20_is_success()
+    {
+        //arrange
+        var point0 = telemetry.Copy();
+        var point1 = telemetry.Copy();
+        point1.Pressure = 9;
+        point1.BitDepth = 140.0001f;
+        point1.RotorSpeed = 10;
+
+        var telemetries = new[] { point0, point1 };
+
+        //act
+        var isDetectOperation = detector.TryDetect(0, telemetries, 0, telemetries.Length - 1, null, out var result);
+
+        //assert
+        Assert.False(isDetectOperation);
+        Assert.NotNull(result);
+        Assert.Equal(WellOperationCategory.IdFlashing, result.Operation.IdCategory);
+        Assert.Equal(IdReasonOfEnd_PressureIsLo, result.Operation.ExtraData["IdReasonOfEnd"]);
+    }
+
+
+}
\ No newline at end of file

From e06e01809cdf2e4cccc21ffe9d5a8bc409c75841 Mon Sep 17 00:00:00 2001
From: Olga Nemt <on.nemtina@digitaldrilling.ru>
Date: Fri, 15 Mar 2024 14:54:59 +0500
Subject: [PATCH 3/7] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20?=
 =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D1=8E=D0=B7=D0=B8=D0=BD?=
 =?UTF-8?q?=D0=B3=D0=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../DetectedOperations/Detectors/DetectorFlashingTests.cs    | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
index f93edd8f..babcd4be 100644
--- a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
+++ b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
@@ -1,6 +1,3 @@
-using System.Collections.Generic;
-using System.Linq;
-using AsbCloudApp.Data.DetectedOperation;
 using AsbCloudDb.Model;
 using AsbCloudInfrastructure.Services.DetectOperations;
 using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
@@ -67,7 +64,7 @@ public class DetectorFlashingTests : DetectorFlashing
 
         var telemetries = new[] { point0, point1 };
 
-		//act
+        //act
 
         var isDetectOperation = detector.TryDetect(0, telemetries, 0, telemetries.Length - 1, null, out var result);
 

From 8c9a5027d0f3a90554127d167d8181505468c6ea Mon Sep 17 00:00:00 2001
From: Olga Nemt <on.nemtina@digitaldrilling.ru>
Date: Fri, 15 Mar 2024 14:55:40 +0500
Subject: [PATCH 4/7] =?UTF-8?q?=D0=9A=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2?=
 =?UTF-8?q?=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Detectors/DetectorFlashingTests.cs         | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
index babcd4be..56f16e45 100644
--- a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
+++ b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
@@ -6,14 +6,14 @@ using Xunit;
 namespace AsbCloudWebApi.Tests.Services.DetectedOperations.Detectors;
 
 /// <summary>
-/// ������������ ��������������� �������� "��������"
+/// Тестирование автоопределения операции "Промывка"
 /// </summary>
 public class DetectorFlashingTests : DetectorFlashing
 {
     private readonly DetectorFlashing detector = new();
 
     /// <summary>
-    /// ��������, ���������� ��� ��������������� �������� ��������
+    /// Операция, попадающая под автоопределение операции промывки
     /// </summary>
     private readonly DetectableTelemetry telemetry = new()
     {
@@ -26,9 +26,9 @@ public class DetectorFlashingTests : DetectorFlashing
 
 
     /// <summary>
-    /// ������������ ��������, ���������� ��� ��������������� �������� ��������, ��� ����
-    /// - ������ ������� ������ ��������
-    /// - �� ������ ������� ��������� ��������
+    /// Тестирование операций, попадающей под автоопределение операции промывки, при этом
+    /// - найден признак начала операции
+    /// - не найден признак окончания операции
     /// </summary>
     [Fact]
     public void DetectOperation_find_startOperation_notFind_endOperation()
@@ -51,7 +51,7 @@ public class DetectorFlashingTests : DetectorFlashing
     }
 
     /// <summary>
-    /// ��������, � ������� ������� ������ = 150�, �� �������� ��������� 
+    /// Операция, у которой глубина долота = 150м, не является промывкой 
     /// </summary>
     [Fact]
     public void DetectOperation_with_BitDepth_LE_150_is_fail()
@@ -75,7 +75,7 @@ public class DetectorFlashingTests : DetectorFlashing
 
 
     /// <summary>
-    /// ��������, � ������� �������� ������� �����, �� �������� ��������� 
+    /// Операция, у которой меняется глубина забоя, не является промывкой 
     /// </summary>
     [Fact]
     public void DetectOperation_with_DeltaWellDepth_NotEqual_0_is_fail()
@@ -96,8 +96,8 @@ public class DetectorFlashingTests : DetectorFlashing
     }
 
     /// <summary>
-    /// ������� ��������� � �������� �������� ��������,
-    /// ������� ��������� �������� - �������� �������� ����� 10 ���
+    /// Найдены начальная и конечная операции промывки,
+    /// Признак окончания операции - снижение давления менее 10 атм
     /// </summary>
     [Fact]
     public void DetectOperations_Begin_And_End_by_Pressure_Less_20_is_success()

From 0a1ab12ce418a3d2418bb0acb43b46097cab596d Mon Sep 17 00:00:00 2001
From: Olga Nemt <on.nemtina@digitaldrilling.ru>
Date: Fri, 15 Mar 2024 16:02:44 +0500
Subject: [PATCH 5/7] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?=
 =?UTF-8?q?=D0=B8=D0=B5=20=D0=B2=20=D0=B0=D0=BB=D0=BE=D0=B3=D1=80=D0=B8?=
 =?UTF-8?q?=D1=82=D0=BC=D1=8B=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BE=D0=BF=D1=80?=
 =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D0=BF?=
 =?UTF-8?q?=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../DetectOperations/Detectors/DetectorFlashing.cs        | 4 ++--
 .../Services/DetectOperations/Specifications/Промывка.md  | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
index 0718d447..acc5043f 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
@@ -26,7 +26,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
             if (delta < 0.03d)
                 return false;
 
-            if (currentPoint.RotorSpeed >= 10)
+            if (currentPoint.RotorSpeed > 10.5)
                 return false;
 
             var nextIndexPoint = telemetry.Length <= position ? position : position + 1;
@@ -49,7 +49,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
                 return IdReasonOfEnd_PressureIsLo;
             if ((currentPoint.WellDepth - currentPoint.BitDepth) < 0.03d)
                 return IdReasonOfEnd_DeltaWellDepthAndBithDepthIsLo;
-            if (currentPoint.RotorSpeed >= 10)
+            if (currentPoint.RotorSpeed > 10.5)
                 return IdReasonOfEnd_RotorSpeedIsHi;
             if (currentPoint.BitDepth < 150)
                 return IdReasonOfEnd_BithDepthIsLo;
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
index 0dd385fd..37bffbe9 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
@@ -12,19 +12,19 @@
 
 	Признак начала операции = 
        	( давление > 10 атм ) И
-        	( обороты ротора < 10 об/мин) И 
+        	( обороты ротора <= 10.5 об/мин) И 
 		( расстояние от долота до забоя >= 0.03 м) И
 		( глубина забоя не изменяется) И 
 		( глубина долота > 150 м) И
  		( положение блока не меняется) ИЛИ
  		( положение блока уменьшается) ИЛИ
- 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора < 10 об/мин);
+ 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора <= 10.5 об/мин);
 
 	Признак окончания операции = 
 		( давление < 10 атм ) ИЛИ
 		( расстояние от долота до забоя < 0.03 м ) ИЛИ
-		( обороты ротора >= 10 об/мин) ИЛИ
- 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора >= 10 об/мин) ИЛИ 
+		( обороты ротора > 10.5 об/мин) ИЛИ
+ 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора > 10.5 об/мин) ИЛИ 
 		( глубина долота < 150 м);
 		
 

From cfb31fcbeddce7bccddc49b3ca6331987c05cd06 Mon Sep 17 00:00:00 2001
From: Olga Nemt <on.nemtina@digitaldrilling.ru>
Date: Mon, 18 Mar 2024 13:34:31 +0500
Subject: [PATCH 6/7] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?=
 =?UTF-8?q?=D0=BF=D0=BE=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0?=
 =?UTF-8?q?=D1=82=D0=B0=D0=BC:=20-=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?=
 =?UTF-8?q?=20=D0=B0=D0=BB=D0=B3=D0=BE=D1=80=D0=B8=D1=82=D0=BC=D0=BE=D0=B2?=
 =?UTF-8?q?=20=D0=BE=D1=82=20=D0=94=D0=B8=D0=BC=D1=8B=20=D0=97.=20-=20?=
 =?UTF-8?q?=D1=80=D0=B5=D0=B2=D1=8C=D1=8E=20=D0=BE=D1=82=20=D0=94=D0=B8?=
 =?UTF-8?q?=D0=BC=D1=8B=20=D0=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../DetectOperations/DetectableTelemetry.cs   | 11 ++++
 .../DetectedOperationService.cs               | 54 +++++++++----------
 .../Detectors/DetectorFlashing.cs             |  8 +--
 .../Specifications/Промывка.md                | 16 +++---
 .../Detectors/DetectorFlashingTests.cs        | 25 ++-------
 5 files changed, 53 insertions(+), 61 deletions(-)

diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs
index 372cda3c..50d6dd14 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectableTelemetry.cs
@@ -4,8 +4,19 @@ namespace AsbCloudInfrastructure.Services.DetectOperations;
 
 public class DetectableTelemetry
 {
+    /// <summary>
+    /// Дата начала
+    /// </summary>
     public DateTimeOffset DateTime { get; set; }
+
+    /// <summary>
+    /// Режим
+    /// </summary>
     public int Mode { get; set; }
+
+    /// <summary>
+    /// Ключ пользователя
+    /// </summary>
     public int? IdUser { get; set; }
 
     /// <summary>
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
index 86c9aea0..16eea6d7 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
@@ -28,12 +28,12 @@ public class DetectedOperationService : IDetectedOperationService
         new DetectorSlipsTime(),
         new DetectorFlashing(),
     };
-        
+
     public DetectedOperationService(
         IDetectedOperationRepository operationRepository,
         IWellOperationCategoryRepository wellOperationCategoryRepository,
         IWellService wellService,
-        IRepositoryWellRelated<OperationValueDto> operationValueRepository, 
+        IRepositoryWellRelated<OperationValueDto> operationValueRepository,
         IScheduleRepository scheduleRepository,
         ITelemetryDataSaubService telemetryDataSaubService)
     {
@@ -87,9 +87,9 @@ public class DetectedOperationService : IDetectedOperationService
             if (well?.IdTelemetry is null)
                 return Enumerable.Empty<WellOperationCategoryDto>();
 
-            var request = new DetectedOperationByTelemetryRequest() 
-            { 
-                IdTelemetry = well.IdTelemetry.Value 
+            var request = new DetectedOperationByTelemetryRequest()
+            {
+                IdTelemetry = well.IdTelemetry.Value
             };
 
             var operations = await operationRepository.Get(request, token);
@@ -112,7 +112,7 @@ public class DetectedOperationService : IDetectedOperationService
 
         if (!operations.Any())
             return Enumerable.Empty<DetectedOperationStatDto>();
-        
+
         var dtos = operations
             .GroupBy(o => (o.IdCategory, o.OperationCategory.Name))
             .OrderBy(g => g.Key)
@@ -136,58 +136,58 @@ public class DetectedOperationService : IDetectedOperationService
     public async Task<IEnumerable<DetectedOperationDto>> DetectOperationsAsync(int idTelemetry, DateTimeOffset? beginDate, CancellationToken token)
     {
         const int take = 4 * 86_400;
-        
+
         var detectedOperations = new List<DetectedOperationDto>();
         DetectedOperationDto? lastDetectedOperation = null;
         const int minOperationLength = 5;
         const int maxDetectorsInterpolationFrameLength = 30;
         const int gap = maxDetectorsInterpolationFrameLength + minOperationLength;
-        
+
         while (true)
         {
             var request = new TelemetryDataRequest
             {
                 GeDate = beginDate,
                 Take = take,
-                Order = 0 
+                Order = 0
             };
-            
+
             var detectableTelemetries = (await telemetryDataSaubService.GetByTelemetryAsync(idTelemetry, request, token))
                 .Where(t => t.BlockPosition >= 0)
                 .Select(t => new DetectableTelemetry
-                    {
-                        DateTime = t.DateTime,
-                        IdUser = t.IdUser,
-                        Mode = t.Mode,
-                        WellDepth = t.WellDepth,
-                        Pressure = t.Pressure,
-                        HookWeight = t.HookWeight,
-                        BlockPosition = t.BlockPosition,
-                        BitDepth = t.BitDepth,
-                        RotorSpeed = t.RotorSpeed,
-                        AxialLoad = t.AxialLoad,
-                    }).ToArray();
-            
+                {
+                    DateTime = t.DateTime,
+                    IdUser = t.IdUser,
+                    Mode = t.Mode,
+                    WellDepth = t.WellDepth,
+                    Pressure = t.Pressure,
+                    HookWeight = t.HookWeight,
+                    BlockPosition = t.BlockPosition,
+                    BitDepth = t.BitDepth,
+                    RotorSpeed = t.RotorSpeed,
+                    AxialLoad = t.AxialLoad,
+                }).ToArray();
+
             if (detectableTelemetries.Length <= gap)
                 break;
 
             var isDetected = false;
             var positionBegin = 0;
             var positionEnd = detectableTelemetries.Length - gap;
-              while (positionEnd > positionBegin)
+            while (positionEnd > positionBegin)
             {
                 foreach (var detector in detectors)
                 {
                     if (!detector.TryDetect(idTelemetry, detectableTelemetries, positionBegin, positionEnd, lastDetectedOperation, out var result))
                         continue;
-					
+
                     detectedOperations.Add(result!.Operation);
                     lastDetectedOperation = result.Operation;
                     isDetected = true;
                     positionBegin = result.TelemetryEnd;
                     break;
                 }
-				
+
                 positionBegin += 1;
             }
 
@@ -264,7 +264,7 @@ public class DetectedOperationService : IDetectedOperationService
         dto.OperationValue = operationValues.FirstOrDefault(v => v.IdOperationCategory == dto.IdCategory
               && v.DepthStart <= dto.DepthStart
               && v.DepthEnd > dto.DepthStart);
-        
+
         var dateStart = dto.DateStart;
         var timeStart = new TimeDto(dateStart);
         var driller = schedules.FirstOrDefault(s =>
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
index acc5043f..e6d8a0dd 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs
@@ -19,14 +19,14 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
         {
 
             var currentPoint = telemetry[position];
-            if (currentPoint.Pressure <= 10)
+            if (currentPoint.Pressure < 10)
                 return false;
 
             var delta = currentPoint.WellDepth - currentPoint.BitDepth;
             if (delta < 0.03d)
                 return false;
 
-            if (currentPoint.RotorSpeed > 10.5)
+            if (currentPoint.RotorSpeed > 8)
                 return false;
 
             var nextIndexPoint = telemetry.Length <= position ? position : position + 1;
@@ -34,7 +34,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
             if (Math.Abs(currentPoint.WellDepth - nextPoint.WellDepth) > 0)
                 return false;
 
-            if (currentPoint.BitDepth <= 150)
+            if (currentPoint.BitDepth < 150)
                 return false;
 
             return true;
@@ -49,7 +49,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
                 return IdReasonOfEnd_PressureIsLo;
             if ((currentPoint.WellDepth - currentPoint.BitDepth) < 0.03d)
                 return IdReasonOfEnd_DeltaWellDepthAndBithDepthIsLo;
-            if (currentPoint.RotorSpeed > 10.5)
+            if (currentPoint.RotorSpeed > 8)
                 return IdReasonOfEnd_RotorSpeedIsHi;
             if (currentPoint.BitDepth < 150)
                 return IdReasonOfEnd_BithDepthIsLo;
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
index 37bffbe9..760d28cb 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Specifications/Промывка.md
@@ -5,26 +5,22 @@
 Промывка  – операция, во время которой давление условно постоянное, а вращение колонны отсутствует, талевый блок при этом может быть как в движении, так и статичным.
 
 Промывка определяется как время между:
-- окончанием операции бурения или выходом на режим буровых насосов
-- началом операции проработки/шаблонировки перед наращиванием или остановкой буровых насосов
+- окончанием операции бурения или выходом на режим буровых насосов (рост давления)
+- началом операции проработки/шаблонировки перед наращиванием или остановкой буровых насосов (снижение давления).
 
 ## Метод определения
 
 	Признак начала операции = 
-       	( давление > 10 атм ) И
-        	( обороты ротора <= 10.5 об/мин) И 
+       	( давление >= 10 атм ) И
+        	( обороты ротора <= 8 об/мин) И 
 		( расстояние от долота до забоя >= 0.03 м) И
 		( глубина забоя не изменяется) И 
-		( глубина долота > 150 м) И
- 		( положение блока не меняется) ИЛИ
- 		( положение блока уменьшается) ИЛИ
- 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора <= 10.5 об/мин);
+		( глубина долота >= 150 м);
 
 	Признак окончания операции = 
 		( давление < 10 атм ) ИЛИ
 		( расстояние от долота до забоя < 0.03 м ) ИЛИ
-		( обороты ротора > 10.5 об/мин) ИЛИ
- 		( положение блока увеличивается --> дальше смотрим: если после остановки блока обороты ротора > 10.5 об/мин) ИЛИ 
+		( обороты ротора > 8 об/мин) ИЛИ 
 		( глубина долота < 150 м);
 		
 
diff --git a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
index 56f16e45..43203db9 100644
--- a/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
+++ b/AsbCloudWebApi.Tests/Services/DetectedOperations/Detectors/DetectorFlashingTests.cs
@@ -20,16 +20,11 @@ public class DetectorFlashingTests : DetectorFlashing
         Pressure = 21,
         WellDepth = 152,
         BitDepth = 151,
-        RotorSpeed = 9,
+        RotorSpeed = 8,
         DateTime = System.DateTimeOffset.Now
     };
 
 
-    /// <summary>
-    /// Тестирование операций, попадающей под автоопределение операции промывки, при этом
-    /// - найден признак начала операции
-    /// - не найден признак окончания операции
-    /// </summary>
     [Fact]
     public void DetectOperation_find_startOperation_notFind_endOperation()
     {
@@ -50,9 +45,6 @@ public class DetectorFlashingTests : DetectorFlashing
         Assert.Equal(IdReasonOfEnd_NotDetected, result.Operation.ExtraData["IdReasonOfEnd"]);
     }
 
-    /// <summary>
-    /// Операция, у которой глубина долота = 150м, не является промывкой 
-    /// </summary>
     [Fact]
     public void DetectOperation_with_BitDepth_LE_150_is_fail()
     {
@@ -70,13 +62,12 @@ public class DetectorFlashingTests : DetectorFlashing
 
         //assert
         Assert.False(isDetectOperation);
-        Assert.Null(result);
+        Assert.NotNull(result);
+        Assert.Equal(WellOperationCategory.IdFlashing, result.Operation.IdCategory);
+        Assert.Equal(IdReasonOfEnd_NotDetected, result.Operation.ExtraData["IdReasonOfEnd"]);
     }
 
 
-    /// <summary>
-    /// Операция, у которой меняется глубина забоя, не является промывкой 
-    /// </summary>
     [Fact]
     public void DetectOperation_with_DeltaWellDepth_NotEqual_0_is_fail()
     {
@@ -95,12 +86,8 @@ public class DetectorFlashingTests : DetectorFlashing
         Assert.Null(result);
     }
 
-    /// <summary>
-    /// Найдены начальная и конечная операции промывки,
-    /// Признак окончания операции - снижение давления менее 10 атм
-    /// </summary>
     [Fact]
-    public void DetectOperations_Begin_And_End_by_Pressure_Less_20_is_success()
+    public void DetectOperations_Begin_And_End_by_Pressure_Less_10_is_success()
     {
         //arrange
         var point0 = telemetry.Copy();
@@ -120,6 +107,4 @@ public class DetectorFlashingTests : DetectorFlashing
         Assert.Equal(WellOperationCategory.IdFlashing, result.Operation.IdCategory);
         Assert.Equal(IdReasonOfEnd_PressureIsLo, result.Operation.ExtraData["IdReasonOfEnd"]);
     }
-
-
 }
\ No newline at end of file

From ab9a40e65e6eaa6a87bb2535dcb11c17c5b5039f Mon Sep 17 00:00:00 2001
From: ngfrolov <ng.frolov@autodrilling.ru>
Date: Mon, 25 Mar 2024 11:28:17 +0500
Subject: [PATCH 7/7] Fix ProcessMapPlanBaseRepository<ProcessMapPlanReamDto,
 ProcessMapPlanReam>> registration

---
 AsbCloudInfrastructure/DependencyInjection.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index 5ee77197..d07de418 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -183,7 +183,7 @@ namespace AsbCloudInfrastructure
 
             services.AddTransient<
                 IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell>,
-                ProcessMapPlanBaseRepository<ProcessMapPlanReamDto, ProcessMapPlanDrilling>>();
+                ProcessMapPlanBaseRepository<ProcessMapPlanReamDto, ProcessMapPlanReam>>();
 
             services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();