123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using JetEfemLib.LPs;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.ModuleLibrary.LPModules;
- using MECF.Framework.RT.ModuleLibrary.SystemModules;
- namespace JetEfemLib.Efems
- {
- public class EfemMapRoutine : ModuleRoutineBase, IStepRoutine
- {
- enum RoutineStep
- {
- CheckTargetEnableMap,
- Map,
- End,
- }
- private int _mapTimeout;
- private ModuleName _target;
- private int _thicknessIndex;
- //private Hand _hand;
- //private bool _autoHand;
- private EfemModule _efemModule;
- public EfemMapRoutine(EfemModule efemModule) : base("EFEM")
- {
- Name = "Map";
- _efemModule = efemModule;
- }
- public RState Start(params object[] objs)
- {
- _mapTimeout = SC.GetValue<int>("EFEM.EfemRobot.MapTimeout");
- Reset();
- _thicknessIndex = 0;
- //if (ModuleHelper.IsLoadPort(_target))
- //{
- // LoadPortModule lp = Singleton<EquipmentManager>.Instance.Modules[_target] as LoadPortModule;
- // _thicknessIndex = lp.LPDevice.GetThicknessIndex();
- //}
- Notify($"Start map {_target}");
- return Runner.Start(ModuleName.EfemRobot.ToString(), Name);
- }
- public void Init(ModuleName source)
- {
- //_autoHand = true;
- _target = source;
- }
- public void Abort()
- {
- Notify($"Abort map {_target}");
- }
- public RState Monitor()
- {
- Runner.Wait(RoutineStep.CheckTargetEnableMap, CheckTargetEnableMap)
- .Run(RoutineStep.Map, Map, CheckMap, _mapTimeout * 1000)
- .End(RoutineStep.End, NullFun, _delay_50ms);
- return Runner.Status;
- }
- public bool CheckTargetEnableMap()
- {
- Notify($"Check {_target} enable map");
- if (!_efemModule.RobotDevice.IsReady())
- {
- Stop($"Can not map {_target}, EfemRobot is not ready");
- return false;
- }
- if (!ModuleHelper.IsLoadPort(_target) && !ModuleHelper.IsLoadLock(_target))
- {
- Stop($"Can not map {_target}, only LP or Buf supported");
- return false;
- }
- if (_target == ModuleName.LLA && DEVICE.GetDevice<IoSensor>($"System.SensorBufferABigWaferProtrusion").Value)
- {
- Stop($"Can not map {_target}, SensorBufferABigWaferProtrusion is on");
- return false;
- }
- if (_target == ModuleName.LLB && DEVICE.GetDevice<IoSensor>($"System.SensorBufferBBigWaferProtrusion").Value)
- {
- Stop($"Can not map {_target}, SensorBufferBBigWaferProtrusion is on");
- return false;
- }
- if (ModuleHelper.IsLoadPort(_target))
- {
- LoadPortModuleBase lp = EquipmentManager.Modules[_target] as LoadPortModuleBase;
- if (!lp.CheckReadyForMap(ModuleName.EfemRobot, Hand.Blade1, out string reason))
- {
- Stop(reason);
- return false;
- }
- }
- return true;
- }
- public bool Map()
- {
- Notify($"Robot start map {_target}");
- string reason;
- if (!_efemModule.RobotDevice.Map(_target, _thicknessIndex, out reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool CheckMap()
- {
- return !_efemModule.RobotDevice.IsError && _efemModule.RobotDevice.IsIdle;
- }
- }
- }
|