WindturbineStatus.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using log4net;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Runtime.Serialization;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using WisdomClient.data;
  9. namespace IntelligentControlForsx.Model
  10. {
  11. public class WindturbineStatus
  12. {
  13. private ILog logger = LogManager.GetLogger("AppInfoLog");
  14. private string windturbineId;
  15. public string WindturbineId
  16. {
  17. get
  18. {
  19. return windturbineId;
  20. }
  21. }
  22. private DateTime lastUpdateTime;
  23. public DateTime LastUpdateTime
  24. {
  25. get
  26. {
  27. return lastUpdateTime;
  28. }
  29. }
  30. public int GetStatus()
  31. {
  32. TsData td = attributes["FJZT8"];
  33. if (td != null)
  34. {
  35. return Convert.ToInt32(td.doubleValue);
  36. }
  37. return 0;
  38. }
  39. public WindturbineStatus(string windturbineId)
  40. {
  41. this.windturbineId = windturbineId;
  42. }
  43. #region 属性缓存定义
  44. private Dictionary<String, TsData> attributes = new Dictionary<string, TsData>();
  45. /// <summary>
  46. /// 以索引的方式访问场站属性状态,注意用统一编码做索引
  47. /// </summary>
  48. /// <param name="key"></param>
  49. /// <returns></returns>
  50. public TsData this[string key]
  51. {
  52. get {
  53. if (attributes.ContainsKey(key))
  54. return attributes[key];
  55. else
  56. return new TsData();
  57. }
  58. set
  59. {
  60. if (attributes.ContainsKey(key))
  61. {
  62. attributes[key] = value;
  63. } else
  64. {
  65. attributes.Add(key, value);
  66. }
  67. }
  68. }
  69. #endregion
  70. #region 重写比较方法
  71. public override bool Equals(object obj)
  72. {
  73. WindturbineStatus ws = obj as WindturbineStatus;
  74. if (ws != null && ws.WindturbineId == this.WindturbineId)
  75. return true;
  76. return false;
  77. }
  78. public override int GetHashCode()
  79. {
  80. return base.GetHashCode();
  81. }
  82. #endregion
  83. }
  84. }