SrdRotationAxisInterLock.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using CyberX8_RT.Devices.AXIS;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace CyberX8_RT.Devices.SRD
  10. {
  11. public class SrdRotationAxisInterLock : IAxisInterLock
  12. {
  13. #region 内部变量
  14. private JetAxisBase _axis;
  15. #endregion
  16. #region 属性
  17. /// <summary>
  18. /// 模块名称
  19. /// </summary>
  20. public string Module { get { return _axis.Module; } }
  21. /// <summary>
  22. /// 子模块名称
  23. /// </summary>
  24. public string Name { get { return _axis.Name; } }
  25. #endregion
  26. /// <summary>
  27. /// 构造函数
  28. /// </summary>
  29. /// <param name="Module"></param>
  30. /// <param name="name"></param>
  31. public SrdRotationAxisInterLock(JetAxisBase axis)
  32. {
  33. _axis = axis;
  34. }
  35. public bool CheckGotoPosition(string station)
  36. {
  37. if (!_axis.IsHomed)
  38. {
  39. LOG.WriteLog(eEvent.ERR_PUF, Module, "axis is not home, Cannot execute GotoSavedPosition");
  40. return false;
  41. }
  42. if (!_axis.IsSwitchOn)
  43. {
  44. LOG.WriteLog(eEvent.ERR_PUF, Module, "axis is switch off, Cannot execute GotoSavedPosition");
  45. return false;
  46. }
  47. SrdCommonDevice common = DEVICE.GetDevice<SrdCommonDevice>($"{Module}.Common");
  48. if(!common.CommonData.DoorClosed)
  49. {
  50. LOG.WriteLog(eEvent.ERR_SRD, Module, "Door is not closed,Rotation can not position");
  51. return false;
  52. }
  53. //Check Flippers
  54. if (common.CommonData.FlippersIn150 || common.CommonData.FlippersIn200) //|| _srdCommon.CommonData.FlippersIn100
  55. {
  56. LOG.WriteLog(eEvent.ERR_SRD, Module,"FlippersIn is on");
  57. return false;
  58. }
  59. if (!common.CommonData.Flipper1Out150Status || !common.CommonData.Flipper2Out150Status || !common.CommonData.Flipper3Out150Status
  60. || !common.CommonData.Flipper1Out200Status || !common.CommonData.Flipper2Out200Status || !common.CommonData.Flipper3Out200Status)
  61. //|| !_srdCommon.CommonData.Flipper1Out100Status || !_srdCommon.CommonData.Flipper2Out100Status || !_srdCommon.CommonData.Flipper3Out100Status
  62. {
  63. LOG.WriteLog(eEvent.ERR_SRD, Module,"Flippers are at In position");
  64. return false;
  65. }
  66. return true;
  67. }
  68. }
  69. }