using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace IStation.Calculation.DispatchAna
|
{
|
/// <summary>
|
/// 长兴泵站调度方案计算器
|
/// </summary>
|
internal class Calculator_KeepStatus_SHYS_长兴岛 : CalculatorBase_SHYS_长兴岛, IKeepStatusCalc
|
{
|
public Calculator_KeepStatus_SHYS_长兴岛()
|
{
|
}
|
Model.RequestParasComplex _request_paras;
|
List<long> _open_machine_IdList ;
|
/// <summary>
|
/// 初始化参数
|
/// </summary>
|
/// <param name="complex_request_paras"></param>
|
/// <param name="eta_ana_records"></param>
|
/// <param name="open_machine_ids"></param>
|
public void IntialRequest(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras,
|
IStation.Calculation.DispatchAna.Model.EtaAnaRecord4Station eta_ana_records,
|
List<long> open_machine_ids)
|
{
|
this._request_paras = complex_request_paras;
|
this._open_machine_IdList = open_machine_ids;
|
}
|
|
|
|
|
/// <summary>
|
/// 计算保持当前开机状态
|
/// </summary>
|
/// <param name="error_info">错误信息</param>
|
/// <returns></returns>
|
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 < 2)
|
{
|
error_info = "ERROR 35";
|
return null;
|
}
|
double pipe1_TargetFlow = _request_paras.OutletPipePara[0].TargetFlow;
|
double pipe2_TargetFlow = _request_paras.OutletPipePara[1].TargetFlow;
|
if (pipe1_TargetFlow < 10 && pipe2_TargetFlow < 10)
|
{
|
return default;
|
}
|
|
double pipe1_TargetPess = _request_paras.OutletPipePara[0].TargetPress;
|
double pipe2_TargetPess = _request_paras.OutletPipePara[1].TargetPress;
|
|
|
double water_level = 0;//水位
|
if (_request_paras.WaterLevelPara != null && _request_paras.WaterLevelPara.Count > 0)
|
{
|
water_level = _request_paras.WaterLevelPara.First().Value;
|
}
|
|
|
if (_request_paras.ValvePara == null || _request_paras.ValvePara.Count < 1)
|
{
|
error_info = "ERROR 57";
|
return null;
|
}
|
int isOpenMiddleValve = _request_paras.ValvePara.First().OpenStatus;
|
|
List<Model.MachineDetail> allMachineList = null;
|
if (!BuildMachineList(
|
out allMachineList,
|
out error_info))
|
{
|
error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info;
|
return null;
|
}
|
|
if (isOpenMiddleValve == 1)//阀门开的状态下 两管相连数据相加求平均值
|
{
|
double press = 0;
|
if (pipe1_TargetPess > 0.1 && pipe2_TargetPess > 0.1)
|
{
|
press = (pipe1_TargetPess + pipe2_TargetPess) / 2;
|
}
|
else
|
{
|
if (pipe1_TargetPess > 0.01)
|
press = pipe1_TargetPess;
|
else if (pipe2_TargetPess > 0.01)
|
press = pipe2_TargetPess;
|
else
|
return null;
|
}
|
Common.DispatchAnaGeneralHelper压力 calc_pipe_helper =
|
new Common.DispatchAnaGeneralHelper压力();
|
calc_pipe_helper.InitialParas(
|
pipe1_TargetFlow + pipe2_TargetFlow,
|
water_level,
|
press,
|
null, null,
|
allMachineList, null);
|
|
return calc_pipe_helper.CalcKeepStatus(_open_machine_IdList);
|
}
|
else //阀门关的状态下 两管相连数据相加
|
{
|
var pipe1_machineIds = new List<long>() { 19, 22 };//1号泵,2号泵
|
var pipe2_machineIds = new List<long>() { 25, 28 };//3号泵,4号泵
|
|
Common.DispatchAnaGeneralHelper压力 calc_pipe1_helper
|
= new Common.DispatchAnaGeneralHelper压力();
|
|
Common.DispatchAnaGeneralHelper压力 calc_pipe2_helper
|
= new Common.DispatchAnaGeneralHelper压力();
|
|
if (pipe2_TargetFlow < 30)
|
{//只开一号泵二号泵
|
calc_pipe1_helper.InitialParas(
|
pipe1_TargetFlow,
|
water_level,
|
pipe1_TargetPess,
|
null, null,
|
(from x in allMachineList where pipe1_machineIds.Contains(x.MachineID) select x).ToList(), null);
|
|
return calc_pipe1_helper.CalcKeepStatus(_open_machine_IdList);
|
}
|
else if (pipe1_TargetFlow < 30)
|
{
|
calc_pipe2_helper.InitialParas(
|
pipe2_TargetFlow,
|
water_level,
|
pipe2_TargetPess,
|
null, null,
|
(from x in allMachineList where pipe2_machineIds.Contains(x.MachineID) select x).ToList(), null);
|
|
return calc_pipe2_helper.CalcKeepStatus(_open_machine_IdList);
|
}
|
|
|
|
|
calc_pipe1_helper.InitialParas(
|
pipe1_TargetFlow,
|
water_level,
|
pipe1_TargetPess,
|
null, null,
|
(from x in allMachineList where pipe1_machineIds.Contains(x.MachineID) select x).ToList(), null);
|
var pipe1_result = calc_pipe1_helper.CalcKeepStatus(_open_machine_IdList);
|
|
|
calc_pipe2_helper.InitialParas(
|
pipe2_TargetFlow,
|
water_level,
|
pipe2_TargetPess,
|
null, null,
|
(from x in allMachineList where pipe2_machineIds.Contains(x.MachineID) select x).ToList(), null);
|
|
var pipe2_result = calc_pipe2_helper.CalcKeepStatus(_open_machine_IdList);
|
|
if (pipe1_result == null || pipe2_result == null)
|
return default;
|
|
|
|
var connect_scheme = new Model.AnaScheme();
|
connect_scheme.ID = 1;
|
connect_scheme.TotalWrkQ = pipe1_result.TotalWrkQ + pipe2_result.TotalWrkQ;
|
connect_scheme.TotalWrkH = (pipe1_result.TotalWrkH + pipe2_result.TotalWrkH) / 2;
|
connect_scheme.TotalWrkP = pipe1_result.TotalWrkP + pipe2_result.TotalWrkP;
|
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<Model.AnaSchemeItem>();
|
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);
|
|
|
return connect_scheme;
|
}
|
}
|
}
|
}
|