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