123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- 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<String, TsData> attributes = new Dictionary<string, TsData>();
- /// <summary>
- /// 以索引的方式访问场站属性状态,注意用统一编码做索引
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- 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
- }
- }
|