forked from ddrilling/AsbCloudServer
Replace GetIdOperation delegate by method.
Add Mode to DetectableTelemetry
This commit is contained in:
parent
4500d2e6de
commit
fd8b0de5a0
@ -1,18 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DetectOperations
|
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
||||||
{
|
|
||||||
|
|
||||||
public class DetectableTelemetry
|
public class DetectableTelemetry
|
||||||
{
|
{
|
||||||
public DateTimeOffset DateTime { get; set; }
|
public DateTimeOffset DateTime { get; set; }
|
||||||
public int? IdUser { get; set; }
|
public int? IdUser { get; set; }
|
||||||
|
public int Mode { get; set; }
|
||||||
public float WellDepth { get; set; }
|
public float WellDepth { get; set; }
|
||||||
public float Pressure { get; set; }
|
public float Pressure { get; set; }
|
||||||
public float HookWeight { get; set; }
|
public float HookWeight { get; set; }
|
||||||
public float BlockPosition { get; set; }
|
public float BlockPosition { get; set; }
|
||||||
public float BitDepth { get; set; }
|
public float BitDepth { get; set; }
|
||||||
public float RotorSpeed { get; set; }
|
public float RotorSpeed { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
|||||||
|
|
||||||
protected const int IdReasonOfEnd_Custom1 = 10_000;
|
protected const int IdReasonOfEnd_Custom1 = 10_000;
|
||||||
|
|
||||||
protected abstract Func<DetectableTelemetry[], int, int, int> GetIdOperation { get; }
|
|
||||||
|
|
||||||
public bool TryDetect(int idTelemetry, DetectableTelemetry[] telemetry, int begin, int end, DetectedOperation? previousOperation,
|
public bool TryDetect(int idTelemetry, DetectableTelemetry[] telemetry, int begin, int end, DetectedOperation? previousOperation,
|
||||||
out OperationDetectorResult? result)
|
out OperationDetectorResult? result)
|
||||||
{
|
{
|
||||||
@ -87,7 +85,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
|||||||
Operation = new DetectedOperation
|
Operation = new DetectedOperation
|
||||||
{
|
{
|
||||||
IdTelemetry = idTelemetry,
|
IdTelemetry = idTelemetry,
|
||||||
IdCategory = GetIdOperation.Invoke(telemetry, begin, end),
|
IdCategory = GetIdOperation(telemetry, begin, end),
|
||||||
IdUsersAtStart = pBegin.IdUser ?? -1,
|
IdUsersAtStart = pBegin.IdUser ?? -1,
|
||||||
DateStart = pBegin.DateTime,
|
DateStart = pBegin.DateTime,
|
||||||
DateEnd = pEnd.DateTime,
|
DateEnd = pEnd.DateTime,
|
||||||
@ -101,6 +99,8 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
|||||||
return !IsValidOperationDetectorResult(result) ? null : result;
|
return !IsValidOperationDetectorResult(result) ? null : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract int GetIdOperation(DetectableTelemetry[] telemetry, int begin, int end);
|
||||||
|
|
||||||
protected abstract double CalcValue(DetectableTelemetry[] telemetry, int begin, int end);
|
protected abstract double CalcValue(DetectableTelemetry[] telemetry, int begin, int end);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -7,8 +7,6 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
|||||||
|
|
||||||
public class DetectorDrilling : DetectorAbstract
|
public class DetectorDrilling : DetectorAbstract
|
||||||
{
|
{
|
||||||
protected override Func<DetectableTelemetry[], int, int, int> GetIdOperation => DefineDrillingOperation;
|
|
||||||
|
|
||||||
public IDictionary<(int, int), float> AvgRotorSpeedDict { get; } = new Dictionary<(int, int), float>();
|
public IDictionary<(int, int), float> AvgRotorSpeedDict { get; } = new Dictionary<(int, int), float>();
|
||||||
public IDictionary<(int, int), double> DespersionDict { get; } = new Dictionary<(int, int), double>();
|
public IDictionary<(int, int), double> DespersionDict { get; } = new Dictionary<(int, int), double>();
|
||||||
|
|
||||||
@ -46,7 +44,7 @@ public class DetectorDrilling : DetectorAbstract
|
|||||||
operationDetectorResult.Operation.IdReasonOfEnd is IdReasonOfEnd_DeltaDepthIsHi or IdReasonOfEnd_PressureIsLo &&
|
operationDetectorResult.Operation.IdReasonOfEnd is IdReasonOfEnd_DeltaDepthIsHi or IdReasonOfEnd_PressureIsLo &&
|
||||||
Math.Abs(operationDetectorResult.Operation.DepthStart - operationDetectorResult.Operation.DepthEnd) > 0.01;
|
Math.Abs(operationDetectorResult.Operation.DepthStart - operationDetectorResult.Operation.DepthEnd) > 0.01;
|
||||||
|
|
||||||
private int DefineDrillingOperation(DetectableTelemetry[] telemetry, int begin, int end)
|
protected override int GetIdOperation(DetectableTelemetry[] telemetry, int begin, int end)
|
||||||
{
|
{
|
||||||
const int idSlideWithOscillation = 12000;
|
const int idSlideWithOscillation = 12000;
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ public class DetectorSlipsTime : DetectorAbstract
|
|||||||
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
|
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
|
||||||
=> CalcDeltaMinutes(telemetry, begin, end);
|
=> CalcDeltaMinutes(telemetry, begin, end);
|
||||||
|
|
||||||
protected override Func<DetectableTelemetry[], int, int, int> GetIdOperation => (_, _, _) => WellOperationCategory.IdSlipsTime;
|
|
||||||
|
|
||||||
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
|
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
|
||||||
{
|
{
|
||||||
var point0 = telemetry[position];
|
var point0 = telemetry[position];
|
||||||
@ -29,6 +27,9 @@ public class DetectorSlipsTime : DetectorAbstract
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override int GetIdOperation(DetectableTelemetry[] telemetry, int begin, int end)
|
||||||
|
=> WellOperationCategory.IdSlipsTime;
|
||||||
|
|
||||||
protected override bool IsValidOperationDetectorResult(OperationDetectorResult operationDetectorResult) =>
|
protected override bool IsValidOperationDetectorResult(OperationDetectorResult operationDetectorResult) =>
|
||||||
Math.Abs(operationDetectorResult.Operation.DepthStart - operationDetectorResult.Operation.DepthEnd) > 0.01;
|
Math.Abs(operationDetectorResult.Operation.DepthStart - operationDetectorResult.Operation.DepthEnd) > 0.01;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ public class WorkOperationDetection: Work
|
|||||||
{
|
{
|
||||||
DateTime = d.DateTime,
|
DateTime = d.DateTime,
|
||||||
IdUser = d.IdUser,
|
IdUser = d.IdUser,
|
||||||
|
Mode = d.Mode,
|
||||||
WellDepth = d.WellDepth,
|
WellDepth = d.WellDepth,
|
||||||
Pressure = d.Pressure,
|
Pressure = d.Pressure,
|
||||||
HookWeight = d.HookWeight,
|
HookWeight = d.HookWeight,
|
||||||
|
Loading…
Reference in New Issue
Block a user