diff --git a/AsbCloudDb/Migrations/20240131074638_Add_Table_DataSaubStat.Designer.cs b/AsbCloudDb/Migrations/20240131104814_Add_Table_DataSaubStat.Designer.cs similarity index 99% rename from AsbCloudDb/Migrations/20240131074638_Add_Table_DataSaubStat.Designer.cs rename to AsbCloudDb/Migrations/20240131104814_Add_Table_DataSaubStat.Designer.cs index c4c8b6b5..953a220c 100644 --- a/AsbCloudDb/Migrations/20240131074638_Add_Table_DataSaubStat.Designer.cs +++ b/AsbCloudDb/Migrations/20240131104814_Add_Table_DataSaubStat.Designer.cs @@ -13,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AsbCloudDb.Migrations { [DbContext(typeof(AsbCloudDbContext))] - [Migration("20240131074638_Add_Table_DataSaubStat")] + [Migration("20240131104814_Add_Table_DataSaubStat")] partial class Add_Table_DataSaubStat { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -378,6 +378,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("enabled_subsystems") .HasComment("Флаги подсистем"); + b.Property("Flow") + .HasColumnType("double precision") + .HasColumnName("flow") + .HasComment("Фактический расход"); + b.Property("HasOscillation") .HasColumnType("boolean") .HasColumnName("has_oscillation") diff --git a/AsbCloudDb/Migrations/20240131074638_Add_Table_DataSaubStat.cs b/AsbCloudDb/Migrations/20240131104814_Add_Table_DataSaubStat.cs similarity index 97% rename from AsbCloudDb/Migrations/20240131074638_Add_Table_DataSaubStat.cs rename to AsbCloudDb/Migrations/20240131104814_Add_Table_DataSaubStat.cs index 65e66313..a2b6d38f 100644 --- a/AsbCloudDb/Migrations/20240131074638_Add_Table_DataSaubStat.cs +++ b/AsbCloudDb/Migrations/20240131104814_Add_Table_DataSaubStat.cs @@ -36,6 +36,7 @@ namespace AsbCloudDb.Migrations detected_operation_category_id = table.Column(type: "integer", nullable: false, comment: "Название автоопределённой операции"), enabled_subsystems = table.Column(type: "integer", nullable: false, comment: "Флаги подсистем"), has_oscillation = table.Column(type: "boolean", nullable: false, comment: "Наличие или отсутствие осцилляции"), + flow = table.Column(type: "double precision", nullable: false, comment: "Фактический расход"), id_telemetry = table.Column(type: "integer", nullable: false, comment: "Ключ телеметрии") }, constraints: table => diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index 609fd91c..82cd365a 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -376,6 +376,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("enabled_subsystems") .HasComment("Флаги подсистем"); + b.Property("Flow") + .HasColumnType("double precision") + .HasColumnName("flow") + .HasComment("Фактический расход"); + b.Property("HasOscillation") .HasColumnType("boolean") .HasColumnName("has_oscillation") diff --git a/AsbCloudDb/Model/DataSaubStat.cs b/AsbCloudDb/Model/DataSaubStat.cs index 32b5d392..8b22367b 100644 --- a/AsbCloudDb/Model/DataSaubStat.cs +++ b/AsbCloudDb/Model/DataSaubStat.cs @@ -73,6 +73,9 @@ namespace AsbCloudDb.Model [Column("has_oscillation"), Comment("Наличие или отсутствие осцилляции")] public bool HasOscillation { get; set; } + [Column("flow"), Comment("Фактический расход")] + public double Flow { get; set; } + [Column("id_telemetry"), Comment("Ключ телеметрии")] public int IdTelemetry { get; set; } diff --git a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs index 9cd4c9ba..15f3cd34 100644 --- a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs +++ b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs @@ -128,6 +128,7 @@ namespace AsbCloudInfrastructure.Background.PeriodicWorks EnabledSubsystems = operation.EnabledSubsystems, HasOscillation = hasOscillation, IdTelemetry = operation.IdTelemetry, + Flow = wavg.Flow }; return processMapDrillingCacheItem; } @@ -136,13 +137,15 @@ namespace AsbCloudInfrastructure.Background.PeriodicWorks double Pressure, double AxialLoad, double RotorTorque, - double RotorSpeed + double RotorSpeed, + double Flow ) CalcWavg(Span span) { var sumPressure = 0.0; var sumAxialLoad = 0.0; var sumRotorTorque = 0.0; var sumRotorSpeed = 0.0; + var flow = span[0].Flow ?? 0.0; var diffDepthTotal = span[^1].WellDepth - span[0].WellDepth; for (var i = 0; i < span.Length - 1; i++) { @@ -151,12 +154,14 @@ namespace AsbCloudInfrastructure.Background.PeriodicWorks sumAxialLoad += weigth * span[i].AxialLoad; sumRotorTorque += weigth * span[i].RotorTorque; sumRotorSpeed += weigth * span[i].RotorSpeed; + flow = span[i + 1].Flow > flow ? span[i + 1].Flow ?? 0.0 :flow; } return ( Pressure: sumPressure / diffDepthTotal, AxialLoad: sumAxialLoad / diffDepthTotal, RotorTorque: sumRotorTorque / diffDepthTotal, - RotorSpeed: sumRotorSpeed / diffDepthTotal + RotorSpeed: sumRotorSpeed / diffDepthTotal, + Flow: flow ); }