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

65 lines
1.9 KiB
C#
Raw Normal View History

2022-06-30 17:37:57 +05:00
using AsbCloudDb.Model;
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
#nullable enable
internal class DetectorDevelopment : DetectorAbstract
{
public DetectorDevelopment()
: base(18) { }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaTime(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
if (previousOperation?.IdCategory == 14)
return false;
var point0 = telemetry[position];
var delta = point0.WellDepth - point0.BitDepth;
if (delta < 0.03d || delta > 30)
return false;
if (point0.Pressure < 15)
return false;
if (point0.BlockPosition > 31)
return false;
if (point0.RotorSpeed < 10)
return false;
if (!ContainsDeviationApprox(telemetry, d => d.BlockPosition, position, 60, 0.03))
return false;
2022-06-30 17:37:57 +05:00
return true;
}
protected override bool DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
var point0 = telemetry[position];
var delta = point0.WellDepth - point0.BitDepth;
if (delta < 0.03d || delta > 30)
return true;
if (point0.Pressure < 15)
return true;
if (point0.BlockPosition > 31)
return true;
if (point0.RotorSpeed < 10)
return true;
return false;
}
2022-06-30 17:37:57 +05:00
protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
=> IsValidByWellDepthDoesNotChange(telemetry, begin, end);
}
#nullable disable
}