tangxu
2023-04-21 0ff2225384c72ab981b116ce15685e07e4615603
Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs
@@ -316,14 +316,14 @@
            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;
                real_total_flow_pipe1 = Math.Round( pipe1_val_flow_real.value,0);
            }
            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)
            {//实时量,  "stationCX_2#_flow" 是 三高给的目标量
                real_oulet_press_pipe1 = pipe1_val_press_real.value;
                real_oulet_press_pipe1 = Math.Round(pipe1_val_press_real.value,5);
            }
@@ -331,19 +331,17 @@
            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;
                real_total_flow_pipe2 = Math.Round(pipe2_val_flow_real.value,0);
            }
            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)
            {//实时量,  stationCX_2#_flow" 三高给的目标量
                real_oulet_press_pipe2 = pipe2_val_press_real.value;
                real_oulet_press_pipe2 = Math.Round(pipe2_val_press_real.value,5);
            }
            #endregion
            //出方案 
            var scheme = calulator.Calc(out error_info);
            if (scheme == null)
@@ -439,45 +437,10 @@
                result.Pumps.Add(pump_item);
            }
            #endregion
            #region 修正
            if (machine_run_status.Count == 1)
            {//保证开一台泵时, 流量大 频率也大, 流量小 , 频率也小
                if (pipe1.TargetFlow + pipe2.TargetFlow > 100)
                {
                    double current_total_flow = 0;
                    if (pipe1.TargetFlow > 100)
                        current_total_flow = pipe1.TargetFlow;
                    else
                        current_total_flow = pipe2.TargetFlow;
                    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);
                    if (current_val_fr_hz != null && current_val_fr_hz.value > 10)
                    {
                        if (current_total_flow < scheme.TotalWrkQ && current_val_fr_hz.value > open_pump.Frequency)
                        {//保证趋势正确
                            open_pump.Frequency = Math.Round(current_val_fr_hz.value * scheme.TotalWrkQ / current_total_flow, 1);
                        }
                        else if (current_total_flow > scheme.TotalWrkQ && current_val_fr_hz.value < open_pump.Frequency)
                        {//保证趋势正确
                            open_pump.Frequency = Math.Round(current_val_fr_hz.value * scheme.TotalWrkQ / current_total_flow, 1);
                        }
                        else
                        {//原水反馈 , 用曲线计算, 频率偏低, 人为增加0.5HZ
                            if (open_pump.Frequency < 49.5)
                            {
                                //open_pump.Speed = Math.Round
                                //    (open_pump.Speed * (open_pump.Frequency + 0.5) / (open_pump.Frequency),0);
                                open_pump.Frequency = open_pump.Frequency + 0.5;
                                open_pump.Speed = Math.Round(740 * open_pump.Frequency / 50, 1);
                            }
                        }
                    }
                }
            }
            else
            {
                result.Pumps.ForEach(x =>
                {//原水反馈 , 用曲线计算, 频率偏低, 人为增加0.5HZ
@@ -492,8 +455,52 @@
                        }
                    }
                });
                //if (pipe1.TargetFlow + pipe2.TargetFlow > 100)
                //{
                //    double current_total_flow = 0;
                //    if (pipe1.TargetFlow > 100)
                //        current_total_flow = pipe1.TargetFlow;
                //    else
                //        current_total_flow = pipe2.TargetFlow;
                //    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);
                //    if (current_val_fr_hz != null && current_val_fr_hz.value > 10)
                //    {
                //        bool isCor = false;
                //        if (current_total_flow < scheme.TotalWrkQ && current_val_fr_hz.value > open_pump.Frequency)
                //        {//保证趋势正确
                //            isCor = true;
                //            open_pump.Note = string.Format("ORI_{0}", open_pump.Frequency);
                //            open_pump.Frequency = Math.Round(current_val_fr_hz.value * scheme.TotalWrkQ / current_total_flow, 1);
                //        }
                //        else if (current_total_flow > scheme.TotalWrkQ && current_val_fr_hz.value < open_pump.Frequency)
                //        {//保证趋势正确
                //            isCor = true;
                //            open_pump.Note = string.Format("ORI_{0}", open_pump.Frequency);
                //            open_pump.Frequency = Math.Round(current_val_fr_hz.value * scheme.TotalWrkQ / current_total_flow, 1);
                //        }
                //    }
                //}
            }
            else
            {
                result.Pumps.ForEach(x =>
                {//原水反馈 , 用曲线计算, 频率偏低, 人为增加0.3HZ
                    if (x.Frequency > 10)
                    {
                        if (x.Frequency < 49.7)
                        {
                            x.Frequency = x.Frequency + 0.3;
                            x.Speed = Math.Round(740 * x.Frequency / 50, 1);
                        }
                    }
                });
            }
            #endregion
            result.Pumps.ForEach(x =>
            {//再检查一下转速