tangxu
2023-03-16 8686d55bdb23502e2d027e1d5f7f552859a2e09a
Application/IStation.Application.OpenApi/shys/dispatch/DispatchAna_ShysController.cs
@@ -290,11 +290,13 @@
            complex_request_paras.SchemeSortType = Calculation.DispatchAna.Model.eAnaSchemeSortType.功率;
            complex_request_paras.SchemeNumber = 1;
            //构造计算器
            var calulator = IStation.Calculation.DispatchAnalyCalculatorFactory.CreateKeepStatusCalculator(4, IStation.ObjectType.Station, 2,null);
            //构造计算器
            var calulator = IStation.Calculation.DispatchAnalyCalculatorFactory.CreateKeepStatusCalculator(4,
                IStation.ObjectType.Station, 2,null);
            calulator.IntialRequest(complex_request_paras,
                    null,
                    machine_run_status);
            //出方案 
            var scheme = calulator.Calc(out error_info);
            if (scheme == null)
@@ -333,6 +335,53 @@
                else if (pump_item.Index == 3)
                    pump_item.Name = "长兴泵房4号机泵";
            }
            //保证开一台泵时, 流量大 频率也大, 流量小 , 频率也小
            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)
                {
                    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;
                    }
                }
                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);
                    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, 2);
                        }
                        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, 2);
                        }
                    }
                }
            }
            return result;
        }