DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorConditioning.cs
2024-07-26 16:56:36 +05:00

56 lines
2.0 KiB
C#

using AsbCloudApp.Data.DetectedOperation;
using AsbCloudDb.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
public class DetectorConditioning : DetectorAbstract
{
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end) =>
CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperationDto? previousOperation)
{
var currentPoint = telemetry[position];
if (currentPoint.Pressure < 10)
return false;
if (currentPoint.RotorSpeed <= 8)
return false;
var delta = currentPoint.WellDepth - currentPoint.BitDepth;
if (delta < 0.03d)
return false;
if (currentPoint.BitDepth < 150)
return false;
return true;
}
protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperationDto? previousOperation)
{
var currentPoint = telemetry[position];
if (currentPoint.Pressure < 10)
return IdReasonOfEnd_PressureIsLo;
if (currentPoint.RotorSpeed <=8)
return IdReasonOfEnd_RotorSpeedIsHi;
if ((currentPoint.WellDepth - currentPoint.BitDepth) < 0.03d)
return IdReasonOfEnd_DeltaWellDepthAndBitDepthIsLo;
if (currentPoint.BitDepth < 150)
return IdReasonOfEnd_BitDepthIsLo;
return IdReasonOfEnd_NotDetected;
}
protected override (int IdCategory, IDictionary<string, object> ExtraData) GetSpecificInformation(DetectableTelemetry[] telemetry, int begin, int end)
{
return (WellOperationCategory.IdConditioning, new Dictionary<string, object>());
}
}
}