using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.Model
{
///
///
///
public class EtaBasicRealRecord
{
///
///
///
public EtaBasicRealRecord() { }
///
///
///
public EtaBasicRealRecord(EtaBasicRealRecord rhs)
{
this.CorpID = rhs.CorpID;
this.ObjectType = rhs.ObjectType;
this.ObjectID = rhs.ObjectID;
this.DataTime = rhs.DataTime;
this.Duration = rhs.Duration;
this.Qa = rhs.Qa;
this.Ha = rhs.Ha;
this.Pa = rhs.Pa;
this.Ea = rhs.Ea;
this.WPa = rhs.WPa;
this.UWPa = rhs.UWPa;
this.AnalyStatus = rhs.AnalyStatus;
this.AnalyInfo = rhs.AnalyInfo;
}
///
/// 复制分析参数
///
///
public void CopyAnaPara(EtaBasicRealRecord rhs)
{
if (rhs == null)
return;
this.Qa = rhs.Qa;
this.Ha = rhs.Ha;
this.Pa = rhs.Pa;
this.Ea = rhs.Ea;
this.WPa = rhs.WPa;
this.UWPa = rhs.UWPa;
this.AnalyStatus = rhs.AnalyStatus;
this.AnalyInfo = rhs.AnalyInfo;
}
///
/// 客户标识
///
public long CorpID { get; set; }
///
/// 对象类型
///
public string ObjectType { get; set; }
///
/// 对象标识
///
public long ObjectID { get; set; }
///
/// 数据时间
///
public DateTime DataTime { get; set; }
///
/// 间隔
///
public int Duration { get; set; }
///
/// 分析瞬时流量
///
public double? Qa { get; set; }
///
/// 分析扬程
///
public double? Ha { get; set; }
///
/// 分析功率
///
public double? Pa { get; set; }
///
/// 分析效率
///
public double? Ea { get; set; }
///
/// 分析千吨能耗
///
public double? WPa { get; set; }
///
/// 分析单位能耗
///
public double? UWPa { get; set; }
///
/// 分析状态
///
public Eta.eAnalyStatus AnalyStatus { get; set; }
///
/// 分析信息
///
public string AnalyInfo { get; set; }
#region AnalyInfo
///
/// 添加状态
///
///
public void PutAnalyInfo(string tag)
{
if (string.IsNullOrEmpty(AnalyInfo))
{
AnalyInfo = string.Format("V1|{0}:", tag);
}
else
{
AnalyInfo = string.Format("{0}|{1}:", AnalyInfo, tag);
}
}
///
/// 添加AnalyInfo标识
///
/// 标识
/// 更多信息
public void PutAnalyInfo(string tag, string more)
{
if (string.IsNullOrEmpty(AnalyInfo))
{
if (string.IsNullOrEmpty(more))
{
AnalyInfo = string.Format("V1|{0}:", tag);
}
else
{
AnalyInfo = string.Format("V1|{0}:{1}", tag, more);
}
}
else
{
if (string.IsNullOrEmpty(more))
{
AnalyInfo = string.Format("{0}|{1}:", AnalyInfo, tag);
}
else
{
AnalyInfo = string.Format("{0}|{1}:{2}", AnalyInfo, tag, more);
}
}
}
///
/// 添加AnalyInfo标识
///
/// 标识
public void RemoveAnalyInfo(string tag)
{
if (string.IsNullOrEmpty(AnalyInfo))
{
return;
}
var sss = AnalyInfo.Split('|').ToList();
for (int i = 0; i < sss.Count(); i++)
{
if (sss[i].StartsWith(tag))
{
sss.RemoveAt(i);
AnalyInfo = string.Join("|", sss);
if (AnalyInfo == "V1")
{
AnalyInfo = null;
}
return;
}
}
}
///
/// 有分析异常
///
///
///
public bool IsHaveAnaTag(string tag)
{
if (string.IsNullOrEmpty(AnalyInfo))
{
return false;
}
return AnalyInfo.Contains("|" + tag);
}
///
/// 运行状态发生异常的标识
///
public static string InfoTag_RU = "RU";
///
/// 频率发生异常的标识
///
public static string InfoTag_HZ = "HZ";
///
/// 流量发生异常的标识
///
public static string InfoTag_Qa = "Qa";
///
/// 扬程发生异常的标识
///
public static string InfoTag_Ha = "Ha";
///
/// 进口压力发生异常的标识
///
public static string InfoTag_P1 = "P1";
///
/// 出口压力发生异常的标识
///
public static string InfoTag_P2 = "P2";
///
/// 功率发生异常的标识
///
public static string InfoTag_Pa = "Pa";
///
/// 效率发生异常的标识
///
public static string InfoTag_Ea = "Ea";
///
/// 电流发生异常的标识
///
public static string InfoTag_Ia = "Ia";
///
/// 曲线发生异常的标识
///
public static string InfoTag_Curve = "Cu";
#endregion
#region 计算
///
///
///
///
///
public static double MPa2M(double mpa)
{
return mpa * 1000 / 9.81;
}
///
///
///
///
///
///
///
///
///
public static double Calc_Eta(double Q, double H, double P, double midu, double gavity)
{
P = P * 1000;//此处 1000 是 kw换成w
Q = Q / 3600;//此处 3600 是 小时换成秒
double E = 0;
if (P < 0.1)
E = 0;
else
E = midu * gavity * Q * H / P;
return Math.Round(E * 100, 2);//效率用百分数
}
///
///
///
///
///
///
///
public static double Calc_Eta(double Q, double H, double P)
{
double midu = 1000;
double gavity = 9.81;
P = P * 1000;//此处 1000 是 kw换成w
Q = Q / 3600;//此处 3600 是 小时换成秒
double E = 0;
if (P < 0.1)
E = 0;
else
E = midu * gavity * Q * H / P;
return Math.Round(E * 100, 2);//效率用百分数
}
///
///
///
///
public bool Calcu_WP()
{
if (this.Qa == null || this.Qa < 0.1)
return false;
if (this.Pa == null || this.Pa < 0.1)
return false;
this.WPa = Math.Round(this.Pa.Value / this.Qa.Value * 1000f, 3);
return true;
}
///
/// 单位水耗 千吨水
///
///
public bool Calcu_UWP()
{
if (this.Qa == null || this.Qa < 0.1)
return false;
if (this.Pa == null || this.Pa < 0.1)
return false;
if (this.Ha == null || this.Ha < 0.1)
return false;
this.UWPa = Math.Round(this.Pa.Value / this.Qa.Value / this.Ha.Value * 1000f, 4);
return true;
}
#endregion
}
}