123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- using System;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using EFEM.RT.Devices;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- namespace EFEM.RT.Routines.LP
- {
- internal class HomeRoutine : CommonRoutine, IRoutine
- {
- enum Home
- {
- Reset,
- Home,
- Wait,
- }
- private SCConfigItem _scHomeTimeout = null;
- private int _timeoutHome = 0;
- public ModuleName Chamber { get; set; }
- LoadPortBaseDevice _device = null;
- public HomeRoutine(string module, string name)
- {
- Module = module;
- Name = name;
- }
- public bool Initalize()
- {
- _scHomeTimeout = SC.GetConfigItem("LoadPort.TimeLimitLoadportLoad");
- return true;
- }
- public Result Start(params object[] objs)
- {
- _timeoutHome = _scHomeTimeout.IntValue;
- Reset();
- _device = DEVICE.GetDevice<LoadPortBaseDevice>(Chamber.ToString());
- EV.PostMessage(Chamber.ToString(), EventEnum.HomeBegins, Chamber.ToString());
-
- string reason = string.Empty;
- if (SC.GetValue<bool>("System.LPRobotActionIntervene"))
- {
- if(!CheckLoadportMotionInterlock(Chamber, out reason))
- {
- EV.PostMessage(Chamber.ToString(), EventEnum.HomeFailed, reason);
- return Result.FAIL;
- }
- }
- if (Chamber == ModuleName.LP1)
- {
- if (DeviceModel.SensorRBNotExtendSIMF1 != null && DeviceModel.SensorRBNotExtendSIMF1.Value)
- {
- EV.PostMessage(Chamber.ToString(), EventEnum.DefaultWarning, "robot Extend to LP1.");
- }
- }
- else
- {
- if (DeviceModel.SensorRBNotExtendSIMF2 != null && DeviceModel.SensorRBNotExtendSIMF2.Value)
- {
- EV.PostMessage(Chamber.ToString(), EventEnum.DefaultWarning, "robot Extend to LP2.");
- }
- }
- return Result.RUN;
- }
- public Result Monitor()
- {
- try
- {
- LoadportReset((int)Home.Reset, _device, "reset", _timeoutHome, Notify, Stop);
- LoadportInit((int)Home.Home, _device, "home", Notify, Stop);
- WaitLoadportMotion((int)Home.Wait, _device, "homing...", _timeoutHome, Notify, Stop);
- }
- catch (RoutineBreakException)
- {
- return Result.RUN;
- }
- catch (RoutineFaildException)
- {
- return Result.FAIL;
- }
- EV.PostMessage(ModuleName.System.ToString(), EventEnum.HomeEnds, ModuleName.System.ToString());
- return Result.DONE;
- }
-
- protected override void Notify(string message)
- {
- EV.PostMessage(Module, EventEnum.GeneralInfo, String.Format("Home sequence :{0}", message));
- }
- /// <summary>
- /// prepare process failed
- /// </summary>
- /// <param name="failReason"></param>
- /// <param name="reactor"></param>
- protected override void Stop(string failReason)
- {
- string reason = String.Empty;
- EV.PostMessage(Module, EventEnum.HomeFailed, failReason);
- }
- }
- }
|