using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace IStation.Calculation.DispatchAna
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class CalculatorBase
|
{
|
/// <summary>
|
/// /
|
/// </summary>
|
protected long _corpID = 0;
|
/// <summary>
|
///
|
/// </summary>
|
protected long _stationID = 0;
|
|
|
|
/// <summary>
|
/// 计算(最优)
|
/// </summary>
|
public virtual List<IStation.Calculation.DispatchAna.Model.AnaScheme> CalcOptListCore(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex requesParas,
|
IStation.Calculation.DispatchAna.Model.MachineRunPara runParas,
|
out string error_info)
|
{
|
error_info = "未实现!Error:21";
|
return null;
|
}
|
|
/// <summary>
|
/// 计算保持当前开机状态
|
/// </summary>
|
/// <param name="requesParas"></param>
|
/// <param name="openMachineIdList"></param>
|
/// <param name="error_info"></param>
|
/// <returns></returns>
|
public virtual IStation.Calculation.DispatchAna.Model.AnaScheme CalcKeepStatusCore(
|
IStation.Calculation.DispatchAna.Model.RequestParasComplex requesParas,
|
List<long> openMachineIdList,
|
out string error_info)
|
{
|
error_info = "未实现!Error:34";
|
return null;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="CorpID"></param>
|
/// <param name="StationID"></param>
|
/// <param name="allMachineList"></param>
|
/// <returns></returns>
|
protected bool BuildMachineList(
|
long CorpID,
|
long StationID,
|
out List<IStation.Calculation.DispatchAna.Model.MachineDetail> allMachineList)
|
{
|
this._corpID = CorpID;
|
this._stationID = StationID;
|
|
allMachineList = null;
|
IStation.Service.Product service_product = new IStation.Service.Product();
|
IStation.Service.PumpCurve service_curve = new IStation.Service.PumpCurve();
|
|
var allEnginePumpList = service_product.GetEnginePumpListByBelongTypeAndBelongID(CorpID,
|
IStation.ObjectType.Station, StationID); //获取机泵列表
|
//var allPumpList = service_product.GetChildPumpByID(this._stationID);
|
if (allEnginePumpList == null || allEnginePumpList.Count() == 0)
|
{
|
return false;
|
}
|
|
|
allMachineList = new List<IStation.Calculation.DispatchAna.Model.MachineDetail>();
|
|
allEnginePumpList = allEnginePumpList.OrderBy(x => x.SortCode).ToList();
|
foreach (var engine in allEnginePumpList)
|
{
|
IStation.Model.Product<IStation.Model.Pump> pump = service_product.GetChildPumpByEnginePumpID(CorpID, engine.ID);
|
if (pump == null)
|
continue;
|
|
var curve_default = service_curve.GetWorkingByPumpID(CorpID, pump.ID);
|
if (curve_default == null)
|
continue;
|
if (curve_default.CurveInfo == null)
|
continue;
|
//var motor = service_product.GetChildMotorProductByID(machine.ID);
|
//if (motor == null)
|
// continue;
|
IStation.Calculation.DispatchAna.Model.MachineDetail detail =
|
new IStation.Calculation.DispatchAna.Model.MachineDetail(engine, pump, curve_default);
|
allMachineList.Add(detail);
|
}
|
|
|
return true;
|
}
|
|
|
#region 计算能耗
|
|
/// <summary>
|
/// 计算千吨能耗
|
/// </summary>
|
/// <param name="p">功率kW</param>
|
/// <param name="q">瞬时流量m³/h</param>
|
/// <returns>kW·h/km³</returns>
|
public static double CalculateWP(double p, double q)
|
{
|
if (q < 0.1)
|
return 0;
|
return p / q * 1000;
|
}
|
|
/// <summary>
|
/// 计算单位能耗
|
/// </summary>
|
/// <param name="p">功率kW</param>
|
/// <param name="q">瞬时流量m³/h</param>
|
/// <param name="h">扬程m</param>
|
/// <returns>kW·h/km³</returns>
|
public static double CalculateUWP(double p, double q, double h)
|
{
|
if (q < 0.1)
|
return default;
|
if (h < 0.1)
|
return default;
|
return p / q / h * 1000;
|
}
|
|
#endregion
|
|
}
|
}
|