forked from ddrilling/AsbCloudServer
Автоопределение операций
1. Фикс расчетов 2. Добавлен новый флаг включенной подсистемы
This commit is contained in:
parent
0a0edc3c62
commit
866cc4c066
@ -92,6 +92,10 @@ namespace AsbCloudDb.Model
|
||||
/// блокировка
|
||||
/// </summary>
|
||||
AutoBlocknig = 1 << 6,
|
||||
/// <summary>
|
||||
/// Спин-мастер
|
||||
/// </summary>
|
||||
AutoSpin = 1 << 7,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -152,8 +152,7 @@ public class DetectedOperationExportService
|
||||
{
|
||||
var idCategory = current.IdCategory;
|
||||
if (idCategory == WellOperationCategory.IdSlide
|
||||
&& current.ExtraData[DetectorDrilling.ExtraDataKeyHasOscillation] is bool hasOscillation
|
||||
&& hasOscillation)
|
||||
&& current.HasSubsystemFlag(DetectedOperation.EnabledSubsystemsFlags.AutoSpin))
|
||||
return "Бурение в слайде с осцилляцией";
|
||||
|
||||
var category = wellOperationCategories.FirstOrDefault(o => o.Id == current.IdCategory);
|
||||
|
@ -1,7 +1,6 @@
|
||||
using AsbCloudDb.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
||||
{
|
||||
@ -126,7 +125,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
||||
DepthEnd = (double)pEnd.WellDepth,
|
||||
ExtraData = ExtraData,
|
||||
Value = CalcValue(telemetry, begin, end),
|
||||
EnabledSubsystems = DetectEnabledSubsystems(telemetry, begin, end)
|
||||
EnabledSubsystems = DetectEnabledSubsystems(telemetry, begin, end, ExtraData)
|
||||
};
|
||||
|
||||
return operation;
|
||||
@ -155,10 +154,19 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
||||
/// <param name="telemetry"></param>
|
||||
/// <param name="begin"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <param name="extraData"></param>
|
||||
/// <returns></returns>
|
||||
private static int DetectEnabledSubsystems(DetectableTelemetry[] telemetry, int begin, int end)
|
||||
private static int DetectEnabledSubsystems(DetectableTelemetry[] telemetry, int begin, int end, IDictionary<string, object> extraData)
|
||||
{
|
||||
var enabledSubsystems = 0;
|
||||
|
||||
if(extraData.TryGetValue(DetectorDrilling.ExtraDataKeyHasOscillation, out var hasOscillation)
|
||||
&& hasOscillation is true)
|
||||
{
|
||||
enabledSubsystems |= (int)DetectedOperation.EnabledSubsystemsFlags.AutoSpin;
|
||||
|
||||
return enabledSubsystems;
|
||||
}
|
||||
|
||||
for (var i = begin; i < end; i += 2)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using AsbCloudDb.Model;
|
||||
|
||||
@ -65,14 +64,27 @@ public class DetectorDrilling : DetectorAbstract
|
||||
{
|
||||
[ExtraDataKeyAvgRotorSpeed] = avgRotorSpeed,
|
||||
[ExtraDataKeyDispersionOfNormalizedRotorSpeed] = dispersionOfNormalizedRotorSpeed,
|
||||
[ExtraDataKeyHasOscillation] = dispersionOfNormalizedRotorSpeed > dispersionOfNormalizedRotorSpeedThreshold
|
||||
[ExtraDataKeyHasOscillation] = avgRotorSpeed > 5 && dispersionOfNormalizedRotorSpeed > dispersionOfNormalizedRotorSpeedThreshold
|
||||
};
|
||||
return (idCategory, extraData);
|
||||
}
|
||||
|
||||
private static (double avgRotorSpeed, double dispersionOfNormalizedRotorSpeed) CalcCriteries(DetectableTelemetry[] telemetry, int begin, int end)
|
||||
{
|
||||
var telemetryRange = telemetry[begin..end];
|
||||
var telemetryRange = telemetry[begin..end]
|
||||
.OrderBy(t => t.DateTime).ToList();
|
||||
|
||||
for (var i = telemetryRange.Count - 1; i >= 0 && telemetryRange.Count > 1; i--)
|
||||
{
|
||||
if (Math.Abs(telemetryRange[i].WellDepth - telemetryRange[i - 1].WellDepth) < 0.001d)
|
||||
{
|
||||
telemetryRange.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
var avgRotorSpeed = telemetryRange.Average(t => t.RotorSpeed);
|
||||
var dispersion = telemetryRange.Average(t => Math.Pow(t.RotorSpeed / avgRotorSpeed - 1, 2));
|
||||
return (avgRotorSpeed, dispersion);
|
||||
@ -85,10 +97,10 @@ public class DetectorDrilling : DetectorAbstract
|
||||
if (avgRotorSpeed < 5)
|
||||
return WellOperationCategory.IdSlide;
|
||||
|
||||
if (dispersionOfNormalizedRotorSpeed < dispersionOfNormalizedRotorSpeedThreshold)
|
||||
if(dispersionOfNormalizedRotorSpeed < dispersionOfNormalizedRotorSpeedThreshold)
|
||||
return WellOperationCategory.IdRotor;
|
||||
else
|
||||
return idSlideWithOscillation;
|
||||
}
|
||||
|
||||
return idSlideWithOscillation;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user