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

56 lines
1.8 KiB
C#
Raw Normal View History

2022-08-05 17:16:34 +05:00
using AsbCloudDb.Model;
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
#nullable enable
/// <summary>
/// Промывка перед наращиванием
/// </summary>
internal class DetectorFlashingBeforeConnection : DetectorAbstract
{
public DetectorFlashingBeforeConnection()
: base(20) { }
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 == 2) ||
(previousOperation?.IdCategory == 3)))
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;
return true;
}
protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
2022-08-05 17:16:34 +05:00
{
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;
2022-08-05 17:16:34 +05:00
return IdReasonOfEnd_NotDetected;
2022-08-05 17:16:34 +05:00
}
protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
=> IsValidByWellDepthDoesNotChange(telemetry, begin, end);
}
#nullable disable
}