using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.Calculation.DispatchAna
{
///
/// 常规
///
internal class Calculator4StationGeneral : CalculatorBase
{
///
/// 获取当前调度信息
///
///
///
///
///
public IStation.Calculation.DispatchAna.Model.CurrentRecordBundle GetCurrentRecord(
long CorpID,
long StationID,
out string error_info)
{
error_info = null;
return null;
}
///
/// 计算(最优)
///
/// 需求参数
///
/// 错误信息
///
public override List CalcOptListCore(
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_press = complex_request_paras.OutletPipePara[0].TargetPress;
if (target_press < 0.01)
{
error_info = "压力值过低,ERROR 68";
return null;
}
double water_level = 0;//水位
if (complex_request_paras.WaterLevelPara != null && complex_request_paras.WaterLevelPara.Count > 0)
{
water_level = complex_request_paras.WaterLevelPara.First().Value;
}
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,
target_press,
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);
}
///
/// 计算保持当前开机状态
///
///
/// 开泵ID
/// 错误信息
///
protected override IStation.Calculation.DispatchAna.Model.AnaScheme CalcKeepStatusCore(
IStation.Calculation.DispatchAna.Model.RequestParasComplex requesParas,
List openMachineIdList,
out string error_info)
{
error_info = null;
this._corpID = requesParas.CorpID;
this._stationID = requesParas.StationID;
if (requesParas == null)
{
error_info = "ERROR 30";
return null;
}
if (openMachineIdList == null || openMachineIdList.Count == 0)
{
error_info = "ERROR 25";
return null;
}
if (requesParas.OutletPipePara == null || requesParas.OutletPipePara.Count < 2)
{
error_info = "ERROR 35";
return null;
}
double target_flow = requesParas.OutletPipePara[0].TargetFlow;
if (target_flow < 10 )
{
return default;
}
double target_press = requesParas.OutletPipePara[0].TargetPress;
if (target_press < 10)
{
return default;
}
double water_level = 0;//水位
if (requesParas.WaterLevelPara != null && requesParas.WaterLevelPara.Count > 0)
{
water_level = requesParas.WaterLevelPara.First().Value;
}
if (requesParas.ValvePara == null || requesParas.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,
target_press,
requesParas.OutletPipePara[0].TargetFlowRangeMin,
requesParas.OutletPipePara[0].TargetFlowRangeMax,
allMachineList, null);
return calc_pipe_helper.CalcKeepStatus(openMachineIdList);
}
}
}