SicMultiplate/Modules/Mainframe/LLs/Routines/LoadLockTrayLoadAngleRoutin...

97 lines
2.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using SicModules.LLs.Routines.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace SicModules.LLs.Routines
{
/// <summary>
/// Tray盘在Load腔中根据感应器找上料角度
/// </summary>
public class LoadLockTrayLoadAngleRoutine : LoadLockBaseRoutine
{
private enum RoutineStep
{
TimeDelay1,
TrayClamp,
TrayUnClamp,
ResetRotationServo,
RotationServoOn,
MoveTrayHome,
WaitMoveDone,
TimeDelay2,
}
private int _homeTimeout;
private LoadLockTrayClawRoutine _trayClamp = new LoadLockTrayClawRoutine();
private LoadLockTrayClawRoutine _trayUnClamp = new LoadLockTrayClawRoutine();
public LoadLockTrayLoadAngleRoutine(ModuleName module)
{
Module = module.ToString();
Name = "Tray Load Angle";
}
public override Result Start(params object[] objs)
{
Reset();
_trayClamp.Init(true);
_trayUnClamp.Init(false);
_homeTimeout = SC.GetValue<int>("LoadLock.HomeTimeout");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (SC.GetValue<bool>($"System.IsSimulatorMode"))
{
return Result.DONE;
}
//对中
ExecuteRoutine((int)RoutineStep.TrayClamp, _trayClamp); //夹爪关闭
TimeDelay((int)RoutineStep.TimeDelay1, 1);//延迟1s
ExecuteRoutine((int)RoutineStep.TrayUnClamp, _trayUnClamp); //夹爪打开
//伺服 开启TrayHome信号
ResetRotationServo((int)RoutineStep.ResetRotationServo, 3);
RotationServoOn((int)RoutineStep.RotationServoOn, 3);
MoveTrayHome((int)RoutineStep.MoveTrayHome, _homeTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
//等待感应器定位Tray盘对位
WaitLoadRotationDone((int)RoutineStep.WaitMoveDone, _homeTimeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
}
}