HelpperMethod.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using GDNXFD.Data.Model;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace GDNXFD.WcfService
  8. {
  9. public class HelpperMethod
  10. {
  11. /// <summary>
  12. /// 获取风机状态
  13. /// </summary>
  14. /// <param name="statusValue">风机状态值</param>
  15. /// <returns>风机状态(枚举)</returns>
  16. public static WStatus GetWindturbineStatus(double statusValue)
  17. {
  18. WStatus status = WStatus.UnKnow;
  19. int st = Convert.ToInt32(statusValue);
  20. switch (st)
  21. {
  22. //0-停机-TJTS、 1-上电-SDTS、2-待机-DJTS、3-启动-QDTS、4-并网-BWTS、5-故障-GZTS、6-维护-WHTS、 7-离线-LXTS
  23. case 0: //停机状态
  24. status = WStatus.Stop;
  25. break;
  26. case 1: //上电状态
  27. status = WStatus.OnPower;
  28. break;
  29. case 2: //待机状态
  30. status = WStatus.Standby;
  31. break;
  32. case 3: //启动状态
  33. status = WStatus.Start;
  34. break;
  35. case 4: //并网状态
  36. status = WStatus.Online;
  37. break;
  38. case 5: //故障状态
  39. status = WStatus.Fault;
  40. break;
  41. case 6: //维护状态
  42. status = WStatus.Maintain;
  43. break;
  44. case 7: //离线状态
  45. status = WStatus.Offline;
  46. break;
  47. default:
  48. status = WStatus.UnKnow;
  49. break;
  50. }
  51. return status;
  52. }
  53. public static HungType GetHungType(double lockValue) {
  54. HungType hung = HungType.UnKnow;
  55. int st = Convert.ToInt32(lockValue);
  56. switch (st)
  57. {
  58. case 0: //未挂牌
  59. hung = HungType.UnLock;
  60. break;
  61. case 2: //场内受累检修
  62. hung = HungType.StationCheckLock;
  63. break;
  64. case 3: //场内受累故障
  65. hung = HungType.StationFaulLock;
  66. break;
  67. case 4: //场外受累电网
  68. hung = HungType.StationPowerLineLock;
  69. break;
  70. case 5: //场外受累天气
  71. hung = HungType.StationWeatherLock;
  72. break;
  73. case 7: //故障检修
  74. hung = HungType.FaultLock;
  75. break;
  76. case 8: //检修
  77. hung = HungType.CheckLock;
  78. break;
  79. default:
  80. hung = HungType.UnKnow;
  81. break;
  82. }
  83. return hung;
  84. }
  85. public static string GetWindDirection(double value)
  86. {
  87. if (value >= 11.25 && value < 33.75)
  88. return "NNE";
  89. else if (value >= 33.75 && value < 56.25)
  90. return "NE";
  91. else if (value >= 56.25 && value < 78.75)
  92. return "ENE";
  93. else if (value >= 78.75 && value < 101.25)
  94. return "E";
  95. else if (value >= 101.25 && value < 123.75)
  96. return "ESE";
  97. else if (value >= 123.75 && value < 146.25)
  98. return "SE";
  99. else if (value >= 146.25 && value < 168.75)
  100. return "SSE";
  101. else if (value >= 168.75 && value < 191.25)
  102. return "S";
  103. else if (value >= 191.25 && value < 213.75)
  104. return "SSW";
  105. else if (value >= 213.75 && value < 236.25)
  106. return "SW";
  107. else if (value >= 236.25 && value < 258.75)
  108. return "WSW";
  109. else if (value >= 258.75 && value < 281.25)
  110. return "W";
  111. else if (value >= 281.25 && value < 303.75)
  112. return "WNW";
  113. else if (value >= 303.75 && value < 326.25)
  114. return "NW";
  115. else if (value >= 326.25 && value < 348.75)
  116. return "NNW";
  117. else if (value >= 348.75 || value < 11.25)
  118. return "N";
  119. return "UNKNOW";
  120. }
  121. }
  122. }