CleverInfoSvc.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using WisdomClient;
  7. using WisdomClient.data;
  8. namespace IntelligentControlForsx.Service.WindturbineControl
  9. {
  10. public class CleverInfoSvc
  11. {
  12. public static CleverInfoSvc Instance
  13. {
  14. get { return SingletonCreator.instance; }
  15. }
  16. class SingletonCreator
  17. {
  18. internal static readonly CleverInfoSvc instance = new CleverInfoSvc();
  19. }
  20. public static Dictionary<string, TsData> agcInfoDic = new Dictionary<string, TsData>();
  21. public void GetAgcInfo(string stationId)
  22. {
  23. if (stationId != "SBQ_FDC")
  24. {
  25. string[] uniformCode = new string[]
  26. {
  27. "YGSDZ",
  28. "SSZGL",
  29. "ZLLGL",
  30. "ZZSGL",
  31. "FCFGCDQ0001",
  32. "FCFGCDQ0002",
  33. "FCFGCDQ0004",
  34. "FCFGCDQ0016"
  35. };
  36. Dictionary<string, TsData> dicResult = RestfulClient.findLatestByThingCodes("station", stationId,
  37. uniformCode);
  38. agcInfoDic = dicResult;
  39. }
  40. else
  41. {
  42. string[] uniformCode = new string[]
  43. {
  44. "SSZGL",
  45. "ZLLGL",
  46. "ZZSGL",
  47. "FCFGCDQ0001",
  48. "FCFGCDQ0002",
  49. "FCFGCDQ0004",
  50. "FCFGCDQ0016"
  51. };
  52. Dictionary<string, TsData> dicResult = RestfulClient.findLatestByThingCodes("station", stationId,
  53. uniformCode);
  54. string[] pointArr = { "SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0818", "SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0827" };
  55. Dictionary<string, TsData> agcPowerSetDic = RestfulClient.findLatestByTagNames(pointArr);
  56. if (agcPowerSetDic.Count == 2)
  57. {
  58. if (agcPowerSetDic.ContainsKey("SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0827") &&
  59. agcPowerSetDic.ContainsKey("SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0818"))
  60. {
  61. TsData d1 = agcPowerSetDic["SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0818"];
  62. TsData d2 = agcPowerSetDic["SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0827"];
  63. TsData resultData = new TsData();
  64. resultData.ts = d1.ts;
  65. resultData.doubleValue = d1.doubleValue + d2.doubleValue;
  66. if (!dicResult.ContainsKey("YGSDZ"))
  67. {
  68. dicResult.Add("YGSDZ", resultData);
  69. }
  70. }
  71. }
  72. agcInfoDic = dicResult;
  73. }
  74. }
  75. }
  76. }