using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Calculation.DispatchAna { /// /// 常规 /// public class Calculator_OptAna_General : CalculatorOptAnaBase, IOptAnaCalc { /// /// /// protected List allMachineList = null; #region 计算 最优方案 /// /// 计算 最优方案 /// /// /// /// /// public List CalcSchemes( IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras, IStation.Calculation.DispatchAna.Model.EtaAnaRecord4Station eta_ana_records, IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status, out string error_info) { var isUsePress = complex_request_paras.PressValueType == Model.RequestParasComplex.ePressValueType.压力 ? true : false; if (isUsePress) return CalcSchemes压力(complex_request_paras, machine_run_status, out error_info); else return CalcSchemes扬程(complex_request_paras, machine_run_status, out error_info); } /// /// /// /// /// /// /// protected override List CalcSchemes压力( IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras, IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status, out string error_info) { error_info = null; this._corpID = complex_request_paras.CorpID; this._stationID = complex_request_paras.StationID; if (complex_request_paras == null) { error_info = "ERROR 30"; return null; } if (complex_request_paras.OutletPipePara == null || complex_request_paras.OutletPipePara.Count < 1) { error_info = "出口管路参数有误, 请确认是否赋值, ERROR 35"; return null; } double target_flow = complex_request_paras.OutletPipePara[0].TargetFlow; if (target_flow < 10) { error_info = "流量值过低, 请确认是否赋值, 如果确实是零流量,则不需要做分析, ERROR 67"; return null; } double outlet_para_value = complex_request_paras.OutletPipePara[0].TargetPress; bool outlet_isWaterLevel = complex_request_paras.OutletPipePara[0].IsWaterLevel; if (outlet_para_value < 0.01) { error_info = "压力值过低, 请确认是否赋值, ERROR 68"; return null; } double inlet_para_value = 0;//水位 bool inlet_isWaterLevel = true; if (complex_request_paras.InletPipePara != null && complex_request_paras.InletPipePara.Count > 0) { inlet_isWaterLevel = complex_request_paras.InletPipePara.First().IsWaterLevel; if (complex_request_paras.InletPipePara.Count == 1) { inlet_para_value = complex_request_paras.InletPipePara.First().Value; } else {//多个用平均值 for (int i = 0; i < complex_request_paras.InletPipePara.Count; i++) { inlet_para_value += complex_request_paras.InletPipePara[i].Value; } inlet_para_value = inlet_para_value / complex_request_paras.InletPipePara.Count; } } if (allMachineList == null) { if (!BuildMachineList( out allMachineList, out error_info)) { error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info; return null; } } IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper压力 calc_pipe_helper = new IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper压力(); calc_pipe_helper.TargetQmaxDefaultPercent = this.TargetQmaxDefaultPercent; if (!calc_pipe_helper.InitialParas( target_flow, inlet_para_value, inlet_isWaterLevel, outlet_para_value, outlet_isWaterLevel, complex_request_paras.OutletPipePara[0].TargetFlowRangeMin, complex_request_paras.OutletPipePara[0].TargetFlowRangeMax, allMachineList, machine_run_status == null ? null : machine_run_status.MachineRunFilter, out error_info)) { return null; } return calc_pipe_helper.CalcOptList(complex_request_paras.SchemeSortType, complex_request_paras.SchemeNumber); } /// /// /// /// /// /// /// protected List CalcSchemes扬程( IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras, IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status, out string error_info) { error_info = null; this._corpID = complex_request_paras.CorpID; this._stationID = complex_request_paras.StationID; if (complex_request_paras == null) { error_info = "ERROR 30"; return null; } if (complex_request_paras.OutletPipePara == null || complex_request_paras.OutletPipePara.Count < 1) { error_info = "出口管路参数有误, ERROR 35"; return null; } double target_flow = complex_request_paras.OutletPipePara[0].TargetFlow; if (target_flow < 10) { error_info = "流量值过低, ERROR 67"; return null; } double target_head = complex_request_paras.OutletPipePara[0].TargetPress; if (target_head < 0.01) { error_info = "压力值过低,ERROR 68"; return null; } if (allMachineList == null) { if (!BuildMachineList( out allMachineList, out error_info)) { error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info; return null; } } IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper扬程 calc_pipe_helper = new IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper扬程(); calc_pipe_helper.InitialParas( target_flow, target_head, complex_request_paras.OutletPipePara[0].TargetFlowRangeMin, complex_request_paras.OutletPipePara[0].TargetFlowRangeMax, allMachineList, machine_run_status.MachineRunFilter); return calc_pipe_helper.CalcOptList(complex_request_paras.SchemeSortType, complex_request_paras.SchemeNumber); } #endregion } }