forked from ddrilling/AsbCloudServer
Refactor DataSaubBase to TelemetryDataSaub;
Add generic TelemetryDataController; Add TelemetryDataSpin and model; Add migration;
This commit is contained in:
parent
787627d439
commit
35cd538b1d
@ -5,7 +5,7 @@ namespace AsbCloudApp.Data
|
||||
/// <summary>
|
||||
/// Сообщение получаемое по телеметрии и отправляемое в frontend
|
||||
/// </summary>
|
||||
public class DataSaubBaseDto
|
||||
public class TelemetryDataSaubDto
|
||||
{
|
||||
//[JsonPropertyName("date")]
|
||||
public DateTime Date { get; set; }
|
78
AsbCloudApp/Data/TelemetryDataSpinDto.cs
Normal file
78
AsbCloudApp/Data/TelemetryDataSpinDto.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class TelemetryDataSpinDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int IdTelemetry { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public double? TopDriveSpeed { get; set; }
|
||||
public double? TopDriveSpeedMin { get; set; }
|
||||
public double? TopDriveSpeedMax { get; set; }
|
||||
public double? TopDriveSpeedOffset { get; set; }
|
||||
public int? TopDriveSpeedErr { get; set; }
|
||||
public double? TopDriveTorque { get; set; }
|
||||
public double? TopDriveTorqueMin { get; set; }
|
||||
public double? TopDriveTorqueMax { get; set; }
|
||||
public double? TopDriveTorqueOffset { get; set; }
|
||||
public int? TopDriveTorqueErr { get; set; }
|
||||
public double? TopDriveSpeedSpFrom { get; set; }
|
||||
public double? TopDriveSpeedSpFromMin { get; set; }
|
||||
public double? TopDriveSpeedSpFromMax { get; set; }
|
||||
public double? TopDriveSpeedSpFromOffset { get; set; }
|
||||
public int? TopDriveSpeedSpFromErr { get; set; }
|
||||
public double? TopDriveTorqueSpFrom { get; set; }
|
||||
public double? TopDriveTorqueSpFromMin { get; set; }
|
||||
public double? TopDriveTorqueSpFromMax { get; set; }
|
||||
public double? TopDriveTorqueSpFromOffset { get; set; }
|
||||
public int? TopDriveTorqueSpFromErr { get; set; }
|
||||
public double? TopDriveSpeedSpTo { get; set; }
|
||||
public double? TopDriveSpeedSpToMin { get; set; }
|
||||
public double? TopDriveSpeedSpToMax { get; set; }
|
||||
public double? TopDriveSpeedSpToOffset { get; set; }
|
||||
public int? TopDriveSpeedSpToErr { get; set; }
|
||||
public double? TopDriveTorqueSpTo { get; set; }
|
||||
public double? TopDriveTorqueSpToMin { get; set; }
|
||||
public double? TopDriveTorqueSpToMax { get; set; }
|
||||
public double? TopDriveTorqueSpToOffset { get; set; }
|
||||
public int? TopDriveTorqueSpToErr { get; set; }
|
||||
public int? W2800 { get; set; }
|
||||
public int? W2810 { get; set; }
|
||||
public int? Mode { get; set; }
|
||||
public int? W2808 { get; set; }
|
||||
public double? TorqueStarting { get; set; }
|
||||
public double? RotorTorqueAvg { get; set; }
|
||||
public double? EncoderResolution { get; set; }
|
||||
public double? Ratio { get; set; }
|
||||
public double? TorqueRightLimit { get; set; }
|
||||
public double? TorqueLeftLimit { get; set; }
|
||||
public double? RevolsRightLimit { get; set; }
|
||||
public double? RevolsLeftLimit { get; set; }
|
||||
public double? SpeedRightSp { get; set; }
|
||||
public double? SpeedLeftSp { get; set; }
|
||||
public double? RevolsRightTotal { get; set; }
|
||||
public double? RevolsLeftTotal { get; set; }
|
||||
public double? TurnRightOnceByTorque { get; set; }
|
||||
public double? TurnLeftOnceByTorque { get; set; }
|
||||
public double? TurnRightOnceByAngle { get; set; }
|
||||
public double? TurnLeftOnceByAngle { get; set; }
|
||||
public double? TurnRightOnceByRevols { get; set; }
|
||||
public double? TurnLeftOnceByRevols { get; set; }
|
||||
public double? BreakAngleK { get; set; }
|
||||
public double? ReverseKTorque { get; set; }
|
||||
public double? PositionZero { get; set; }
|
||||
public double? PositionRight { get; set; }
|
||||
public double? TorqueRampTime { get; set; }
|
||||
public double? Ver { get; set; }
|
||||
public int? ReverseSpeedSpZeroTime { get; set; }
|
||||
public double? UnlockBySectorOut { get; set; }
|
||||
public double? PidMuxTorqueLeftLimit { get; set; }
|
||||
public int? State { get; set; }
|
||||
public double? BreakAngleLeft { get; set; }
|
||||
}
|
||||
}
|
@ -8,11 +8,11 @@ namespace AsbCloudApp.Services
|
||||
{
|
||||
public interface IDataService
|
||||
{
|
||||
Task<IEnumerable<DataSaubBaseDto>> GetAsync(int idWell, DateTime dateBegin = default,
|
||||
Task<IEnumerable<TelemetryDataSaubDto>> GetAsync(int idWell, DateTime dateBegin = default,
|
||||
double intervalSec = 600d, int approxPointsCount = 1024,
|
||||
CancellationToken token = default);
|
||||
|
||||
Task<int> UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos,
|
||||
Task<int> UpdateDataAsync(string uid, IEnumerable<TelemetryDataSaubDto> dtos,
|
||||
CancellationToken token);
|
||||
Task<DatesRangeDto> GetDataDatesRangeAsync(int idWell,
|
||||
CancellationToken token);
|
||||
|
@ -6,7 +6,7 @@ namespace AsbCloudApp.Services
|
||||
public interface ISaubDataCache
|
||||
{
|
||||
TelemetryAnalysisDto CurrentAnalysis { get; set; }
|
||||
IEnumerable<DataSaubBaseDto> GetOrCreateCache(int telemetryId);
|
||||
void AddData(DataSaubBaseDto data);
|
||||
IEnumerable<TelemetryDataSaubDto> GetOrCreateCache(int telemetryId);
|
||||
void AddData(TelemetryDataSaubDto data);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace AsbCloudApp.Services
|
||||
Task<IEnumerable<TelemetryOperationInfoDto>> GetOperationsToIntervalAsync(int idWell,
|
||||
int intervalHoursTimestamp, int workBeginTimestamp,
|
||||
CancellationToken token = default);
|
||||
void SaveAnalytics(DataSaubBaseDto dataSaub);
|
||||
void SaveAnalytics(TelemetryDataSaubDto dataSaub);
|
||||
Task<DatesRangeDto> GetOperationsDateRangeAsync(int idWell,
|
||||
CancellationToken token = default);
|
||||
}
|
||||
|
2362
AsbCloudDb/Migrations/20210914105045_RefactorTelemetryData.Designer.cs
generated
Normal file
2362
AsbCloudDb/Migrations/20210914105045_RefactorTelemetryData.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
141
AsbCloudDb/Migrations/20210914105045_RefactorTelemetryData.cs
Normal file
141
AsbCloudDb/Migrations/20210914105045_RefactorTelemetryData.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class RefactorTelemetryData : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(name: "t_data_saub_base_t_telemetry_id_fk", table: "t_data_saub_base");
|
||||
migrationBuilder.DropPrimaryKey(name: "PK_t_data_saub_base", table: "t_data_saub_base");
|
||||
|
||||
migrationBuilder.RenameTable(name: "t_data_saub_base", newName: "t_telemetry_data_saub");
|
||||
migrationBuilder.RenameIndex(name: "IX_t_data_saub_base_id_telemetry", newName: "IX_t_telemetry_data_saub_id_telemetry");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_telemetry_data_saub", column: "id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_data_saub_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_saub",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_telemetry_data_spin",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "'2021-10-19 18:23:54+05'"),
|
||||
top_drive_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Скорость СВП"),
|
||||
top_drive_speed_min = table.Column<double>(type: "double precision", nullable: true, comment: "нижний предел"),
|
||||
top_drive_speed_max = table.Column<double>(type: "double precision", nullable: true, comment: "верхний предел"),
|
||||
top_drive_speed_offset = table.Column<double>(type: "double precision", nullable: true, comment: "смещение"),
|
||||
top_drive_speed_err = table.Column<int>(type: "integer", nullable: true),
|
||||
top_drive_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Момент СВП"),
|
||||
top_drive_torque_min = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_max = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_offset = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_err = table.Column<int>(type: "integer", nullable: true),
|
||||
top_drive_speed_sp_from = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость c СВП"),
|
||||
top_drive_speed_sp_from_min = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_speed_sp_from_max = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_speed_sp_from_offset = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_speed_sp_from_err = table.Column<int>(type: "integer", nullable: true),
|
||||
top_drive_torque_sp_from = table.Column<double>(type: "double precision", nullable: true, comment: "Заданный момент c СВП"),
|
||||
top_drive_torque_sp_from_min = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_sp_from_max = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_sp_from_offset = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_sp_from_err = table.Column<int>(type: "integer", nullable: true),
|
||||
top_drive_speed_sp_to = table.Column<double>(type: "double precision", nullable: true, comment: "Задание скорости на СВП"),
|
||||
top_drive_speed_sp_to_min = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_speed_sp_to_max = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_speed_sp_to_offset = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_speed_sp_to_err = table.Column<int>(type: "integer", nullable: true),
|
||||
top_drive_torque_sp_to = table.Column<double>(type: "double precision", nullable: true, comment: "Задание момента на СВП"),
|
||||
top_drive_torque_sp_to_min = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_sp_to_max = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_sp_to_offset = table.Column<double>(type: "double precision", nullable: true),
|
||||
top_drive_torque_sp_to_err = table.Column<int>(type: "integer", nullable: true),
|
||||
w2800 = table.Column<int>(type: "integer", nullable: true, comment: "Установка нуля энкодера"),
|
||||
w2810 = table.Column<int>(type: "integer", nullable: true, comment: " автоматический сброс блокировки"),
|
||||
mode = table.Column<int>(type: "integer", nullable: true, comment: "Выбранный режим управления"),
|
||||
w2808 = table.Column<int>(type: "integer", nullable: true, comment: "Неисправность энкодера"),
|
||||
torque_starting = table.Column<double>(type: "double precision", nullable: true, comment: " Страгивающий момент"),
|
||||
rotor_torque_avg = table.Column<double>(type: "double precision", nullable: true, comment: " Момент в роторе средний"),
|
||||
encoder_resolution = table.Column<double>(name: "encoder_resolution ", type: "double precision", nullable: true, comment: " Разрешение энкодера"),
|
||||
ratio = table.Column<double>(type: "double precision", nullable: true, comment: " Коэффициент редукции редектора"),
|
||||
torque_right_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение крутящего момента вправо"),
|
||||
torque_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение крутящего момента влево"),
|
||||
revols_right_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение числа оборотов вправо"),
|
||||
revols_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение числа оборотов влево"),
|
||||
speed_right_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость вращения вправо"),
|
||||
speed_left_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость вращения влево"),
|
||||
revols_right_total = table.Column<double>(type: "double precision", nullable: true, comment: "Суммарное количество оборотов вправо"),
|
||||
revols_left_total = table.Column<double>(type: "double precision", nullable: true, comment: "Суммарное количество оборотов влево"),
|
||||
turn_right_once_by_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по моменту единожды вправо"),
|
||||
turn_left_once_by_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по моменту единожды влево"),
|
||||
turn_right_once_by_angle = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по градусам единожды вправо"),
|
||||
turn_left_once_by_angle = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по градусам единожды влево"),
|
||||
turn_right_once_by_revols = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по оборотам единожды вправо"),
|
||||
turn_left_once_by_revols = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по оборотам единожды влево"),
|
||||
break_angle_k = table.Column<double>(type: "double precision", nullable: true, comment: "Коэффициент для расчёта за какой угол нужно тормозить"),
|
||||
reverse_k_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону"),
|
||||
position_zero = table.Column<double>(type: "double precision", nullable: true, comment: "Нулевая позиция осциляции"),
|
||||
position_right = table.Column<double>(type: "double precision", nullable: true, comment: "Крайний правый угол осциляции"),
|
||||
torque_ramp_time = table.Column<double>(type: "double precision", nullable: true, comment: "Время нарастания момента"),
|
||||
ver = table.Column<double>(type: "double precision", nullable: true, comment: "Версия ПО ПЛК"),
|
||||
reverse_speed_sp_zero_time = table.Column<int>(type: "integer", nullable: true, comment: "Время выдачи сигнала нулевой скорости на при смене направления"),
|
||||
unlock_by_sector_out = table.Column<double>(type: "double precision", nullable: true, comment: " Градус отклонения от сектора для автоматического сброса блокировки"),
|
||||
pid_mux_torque_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: " Момент при котором определяется ехать назад по моменту или по скорости"),
|
||||
state = table.Column<int>(type: "integer", nullable: true, comment: "Переменная этапа"),
|
||||
break_angle_left = table.Column<double>(type: "double precision", nullable: true, comment: "Угол торможения влево при работе по моменту")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_telemetry_data_spin", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "t_telemetry_data_spin_t_telemetry_id_fk",
|
||||
column: x => x.id_telemetry,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
},
|
||||
comment: "набор основных данных по SpinMaster");
|
||||
|
||||
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_telemetry_data_spin_id_telemetry",
|
||||
table: "t_telemetry_data_spin",
|
||||
column: "id_telemetry");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_telemetry_data_spin");
|
||||
|
||||
migrationBuilder.DropForeignKey(name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub");
|
||||
migrationBuilder.DropPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_telemetry_data_saub");
|
||||
|
||||
migrationBuilder.RenameTable(name: "t_telemetry_data_saub", newName: "t_data_saub_base");
|
||||
migrationBuilder.RenameIndex(name: "IX_t_telemetry_data_saub_id_telemetry", newName: "IX_t_data_saub_base_id_telemetry");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_data_saub_base", column: "id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_data_saub_t_telemetry_id_fk",
|
||||
table: "t_data_saub_base",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
@ -127,213 +127,6 @@ namespace AsbCloudDb.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.DataSaubBase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
|
||||
b.Property<double?>("AxialLoad")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("axial_load")
|
||||
.HasComment("Осевая нагрузка");
|
||||
|
||||
b.Property<double?>("AxialLoadLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("axial_load_limit_max")
|
||||
.HasComment("Осевая нагрузка. Аварийная макс.");
|
||||
|
||||
b.Property<double?>("AxialLoadSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("axial_load_sp")
|
||||
.HasComment("Осевая нагрузка. Задание");
|
||||
|
||||
b.Property<double?>("BitDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("bit_depth")
|
||||
.HasComment("Положение инструмента");
|
||||
|
||||
b.Property<double?>("BlockPosition")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_position")
|
||||
.HasComment("Высота талевого блока");
|
||||
|
||||
b.Property<double?>("BlockPositionMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_position_max")
|
||||
.HasComment("Талевый блок. Макс положение");
|
||||
|
||||
b.Property<double?>("BlockPositionMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_position_min")
|
||||
.HasComment("Талевый блок. Мин положение");
|
||||
|
||||
b.Property<double?>("BlockSpeed")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed")
|
||||
.HasComment("Скорость талевого блока");
|
||||
|
||||
b.Property<double?>("BlockSpeedSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp")
|
||||
.HasComment("Скорости талевого блока. Задание");
|
||||
|
||||
b.Property<double?>("BlockSpeedSpDevelop")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp_develop")
|
||||
.HasComment("Талевый блок. Задание скорости для проработки");
|
||||
|
||||
b.Property<double?>("BlockSpeedSpRotor")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp_rotor")
|
||||
.HasComment("Талевый блок. Задание скорости для роторного бурения");
|
||||
|
||||
b.Property<double?>("BlockSpeedSpSlide")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp_slide")
|
||||
.HasComment("Талевый блок. Задание скорости для режима слайда");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date")
|
||||
.HasComment("'2021-10-19 18:23:54+05'");
|
||||
|
||||
b.Property<double?>("Flow")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("flow")
|
||||
.HasComment("Расход");
|
||||
|
||||
b.Property<double?>("FlowDeltaLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("flow_delta_limit_max")
|
||||
.HasComment("Расход. Аварийный макс.");
|
||||
|
||||
b.Property<double?>("FlowIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("flow_idle")
|
||||
.HasComment("Расход. Холостой ход");
|
||||
|
||||
b.Property<double?>("HookWeight")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight")
|
||||
.HasComment("Вес на крюке");
|
||||
|
||||
b.Property<double?>("HookWeightIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight_idle")
|
||||
.HasComment("Вес на крюке. Холостой ход");
|
||||
|
||||
b.Property<double?>("HookWeightLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight_limit_max")
|
||||
.HasComment("Вес на крюке. Затяжка");
|
||||
|
||||
b.Property<double?>("HookWeightLimitMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight_limit_min")
|
||||
.HasComment("Вес на крюке. Посадка");
|
||||
|
||||
b.Property<double?>("IdFeedRegulator")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("id_feed_regulator")
|
||||
.HasComment("Текущий критерий бурения");
|
||||
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int?>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("Пользователь САУБ");
|
||||
|
||||
b.Property<int?>("Mode")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mode")
|
||||
.HasComment("Режим САУБ");
|
||||
|
||||
b.Property<double?>("MseState")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("mse_state")
|
||||
.HasComment("Текущее состояние работы MSE");
|
||||
|
||||
b.Property<double?>("Pressure")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure")
|
||||
.HasComment("Давление");
|
||||
|
||||
b.Property<double?>("PressureDeltaLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_delta_limit_max")
|
||||
.HasComment("Давление дифф. Аварийное макс.");
|
||||
|
||||
b.Property<double?>("PressureIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_idle")
|
||||
.HasComment("Давление. Холостой ход");
|
||||
|
||||
b.Property<double?>("PressureSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp")
|
||||
.HasComment("Давление. Задание");
|
||||
|
||||
b.Property<double?>("PressureSpDevelop")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp_develop")
|
||||
.HasComment("Давление. Задание для проработки");
|
||||
|
||||
b.Property<double?>("PressureSpRotor")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp_rotor")
|
||||
.HasComment("Давление. Задание для роторного бурения");
|
||||
|
||||
b.Property<double?>("PressureSpSlide")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp_slide")
|
||||
.HasComment("Давление. Задание для режима слайда");
|
||||
|
||||
b.Property<double?>("RotorSpeed")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_speed")
|
||||
.HasComment("Обороты ротора");
|
||||
|
||||
b.Property<double?>("RotorTorque")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque")
|
||||
.HasComment("Момент на роторе");
|
||||
|
||||
b.Property<double?>("RotorTorqueIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_idle")
|
||||
.HasComment("Момент на роторе. Холостой ход");
|
||||
|
||||
b.Property<double?>("RotorTorqueLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_limit_max")
|
||||
.HasComment("Момент на роторе. Аварийный макс.");
|
||||
|
||||
b.Property<double?>("RotorTorqueSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_sp")
|
||||
.HasComment("Момент на роторе. Задание");
|
||||
|
||||
b.Property<double?>("WellDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("well_depth")
|
||||
.HasComment("Глубина забоя");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_data_saub_base");
|
||||
|
||||
b
|
||||
.HasComment("набор основных данных по SAUB");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -832,6 +625,534 @@ namespace AsbCloudDb.Migrations
|
||||
.HasComment("События на скважине");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
|
||||
b.Property<double?>("AxialLoad")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("axial_load")
|
||||
.HasComment("Осевая нагрузка");
|
||||
|
||||
b.Property<double?>("AxialLoadLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("axial_load_limit_max")
|
||||
.HasComment("Осевая нагрузка. Аварийная макс.");
|
||||
|
||||
b.Property<double?>("AxialLoadSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("axial_load_sp")
|
||||
.HasComment("Осевая нагрузка. Задание");
|
||||
|
||||
b.Property<double?>("BitDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("bit_depth")
|
||||
.HasComment("Положение инструмента");
|
||||
|
||||
b.Property<double?>("BlockPosition")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_position")
|
||||
.HasComment("Высота талевого блока");
|
||||
|
||||
b.Property<double?>("BlockPositionMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_position_max")
|
||||
.HasComment("Талевый блок. Макс положение");
|
||||
|
||||
b.Property<double?>("BlockPositionMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_position_min")
|
||||
.HasComment("Талевый блок. Мин положение");
|
||||
|
||||
b.Property<double?>("BlockSpeed")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed")
|
||||
.HasComment("Скорость талевого блока");
|
||||
|
||||
b.Property<double?>("BlockSpeedSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp")
|
||||
.HasComment("Скорости талевого блока. Задание");
|
||||
|
||||
b.Property<double?>("BlockSpeedSpDevelop")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp_develop")
|
||||
.HasComment("Талевый блок. Задание скорости для проработки");
|
||||
|
||||
b.Property<double?>("BlockSpeedSpRotor")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp_rotor")
|
||||
.HasComment("Талевый блок. Задание скорости для роторного бурения");
|
||||
|
||||
b.Property<double?>("BlockSpeedSpSlide")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("block_speed_sp_slide")
|
||||
.HasComment("Талевый блок. Задание скорости для режима слайда");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date")
|
||||
.HasComment("'2021-10-19 18:23:54+05'");
|
||||
|
||||
b.Property<double?>("Flow")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("flow")
|
||||
.HasComment("Расход");
|
||||
|
||||
b.Property<double?>("FlowDeltaLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("flow_delta_limit_max")
|
||||
.HasComment("Расход. Аварийный макс.");
|
||||
|
||||
b.Property<double?>("FlowIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("flow_idle")
|
||||
.HasComment("Расход. Холостой ход");
|
||||
|
||||
b.Property<double?>("HookWeight")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight")
|
||||
.HasComment("Вес на крюке");
|
||||
|
||||
b.Property<double?>("HookWeightIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight_idle")
|
||||
.HasComment("Вес на крюке. Холостой ход");
|
||||
|
||||
b.Property<double?>("HookWeightLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight_limit_max")
|
||||
.HasComment("Вес на крюке. Затяжка");
|
||||
|
||||
b.Property<double?>("HookWeightLimitMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("hook_weight_limit_min")
|
||||
.HasComment("Вес на крюке. Посадка");
|
||||
|
||||
b.Property<double?>("IdFeedRegulator")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("id_feed_regulator")
|
||||
.HasComment("Текущий критерий бурения");
|
||||
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int?>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("Пользователь САУБ");
|
||||
|
||||
b.Property<int?>("Mode")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mode")
|
||||
.HasComment("Режим САУБ");
|
||||
|
||||
b.Property<double?>("MseState")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("mse_state")
|
||||
.HasComment("Текущее состояние работы MSE");
|
||||
|
||||
b.Property<double?>("Pressure")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure")
|
||||
.HasComment("Давление");
|
||||
|
||||
b.Property<double?>("PressureDeltaLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_delta_limit_max")
|
||||
.HasComment("Давление дифф. Аварийное макс.");
|
||||
|
||||
b.Property<double?>("PressureIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_idle")
|
||||
.HasComment("Давление. Холостой ход");
|
||||
|
||||
b.Property<double?>("PressureSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp")
|
||||
.HasComment("Давление. Задание");
|
||||
|
||||
b.Property<double?>("PressureSpDevelop")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp_develop")
|
||||
.HasComment("Давление. Задание для проработки");
|
||||
|
||||
b.Property<double?>("PressureSpRotor")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp_rotor")
|
||||
.HasComment("Давление. Задание для роторного бурения");
|
||||
|
||||
b.Property<double?>("PressureSpSlide")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pressure_sp_slide")
|
||||
.HasComment("Давление. Задание для режима слайда");
|
||||
|
||||
b.Property<double?>("RotorSpeed")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_speed")
|
||||
.HasComment("Обороты ротора");
|
||||
|
||||
b.Property<double?>("RotorTorque")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque")
|
||||
.HasComment("Момент на роторе");
|
||||
|
||||
b.Property<double?>("RotorTorqueIdle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_idle")
|
||||
.HasComment("Момент на роторе. Холостой ход");
|
||||
|
||||
b.Property<double?>("RotorTorqueLimitMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_limit_max")
|
||||
.HasComment("Момент на роторе. Аварийный макс.");
|
||||
|
||||
b.Property<double?>("RotorTorqueSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_sp")
|
||||
.HasComment("Момент на роторе. Задание");
|
||||
|
||||
b.Property<double?>("WellDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("well_depth")
|
||||
.HasComment("Глубина забоя");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_telemetry_data_saub");
|
||||
|
||||
b
|
||||
.HasComment("набор основных данных по SAUB");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
|
||||
b.Property<double?>("BreakAngleK")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("break_angle_k")
|
||||
.HasComment("Коэффициент для расчёта за какой угол нужно тормозить");
|
||||
|
||||
b.Property<double?>("BreakAngleLeft")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("break_angle_left")
|
||||
.HasComment("Угол торможения влево при работе по моменту");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date")
|
||||
.HasComment("'2021-10-19 18:23:54+05'");
|
||||
|
||||
b.Property<double?>("EncoderResolution")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("encoder_resolution ")
|
||||
.HasComment(" Разрешение энкодера");
|
||||
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int?>("Mode")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mode")
|
||||
.HasComment("Выбранный режим управления");
|
||||
|
||||
b.Property<double?>("PidMuxTorqueLeftLimit")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("pid_mux_torque_left_limit")
|
||||
.HasComment(" Момент при котором определяется ехать назад по моменту или по скорости");
|
||||
|
||||
b.Property<double?>("PositionRight")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("position_right")
|
||||
.HasComment("Крайний правый угол осциляции");
|
||||
|
||||
b.Property<double?>("PositionZero")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("position_zero")
|
||||
.HasComment("Нулевая позиция осциляции");
|
||||
|
||||
b.Property<double?>("Ratio")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("ratio")
|
||||
.HasComment(" Коэффициент редукции редектора");
|
||||
|
||||
b.Property<double?>("ReverseKTorque")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("reverse_k_torque")
|
||||
.HasComment("Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону");
|
||||
|
||||
b.Property<int?>("ReverseSpeedSpZeroTime")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("reverse_speed_sp_zero_time")
|
||||
.HasComment("Время выдачи сигнала нулевой скорости на при смене направления");
|
||||
|
||||
b.Property<double?>("RevolsLeftLimit")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("revols_left_limit")
|
||||
.HasComment("Ограничение числа оборотов влево");
|
||||
|
||||
b.Property<double?>("RevolsLeftTotal")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("revols_left_total")
|
||||
.HasComment("Суммарное количество оборотов влево");
|
||||
|
||||
b.Property<double?>("RevolsRightLimit")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("revols_right_limit")
|
||||
.HasComment("Ограничение числа оборотов вправо");
|
||||
|
||||
b.Property<double?>("RevolsRightTotal")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("revols_right_total")
|
||||
.HasComment("Суммарное количество оборотов вправо");
|
||||
|
||||
b.Property<double?>("RotorTorqueAvg")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("rotor_torque_avg")
|
||||
.HasComment(" Момент в роторе средний");
|
||||
|
||||
b.Property<double?>("SpeedLeftSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("speed_left_sp")
|
||||
.HasComment("Заданная скорость вращения влево");
|
||||
|
||||
b.Property<double?>("SpeedRightSp")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("speed_right_sp")
|
||||
.HasComment("Заданная скорость вращения вправо");
|
||||
|
||||
b.Property<int?>("State")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("state")
|
||||
.HasComment("Переменная этапа");
|
||||
|
||||
b.Property<double?>("TopDriveSpeed")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed")
|
||||
.HasComment("Скорость СВП");
|
||||
|
||||
b.Property<int?>("TopDriveSpeedErr")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("top_drive_speed_err");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_max")
|
||||
.HasComment("верхний предел");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_min")
|
||||
.HasComment("нижний предел");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedOffset")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_offset")
|
||||
.HasComment("смещение");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpFrom")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_from")
|
||||
.HasComment("Заданная скорость c СВП");
|
||||
|
||||
b.Property<int?>("TopDriveSpeedSpFromErr")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("top_drive_speed_sp_from_err");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpFromMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_from_max");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpFromMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_from_min");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpFromOffset")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_from_offset");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpTo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_to")
|
||||
.HasComment("Задание скорости на СВП");
|
||||
|
||||
b.Property<int?>("TopDriveSpeedSpToErr")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("top_drive_speed_sp_to_err");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpToMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_to_max");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpToMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_to_min");
|
||||
|
||||
b.Property<double?>("TopDriveSpeedSpToOffset")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_speed_sp_to_offset");
|
||||
|
||||
b.Property<double?>("TopDriveTorque")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque")
|
||||
.HasComment("Момент СВП");
|
||||
|
||||
b.Property<int?>("TopDriveTorqueErr")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("top_drive_torque_err");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_max");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_min");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueOffset")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_offset");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpFrom")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_from")
|
||||
.HasComment("Заданный момент c СВП");
|
||||
|
||||
b.Property<int?>("TopDriveTorqueSpFromErr")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("top_drive_torque_sp_from_err");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpFromMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_from_max");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpFromMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_from_min");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpFromOffset")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_from_offset");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpTo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_to")
|
||||
.HasComment("Задание момента на СВП");
|
||||
|
||||
b.Property<int?>("TopDriveTorqueSpToErr")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("top_drive_torque_sp_to_err");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpToMax")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_to_max");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpToMin")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_to_min");
|
||||
|
||||
b.Property<double?>("TopDriveTorqueSpToOffset")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("top_drive_torque_sp_to_offset");
|
||||
|
||||
b.Property<double?>("TorqueLeftLimit")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("torque_left_limit")
|
||||
.HasComment("Ограничение крутящего момента влево");
|
||||
|
||||
b.Property<double?>("TorqueRampTime")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("torque_ramp_time")
|
||||
.HasComment("Время нарастания момента");
|
||||
|
||||
b.Property<double?>("TorqueRightLimit")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("torque_right_limit")
|
||||
.HasComment("Ограничение крутящего момента вправо");
|
||||
|
||||
b.Property<double?>("TorqueStarting")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("torque_starting")
|
||||
.HasComment(" Страгивающий момент");
|
||||
|
||||
b.Property<double?>("TurnLeftOnceByAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("turn_left_once_by_angle")
|
||||
.HasComment("Доворот по градусам единожды влево");
|
||||
|
||||
b.Property<double?>("TurnLeftOnceByRevols")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("turn_left_once_by_revols")
|
||||
.HasComment("Доворот по оборотам единожды влево");
|
||||
|
||||
b.Property<double?>("TurnLeftOnceByTorque")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("turn_left_once_by_torque")
|
||||
.HasComment("Доворот по моменту единожды влево");
|
||||
|
||||
b.Property<double?>("TurnRightOnceByAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("turn_right_once_by_angle")
|
||||
.HasComment("Доворот по градусам единожды вправо");
|
||||
|
||||
b.Property<double?>("TurnRightOnceByRevols")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("turn_right_once_by_revols")
|
||||
.HasComment("Доворот по оборотам единожды вправо");
|
||||
|
||||
b.Property<double?>("TurnRightOnceByTorque")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("turn_right_once_by_torque")
|
||||
.HasComment("Доворот по моменту единожды вправо");
|
||||
|
||||
b.Property<double?>("UnlockBySectorOut")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("unlock_by_sector_out")
|
||||
.HasComment(" Градус отклонения от сектора для автоматического сброса блокировки");
|
||||
|
||||
b.Property<double?>("Ver")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("ver")
|
||||
.HasComment("Версия ПО ПЛК");
|
||||
|
||||
b.Property<int?>("W2800")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("w2800")
|
||||
.HasComment("Установка нуля энкодера");
|
||||
|
||||
b.Property<int?>("W2808")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("w2808")
|
||||
.HasComment("Неисправность энкодера");
|
||||
|
||||
b.Property<int?>("W2810")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("w2810")
|
||||
.HasComment(" автоматический сброс блокировки");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_telemetry_data_spin");
|
||||
|
||||
b
|
||||
.HasComment("набор основных данных по SpinMaster");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b =>
|
||||
{
|
||||
b.Property<int>("IdTelemetry")
|
||||
@ -1730,17 +2051,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("CompanyType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.DataSaubBase", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany("DataSaubBases")
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.HasConstraintName("t_data_saub_base_t_telemetry_id_fk")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "Author")
|
||||
@ -1846,6 +2156,28 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany("DataSaub")
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.HasConstraintName("t_data_saub_t_telemetry_id_fk")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany("DataSpin")
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.HasConstraintName("t_data_spin_t_telemetry_id_fk")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
@ -1978,7 +2310,9 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
b.Navigation("Analysis");
|
||||
|
||||
b.Navigation("DataSaubBases");
|
||||
b.Navigation("DataSaub");
|
||||
|
||||
b.Navigation("DataSpin");
|
||||
|
||||
b.Navigation("Events");
|
||||
|
||||
|
@ -15,7 +15,6 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
public virtual DbSet<Cluster> Clusters { get; set; }
|
||||
public virtual DbSet<Company> Companies { get; set; }
|
||||
public virtual DbSet<DataSaubBase> DataSaubBases { get; set; }
|
||||
public virtual DbSet<Deposit> Deposits { get; set; }
|
||||
public virtual DbSet<FileCategory> FileCategories { get; set; }
|
||||
public virtual DbSet<FileInfo> Files { get; set; }
|
||||
@ -23,6 +22,8 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<MeasureCategory> MeasureCategories { get; set; }
|
||||
public virtual DbSet<ReportProperty> ReportProperties { get; set; }
|
||||
public virtual DbSet<Telemetry> Telemetries { get; set; }
|
||||
public virtual DbSet<TelemetryDataSaub> TelemetryDataSaub { get; set; }
|
||||
public virtual DbSet<TelemetryDataSpin> TelemetryDataSpin { get; set; }
|
||||
public virtual DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
|
||||
public virtual DbSet<TelemetryEvent> TelemetryEvents { get; set; }
|
||||
public virtual DbSet<TelemetryMessage> TelemetryMessages { get; set; }
|
||||
@ -70,13 +71,22 @@ namespace AsbCloudDb.Model
|
||||
.HasConstraintName("t_cluster_t_deposit_id_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DataSaubBase>(entity =>
|
||||
modelBuilder.Entity<TelemetryDataSaub>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.DataSaubBases)
|
||||
.WithMany(p => p.DataSaub)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("t_data_saub_base_t_telemetry_id_fk");
|
||||
.HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TelemetryDataSpin>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.DataSpin)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TelemetryMessage>(entity =>
|
||||
@ -378,7 +388,7 @@ namespace AsbCloudDb.Model
|
||||
using var command = Database.GetDbConnection().CreateCommand();
|
||||
|
||||
command.CommandText = $@"SELECT Min(t.bit_depth) AS MinDepth, Max(t.bit_depth) AS MaxDepth, Min(t.Date) AS dateStart
|
||||
FROM t_data_saub_base AS t
|
||||
FROM t_telemetry_data_saub AS t
|
||||
WHERE id_telemetry = {telemetryId} AND t.Id % 10 = 0
|
||||
GROUP BY floor((extract(epoch from t.date) - {workStartTimestamp} + {timezoneOffset}) / {intervalHoursTimestamp});";
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
DbSet<Cluster> Clusters { get; set; }
|
||||
DbSet<Company> Companies { get; set; }
|
||||
DbSet<DataSaubBase> DataSaubBases { get; set; }
|
||||
DbSet<TelemetryDataSaub> TelemetryDataSaub { get; set; }
|
||||
DbSet<Deposit> Deposits { get; set; }
|
||||
DbSet<TelemetryEvent> TelemetryEvents { get; set; }
|
||||
DbSet<TelemetryMessage> TelemetryMessages { get; set; }
|
||||
|
@ -14,7 +14,7 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
public Telemetry()
|
||||
{
|
||||
DataSaubBases = new HashSet<DataSaubBase>();
|
||||
DataSaub = new HashSet<TelemetryDataSaub>();
|
||||
Messages = new HashSet<TelemetryMessage>();
|
||||
}
|
||||
|
||||
@ -31,8 +31,11 @@ namespace AsbCloudDb.Model
|
||||
[InverseProperty(nameof(Model.Well.Telemetry))]
|
||||
public virtual Well Well { get; set; }
|
||||
|
||||
[InverseProperty(nameof(DataSaubBase.Telemetry))]
|
||||
public virtual ICollection<DataSaubBase> DataSaubBases { get; set; }
|
||||
[InverseProperty(nameof(TelemetryDataSaub.Telemetry))]
|
||||
public virtual ICollection<TelemetryDataSaub> DataSaub { get; set; }
|
||||
|
||||
[InverseProperty(nameof(TelemetryDataSpin.Telemetry))]
|
||||
public virtual ICollection<TelemetryDataSpin> DataSpin { get; set; }
|
||||
|
||||
[InverseProperty(nameof(TelemetryMessage.Telemetry))]
|
||||
public virtual ICollection<TelemetryMessage> Messages { get; set; }
|
||||
|
@ -8,8 +8,8 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
[Table("t_data_saub_base"), Comment("набор основных данных по SAUB")]
|
||||
public partial class DataSaubBase : IId, IIdTelemetryDate
|
||||
[Table("t_telemetry_data_saub"), Comment("набор основных данных по SAUB")]
|
||||
public partial class TelemetryDataSaub : IId, IIdTelemetryDate
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
||||
@ -113,7 +113,7 @@ namespace AsbCloudDb.Model
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(IdTelemetry))]
|
||||
[InverseProperty(nameof(Model.Telemetry.DataSaubBases))]
|
||||
[InverseProperty(nameof(Model.Telemetry.DataSaub))]
|
||||
public virtual Telemetry Telemetry { get; set; }
|
||||
}
|
||||
}
|
90
AsbCloudDb/Model/TelemetryDataSpin.cs
Normal file
90
AsbCloudDb/Model/TelemetryDataSpin.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
[Table("t_telemetry_data_spin"), Comment("набор основных данных по SpinMaster")]
|
||||
public class TelemetryDataSpin
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("id_telemetry")]
|
||||
public int IdTelemetry { get; set; }
|
||||
[Column("date", TypeName = "timestamp with time zone"), Comment("'2021-10-19 18:23:54+05'")]
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
[Column("top_drive_speed"), Comment("Скорость СВП")] public double? TopDriveSpeed { get; set; }
|
||||
[Column("top_drive_speed_min"), Comment("нижний предел")] public double? TopDriveSpeedMin { get; set; }
|
||||
[Column("top_drive_speed_max"), Comment("верхний предел")] public double? TopDriveSpeedMax { get; set; }
|
||||
[Column("top_drive_speed_offset"), Comment("смещение")] public double? TopDriveSpeedOffset { get; set; }
|
||||
[Column("top_drive_speed_err")] public int? TopDriveSpeedErr { get; set; }
|
||||
[Column("top_drive_torque"), Comment("Момент СВП")] public double? TopDriveTorque { get; set; }
|
||||
[Column("top_drive_torque_min")] public double? TopDriveTorqueMin { get; set; }
|
||||
[Column("top_drive_torque_max")] public double? TopDriveTorqueMax { get; set; }
|
||||
[Column("top_drive_torque_offset")] public double? TopDriveTorqueOffset { get; set; }
|
||||
[Column("top_drive_torque_err")] public int? TopDriveTorqueErr { get; set; }
|
||||
[Column("top_drive_speed_sp_from"), Comment("Заданная скорость c СВП")] public double? TopDriveSpeedSpFrom { get; set; }
|
||||
[Column("top_drive_speed_sp_from_min")] public double? TopDriveSpeedSpFromMin { get; set; }
|
||||
[Column("top_drive_speed_sp_from_max")] public double? TopDriveSpeedSpFromMax { get; set; }
|
||||
[Column("top_drive_speed_sp_from_offset")] public double? TopDriveSpeedSpFromOffset { get; set; }
|
||||
[Column("top_drive_speed_sp_from_err")] public int? TopDriveSpeedSpFromErr { get; set; }
|
||||
[Column("top_drive_torque_sp_from"), Comment("Заданный момент c СВП")] public double? TopDriveTorqueSpFrom { get; set; }
|
||||
[Column("top_drive_torque_sp_from_min")] public double? TopDriveTorqueSpFromMin { get; set; }
|
||||
[Column("top_drive_torque_sp_from_max")] public double? TopDriveTorqueSpFromMax { get; set; }
|
||||
[Column("top_drive_torque_sp_from_offset")] public double? TopDriveTorqueSpFromOffset { get; set; }
|
||||
[Column("top_drive_torque_sp_from_err")] public int? TopDriveTorqueSpFromErr { get; set; }
|
||||
[Column("top_drive_speed_sp_to"), Comment("Задание скорости на СВП")] public double? TopDriveSpeedSpTo { get; set; }
|
||||
[Column("top_drive_speed_sp_to_min")] public double? TopDriveSpeedSpToMin { get; set; }
|
||||
[Column("top_drive_speed_sp_to_max")] public double? TopDriveSpeedSpToMax { get; set; }
|
||||
[Column("top_drive_speed_sp_to_offset")] public double? TopDriveSpeedSpToOffset { get; set; }
|
||||
[Column("top_drive_speed_sp_to_err")] public int? TopDriveSpeedSpToErr { get; set; }
|
||||
[Column("top_drive_torque_sp_to"), Comment("Задание момента на СВП")] public double? TopDriveTorqueSpTo { get; set; }
|
||||
[Column("top_drive_torque_sp_to_min")] public double? TopDriveTorqueSpToMin { get; set; }
|
||||
[Column("top_drive_torque_sp_to_max")] public double? TopDriveTorqueSpToMax { get; set; }
|
||||
[Column("top_drive_torque_sp_to_offset")] public double? TopDriveTorqueSpToOffset { get; set; }
|
||||
[Column("top_drive_torque_sp_to_err")] public int? TopDriveTorqueSpToErr { get; set; }
|
||||
[Column("w2800"), Comment("Установка нуля энкодера")] public int? W2800 { get; set; }
|
||||
[Column("w2810"), Comment(" автоматический сброс блокировки")] public int? W2810 { get; set; }
|
||||
[Column("mode"), Comment("Выбранный режим управления")] public int? Mode { get; set; }
|
||||
[Column("w2808"), Comment("Неисправность энкодера")] public int? W2808 { get; set; }
|
||||
[Column("torque_starting"), Comment(" Страгивающий момент")] public double? TorqueStarting { get; set; }
|
||||
[Column("rotor_torque_avg"), Comment(" Момент в роторе средний")] public double? RotorTorqueAvg { get; set; }
|
||||
[Column("encoder_resolution "), Comment(" Разрешение энкодера")] public double? EncoderResolution { get; set; }
|
||||
[Column("ratio"), Comment(" Коэффициент редукции редектора")] public double? Ratio { get; set; }
|
||||
[Column("torque_right_limit"), Comment("Ограничение крутящего момента вправо")] public double? TorqueRightLimit { get; set; }
|
||||
[Column("torque_left_limit"), Comment("Ограничение крутящего момента влево")] public double? TorqueLeftLimit { get; set; }
|
||||
[Column("revols_right_limit"), Comment("Ограничение числа оборотов вправо")] public double? RevolsRightLimit { get; set; }
|
||||
[Column("revols_left_limit"), Comment("Ограничение числа оборотов влево")] public double? RevolsLeftLimit { get; set; }
|
||||
[Column("speed_right_sp"), Comment("Заданная скорость вращения вправо")] public double? SpeedRightSp { get; set; }
|
||||
[Column("speed_left_sp"), Comment("Заданная скорость вращения влево")] public double? SpeedLeftSp { get; set; }
|
||||
[Column("revols_right_total"), Comment("Суммарное количество оборотов вправо")] public double? RevolsRightTotal { get; set; }
|
||||
[Column("revols_left_total"), Comment("Суммарное количество оборотов влево")] public double? RevolsLeftTotal { get; set; }
|
||||
[Column("turn_right_once_by_torque"), Comment("Доворот по моменту единожды вправо")] public double? TurnRightOnceByTorque { get; set; }
|
||||
[Column("turn_left_once_by_torque"), Comment("Доворот по моменту единожды влево")] public double? TurnLeftOnceByTorque { get; set; }
|
||||
[Column("turn_right_once_by_angle"), Comment("Доворот по градусам единожды вправо")] public double? TurnRightOnceByAngle { get; set; }
|
||||
[Column("turn_left_once_by_angle"), Comment("Доворот по градусам единожды влево")] public double? TurnLeftOnceByAngle { get; set; }
|
||||
[Column("turn_right_once_by_revols"), Comment("Доворот по оборотам единожды вправо")] public double? TurnRightOnceByRevols { get; set; }
|
||||
[Column("turn_left_once_by_revols"), Comment("Доворот по оборотам единожды влево")] public double? TurnLeftOnceByRevols { get; set; }
|
||||
[Column("break_angle_k"), Comment("Коэффициент для расчёта за какой угол нужно тормозить")] public double? BreakAngleK { get; set; }
|
||||
[Column("reverse_k_torque"), Comment("Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону")] public double? ReverseKTorque { get; set; }
|
||||
[Column("position_zero"), Comment("Нулевая позиция осциляции")] public double? PositionZero { get; set; }
|
||||
[Column("position_right"), Comment("Крайний правый угол осциляции")] public double? PositionRight { get; set; }
|
||||
[Column("torque_ramp_time"), Comment("Время нарастания момента")] public double? TorqueRampTime { get; set; }
|
||||
[Column("ver"), Comment("Версия ПО ПЛК")] public double? Ver { get; set; }
|
||||
[Column("reverse_speed_sp_zero_time"), Comment("Время выдачи сигнала нулевой скорости на при смене направления")] public int? ReverseSpeedSpZeroTime { get; set; }
|
||||
[Column("unlock_by_sector_out"), Comment(" Градус отклонения от сектора для автоматического сброса блокировки")] public double? UnlockBySectorOut { get; set; }
|
||||
[Column("pid_mux_torque_left_limit"), Comment(" Момент при котором определяется ехать назад по моменту или по скорости")] public double? PidMuxTorqueLeftLimit { get; set; }
|
||||
[Column("state"), Comment("Переменная этапа")] public int? State { get; set; }
|
||||
[Column("break_angle_left"), Comment("Угол торможения влево при работе по моменту")] public double? BreakAngleLeft { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(IdTelemetry))]
|
||||
[InverseProperty(nameof(Model.Telemetry.DataSpin))]
|
||||
public virtual Telemetry Telemetry { get; set; }
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ dotnet ef migrations add <MigrationName> --project AsbCloudDb
|
||||
dotnet ef migrations remvoe <MigrationName> --project AsbCloudDb
|
||||
```
|
||||
<MigrationName> - Name of migration class
|
||||
После создания миграции обязательно прочитать сгенерированый код.
|
||||
|
||||
Применить миграции
|
||||
```
|
||||
|
@ -67,7 +67,7 @@ namespace AsbSaubReport
|
||||
var messagesMinDate = messagesQuery.Min(e => e.Date);
|
||||
var messagesMaxDate = messagesQuery.Max(e => e.Date);
|
||||
|
||||
var dataQuery = from item in context.DataSaubBases
|
||||
var dataQuery = from item in context.TelemetryDataSaub
|
||||
where item.IdTelemetry == idTelemetry
|
||||
select item;
|
||||
|
||||
@ -85,7 +85,7 @@ namespace AsbSaubReport
|
||||
}
|
||||
|
||||
public IQueryable<DataSaubReport> GetDataSaubItems(DateTime begin, DateTime end)
|
||||
=> from item in context.DataSaubBases
|
||||
=> from item in context.TelemetryDataSaub
|
||||
where item.IdTelemetry == idTelemetry
|
||||
&& item.Date >= begin
|
||||
&& item.Date <= end
|
||||
|
@ -32,7 +32,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
cacheWells = cacheDb.GetCachedTable<Well>((AsbCloudDbContext)db);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DataSaubBaseDto>> GetAsync(int idWell,
|
||||
public async Task<IEnumerable<TelemetryDataSaubDto>> GetAsync(int idWell,
|
||||
DateTime dateBegin = default, double intervalSec = 600d,
|
||||
int approxPointsCount = 1024, CancellationToken token = default)
|
||||
{
|
||||
@ -49,7 +49,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
var datEnd = dateBegin.AddSeconds(intervalSec);
|
||||
|
||||
var query = from data in db.DataSaubBases
|
||||
var query = from data in db.TelemetryDataSaub
|
||||
where data.IdTelemetry == telemetry.Id
|
||||
&& data.Date >= dateBegin && data.Date < datEnd
|
||||
select data;
|
||||
@ -70,12 +70,12 @@ namespace AsbCloudInfrastructure.Services
|
||||
var entities = await query.AsNoTracking()
|
||||
.ToListAsync(token).ConfigureAwait(false);
|
||||
|
||||
var dtos = entities.Adapt<DataSaubBaseDto>();
|
||||
var dtos = entities.Adapt<TelemetryDataSaubDto>();
|
||||
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos,
|
||||
public async Task<int> UpdateDataAsync(string uid, IEnumerable<TelemetryDataSaubDto> dtos,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
if (dtos == default || !dtos.Any())
|
||||
@ -85,7 +85,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
var dtoMinDate = dtos.Min(d => d.Date);
|
||||
var dtoMaxDate = dtos.Max(d => d.Date);
|
||||
|
||||
var oldDataSaubBase = await (from d in db.DataSaubBases
|
||||
var oldDataSaubBase = await (from d in db.TelemetryDataSaub
|
||||
where d.IdTelemetry == telemetryId
|
||||
&& d.Date > dtoMinDate
|
||||
&& d.Date < dtoMaxDate
|
||||
@ -94,17 +94,17 @@ namespace AsbCloudInfrastructure.Services
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (oldDataSaubBase.Any())
|
||||
db.DataSaubBases.RemoveRange(oldDataSaubBase);
|
||||
db.TelemetryDataSaub.RemoveRange(oldDataSaubBase);
|
||||
|
||||
foreach (var dto in dtos)
|
||||
{
|
||||
var dataSaub = dto.Adapt<DataSaubBase>();
|
||||
var dataSaub = dto.Adapt<TelemetryDataSaub>();
|
||||
var telemetryUser = await cacheTelemetryUsers
|
||||
.FirstOrDefaultAsync(u => u.IdTelemetry == telemetryId && (u.Name == dto.User || u.Surname == dto.User), token)
|
||||
.ConfigureAwait(false);
|
||||
dataSaub.IdUser = telemetryUser?.IdUser;
|
||||
dataSaub.IdTelemetry = telemetryId;
|
||||
db.DataSaubBases.Add(dataSaub);
|
||||
db.TelemetryDataSaub.Add(dataSaub);
|
||||
|
||||
dto.IdTelemetry = telemetryId;
|
||||
analyticsService.SaveAnalytics(dto);
|
||||
@ -120,7 +120,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
if (telemetryId is null)
|
||||
return null;
|
||||
|
||||
var (From, To) = await db.GetDatesRangeAsync<DataSaubBase>((int)telemetryId, token)
|
||||
var (From, To) = await db.GetDatesRangeAsync<TelemetryDataSaub>((int)telemetryId, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return new DatesRangeDto { From = From, To = To };
|
||||
|
@ -122,7 +122,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
if (telemetryId is null)
|
||||
return null;
|
||||
|
||||
var datesRange = await (from d in db.DataSaubBases
|
||||
var datesRange = await (from d in db.TelemetryDataSaub
|
||||
where d.IdTelemetry == telemetryId
|
||||
select d.Date).Union(
|
||||
from m in db.TelemetryMessages
|
||||
|
@ -8,18 +8,18 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
public TelemetryAnalysisDto CurrentAnalysis { get; set; }
|
||||
|
||||
private readonly Dictionary<int, List<DataSaubBaseDto>> saubData =
|
||||
new Dictionary<int, List<DataSaubBaseDto>>();
|
||||
private readonly Dictionary<int, List<TelemetryDataSaubDto>> saubData =
|
||||
new Dictionary<int, List<TelemetryDataSaubDto>>();
|
||||
|
||||
public IEnumerable<DataSaubBaseDto> GetOrCreateCache(int telemetryId)
|
||||
public IEnumerable<TelemetryDataSaubDto> GetOrCreateCache(int telemetryId)
|
||||
{
|
||||
if (!saubData.ContainsKey(telemetryId))
|
||||
saubData[telemetryId] = new List<DataSaubBaseDto>();
|
||||
saubData[telemetryId] = new List<TelemetryDataSaubDto>();
|
||||
|
||||
return saubData[telemetryId];
|
||||
}
|
||||
|
||||
public void AddData(DataSaubBaseDto data)
|
||||
public void AddData(TelemetryDataSaubDto data)
|
||||
{
|
||||
GetOrCreateCache(data.IdTelemetry);
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
if (telemetryId is null)
|
||||
return null;
|
||||
|
||||
var depthToTimeData = (from d in db.DataSaubBases
|
||||
var depthToTimeData = (from d in db.TelemetryDataSaub
|
||||
where d.IdTelemetry == telemetryId
|
||||
select new
|
||||
{
|
||||
@ -231,7 +231,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return groupedOperationsList;
|
||||
}
|
||||
|
||||
public void SaveAnalytics(DataSaubBaseDto dataSaubDto)
|
||||
public void SaveAnalytics(TelemetryDataSaubDto dataSaubDto)
|
||||
{
|
||||
saubDataCache.AddData(dataSaubDto);
|
||||
|
||||
@ -387,7 +387,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return groupedOperationsList;
|
||||
}
|
||||
|
||||
private TelemetryAnalysisDto GetDrillingAnalysis(IEnumerable<DataSaubBaseDto> dataSaubBases)
|
||||
private TelemetryAnalysisDto GetDrillingAnalysis(IEnumerable<TelemetryDataSaubDto> dataSaubBases)
|
||||
{
|
||||
var lastSaubDate = dataSaubBases.Last().Date;
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен завершения задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<DataSaubBaseDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(IEnumerable<TelemetryDataSaubDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDataAsync(int idWell, DateTime begin = default,
|
||||
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/data")]
|
||||
public async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<DataSaubBaseDto> dtos,
|
||||
public async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<TelemetryDataSaubDto> dtos,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
var idWell = telemetryService.GetidWellByTelemetryUid(uid);
|
||||
|
96
AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs
Normal file
96
AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using AsbCloudApp.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
public abstract class TelemetryDataBaseController<Tdto> : ControllerBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Принимает данные от разных систем по скважине
|
||||
/// </summary>
|
||||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||||
/// <param name="dtos">Данные</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}")]
|
||||
public virtual async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<Tdto> dtos,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
//var idWell = telemetryService.GetidWellByTelemetryUid(uid);
|
||||
//await DataService.UpdateDataAsync(uid, dtos, token).ConfigureAwait(false);
|
||||
|
||||
//if (idWell != null && dtos.Any())
|
||||
// await Task.Run(() => telemetryHubContext.Clients.Group($"well_{idWell}")
|
||||
// .SendAsync(nameof(ITelemetryHubClient.ReceiveDataSaub), dtos), token).ConfigureAwait(false);
|
||||
|
||||
//telemetryTracker.SaveRequestDate(uid);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает данные САУБ по скважине.
|
||||
/// По умолчанию за последние 10 минут.
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="begin">дата начала выборки. По умолчанию: текущее время - intervalSec</param>
|
||||
/// <param name="intervalSec">интервал времени даты начала выборки, секунды</param>
|
||||
/// <param name="approxPointsCount">желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.</param>
|
||||
/// <param name="token">Токен завершения задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idWell}")]
|
||||
//[ProducesResponseType(typeof(IEnumerable<Tdto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public virtual async Task<IActionResult> GetDataAsync(int idWell, DateTime begin = default,
|
||||
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
{
|
||||
//if (begin == default)
|
||||
// begin = DateTime.Now.AddSeconds(-intervalSec);
|
||||
//var content = await telemetryDataService.GetAsync(idWell, begin,
|
||||
// intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
||||
|
||||
//if (content is null || !content.Any())
|
||||
// return NoContent();
|
||||
|
||||
return Ok(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает диапазон дат сохраненных данных.
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token">Токен завершения задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("{idWell}/datesRange")]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public virtual async Task<IActionResult> GetDataDatesRangeAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
//int? idCompany = User.GetCompanyId();
|
||||
|
||||
//if (idCompany is null)
|
||||
// return Forbid();
|
||||
|
||||
//bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
// idWell, token).ConfigureAwait(false);
|
||||
|
||||
//if (!isCompanyOwnsWell)
|
||||
// return Forbid();
|
||||
|
||||
//DatesRangeDto dataDatesRange = await telemetryDataService.GetDataDatesRangeAsync(idWell,
|
||||
// token).ConfigureAwait(false);
|
||||
|
||||
return Ok(null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
16
AsbCloudWebApi/Controllers/TelemetryDataSaub.cs
Normal file
16
AsbCloudWebApi/Controllers/TelemetryDataSaub.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using AsbCloudApp.Data;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class TelemetryDataSaub : TelemetryDataBaseController<TelemetryDataSaubDto>
|
||||
{
|
||||
}
|
||||
}
|
11
AsbCloudWebApi/Controllers/TelemetryDataSpin.cs
Normal file
11
AsbCloudWebApi/Controllers/TelemetryDataSpin.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using AsbCloudApp.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class TelemetryDataSpin : TelemetryDataBaseController<TelemetryDataSpinDto>
|
||||
{
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace AsbCloudWebApi.SignalR
|
||||
{
|
||||
public interface ITelemetryHubClient
|
||||
{
|
||||
Task ReceiveDataSaub(IEnumerable<DataSaubBaseDto> dtos);
|
||||
Task ReceiveDataSaub(IEnumerable<TelemetryDataSaubDto> dtos);
|
||||
|
||||
Task ReceiveMessages(IEnumerable<MessageDto> dtos);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace AsbCloudWebApi.SignalR
|
||||
public Task RemoveFromGroup(string groupName)
|
||||
=> Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName);
|
||||
|
||||
public Task SendDataSaub(string groupName, IEnumerable<DataSaubBaseDto> data)
|
||||
public Task SendDataSaub(string groupName, IEnumerable<TelemetryDataSaubDto> data)
|
||||
=> Clients.Group(groupName).ReceiveDataSaub(data);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user