using Aitex.Core.RT.Device; using Aitex.Core.RT.Log; using MECF.Framework.Common.Equipment; using CyberX8_RT.Devices.AXIS; using System; namespace CyberX8_RT.Devices.Loader { public class LoaderRotationAxisInterLock : IAxisInterLock { #region 内部变量 private JetAxisBase _axis; #endregion #region 属性 /// /// 模块名称 /// public string Module { get { return _axis.Module; } } /// /// 子模块名称 /// public string Name { get { return _axis.Name; } } #endregion /// /// 构造函数 /// /// /// public LoaderRotationAxisInterLock(JetAxisBase axis) { _axis = axis; } /// /// GotoPosition条件检验 /// /// /// /// public bool CheckGotoPosition(string station) { //Rotation is homed if (!_axis.IsHomed) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} Rotation is not home, Cannot execute GotoSavedPosition"); return false; } if (!AxisManager.Instance.CheckModuleAxisSwitchOn(Module, Name)) { return false; } //Loader ShuttleA JetAxisBase shuttleAAxis = DEVICE.GetDevice($"{Module}.ShuttleA"); if(shuttleAAxis == null) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} ShuttleA Axis is null"); return false; } if (shuttleAAxis.IsRun) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} shuttleA is running, Cannot execute GotoSavedPosition"); return false; } //Loader ShuttleB JetAxisBase shuttleBAxis = DEVICE.GetDevice($"{Module}.ShuttleB"); if (shuttleBAxis == null) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} ShuttleB Axis is null"); return false; } if (shuttleBAxis.IsRun) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} shuttleB is running, Cannot execute GotoSavedPosition"); return false; } //Loader TiltA JetAxisBase tiltAAxis = DEVICE.GetDevice($"{Module}.TiltA"); if (tiltAAxis == null) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} TiltA Axis is null"); return false; } if (tiltAAxis.IsRun) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} tiltA is running, Cannot execute GotoSavedPosition"); return false; } //Loader TiltB JetAxisBase tiltBAxis = DEVICE.GetDevice($"{Module}.TiltB"); if(tiltBAxis == null) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} tiltB Axis is null"); return false; } if (tiltBAxis.IsRun) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} tiltB is running, Cannot execute GotoSavedPosition"); return false; } //PUF1 的 ROTATION 轴在‘HOME’、‘FLIP’或‘ROBOT’位 if (ModuleHelper.IsInstalled(ModuleName.PUF1)) { JetAxisBase puf1RotationAxis = DEVICE.GetDevice($"{ModuleName.PUF1}.Rotation"); if(puf1RotationAxis == null) { LOG.WriteLog(eEvent.ERR_PUF, Module, "Puf1 Rotation Axis is null"); return false; } double puf1RotationPosition = puf1RotationAxis.MotionData.MotorPosition; if (!puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Home") && !puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Flip") && !puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Robot")) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"PUF1 Rotation {puf1RotationPosition} is not in Home, Flip or Robot station,Cannot execute GotoSavedPosition"); return false; } } //Loader 的 SHUTTLE A 轴在‘MID’、‘LS’或‘IN’位 double shuttleAPosition = shuttleAAxis.MotionData.MotorPosition; if (!shuttleAAxis.CheckPositionIsInStation(shuttleAPosition, "MID") && !shuttleAAxis.CheckPositionIsInStation(shuttleAPosition, "LS") && !shuttleAAxis.CheckPositionIsInStation(shuttleAPosition, "IN")) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} ShuttleA {shuttleAPosition} is not in MID, LS or IN station,Cannot execute GotoSavedPosition"); return false; } //Loader 的 SHUTTLE B 轴在‘MID’、‘LS’或‘IN’位 double shuttleBPosition = shuttleBAxis.MotionData.MotorPosition; if (!shuttleBAxis.CheckPositionIsInStation(shuttleBPosition, "MID") && !shuttleBAxis.CheckPositionIsInStation(shuttleBPosition, "LS") && !shuttleBAxis.CheckPositionIsInStation(shuttleBPosition, "IN")) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} ShuttleB {shuttleBPosition} is not in MID, LS or IN station,Cannot execute GotoSavedPosition"); return false; } //Loader transporter 的 ELEVATOR 在‘UP’位。 bool loaderTransporterInstalled = ModuleHelper.IsInstalled(ModuleName.Transporter2); if (loaderTransporterInstalled) { JetAxisBase loaderTransporterElevatorAxis = DEVICE.GetDevice($"{ModuleName.Transporter2}.Elevator"); if(loaderTransporterElevatorAxis == null) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, "Loader transporter elevator Axis is null"); return false; } double loaderTransporterPosition = loaderTransporterElevatorAxis.MotionData.MotorPosition; if (!loaderTransporterElevatorAxis.CheckPositionIsInStation(loaderTransporterPosition, "Up")) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"Loader transporter elevator is not in Up station, Cannot execute GotoSavedPosition"); return false; } } return true; } } }