123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Log;
- using MECF.Framework.Common.Utilities;
- using CyberX8_RT.Devices.AXIS;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using MECF.Framework.Common.Equipment;
- using Aitex.Core.Util;
- using CyberX8_RT.Modules;
- namespace CyberX8_RT.Devices.Loader
- {
- public class LoaderTiltAxisInterLock : 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
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="Module"></param>
- /// <param name="name"></param>
- public LoaderTiltAxisInterLock(JetAxisBase axis)
- {
- _axis = axis;
- }
- /// <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;
- }
- ////Puf vertical is park
- //if (ModuleHelper.IsInstalled(ModuleName.PUF1))
- //{
- // JetAxisBase puf1VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Vertical");
- // if (puf1VerticalAxis != null)
- // {
- // double puf1VerticalPosition = puf1VerticalAxis.MotionData.MotorPosition;
- // if (!puf1VerticalAxis.CheckPositionIsInStation(puf1VerticalPosition, "Park"))
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} {puf1VerticalPosition} is not in Park, Cannot execute GotoSavedPosition");
- // return false;
- // }
- // }
- //}
- //if (ModuleHelper.IsInstalled(ModuleName.PUF2))
- //{
- // JetAxisBase puf2VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Vertical");
- // if (puf2VerticalAxis != null)
- // {
- // double puf2VerticalPosition = puf2VerticalAxis.MotionData.MotorPosition;
- // if (!puf2VerticalAxis.CheckPositionIsInStation(puf2VerticalPosition, "Park"))
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF2} {puf2VerticalPosition} is not in Park, Cannot execute GotoSavedPosition");
- // return false;
- // }
- // }
- //}
- //JetAxisBase swingAxis = null;
- //double swingPosition = 0;
- //if (Name == "TiltA")
- //{
- // swingAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.SwingA");
- // swingPosition=swingAxis.MotionData.MotorPosition;
- // if (!swingAxis.IsSwitchOn)
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingA is switch off");
- // return false;
- // }
- // if (swingAxis.IsRun)
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingA is running,Cannot execute GotoSavedPosition");
- // return false;
- // }
- //}
- //else
- //{
- // swingAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.SwingB");
- // swingPosition=swingAxis.MotionData.MotorPosition;
- // if (!swingAxis.IsSwitchOn)
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingB is switch off");
- // return false;
- // }
- // if (swingAxis.IsRun)
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingB is running,Cannot execute GotoSavedPosition");
- // return false;
- // }
- //}
- //JetAxisBase rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
- //if (!rotationAxis.IsSwitchOn)
- //{
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"rotation is switch off");
- // return false;
- //}
- //if (rotationAxis.IsRun)
- //{
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"rotation is running,Cannot execute GotoSavedPosition");
- // return false;
- //}
- //if(swingAxis.CheckPositionIsEmpty(swingPosition))
- //{
- // return true;
- //}
- ////Swing在CLOSED,不可以去某一Station
- //if (swingAxis.CheckPositionIsInStation(swingPosition, "CLOSED"))
- //{
- // //LOG.WriteLog(eEvent.ERR_LOADER, Module, "Swing is CLOSED, Cannot execute GotoSavedPosition");
- // //return false;
- // return true;
- //}
- ////Swing在OPEN/OPENB,除了FLIP外其他位置都可以去
- //if (swingAxis.CheckPositionIsInStation(swingPosition, "OPEN")||
- // swingAxis.CheckPositionIsInStation(swingPosition,"OPENB"))
- //{
- // if(station.EndsWith("FLIP"))
- // {
- // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"Swing {swingPosition} is OPEN/OPENB, Cannot Goto Flip");
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
- ////Swing在Clean
- //if(swingAxis.CheckPositionIsInStation(swingPosition,"CLEAN"))
- //{
- // return true;
- //}
- return true;
- }
-
- }
- }
|