using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
|
namespace IStation.Calculation.DispatchAna
|
{
|
/// <summary>
|
/// 常规
|
/// </summary>
|
internal class Calculator4StationGeneral : CalculatorBase
|
{
|
/// <summary>
|
/// 获取当前调度信息
|
/// </summary>
|
/// <param name="CorpID"></param>
|
/// <param name="StationID"></param>
|
/// <param name="error_info"></param>
|
/// <returns></returns>
|
public IStation.Calculation.DispatchAna.Model.CurrentRecordBundle GetCurrentRecord(
|
long CorpID,
|
long StationID,
|
out string error_info)
|
{
|
error_info = null;
|
return null;
|
}
|
|
|
|
|
|
/// <summary>
|
/// 计算(最优)
|
/// </summary>
|
/// <param name="complex_request_paras">需求参数</param>
|
/// <param name="machine_run_status"></param>
|
/// <param name="error_info">错误信息</param>
|
/// <returns></returns>
|
public override List<Calculation.DispatchAna.Model.AnaScheme> 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<IStation.Calculation.DispatchAna.Model.MachineDetail> 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);
|
}
|
|
/// <summary>
|
/// 计算保持当前开机状态
|
/// </summary>
|
/// <param name="requesParas"></param>
|
/// <param name="openMachineIdList">开泵ID</param>
|
/// <param name="error_info">错误信息</param>
|
/// <returns></returns>
|
protected override IStation.Calculation.DispatchAna.Model.AnaScheme CalcKeepStatusCore(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex requesParas,
|
List<long> 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<IStation.Calculation.DispatchAna.Model.MachineDetail> 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);
|
}
|
|
}
|
}
|