2022-04-22 17:17:38 +05:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
|
|
|
|
{
|
|
|
|
|
#nullable enable
|
|
|
|
|
class DetectorDrillingSlide : DetectorAbstract
|
|
|
|
|
{
|
2022-04-28 15:04:13 +05:00
|
|
|
|
public DetectorDrillingSlide() : base(3)
|
2022-04-22 17:17:38 +05:00
|
|
|
|
{
|
|
|
|
|
FragmentLength = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool DetectStart(DetectableTelemetry[] telemetry, int position)
|
|
|
|
|
{
|
2022-04-28 15:04:13 +05:00
|
|
|
|
var firstItem = telemetry[position];
|
|
|
|
|
var delta = firstItem.WellDepth - firstItem.BitDepth;
|
|
|
|
|
if (delta is not null &&
|
|
|
|
|
System.Math.Abs((float)delta) > 1d)
|
|
|
|
|
return false;
|
|
|
|
|
|
2022-04-22 17:17:38 +05:00
|
|
|
|
var fragment = telemetry[position .. (position + FragmentLength)];
|
|
|
|
|
|
|
|
|
|
const double minRop = 5; //м/час
|
|
|
|
|
const double minRotorSpeed = 5; //об/мин
|
|
|
|
|
const double ticksPerHour = 60 * 60 * 10_000_000d;
|
|
|
|
|
|
|
|
|
|
var lineBlockPosition = new InterpolationLine(fragment.Select(d => (d.BlockPosition ?? 0d, d.DateTime.Ticks / ticksPerHour)));
|
|
|
|
|
if (!lineBlockPosition.IsYDecreases(minRop))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var lineWellDepth = new InterpolationLine(fragment.Select(d => (d.WellDepth ?? 0d, d.DateTime.Ticks / ticksPerHour)));
|
|
|
|
|
if(!lineWellDepth.IsYIncreases(minRop))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var lineRotorSpeed = new InterpolationLine(fragment.Select(d => (d.RotorSpeed ?? 0d, d.DateTime.Ticks / ticksPerHour)));
|
|
|
|
|
if (!lineRotorSpeed.IsAverageYMoreThanBound(minRotorSpeed))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool DetectEnd(DetectableTelemetry[] telemetry, int position)
|
|
|
|
|
=> !DetectStart(telemetry, position);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#nullable disable
|
|
|
|
|
}
|