123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- 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 LoaderShuttleAxisInterLock : IAxisInterLock
- {
- #region 内部变量
- private JetAxisBase _axis;
- #endregion
- #region 属性
- /// <summary>
- /// 模块名称
- /// </summary>
- public string Module { get { return _axis.Module ; } }
- /// <summary>
- /// 子模块名称
- /// </summary>
- public string Name { get { return _axis.Name; } }
- #endregion
- #region 内部变量
- private LoaderSideDevice _loaderSide = null;
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="Module"></param>
- /// <param name="name"></param>
- public LoaderShuttleAxisInterLock(JetAxisBase axis)
- {
- _axis = axis;
- }
- /// <summary>
- /// 加载LoaderSide对象
- /// </summary>
- private void GetLoaderSide()
- {
- if (_loaderSide == null)
- {
- switch (Name)
- {
- case "ShuttleA":
- _loaderSide = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideA");
- break;
- default:
- _loaderSide = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideB");
- break;
- }
- }
- }
- /// <summary>
- /// GotoPosition条件检验
- /// </summary>
- /// <param name="station"></param>
- /// <returns></returns>
- /// <exception cref="NotImplementedException"></exception>
- public bool CheckGotoPosition(string station)
- {
- if (!_axis.IsHomed)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is not home, Cannot execute GotoSavedPosition");
- return false;
- }
- JetAxisBase rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
- if(rotationAxis == null)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} rotation Axis is null");
- return false;
- }
- if (!rotationAxis.IsSwitchOn)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{rotationAxis.Module} is switch off");
- return false;
- }
- if (rotationAxis.IsRun)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} rotation is running,Cannot execute GotoSavedPosition");
- return false;
- }
- GetLoaderSide();
- JetAxisBase tiltAxis = null;
- if (Name == "ShuttleA")
- {
- tiltAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.TiltA");
- }
- else
- {
- tiltAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.TiltB");
- }
- if (tiltAxis == null)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} tilt Axis is null");
- return false;
- }
- if (!tiltAxis.IsSwitchOn)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{tiltAxis.Module} is switch off");
- return false;
- }
- if (tiltAxis.IsRun)
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, "tilt is running,Cannot execute GotoSavedPosition");
- return false;
- }
- //Loader 的 TILT 轴在‘VERT’位
- double tiltPosition = tiltAxis.MotionData.MotorPosition;
- if (!tiltAxis.CheckPositionIsInStation(tiltPosition, "VERT"))
- {
- LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module} Tilt {tiltPosition} is not in VERT station,Cannot execute GotoSavedPosition");
- return false;
- }
- //PUF1 的 ROTATION 轴在‘HOME’、‘FLIP’或‘ROBOT’位
- if (ModuleHelper.IsInstalled(ModuleName.PUF1))
- {
- JetAxisBase puf1RotationAxis = DEVICE.GetDevice<JetAxisBase>($"{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;
- }
- }
- return true;
- }
- }
- }
|