using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
|
namespace IStation.Calculation.DispatchAna
|
{
|
/// <summary>
|
/// 常规
|
/// </summary>
|
public class Calculator_OptAna_General : CalculatorOptAnaBase, IOptAnaCalc
|
{
|
List<IStation.Calculation.DispatchAna.Model.MachineDetail> allMachineList = null;
|
|
#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>
|
public List<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)
|
{
|
var isUsePress = complex_request_paras.PressValueType == Model.RequestParasComplex.ePressValueType.压力 ? true : false;
|
|
if (eta_ana_records != null && eta_ana_records.Q.HasValue && eta_ana_records.H.HasValue)
|
{
|
if (complex_request_paras.OutletPipePara[0].TargetFlow < 50 ||
|
complex_request_paras.OutletPipePara[1].TargetFlow < 50)
|
{
|
complex_request_paras.ValvePara[0].OpenStatus = 0;//关闭
|
if (complex_request_paras.OutletPipePara[0].TargetFlow < 50)
|
{
|
complex_request_paras.OutletPipePara[0].TargetFlow = 0;
|
complex_request_paras.OutletPipePara[1].TargetFlow = eta_ana_records.Q.Value;
|
|
complex_request_paras.OutletPipePara[0].TargetPress = eta_ana_records.H.Value;
|
complex_request_paras.OutletPipePara[1].TargetPress = eta_ana_records.H.Value;
|
}
|
else
|
{
|
complex_request_paras.OutletPipePara[1].TargetFlow = 0;
|
complex_request_paras.OutletPipePara[0].TargetFlow = eta_ana_records.Q.Value;
|
|
complex_request_paras.OutletPipePara[0].TargetPress = eta_ana_records.H.Value;
|
complex_request_paras.OutletPipePara[1].TargetPress = eta_ana_records.H.Value;
|
}
|
}
|
else
|
{
|
complex_request_paras.OutletPipePara[0].TargetPress = eta_ana_records.H.Value;
|
complex_request_paras.OutletPipePara[1].TargetPress = eta_ana_records.H.Value;
|
}
|
|
}
|
|
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<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 = 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.InletPipePara != null && complex_request_paras.InletPipePara.Count > 0)
|
{
|
water_level = complex_request_paras.InletPipePara.First().Value;
|
if (!complex_request_paras.InletPipePara.First().IsWaterLevel)
|
{//换成M
|
water_level = water_level * 102;
|
}
|
}
|
|
|
|
|
if(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 ,
|
complex_request_paras.OutletPipePara[0].TargetFlowRangeMin,
|
complex_request_paras.OutletPipePara[0].TargetFlowRangeMax,
|
allMachineList,
|
machine_run_status==null?null: machine_run_status.MachineRunFilter);
|
|
return calc_pipe_helper.CalcOptList(complex_request_paras.SchemeSortType, complex_request_paras.SchemeNumber);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="complex_request_paras"></param>
|
/// <param name="machine_run_status"></param>
|
/// <param name="error_info"></param>
|
/// <returns></returns>
|
protected List<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 = 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_head = complex_request_paras.OutletPipePara[0].TargetPress;
|
if (target_head < 0.01)
|
{
|
error_info = "压力值过低,ERROR 68";
|
return null;
|
}
|
|
|
|
|
|
|
if (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,
|
target_head,
|
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);
|
}
|
#endregion
|
|
|
|
|
}
|
}
|