2022-06-30 17:37:57 +05:00
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
|
|
|
|
{
|
|
|
|
|
#nullable enable
|
|
|
|
|
internal class DetectorRotor : DetectorAbstract
|
|
|
|
|
{
|
|
|
|
|
public DetectorRotor()
|
|
|
|
|
: base(2) { }
|
|
|
|
|
|
|
|
|
|
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
|
|
|
|
|
{
|
|
|
|
|
var point0 = telemetry[position];
|
|
|
|
|
var delta = point0.WellDepth - point0.BitDepth;
|
|
|
|
|
if (delta > 0.03d)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (point0.Pressure < 25)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (point0.RotorSpeed < 5)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var point1 = telemetry[position + 1];
|
|
|
|
|
if (point1.WellDepth - point0.WellDepth <= 0.003)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (point0.Pressure < 25)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
var lineRotorSpeed = MakeInterpolationLine(d => d.RotorSpeed, telemetry, position, 10);
|
|
|
|
|
|
|
|
|
|
if (lineRotorSpeed.IsAverageYLessThan(5))
|
|
|
|
|
return true;
|
|
|
|
|
|
2022-07-20 09:49:36 +05:00
|
|
|
|
if (!DeviatesFromBegin(telemetry, t => t.WellDepth, position, 60, 0.003))
|
2022-06-30 17:37:57 +05:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
|
|
|
|
|
=> IsValidByWellDepthIncreasing(telemetry, begin, end);
|
|
|
|
|
|
|
|
|
|
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
|
|
|
|
|
=> CalcRop(telemetry, begin, end);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
}
|
|
|
|
|
|