using AsbCloudApp.Data.DetectedOperation;
using AsbCloudDb.Model;
using System;
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors;
///
/// Промывка
///
public 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 < 10)
return false;
var delta = currentPoint.WellDepth - currentPoint.BitDepth;
if (delta < 0.01d)
return false;
if (currentPoint.RotorSpeed > 8)
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.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.WellDepth - currentPoint.BitDepth) < 0.01d)
return IdReasonOfEnd_DeltaWellDepthAndBitDepthIsLo;
if (currentPoint.RotorSpeed > 8)
return IdReasonOfEnd_RotorSpeedIsHi;
if (currentPoint.BitDepth < 150)
return IdReasonOfEnd_BitDepthIsLo;
return IdReasonOfEnd_NotDetected;
}
protected override (int IdCategory, IDictionary ExtraData) GetSpecificInformation(DetectableTelemetry[] telemetry,
int begin,
int end)
{
return (WellOperationCategory.IdFlashing, new Dictionary());
}
}