DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorFlashing.cs

60 lines
2.0 KiB
C#
Raw Normal View History

2022-07-19 10:29:38 +05:00
using AsbCloudDb.Model;
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
2022-08-03 11:13:23 +05:00
#nullable enable
2022-07-19 10:29:38 +05:00
/// <summary>
2022-08-05 17:16:34 +05:00
/// Промывка
2022-07-19 10:29:38 +05:00
/// </summary>
internal class DetectorFlashing : DetectorAbstract
{
public DetectorFlashing()
2022-12-09 14:36:45 +05:00
: base(WellOperationCategory.IdFlashing)
{ }
2022-07-19 10:29:38 +05:00
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
2022-12-09 14:36:45 +05:00
if (!((previousOperation?.IdCategory == WellOperationCategory.IdRotor) ||
(previousOperation?.IdCategory == WellOperationCategory.IdSlide)))
2022-07-19 10:29:38 +05:00
return false;
var point0 = telemetry[position];
var delta = point0.WellDepth - point0.BitDepth;
if (delta > 0.05d)
return false;
if (point0.Pressure < 15)
return false;
2022-08-05 17:16:34 +05:00
if (point0.BlockPosition < 3)
2022-07-19 10:29:38 +05:00
return false;
if (ContainsDeviationApprox(telemetry, t => t.WellDepth, position, 150, 0.0001))
return false;
2022-07-19 10:29:38 +05:00
return true;
}
protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
2022-07-19 10:29:38 +05:00
{
var point0 = telemetry[position];
var delta = point0.WellDepth - point0.BitDepth;
if ((delta > 0.03d )
&& (point0.Pressure > 15)
2022-07-20 09:49:36 +05:00
&& ContainsDeviationApprox(telemetry, t=>t.BlockPosition, position, 60, 0.03))
return IdReasonOfEnd_Custom1;
2022-07-19 10:29:38 +05:00
return IdReasonOfEnd_NotDetected;
2022-07-19 10:29:38 +05:00
}
protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
=> IsValidByWellDepthDoesNotChange(telemetry, begin, end);
}
#nullable disable
}