using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
|
namespace Eventech.Model
|
{
|
public class CombineCurveList : List<CombineCurve>, ICloneable
|
{//List都用|分开
|
#region 构造函数
|
public CombineCurveList()
|
{
|
}
|
public CombineCurveList(string strExpressList, int pointNum = 8)
|
{//LIST都用|分开
|
if (string.IsNullOrEmpty(strExpressList))
|
return;
|
|
string[] strExpresses = strExpressList.Split(new string[] { "|" }, StringSplitOptions.None);
|
if (strExpresses == null || strExpresses.Count() == 0)
|
return;
|
|
foreach (var strExpress in strExpresses)
|
{
|
var express = new Eventech.Model.CombineCurve(strExpress, pointNum);
|
if (!express.IsNull)
|
Add(express);
|
}
|
}
|
|
|
|
public CombineCurveList(CombineCurveList rhs)
|
{
|
if (rhs == null)
|
return;
|
|
foreach (CombineCurve item in rhs)
|
{
|
this.Add(item.Clone());
|
}
|
}
|
public CombineCurveList(IEnumerable<CombineCurve> rhs)
|
{
|
if (rhs == null)
|
return;
|
|
foreach (CombineCurve item in rhs)
|
{
|
this.Add(item.Clone());
|
}
|
}
|
public CombineCurveList(IEnumerable<ThroughParaCurve> rhs)
|
{
|
if (rhs == null)
|
return;
|
|
foreach (ThroughParaCurve item in rhs)
|
{
|
this.Add(new CombineCurve(item));
|
}
|
}
|
#endregion
|
|
//50HZ->60HZ
|
public CombineCurveList From50to60HZ( )
|
{
|
return SimuBySpeed(1.2);
|
}
|
//相似换算(speed_ratio = 新的转速 除以 老的转速)
|
public CombineCurveList SimuBySpeed(double speed_ratio)
|
{
|
CombineCurveList C60 = new CombineCurveList();
|
foreach (CombineCurve c50 in this)
|
{
|
C60.Add(c50.SimuBySpeed( speed_ratio));
|
}
|
|
return C60;
|
}
|
|
public string ToDsString()
|
{
|
return ToDsString(this);
|
}
|
public static string ToDsString(CombineCurveList express)
|
{//LIST都用|分开
|
if (express == null || express.Count == 0)
|
return null;
|
|
var strs = from x in express select x.ToDsString();
|
return string.Join("|", strs);
|
}
|
|
public static CombineCurveList ToParameter(string strStore)
|
{
|
if (string.IsNullOrEmpty(strStore))
|
return null;
|
return new CombineCurveList(strStore);
|
}
|
|
object ICloneable.Clone()
|
{
|
return this.Clone();
|
}
|
|
public CombineCurveList Clone()
|
{
|
return new CombineCurveList(this);
|
}
|
|
//获取最大最小值
|
public void GetBoundaryPoint(out double boudary_min_x, out double boudary_max_x, out double boudary_min_y, out double boudary_max_y)
|
{
|
boudary_min_x = double.MaxValue;
|
boudary_max_x = double.MinValue;
|
boudary_min_y = double.MaxValue;
|
boudary_max_y = double.MinValue;
|
|
foreach (var curve in this)
|
{
|
boudary_min_x = Math.Min(boudary_min_x, (from x in curve.PointInfo select x.X).Min());
|
boudary_max_x = Math.Max(boudary_max_x, (from x in curve.PointInfo select x.X).Max());
|
boudary_min_y = Math.Min(boudary_min_y, (from x in curve.PointInfo select x.Y).Min());
|
boudary_max_y = Math.Max(boudary_min_y, (from x in curve.PointInfo select x.Y).Max());
|
}
|
|
}
|
|
public Boundary GetBoundaryPoint( )
|
{
|
double boudary_min_x = double.MaxValue;
|
double boudary_max_x = double.MinValue;
|
double boudary_min_y = double.MaxValue;
|
double boudary_max_y = double.MinValue;
|
|
foreach (var curve in this)
|
{
|
boudary_min_x = Math.Min(boudary_min_x, (from x in curve.PointInfo select x.X).Min());
|
boudary_max_x = Math.Max(boudary_max_x, (from x in curve.PointInfo select x.X).Max());
|
boudary_min_y = Math.Min(boudary_min_y, (from x in curve.PointInfo select x.Y).Min());
|
boudary_max_y = Math.Max(boudary_min_y, (from x in curve.PointInfo select x.Y).Max());
|
}
|
return new Boundary(boudary_min_x, boudary_max_x, boudary_min_y, boudary_max_y);
|
}
|
}
|
}
|