using System;
|
using System.Linq;
|
using System.Text;
|
|
namespace TProduct.Model
|
{
|
public class ValveCoordinateParas
|
{
|
public ValveCoordinateParas() { }
|
|
public ValveCoordinateParas(string strChartCoord)
|
{
|
try
|
{
|
if (string.IsNullOrEmpty(strChartCoord))
|
{
|
isNull = true;
|
return;
|
}
|
|
string[] coords = strChartCoord.Split('|');
|
if (coords.Count() < 4)
|
{
|
isNull = true;
|
return;
|
}
|
|
//
|
string sbQ = coords[0];
|
string[] coordParasQ = sbQ.Split(',');
|
this.GridLineNumberDegree = Convert.ToInt32(coordParasQ[2]);
|
this.MinDegree = Convert.ToDouble(coordParasQ[3]);
|
this.SpaceDegree = Convert.ToDouble(coordParasQ[4]);
|
|
|
//
|
string sbFlow = coords[1];
|
string[] coordParasFlow = sbFlow.Split(',');
|
this.GridLineNumberFlow = Convert.ToInt32(coordParasFlow[2]);
|
this.MinFlow = Convert.ToDouble(coordParasQ[3]);
|
this.SpaceFlow = Convert.ToDouble(coordParasQ[4]);
|
|
//
|
string sbDeltaP = coords[2];
|
string[] coordParasDeltaP = sbDeltaP.Split(',');
|
this.GridLineNumberDeltaP = Convert.ToInt32(coordParasDeltaP[2]);
|
this.MinDeltaP = Convert.ToDouble(coordParasDeltaP[3]);
|
this.SpaceDeltaP = Convert.ToDouble(coordParasDeltaP[4]);
|
|
|
string sbRc = coords[3];
|
string[] coordParasRc = sbRc.Split(',');
|
this.GridLineNumberRc = Convert.ToInt32(coordParasRc[2]);
|
this.MinRc = Convert.ToDouble(coordParasRc[3]);
|
this.SpaceRc = Convert.ToDouble(coordParasRc[4]);
|
|
|
string sbKv = coords[3];
|
string[] coordParasKv = sbKv.Split(',');
|
this.GridLineNumberKv = Convert.ToInt32(coordParasKv[2]);
|
this.MinKv = Convert.ToDouble(coordParasKv[3]);
|
this.SpaceKv = Convert.ToDouble(coordParasKv[4]);
|
|
|
}
|
catch (Exception)
|
{
|
isNull = true;
|
return;
|
}
|
}
|
|
public ValveCoordinateParas(ValveCoordinateParas rhs)
|
{
|
if (rhs == null)
|
{
|
return;
|
}
|
|
|
this.GridLineNumberDegree = rhs.GridLineNumberDegree;
|
this.MinDegree = rhs.MinDegree;
|
this.SpaceDegree = rhs.SpaceDegree;
|
|
|
this.GridLineNumberFlow = rhs.GridLineNumberFlow;
|
this.MinFlow = rhs.MinFlow;
|
this.SpaceFlow = rhs.SpaceFlow;
|
|
|
this.GridLineNumberDeltaP = rhs.GridLineNumberDeltaP;
|
this.MinDeltaP = rhs.MinDeltaP;
|
this.SpaceDeltaP = rhs.SpaceDeltaP;
|
|
|
this.GridLineNumberKv = rhs.GridLineNumberKv;
|
this.MinKv = rhs.MinKv;
|
this.SpaceKv = rhs.SpaceKv;
|
|
|
|
|
this.GridLineNumberRc = rhs.GridLineNumberRc;
|
this.MinRc = rhs.MinRc;
|
this.SpaceRc = rhs.SpaceRc;
|
}
|
|
//开度
|
public int GridLineNumberDegree;
|
public double MinDegree, SpaceDegree;
|
public double MaxDegree
|
{
|
get
|
{
|
return MinDegree + (GridLineNumberDegree - 1) * SpaceDegree;
|
}
|
}
|
|
|
//流量
|
public int GridLineNumberFlow;
|
public double MinFlow, SpaceFlow;
|
public double MaxFlow
|
{
|
get
|
{
|
return MinFlow + (GridLineNumberFlow - 1) * SpaceFlow;
|
}
|
}
|
//压差
|
public int GridLineNumberDeltaP;
|
public double MinDeltaP, SpaceDeltaP;
|
public double MaxDeltaP
|
{
|
get
|
{
|
return MinDeltaP + (GridLineNumberDeltaP - 1) * SpaceDeltaP;
|
}
|
}
|
|
//流阻系数Rc
|
public int GridLineNumberRc;
|
public double MinRc, SpaceRc;
|
public double MaxRc
|
{
|
get
|
{
|
return MinRc + (GridLineNumberRc - 1) * SpaceRc;
|
}
|
}
|
|
//流量系数Kv
|
public int GridLineNumberKv;
|
public double MinKv, SpaceKv;
|
public double MaxKv
|
{
|
get
|
{
|
return MinKv + (GridLineNumberKv - 1) * SpaceKv;
|
}
|
}
|
|
|
|
|
|
|
|
public Object Clone() //对外提供一个创建自身的浅表副本的能力
|
{
|
return this.MemberwiseClone();
|
}
|
|
|
//
|
protected bool isNull = false;
|
public bool IsNull
|
{
|
get { return isNull; }
|
}
|
|
public static ValveCoordinateParas ToParameter(string strChartCoord)
|
{
|
try
|
{
|
var paras = new ValveCoordinateParas(strChartCoord);
|
if (paras.isNull)
|
return null;
|
else
|
return paras;
|
}
|
catch (Exception)
|
{
|
return null;
|
}
|
}
|
|
public string ToDsString()
|
{
|
return ToDsString(this);
|
}
|
|
public static string ToDsString(ValveCoordinateParas paras)
|
{
|
if (paras == null)
|
return "";
|
|
StringBuilder sbInfo = new StringBuilder();
|
sbInfo.Append("1,0,"); //1:表示均匀
|
sbInfo.Append(paras.GridLineNumberDegree); sbInfo.Append(",");
|
sbInfo.Append(paras.MinDegree); sbInfo.Append(",");
|
sbInfo.Append(paras.SpaceDegree);
|
|
sbInfo.Append("|1,0,"); //1:表示均匀
|
sbInfo.Append(paras.GridLineNumberFlow); sbInfo.Append(",");
|
sbInfo.Append(paras.MinFlow); sbInfo.Append(",");
|
sbInfo.Append(paras.SpaceFlow);
|
|
sbInfo.Append("|1,0,"); //1:表示均匀
|
sbInfo.Append(paras.GridLineNumberDeltaP); sbInfo.Append(",");
|
sbInfo.Append(paras.MinDeltaP); sbInfo.Append(",");
|
sbInfo.Append(paras.SpaceDeltaP);
|
|
sbInfo.Append("|1,0,"); //1:表示均匀
|
sbInfo.Append(paras.GridLineNumberRc); sbInfo.Append(",");
|
sbInfo.Append(paras.MinRc); sbInfo.Append(",");
|
sbInfo.Append(paras.SpaceRc);
|
|
sbInfo.Append("|1,0,"); //1:表示均匀
|
sbInfo.Append(paras.GridLineNumberKv); sbInfo.Append(",");
|
sbInfo.Append(paras.MinKv); sbInfo.Append(",");
|
sbInfo.Append(paras.SpaceKv);
|
|
return sbInfo.ToString();
|
}
|
|
|
}
|
}
|