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

70 lines
2.2 KiB
C#
Raw Normal View History

2022-07-20 09:49:36 +05:00
using AsbCloudDb.Model;
using System.Linq;
using System;
2022-07-20 09:49:36 +05:00
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
#nullable enable
/// <summary>
/// Статический замер телесистемы
/// </summary>
internal class DetectorStaticSurveying: DetectorAbstract
{
public DetectorStaticSurveying()
2022-12-09 14:36:45 +05:00
: base(WellOperationCategory.IdStaticSurveying) { }
2022-07-20 09:49:36 +05:00
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
var point0 = telemetry[position];
if (point0.Pressure < 15)
return false;
var delta = point0.WellDepth - point0.BitDepth;
if (delta > 2.5d || delta < 0.15d)
2022-07-20 09:49:36 +05:00
return false;
2022-08-05 15:58:40 +05:00
if (point0.RotorSpeed > 30)
2022-07-20 09:49:36 +05:00
return false;
2022-08-11 15:37:24 +05:00
if (ContainsDeviation(telemetry, t => t.BlockPosition, position, 120, 0.03))
2022-07-20 09:49:36 +05:00
return false;
if (ContainsDeviation(telemetry, t => t.Pressure, position, 60, 10))
return false;
return true;
}
protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
2022-07-20 09:49:36 +05:00
{
var point0 = telemetry[position];
var delta = point0.WellDepth - point0.BitDepth;
if (delta > 2.5d )
return IdReasonOfEnd_DeltaDepthIsHi;
2022-07-20 09:49:36 +05:00
2022-08-05 15:58:40 +05:00
if (point0.RotorSpeed > 30)
return IdReasonOfEnd_RotorSpeedIsHi;
2022-07-20 09:49:36 +05:00
if (RisesFromBegin(telemetry, t => t.Pressure, position, 10, 15))
return IdReasonOfEnd_PressureIsRising;
2022-07-20 09:49:36 +05:00
2022-08-05 15:58:40 +05:00
if (ContainsDeviation(telemetry, t => t.BlockPosition, position, 10, 0.05))
return IdReasonOfEnd_BlockPositionDeviates;
2022-07-20 09:49:36 +05:00
return IdReasonOfEnd_NotDetected;
2022-07-20 09:49:36 +05:00
}
protected override bool IsValid(DetectableTelemetry[] telemetry, int begin, int end)
=> IsValidByWellDepthDoesNotChange(telemetry, begin, end);
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
}
#nullable disable
}