using log4net; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using WisdomClient.data; namespace IntelligentControlForsx.Model { public class WindturbineStatus { private ILog logger = LogManager.GetLogger("AppInfoLog"); private string windturbineId; public string WindturbineId { get { return windturbineId; } } private DateTime lastUpdateTime; public DateTime LastUpdateTime { get { return lastUpdateTime; } } public int GetStatus() { TsData td = attributes["FJZT8"]; if (td != null) { return Convert.ToInt32(td.doubleValue); } return 0; } public WindturbineStatus(string windturbineId) { this.windturbineId = windturbineId; } #region 属性缓存定义 private Dictionary attributes = new Dictionary(); /// /// 以索引的方式访问场站属性状态,注意用统一编码做索引 /// /// /// public TsData this[string key] { get { if (attributes.ContainsKey(key)) return attributes[key]; else return new TsData(); } set { if (attributes.ContainsKey(key)) { attributes[key] = value; } else { attributes.Add(key, value); } } } #endregion #region 重写比较方法 public override bool Equals(object obj) { WindturbineStatus ws = obj as WindturbineStatus; if (ws != null && ws.WindturbineId == this.WindturbineId) return true; return false; } public override int GetHashCode() { return base.GetHashCode(); } #endregion } }