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

68 lines
2.2 KiB
C#

using AsbCloudApp.Data.DetectedOperation;
using AsbCloudDb.Model;
using System;
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
/// <summary>
/// Промывка
/// </summary>
internal class DetectorFlashing : 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 <= 20)
return false;
var delta = currentPoint.WellDepth - currentPoint.BitDepth;
if (delta < 0.03d)
return false;
if (currentPoint.RotorSpeed >= 10)
return false;
var nextIndexPoint = telemetry.Length <= position ? position : position + 1;
var nextPoint = telemetry[nextIndexPoint];
if (Math.Abs(currentPoint.WellDepth - nextPoint.WellDepth) > 0)
return false;
if (currentPoint.WellDepth <= 150)
return false;
return true;
}
protected override int DetectEnd(DetectableTelemetry[] telemetry, int position, DetectedOperationDto? previousOperation)
{
var currentPoint = telemetry[position];
if (currentPoint.Pressure < 20)
return IdReasonOfEnd_PressureIsLo;
if ((currentPoint.WellDepth - currentPoint.BitDepth) < 0.03d)
return 0;
if (currentPoint.RotorSpeed >= 10)
return IdReasonOfEnd_RotorSpeedIsHi;
if (currentPoint.BitDepth < 150)
return 0;
return IdReasonOfEnd_NotDetected;
}
protected override (int IdCategory, IDictionary<string, object> ExtraData) GetSpecificInformation(DetectableTelemetry[] telemetry,
int begin,
int end)
{
return (WellOperationCategory.IdFlashing, new Dictionary<string, object>());
}
}
}