2022-08-10 15:51:41 +05:00
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
|
|
|
|
{
|
|
|
|
|
#nullable enable
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Шаблонировка при бурении
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class DetectorTemplatingWhileDrilling : DetectorAbstract
|
|
|
|
|
{
|
|
|
|
|
public DetectorTemplatingWhileDrilling()
|
2022-12-08 18:00:01 +05:00
|
|
|
|
: base(60017) { }
|
2022-08-10 15:51:41 +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)
|
|
|
|
|
{
|
|
|
|
|
if (previousOperation?.IdCategory != 22)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var point0 = telemetry[position];
|
|
|
|
|
|
|
|
|
|
if (point0.Pressure < 15)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (point0.RotorSpeed < 1)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (RisesFromBegin(telemetry, t => t.BlockPosition, position, 30, 0.5))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
|
|
|
|
|
{
|
|
|
|
|
var point0 = telemetry[position];
|
2022-08-11 14:30:20 +05:00
|
|
|
|
|
|
|
|
|
if (point0.Pressure < 15)
|
|
|
|
|
return IdReasonOfEnd_PressureIsLo;
|
|
|
|
|
|
|
|
|
|
if (RisesFromBegin(telemetry, t=>t.WellDepth, position, 10, 0.01))
|
|
|
|
|
return IdReasonOfEnd_WellDepthDeviates;
|
|
|
|
|
|
2022-08-10 15:51:41 +05:00
|
|
|
|
var delta = point0.WellDepth - point0.BitDepth;
|
2022-08-11 14:30:20 +05:00
|
|
|
|
if ( (delta > 0.03d )
|
2022-08-10 15:51:41 +05:00
|
|
|
|
&& (point0.Pressure > 15)
|
|
|
|
|
&& (!ContainsDeviationApprox(telemetry, t=>t.BlockPosition, position, 60, 0.03)))
|
|
|
|
|
return IdReasonOfEnd_Custom1;
|
|
|
|
|
|
|
|
|
|
return IdReasonOfEnd_NotDetected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
|
|
|
|
|
=> IsValidByWellDepthDoesNotChange(telemetry, begin, end);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
}
|
|
|
|
|
|