using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Numerics;
|
using System.Text;
|
using System.Threading.Tasks;
|
using IStation.Calculation.DispatchAna.Model;
|
|
namespace IStation.Calculation.DispatchAna
|
{
|
/// <summary>
|
/// 南汇北调度方案计算器(最优方案)
|
/// </summary>
|
public class Calculator_OptAna_SHYS_南汇北: CalculatorBase_SHYS_南汇北, IOptAnaCalc
|
{
|
List<Model.MachineDetail> _allMachineList = null;
|
|
|
/// <summary>
|
/// /
|
/// </summary>
|
public Calculator_OptAna_SHYS_南汇北()
|
{
|
|
}
|
|
|
#region 计算 最优方案
|
/// <summary>
|
/// 计算 最优方案
|
/// </summary>
|
/// <param name="complex_request_paras"></param>
|
/// <param name="eta_ana_records"></param>
|
/// <param name="machine_run_status"></param>
|
/// <param name="error_info"></param>
|
/// <returns></returns>
|
public List<IStation.Calculation.DispatchAna.Model.AnaScheme> CalcSchemes(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras,
|
IStation.Calculation.DispatchAna.Model.EtaAnaRecord4Station eta_ana_records,
|
IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status,
|
out string error_info)
|
{
|
this._corpID = complex_request_paras.CorpID;
|
this._stationID = complex_request_paras.StationID;
|
|
|
|
|
var isUsePress = complex_request_paras.PressValueType == Model.RequestParasComplex.ePressValueType.压力 ? true : false;
|
|
|
if (isUsePress)
|
return CalcSchemes压力(complex_request_paras, machine_run_status, out error_info);
|
else
|
return CalcSchemes扬程(complex_request_paras, machine_run_status, out error_info);
|
}
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="complex_request_paras"></param>
|
/// <param name="machine_run_status"></param>
|
/// <param name="error_info"></param>
|
/// <returns></returns>
|
protected override List<IStation.Calculation.DispatchAna.Model.AnaScheme> CalcSchemes压力(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras,
|
IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status,
|
out string error_info)
|
{
|
error_info = "";
|
if (complex_request_paras == null)
|
{
|
error_info = "ERROR 30";
|
return null;
|
}
|
if (complex_request_paras.OutletPipePara == null ||
|
complex_request_paras.OutletPipePara.Count < 2)
|
{
|
error_info = "ERROR 35,南汇北需要两个管路的流量";
|
return null;
|
}
|
|
double pipe1_TargetFlow = complex_request_paras.OutletPipePara[0].TargetFlow;
|
double pipe2_TargetFlow = complex_request_paras.OutletPipePara[1].TargetFlow;
|
if (pipe1_TargetFlow < 50 && pipe2_TargetFlow < 50)
|
{//都关机
|
error_info = "ERROR 35,南汇北需要两个管路的流量都为0";
|
return null;
|
}
|
|
double pipe1_TargetPess = complex_request_paras.OutletPipePara[0].TargetPress;
|
double pipe2_TargetPess = complex_request_paras.OutletPipePara[1].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;
|
}
|
}
|
double inlet_press = 0;//水位
|
if (complex_request_paras.InletPipePara != null && complex_request_paras.InletPipePara.Count > 0)
|
{
|
if (complex_request_paras.InletPipePara.Count > 1)
|
{
|
inlet_press = (complex_request_paras.InletPipePara[0].Value + complex_request_paras.InletPipePara[1].Value) / 2;
|
}
|
else
|
{
|
inlet_press = complex_request_paras.InletPipePara[0].Value;
|
}
|
}
|
double water_level = inlet_press * 102;
|
|
|
//机泵信息
|
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压力();
|
|
|
|
|
calc_pipe1_helper.InitialParas(
|
pipe1_TargetFlow + pipe2_TargetFlow,
|
water_level,true ,
|
(pipe1_TargetPess + pipe2_TargetPess) / 2,false ,
|
null, null,
|
_allMachineList,
|
machine_run_status == null ? null : machine_run_status.MachineRunFilter);
|
|
return calc_pipe1_helper.CalcOptList(complex_request_paras.SchemeSortType, 3);
|
|
|
}
|
|
|
private List<IStation.Calculation.DispatchAna.Model.AnaScheme> CalcSchemes扬程(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras,
|
IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status,
|
out string error_info)
|
{
|
error_info = "";
|
if (complex_request_paras == null)
|
{
|
error_info = "ERROR 30";
|
return null;
|
}
|
if (complex_request_paras.OutletPipePara == null ||
|
complex_request_paras.OutletPipePara.Count < 2)
|
{
|
error_info = "ERROR 35,南汇北需要两个管路的流量";
|
return null;
|
}
|
|
double pipe1_TargetFlow = complex_request_paras.OutletPipePara[0].TargetFlow;
|
double pipe2_TargetFlow = complex_request_paras.OutletPipePara[1].TargetFlow;
|
if (pipe1_TargetFlow < 50 && pipe2_TargetFlow < 50)
|
{//都关机
|
error_info = "ERROR 35,南汇北需要两个管路的流量 都为0";
|
return null;
|
}
|
|
double pipe1_TargetHead = complex_request_paras.OutletPipePara[0].TargetPress;
|
double pipe2_TargetHead = complex_request_paras.OutletPipePara[1].TargetPress;
|
|
if (pipe1_TargetFlow > 50)
|
{
|
if (pipe1_TargetHead < 0.01)
|
{
|
error_info = "ERROR 35,南汇北需要一号管压力未赋值";
|
return default;
|
}
|
}
|
if (pipe2_TargetFlow > 50)
|
{
|
if (pipe2_TargetHead < 0.01)
|
{
|
error_info = "ERROR 35,南汇北需要二号管压力未赋值";
|
return default;
|
}
|
}
|
|
|
|
//机泵信息
|
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扬程();
|
|
|
calc_pipe1_helper.InitialParas(
|
pipe1_TargetFlow+ pipe2_TargetFlow,
|
(pipe1_TargetHead + pipe1_TargetHead)/2,
|
null, null,
|
_allMachineList,
|
machine_run_status == null ? null : machine_run_status.MachineRunFilter);
|
|
return calc_pipe1_helper.CalcOptList(complex_request_paras.SchemeSortType, 3);
|
|
}
|
|
#endregion
|
|
|
|
|
}
|
}
|