添加load腔顶升和闸板阀代码
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Aitex.Core.RT.DataCenter;
|
||||
using Aitex.Core.RT.DataCenter;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Fsm;
|
||||
@@ -13,7 +10,12 @@ using Aitex.Core.Utilities;
|
||||
using Aitex.Sorter.Common;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using SicModules.EFEMs.Routines;
|
||||
using SicModules.LLs.Routines;
|
||||
using SicModules.TMs.Routines;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SicModules.LLs
|
||||
{
|
||||
@@ -39,6 +41,8 @@ namespace SicModules.LLs
|
||||
Separating,
|
||||
Grouping,
|
||||
RotationHomeOffset,
|
||||
OpenSlitValve,
|
||||
CloseSlitValve,
|
||||
}
|
||||
|
||||
public enum MSG
|
||||
@@ -63,6 +67,8 @@ namespace SicModules.LLs
|
||||
Separate,
|
||||
Group,
|
||||
RelativeHomeOffset,
|
||||
OpenSlitValve,
|
||||
CloseSlitValve,
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +173,7 @@ namespace SicModules.LLs
|
||||
private LoadSeparateRoutine _loadSeparateRoutine;
|
||||
|
||||
private LoadRotationHomeOffsetRoutine _loadRotationHomeOffsetRoutine;
|
||||
private LoadLockSlitValveRoutine _slitValveRoutine;
|
||||
|
||||
|
||||
public LoadLockModule(ModuleName module) : base(1)
|
||||
@@ -217,6 +224,7 @@ namespace SicModules.LLs
|
||||
_loadLockGroupRoutine = new LoadLockGroupRoutine(module);
|
||||
_loadSeparateRoutine = new LoadSeparateRoutine(module);
|
||||
_loadRotationHomeOffsetRoutine = new LoadRotationHomeOffsetRoutine();
|
||||
_slitValveRoutine = new LoadLockSlitValveRoutine();
|
||||
}
|
||||
|
||||
private void InitDevice()
|
||||
@@ -243,7 +251,6 @@ namespace SicModules.LLs
|
||||
|
||||
Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
|
||||
|
||||
|
||||
//PrepareTransfer
|
||||
Transition(STATE.Idle, MSG.PrepareTransfer, FsmStartPrepareTransfer, STATE.PrepareTransfer);
|
||||
Transition(STATE.PrepareTransfer, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
|
||||
@@ -273,6 +280,15 @@ namespace SicModules.LLs
|
||||
Transition(STATE.LeakCheck, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
|
||||
Transition(STATE.LeakCheck, MSG.Abort, FsmAbortTask, STATE.Idle);
|
||||
|
||||
//open SlitValve
|
||||
Transition(STATE.Idle, MSG.OpenSlitValve, FsmStartOpenSlitValve, STATE.OpenSlitValve);
|
||||
Transition(STATE.OpenSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
|
||||
Transition(STATE.OpenSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
|
||||
|
||||
//close SlitValve
|
||||
Transition(STATE.Idle, MSG.CloseSlitValve, FsmStartCloseSlitValve, STATE.CloseSlitValve);
|
||||
Transition(STATE.CloseSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
|
||||
Transition(STATE.CloseSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
|
||||
|
||||
//Separate
|
||||
Transition(STATE.Idle, MSG.Separate, FsmStartSeparate, STATE.Separating);
|
||||
@@ -331,6 +347,16 @@ namespace SicModules.LLs
|
||||
return CheckToPostMessage((int)MSG.CloseDoor);
|
||||
});
|
||||
|
||||
OP.Subscribe($"{Name}.OpenSlitValve", (string cmd, object[] args) =>
|
||||
{
|
||||
return CheckToPostMessage((int)MSG.OpenSlitValve);
|
||||
});
|
||||
|
||||
OP.Subscribe($"{Name}.CloseSlitValve", (string cmd, object[] args) =>
|
||||
{
|
||||
return CheckToPostMessage((int)MSG.CloseSlitValve);
|
||||
});
|
||||
|
||||
OP.Subscribe($"{Name}.Reset", (string cmd, object[] args) =>
|
||||
{
|
||||
return CheckToPostMessage((int)MSG.Reset);
|
||||
@@ -693,6 +719,26 @@ namespace SicModules.LLs
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool FsmStartOpenSlitValve(object[] param)
|
||||
{
|
||||
_slitValveRoutine.Init(true);
|
||||
|
||||
Result ret = StartRoutine(_slitValveRoutine);
|
||||
if (ret == Result.FAIL || ret == Result.DONE)
|
||||
return false;
|
||||
return ret == Result.RUN;
|
||||
}
|
||||
|
||||
private bool FsmStartCloseSlitValve(object[] param)
|
||||
{
|
||||
_slitValveRoutine.Init(false);
|
||||
|
||||
Result ret = StartRoutine(_slitValveRoutine);
|
||||
if (ret == Result.FAIL || ret == Result.DONE)
|
||||
return false;
|
||||
return ret == Result.RUN;
|
||||
}
|
||||
|
||||
public override bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Device.Unit;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
|
||||
using SicModules.EFEMs.Routines;
|
||||
using SicModules.TMs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace SicModules.LLs.Routines
|
||||
{
|
||||
public class LoadLockSlitValveRoutine : LoadLockBaseRoutine
|
||||
{
|
||||
enum RoutineStep
|
||||
{
|
||||
ServoRoutine,
|
||||
LiftRoutine,
|
||||
CheckPressureCondition,
|
||||
CheckPressure,
|
||||
SetSlitValve,
|
||||
CheckPressureCondition2,
|
||||
TimeDlay1
|
||||
}
|
||||
|
||||
private int _motionTimeout = 30;
|
||||
private bool _paramIsOpen; //是否开门
|
||||
private SicTM _tm;
|
||||
private IoSlitValve _slitvalveLoadLockLeft;
|
||||
private LoadLockServoToRoutine _llServoToRoutine;
|
||||
private LoadLockLiftRoutine _llLiftRoutine;
|
||||
|
||||
public void Init(bool isOpen)
|
||||
{
|
||||
_paramIsOpen = isOpen;
|
||||
Name = isOpen ? "Open Slit Valve" : "Close Slit Valve";
|
||||
}
|
||||
|
||||
public LoadLockSlitValveRoutine()
|
||||
{
|
||||
Module = ModuleName.LoadLock.ToString();
|
||||
Name = "LoadLockSlitValue";
|
||||
_tm = DEVICE.GetDevice<SicTM>($"{ModuleName.System.ToString()}.{ModuleName.TM.ToString()}");
|
||||
_llServoToRoutine = new LoadLockServoToRoutine(ModuleName.LoadLock);
|
||||
|
||||
_llLiftRoutine = new LoadLockLiftRoutine();
|
||||
_slitvalveLoadLockLeft = DEVICE.GetDevice<IoSlitValve>("LoadLock.LoadLockLSideDoor");
|
||||
|
||||
}
|
||||
|
||||
public override Result Start(params object[] objs)
|
||||
{
|
||||
Reset();
|
||||
if (_paramIsOpen)
|
||||
{
|
||||
//判断TM到LoadLock或者UnLoad的门是否关上
|
||||
if (!_tm.CheckSlitValveClose(ModuleName.LoadLock))
|
||||
{
|
||||
EV.PostWarningLog(Module, $"can not open left slit valve,TM slit valve not closed, can not open at same time");
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
_motionTimeout = SC.GetValue<int>("System.SlitValveMotionTimeout");
|
||||
|
||||
_llServoToRoutine.Init(SC.GetValue<double>("LoadLock.AtmPressureBase"));
|
||||
_llLiftRoutine.Init(false);
|
||||
}
|
||||
Notify("Start");
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public override Result Monitor()
|
||||
{
|
||||
try
|
||||
{
|
||||
//开门之前需要对两边腔体进行气压调节,降Lift
|
||||
if (_paramIsOpen)
|
||||
{
|
||||
ExecuteRoutine((int)RoutineStep.ServoRoutine, _llServoToRoutine);
|
||||
ExecuteRoutine((int)RoutineStep.LiftRoutine, _llLiftRoutine);
|
||||
}
|
||||
|
||||
SetSlitValve((int)RoutineStep.SetSlitValve, _paramIsOpen, _motionTimeout);
|
||||
|
||||
TimeDelay((int)RoutineStep.TimeDlay1, 1);
|
||||
|
||||
}
|
||||
catch (RoutineBreakException)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
catch (RoutineFaildException)
|
||||
{
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
Notify("Finished");
|
||||
return Result.DONE;
|
||||
|
||||
}
|
||||
|
||||
public void SetSlitValve(int id, bool isOpen, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"set left slit valve " + (isOpen ? "Open" : "Close"));
|
||||
|
||||
if (!_slitvalveLoadLockLeft.SetSlitValve(isOpen, out string reason))
|
||||
{
|
||||
Stop(reason);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}, () =>
|
||||
{
|
||||
return isOpen ? _slitvalveLoadLockLeft.IsOpen : _slitvalveLoadLockLeft.IsClose;
|
||||
|
||||
}, timeout * 1000);
|
||||
|
||||
if (ret.Item1)
|
||||
{
|
||||
if (ret.Item2 == Result.FAIL)
|
||||
{
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else if (ret.Item2 == Result.TIMEOUT) //timeout
|
||||
{
|
||||
Stop($"can not complete in {timeout} seconds");
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else
|
||||
throw (new RoutineBreakException());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user