using IStation.Calculation.DispatchAna.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Calculation.DispatchAna { /// /// 长兴泵站调度方案计算器 /// internal class Calculator_KeepStatus_SHYS_陈行一输 : CalculatorBase_SHYS_陈行一输, IKeepStatusCalc { public Calculator_KeepStatus_SHYS_陈行一输() { } Model.RequestParasComplex _request_paras; List _open_machine_IdList ; /// /// 初始化参数 /// /// /// /// public void IntialRequest( IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras, IStation.Calculation.DispatchAna.Model.EtaAnaRecord4Station eta_ana_records, List open_machine_ids) { this._request_paras = complex_request_paras; this._open_machine_IdList = open_machine_ids; } List _allMachineList = null; /// /// 计算保持当前开机状态 /// /// 错误信息 /// public Model.AnaScheme Calc(out string error_info) { if (_open_machine_IdList == null || _open_machine_IdList.Count == 0) { error_info = "ERROR 25"; return null; } error_info = null; if (_request_paras == null) { error_info = "ERROR 30"; return null; } if (_request_paras.OutletPipePara == null || _request_paras.OutletPipePara.Count < 3) { error_info = "ERROR 35"; return null; } double pipe1_TargetFlow = _request_paras.OutletPipePara[0].TargetFlow; double pipe2_TargetFlow = _request_paras.OutletPipePara[1].TargetFlow; double pipe3_TargetFlow = _request_paras.OutletPipePara[2].TargetFlow; if (pipe1_TargetFlow < 10 && pipe2_TargetFlow < 10 && pipe3_TargetFlow < 10) { return default; } double pipe1_TargetPess = _request_paras.OutletPipePara[0].TargetPress; double pipe2_TargetPess = _request_paras.OutletPipePara[1].TargetPress; double pipe3_TargetPess = _request_paras.OutletPipePara[2].TargetPress; if (pipe1_TargetFlow > 50) { if (pipe1_TargetPess < 0.01) { error_info = "ERROR 35,陈行一输需要一号管压力未赋值"; return default; } } if (pipe2_TargetFlow > 50) { if (pipe2_TargetPess < 0.01) { error_info = "ERROR 35,陈行一输需要二号管压力未赋值"; return default; } } if (pipe3_TargetFlow > 50) { if (pipe3_TargetPess < 0.01) { error_info = "ERROR 35,陈行一输需要三号管压力未赋值"; return default; } } double water_level1 = 0, water_level2=0, water_level3=0; if (_request_paras.InletPipePara != null && _request_paras.InletPipePara.Count > 0) { if (_request_paras.InletPipePara.Count >= 1) { water_level1 = _request_paras.InletPipePara[0].Value; } if (_request_paras.InletPipePara.Count >=2) { water_level2 = _request_paras.InletPipePara[1].Value; } if (_request_paras.InletPipePara.Count >= 3) { water_level3 = _request_paras.InletPipePara[2].Value; } } //机泵信息 if (_allMachineList == null) { if (!BuildMachineList( out _allMachineList, out error_info)) { error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info; return null; } } Common.DispatchAnaGeneralHelper压力 calc_pipe1_helper = new Common.DispatchAnaGeneralHelper压力(); Common.DispatchAnaGeneralHelper压力 calc_pipe2_helper = new Common.DispatchAnaGeneralHelper压力(); Common.DispatchAnaGeneralHelper压力 calc_pipe3_helper = new Common.DispatchAnaGeneralHelper压力(); double totalQ = 0, totalH = 0, totalP = 0; int pipe_count = 0; IStation.Calculation.DispatchAna.Model.AnaScheme pipe1_result = null; if (pipe1_TargetFlow > 50) { calc_pipe1_helper.InitialParas( pipe1_TargetFlow, water_level1,true , pipe1_TargetPess,false , null, null, (from x in _allMachineList where pipe1_machineIds.Contains(x.MachineID) select x).ToList(), null, out error_info); pipe1_result = calc_pipe1_helper.CalcKeepStatus(_open_machine_IdList); if (pipe1_result == null) { error_info = "管路一调度方案无法计算请确认数据是否合理"; return null; } totalQ += pipe1_result.TotalWrkQ; totalP += pipe1_result.TotalWrkP; totalH += pipe1_result.TotalWrkH; pipe_count++; } IStation.Calculation.DispatchAna.Model.AnaScheme pipe2_result = null; if (pipe2_TargetFlow > 50) { calc_pipe2_helper.InitialParas( pipe2_TargetFlow, water_level2,true , pipe2_TargetPess,false , null, null, (from x in _allMachineList where pipe2_machineIds.Contains(x.MachineID) select x).ToList(), null, out error_info); pipe2_result = calc_pipe2_helper.CalcKeepStatus(_open_machine_IdList); if (pipe2_result == null) { error_info = "管路2调度方案无法计算请确认数据是否合理"; return null; } totalQ += pipe2_result.TotalWrkQ; totalP += pipe2_result.TotalWrkP; totalH += pipe2_result.TotalWrkH; pipe_count++; } IStation.Calculation.DispatchAna.Model.AnaScheme pipe3_result = null; if (pipe3_TargetFlow > 50) { calc_pipe3_helper.InitialParas( pipe3_TargetFlow, water_level3, true, pipe3_TargetPess,false, null, null, (from x in _allMachineList where pipe3_machineIds.Contains(x.MachineID) select x).ToList(), null, out error_info); pipe3_result = calc_pipe3_helper.CalcKeepStatus(_open_machine_IdList); if (pipe3_result == null) { error_info = "管路3调度方案无法计算请确认数据是否合理"; return null; } totalQ += pipe3_result.TotalWrkQ; totalP += pipe3_result.TotalWrkP; totalH += pipe3_result.TotalWrkH; pipe_count++; } var connect_scheme = new Model.AnaScheme(); connect_scheme.ID = 1; connect_scheme.TotalWrkQ = Math.Round(totalQ, 1); connect_scheme.TotalWrkH = Math.Round(totalH / pipe_count, 2); connect_scheme.TotalWrkP = Math.Round(totalP, 1); connect_scheme.TotalWrkE = IStation.Common.PumpParaHelper.CalculateE(connect_scheme.TotalWrkQ, connect_scheme.TotalWrkH, connect_scheme.TotalWrkP); connect_scheme.UWP = CalculateUWP(connect_scheme.TotalWrkP, connect_scheme.TotalWrkQ, connect_scheme.TotalWrkH); connect_scheme.WP = CalculateWP(connect_scheme.TotalWrkP, connect_scheme.TotalWrkQ); connect_scheme.Items = new List(); if (pipe1_result.Items != null && pipe1_result.Items.Count > 0) connect_scheme.Items.AddRange(pipe1_result.Items); if (pipe2_result.Items != null && pipe2_result.Items.Count > 0) connect_scheme.Items.AddRange(pipe2_result.Items); if (pipe3_result.Items != null && pipe3_result.Items.Count > 0) connect_scheme.Items.AddRange(pipe3_result.Items); return connect_scheme;   } } }