ChillerBase.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net.Configuration;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml;
  8. using Aitex.Core.Common.DeviceData;
  9. using Aitex.Core.RT.DataCenter;
  10. using Aitex.Core.RT.Device;
  11. using Aitex.Core.RT.Event;
  12. using Aitex.Core.RT.IOCore;
  13. using Aitex.Core.RT.OperationCenter;
  14. using Aitex.Core.RT.SCCore;
  15. using Aitex.Core.Util;
  16. namespace MECF.Framework.Common.Device.Bases
  17. {
  18. public abstract class ChillerBase : BaseDevice, IDevice
  19. {
  20. public virtual bool IsOn { get; set; }
  21. public virtual bool IsError { get; set; }
  22. public virtual bool IsStable { get; set; }
  23. public virtual bool IsRunning { get; set; }
  24. public virtual bool IsControl { get; set; }
  25. public virtual float Temperature { get; set; }
  26. public virtual float CoolantInletTcFeedback { get; set; }
  27. public virtual float ControlTcFeedback { get; set; }
  28. public virtual float CoolantOutletTcFeedback { get; set; }
  29. public virtual AITChillerData DeviceData { get; set; }
  30. protected ChillerBase() : base()
  31. {
  32. }
  33. protected ChillerBase(string module, string name, string display, string id) : base(module, name, display, id)
  34. {
  35. }
  36. public virtual bool Initialize()
  37. {
  38. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  39. DATA.Subscribe($"{Module}.{Name}.IsOn", () => IsRunning);
  40. DATA.Subscribe($"{Module}.{Name}.Temperature", () => Temperature);
  41. OP.Subscribe($"{Module}.{Name}.SetPowerOnOff", (function, args) =>
  42. {
  43. bool isEnable = Convert.ToBoolean((string)args[0]);
  44. SetChillerOnOff(isEnable);
  45. return true;
  46. });
  47. OP.Subscribe($"{Module}.{Name}.ChillerOn", (function, args) =>
  48. {
  49. SetChillerOnOff(true);
  50. return true;
  51. });
  52. OP.Subscribe($"{Module}.{Name}.ChillerOff", (function, args) =>
  53. {
  54. SetChillerOnOff(false);
  55. return true;
  56. });
  57. OP.Subscribe($"{Module}.{Name}.Ramp", (function, args) =>
  58. {
  59. SetChillerTemp((float)Convert.ToDouble((string)args[0]), (float)Convert.ToDouble((string)args[1]));
  60. return true;
  61. });
  62. return true;
  63. }
  64. public virtual void SetChillerOnOff(bool isOn) { }
  65. public virtual void SetChillerTemp(float value, float offset) { }
  66. public virtual void Terminate() { }
  67. public virtual void Monitor() { }
  68. public virtual void Reset() { }
  69. public virtual bool ReConnect()
  70. {
  71. return true;
  72. }
  73. }
  74. }