From dfdb157df49c99d5599688fa6209ec2dc9f1afbc Mon Sep 17 00:00:00 2001 From: tangxu <76880903@qq.com> Date: 星期一, 10 四月 2023 16:54:41 +0800 Subject: [PATCH] 原水调度 --- Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs | 139 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 110 insertions(+), 29 deletions(-) diff --git a/Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs b/Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs index c3dcacf..17e2141 100644 --- a/Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs +++ b/Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs @@ -8,6 +8,7 @@ using System.ComponentModel.DataAnnotations; using Mapster; using Microsoft.AspNetCore.Authorization; +using SqlSugar; namespace IStation.Application { @@ -297,6 +298,39 @@ null, machine_run_status); + #region 瀹炴椂閲� + double real_total_flow_pipe1 = 0; + var pipe1_val_flow_real = result_sg.scada.Find(t => t.tagname == "_0402010403030002001"); + if (pipe1_val_flow_real != null && pipe1_val_flow_real.value > 100) + {//瀹炴椂閲�, stationCX_2#_flow" 涓夐珮缁欑殑鐩爣閲� + real_total_flow_pipe1 = pipe1_val_flow_real.value; + } + + double real_oulet_press_pipe1 = 0; + var pipe1_val_press_real = result_sg.scada.Find(t => t.tagname == "_0402010403030002005"); + if (pipe1_val_press_real != null && pipe1_val_press_real.value > 100) + {//瀹炴椂閲�, stationCX_2#_flow" 涓夐珮缁欑殑鐩爣閲� + real_oulet_press_pipe1 = pipe1_val_press_real.value; + } + + + double real_total_flow_pipe2 = 0; + var pipe2_val_flow_real = result_sg.scada.Find(t => t.tagname == "_0402010403030002002"); + if (pipe2_val_flow_real != null && pipe2_val_flow_real.value > 100) + { + real_total_flow_pipe2 = pipe2_val_flow_real.value; + } + + double real_oulet_press_pipe2 = 0; + var pipe2_val_press_real = result_sg.scada.Find(t => t.tagname == "_0402010403030002006"); + if (pipe2_val_press_real != null && pipe2_val_press_real.value > 100) + {//瀹炴椂閲�, stationCX_2#_flow" 涓夐珮缁欑殑鐩爣閲� + real_oulet_press_pipe2 = pipe2_val_press_real.value; + } + + #endregion + + //鍑烘柟妗� var scheme = calulator.Calc(out error_info); if (scheme == null) @@ -309,6 +343,48 @@ result.P = scheme.TotalWrkP; result.WP = scheme.WP; result.UWP = scheme.UWP; + result.Scheme = new DispatchAnaCurrentOutput(); + result.Scheme.MiddleValveStatus = middleValveStatus; + result.Scheme.Pipes = new List<DispatchAnaCurrentOutput.PipeParaOutput>(); + result.Scheme.Pipes.Add( + new DispatchAnaCurrentOutput.PipeParaOutput() + { + Name = "1#绠�", + TargetFlow = pipe1.TargetFlow, + TargetPressure = pipe1.TargetPress, + CurrentFlow = real_total_flow_pipe1, + CurrentPressure = real_oulet_press_pipe1 + } + ); + result.Scheme.Pipes.Add( + new DispatchAnaCurrentOutput.PipeParaOutput() + { + Name = "2#绠�", + TargetFlow = pipe2.TargetFlow, + TargetPressure = pipe2.TargetPress, + CurrentFlow = real_total_flow_pipe2, + CurrentPressure = real_oulet_press_pipe2 + } + ); + + List<string> machine_frq_hz_target_name = new List<string> { + "_0402010403010112007", + "_0402010403010212019", + "_0402010403010312007", + "_0402010403010412019" }; + + List<string> machine_speed_target_name = new List<string> { + "_0402010403010112008", + "_0402010403010212020", + "_0402010403010312008", + "_0402010403010412020" }; + + List<string> machine_names = new List<string> { + "闀垮叴娉垫埧1鍙锋満娉�", + "闀垮叴娉垫埧2鍙锋満娉�", + "闀垮叴娉垫埧3鍙锋満娉�", + "闀垮叴娉垫埧4鍙锋満娉�" }; + result.Pumps = new List<IStation.Application.DispatchAnaSchemeItemOutput>(); foreach (IStation.Calculation.DispatchAna.Model.AnaSchemeItem item in scheme.Items) { @@ -324,16 +400,34 @@ pump_item.P = item.WorkPointP; pump_item.Frequency = item.Frequence; pump_item.Speed = item.Speed; - result.Pumps.Add(pump_item); - if (pump_item.Index == 0) - pump_item.Name = "闀垮叴娉垫埧1鍙锋満娉�"; - else if (pump_item.Index == 1) - pump_item.Name = "闀垮叴娉垫埧2鍙锋満娉�"; - else if (pump_item.Index == 2) - pump_item.Name = "闀垮叴娉垫埧3鍙锋満娉�"; - else if (pump_item.Index == 3) - pump_item.Name = "闀垮叴娉垫埧4鍙锋満娉�"; + if (pump_item.Index >= 0 && pump_item.Index < 4) + { + //鑾峰彇瀹炴椂棰戠巼 + var fr_hz_tag_name = machine_frq_hz_target_name[pump_item.Index]; + var current_val_fr_hz = result_sg.scada.Find(t => t.tagname == fr_hz_tag_name); + if (current_val_fr_hz != null && current_val_fr_hz.value > 10) + { + pump_item.CurrentFrequency = current_val_fr_hz.value; + } + + //鑾峰彇瀹炴椂杞�� + var speed_tag_name = machine_speed_target_name[pump_item.Index]; + var current_val_speed = result_sg.scada.Find(t => t.tagname == speed_tag_name); + if (current_val_speed != null && current_val_speed.value > 10) + { + pump_item.CurrentSpeed = current_val_speed.value; + } + + //鏈烘车鍚嶇О + pump_item.Name = machine_names[pump_item.Index]; + } + + + result.Pumps.Add(pump_item); + + + } @@ -341,28 +435,15 @@ if (machine_run_status.Count == 1) {//淇濊瘉寮�涓�鍙版车鏃�, 娴侀噺澶� 棰戠巼涔熷ぇ, 娴侀噺灏� , 棰戠巼涔熷皬 - double current_total_flow = 0; - var pipe1_val_flow_current = result_sg.scada.Find(t => t.tagname == "_0402010403030002001"); - if (pipe1_val_flow_current != null && pipe1_val_flow_current.value>100) + if(pipe1.TargetFlow + pipe2.TargetFlow > 100) { - current_total_flow = pipe1_val_flow_current.value; - } - else - { - var pipe2_val_flow_current = result_sg.scada.Find(t => t.tagname == "_0402010403030002002"); - if (pipe2_val_flow_current != null && pipe2_val_flow_current.value > 100) - { - current_total_flow = pipe2_val_flow_current.value; - } - } + double current_total_flow = 0; + if (pipe1.TargetFlow > 100) + current_total_flow = pipe1.TargetFlow; + else + current_total_flow = pipe2.TargetFlow; - if(current_total_flow > 100) - { - List<string > machine_frq_hz_target_name = new List<string> { - "_0402010403010112007", - "_0402010403010212019", - "_0402010403010312007", - "_0402010403010412019" }; + var open_pump = result.Pumps.First(); var fr_hz_tag_name = machine_frq_hz_target_name[open_pump.Index]; var current_val_fr_hz = result_sg.scada.Find(t => t.tagname == fr_hz_tag_name); -- Gitblit v1.9.3