SrdCommonChuckATMRoutine.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using CyberX8_Core;
  6. using MECF.Framework.Common.Beckhoff.ModuleIO;
  7. using MECF.Framework.Common.IOCore;
  8. using MECF.Framework.Common.Routine;
  9. namespace CyberX8_RT.Devices.SRD
  10. {
  11. public class SrdCommonChuckATMRoutine : RoutineBase, IRoutine
  12. {
  13. #region 常量
  14. private const string CHUCK_ATM_ON = "ChuckATMOn";
  15. #endregion
  16. private enum ChuckATMStep
  17. {
  18. ChuckATMOn,
  19. Delay,
  20. ChuckATMOff,
  21. End
  22. }
  23. #region 内部变量
  24. /// <summary>
  25. /// Srd Device
  26. /// </summary>
  27. private SrdCommonDevice _srdCommon;
  28. /// <summary>
  29. /// 破真空持续时间
  30. /// </summary>
  31. private int _duration= 100;
  32. #endregion
  33. /// <summary>
  34. /// 构造函数
  35. /// </summary>
  36. /// <param name="module"></param>
  37. public SrdCommonChuckATMRoutine(string module) : base(module)
  38. {
  39. }
  40. public void Abort()
  41. {
  42. Runner.Stop("Manual Abort");
  43. }
  44. public RState Monitor()
  45. {
  46. Runner.Run(ChuckATMStep.ChuckATMOn, ChuckATMOn, _delay_1ms)
  47. .Delay(ChuckATMStep.Delay, _duration)
  48. .Run(ChuckATMStep.ChuckATMOff, ChuckATMOff, _delay_1ms)
  49. .End(ChuckATMStep.End, NullFun, 100);
  50. return Runner.Status;
  51. }
  52. public RState Start(params object[] objs)
  53. {
  54. _srdCommon = DEVICE.GetDevice<SrdCommonDevice>($"{Module}.Common");
  55. return Runner.Start(Module, "Chuck ATM Click");
  56. }
  57. /// <summary>
  58. /// Chuck ATM On
  59. /// </summary>
  60. /// <returns></returns>
  61. private bool ChuckATMOn()
  62. {
  63. return _srdCommon.ChuckATMOnAction("", null);
  64. }
  65. /// <summary>
  66. /// Chuck ATM Off
  67. /// </summary>
  68. /// <returns></returns>
  69. private bool ChuckATMOff()
  70. {
  71. return _srdCommon.ChuckATMOffAction("", null);
  72. }
  73. }
  74. }