LidBase.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.Common.DeviceData;
  7. using Aitex.Core.RT.DataCenter;
  8. using Aitex.Core.RT.Device;
  9. namespace MECF.Framework.Common.Device.Bases
  10. {
  11. public abstract class LidBase : BaseDevice, IDevice
  12. {
  13. public virtual bool OpenFeedback { get; set; }
  14. public virtual bool CloseFeedback { get; set; }
  15. public virtual bool OpenSetPoint { get; set; }
  16. public virtual bool CloseSetPoint { get; set; }
  17. public virtual AITCylinderData DeviceData { get; set; }
  18. protected LidBase() : base()
  19. {
  20. }
  21. protected LidBase(string module, string name) : base(module, name, name, name)
  22. {
  23. }
  24. public bool Initialize()
  25. {
  26. DATA.Subscribe($"{Module}.{Name}.OpenFeedback", () => OpenFeedback);
  27. DATA.Subscribe($"{Module}.{Name}.OpenSetPoint", () => OpenSetPoint);
  28. DATA.Subscribe($"{Module}.{Name}.CloseFeedback", () => CloseFeedback);
  29. DATA.Subscribe($"{Module}.{Name}.CloseSetPoint", () => CloseSetPoint);
  30. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  31. DEVICE.Register($"{Module}.{Name}.Open", (out string reason, int time, object[] param) =>
  32. {
  33. reason = "";
  34. return SetSlitValve(true, out reason);
  35. });
  36. DEVICE.Register($"{Module}.{Name}.Close", (out string reason, int time, object[] param) =>
  37. {
  38. reason = "";
  39. return SetSlitValve(false, out reason);
  40. });
  41. return true;
  42. }
  43. public void Monitor()
  44. {
  45. }
  46. public void Terminate()
  47. {
  48. }
  49. public virtual bool SetSlitValve(bool open, out string reason)
  50. {
  51. reason = "";
  52. return true;
  53. }
  54. public void Reset()
  55. {
  56. }
  57. }
  58. }