using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.Calculation.DispatchAna
{
///
/// 常规
///
internal class Calculator_KeepStatus_General : CalculatorBase, IKeepStatusCalc
{
IStation.Calculation.DispatchAna.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._corpID = complex_request_paras.CorpID;
this._stationID = complex_request_paras.StationID;
this._request_paras = complex_request_paras;
this._open_machine_IdList = open_machine_ids;
}
///
/// 计算保持当前开机状态
///
/// 错误信息
///
public IStation.Calculation.DispatchAna.Model.AnaScheme Calc( out string error_info)
{
error_info = null;
if (_request_paras == null)
{
error_info = "ERROR 30";
return null;
}
if (_open_machine_IdList == null || _open_machine_IdList.Count == 0)
{
error_info = "ERROR 25";
return null;
}
if (_request_paras.OutletPipePara == null || _request_paras.OutletPipePara.Count < 2)
{
error_info = "ERROR 35";
return null;
}
double target_flow = _request_paras.OutletPipePara[0].TargetFlow;
if (target_flow < 10 )
{
return default;
}
double target_press = _request_paras.OutletPipePara[0].TargetPress;
if (target_press < 10)
{
return default;
}
double water_level = 0;//水位
if (_request_paras.InletPipePara != null && _request_paras.InletPipePara.Count > 0)
{
water_level = _request_paras.InletPipePara.First().Value;
}
if (_request_paras.ValvePara == null || _request_paras.ValvePara.Count < 1)
{
error_info = "ERROR 135";
return null;
}
List 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,
water_level,true,
target_press,false,
_request_paras.OutletPipePara[0].TargetFlowRangeMin,
_request_paras.OutletPipePara[0].TargetFlowRangeMax,
allMachineList, null);
return calc_pipe_helper.CalcKeepStatus(_open_machine_IdList);
}
}
}