PrewetPumpDisableRoutine.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Aitex.Core.RT.Routine;
  2. using CyberX8_Core;
  3. using MECF.Framework.Common.Persistent.Prewet;
  4. using MECF.Framework.Common.Routine;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace CyberX8_RT.Devices.Prewet
  11. {
  12. public class PrewetPumpDisableRoutine : RoutineBase, IRoutine
  13. {
  14. private enum PumpDisableStep
  15. {
  16. PumpDisable,
  17. Delay,
  18. PumpValveClose,
  19. End
  20. }
  21. #region 内部变量
  22. PrewetDevice _device;
  23. PrewetPersistentValue _prewetPersistentValue;
  24. #endregion
  25. /// <summary>
  26. /// 构造函数
  27. /// </summary>
  28. /// <param name="module"></param>
  29. public PrewetPumpDisableRoutine(string module, PrewetDevice prewetDevice, PrewetPersistentValue prewetPersistentValue) : base(module)
  30. {
  31. _device = prewetDevice;
  32. _prewetPersistentValue = prewetPersistentValue;
  33. }
  34. /// <summary>
  35. /// 中止
  36. /// </summary>
  37. public void Abort()
  38. {
  39. Runner.Stop("Manual Abort");
  40. }
  41. /// <summary>
  42. /// 监控
  43. /// </summary>
  44. /// <returns></returns>
  45. public RState Monitor()
  46. {
  47. Runner.Run(PumpDisableStep.PumpDisable, _device.PumpDisable, 500)
  48. .Delay(PumpDisableStep.Delay, 500)
  49. .Run(PumpDisableStep.PumpValveClose, _device.PumpValveClose, 500)
  50. .End(PumpDisableStep.End, NullFun, _delay_1ms);
  51. return Runner.Status;
  52. }
  53. /// <summary>
  54. /// 启动
  55. /// </summary>
  56. /// <param name="objs"></param>
  57. /// <returns></returns>
  58. public RState Start(params object[] objs)
  59. {
  60. return Runner.Start(Module, "Pump Disable");
  61. }
  62. }
  63. }