using System.Collections.Generic;
|
using System.Linq;
|
|
namespace IStation.Model
|
{
|
public partial class PumpCurve
|
{
|
/// <summary>
|
/// 通过 频率 计算流量扬程曲线表达式
|
/// </summary>
|
public CurveExpress CalcuCurveQhByHz(double hz)
|
{
|
if (this.CurveInfo == null || this.CurveInfo.CurveQH == null)
|
return default;
|
var points = this.CurveInfo.CurveQH.GetFitPoints(20);
|
double f_ratio = hz / 50.0;
|
var pts = points.Select(x => new CurvePoint(x.X * f_ratio, x.Y * f_ratio * f_ratio)).ToList();
|
return new CurveExpress(pts, this.CurveInfo.CurveQH.FitType);
|
}
|
|
/// <summary>
|
/// 通过 频率 计算流量功率曲线表达式
|
/// </summary>
|
public CurveExpress CalcuCurveQpByHz(double hz)
|
{
|
if (this.CurveInfo == null || this.CurveInfo.CurveQP == null)
|
return default;
|
var points = this.CurveInfo.CurveQP.GetFitPoints(20);
|
double f_ratio = hz / 50.0;
|
var pts = points.Select(x => new CurvePoint(x.X * f_ratio, x.Y * f_ratio * f_ratio * f_ratio)).ToList();
|
return new CurveExpress(pts, this.CurveInfo.CurveQP.FitType);
|
}
|
|
/// <summary>
|
/// 通过 频率 计算流量功率曲线表达式
|
/// </summary>
|
public CurveExpress CalcuCurveQeByHz(double hz)
|
{
|
if (this.CurveInfo == null || this.CurveInfo.CurveQE == null)
|
return default;
|
var points = this.CurveInfo.CurveQE.GetFitPoints(20);
|
double f_ratio = hz / 50.0;
|
var pts = points.Select(x => new CurvePoint(x.X * f_ratio, x.Y)).ToList();
|
return new CurveExpress(pts, this.CurveInfo.CurveQE.FitType);
|
}
|
/// <summary>
|
/// 通过 流量 获取 拟合功率
|
/// </summary>
|
public double GetFitP(double hz, double q)
|
{
|
var express = CalcuCurveQpByHz(hz);
|
return FitCurveHelper.GetFitPointY(express, q);
|
}
|
|
/// <summary>
|
/// 获取拟合点
|
/// </summary>
|
public List<CurvePoint> GetFitPoints(eFeatCurveType featCurveType, int pointNumber = 20)
|
{
|
if (this.PointInfo == null)
|
return default;
|
List<CurvePoint> list = null;
|
switch (featCurveType)
|
{
|
case eFeatCurveType.QH:
|
{
|
if (this.CurveInfo != null && this.CurveInfo.CurveQH != null)
|
{
|
list = this.CurveInfo.CurveQH.GetFitPoints(pointNumber);
|
}
|
}
|
break;
|
case eFeatCurveType.QP:
|
{
|
if (this.CurveInfo != null && this.CurveInfo.CurveQP != null)
|
{
|
list = this.CurveInfo.CurveQP.GetFitPoints(pointNumber);
|
}
|
}
|
break;
|
case eFeatCurveType.QE:
|
{
|
if (this.CurveInfo != null && this.CurveInfo.CurveQE != null)
|
{
|
list = this.CurveInfo.CurveQE.GetFitPoints(pointNumber);
|
}
|
}
|
break;
|
default: break;
|
}
|
return list;
|
|
}
|
|
|
}
|
}
|