123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- using System;
- using Aitex.Core.Common;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Sorter.Common;
- using JetEfemLib.Efems;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using MECF.Framework.RT.ModuleLibrary.SystemModules;
- namespace JetEfemLib.LPs
- {
- class LoadPortLoadRoutine : ModuleRoutineBase, IStepRoutine
- {
- enum RoutineStep
- {
- Clamp,
- Dock,
- OpenDoor,
- QueryStatus1,
- WaitRobotIdle,
- Map,
- GetWaferInfo,
- QueryStatus2,
- End,
- }
- private int _timeout = 0;
- private LoadPortModule _lpModule;
- public LoadPortLoadRoutine(LoadPortModule lpModule) : base(lpModule.Module)
- {
- _lpModule = lpModule;
- Name = "Load";
- }
- public bool Initalize()
- {
- return true;
- }
- public RState Start(params object[] objs)
- {
- Reset();
- _timeout = SC.GetValue<int>("EFEM.LoadPort.HomeTimeout");
- var waferSize = _lpModule.LPDevice.GetCurrentWaferSize();
- if (waferSize != WaferSize.WS8 && waferSize != WaferSize.WS12)
- {
- EV.PostWarningLog(Module, $"{Module} get wafer size abnormal, can not load");
- return RState.Failed;
- }
- if (!_lpModule.LPDevice.IsPresent || !_lpModule.LPDevice.IsPlacement)
- {
- EV.PostWarningLog(Module, $"{Module} not found carrier, can not load");
- return RState.Failed;
- }
- return Runner.Start(_lpModule.Module, Name);
- }
- public RState Monitor()
- {
- Runner.Run(RoutineStep.Clamp, Clamp, CheckDevice, _timeout * 1000)
- //.Run(RoutineStep.Dock, Dock, CheckDevice, _timeout *1000)
- .Run(RoutineStep.OpenDoor, OpenDoor, CheckDevice, _timeout * 1000)
- .Run(RoutineStep.GetWaferInfo, QueryMapInfo, CheckDevice, _timeout * 1000)
- .End(RoutineStep.QueryStatus2, QueryStatus, CheckOpenDoor, _timeout * 1000);
- return Runner.Status;
- }
- bool Clamp()
- {
- Notify($"Start clamp {_lpModule.LPDevice.Name}");
- if (!_lpModule.LPDevice.Clamp(out string reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool Dock()
- {
- if (!_lpModule.LPDevice.Dock(out string reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool CheckDevice()
- {
- return !(_lpModule.LPDevice.Error || _lpModule.LPDevice.IsBusy);
- }
- bool OpenDoor()
- {
- Notify($"Start OpenDoorAndMap {_lpModule.LPDevice.Name}");
- if (!_lpModule.LPDevice.OpenDoor(out string reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool CheckOpenDoor()
- {
- return !(_lpModule.LPDevice.Error || _lpModule.LPDevice.IsBusy || _lpModule.LPDevice.DoorState != FoupDoorState.Open);
- }
- bool QueryMapInfo()
- {
- Notify($"Start to get wafer info {_lpModule.LPDevice.Name}");
- if (!_lpModule.LPDevice.GetMapInfo(out string reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool QueryStatus()
- {
- Notify($"Start query status {_lpModule.LPDevice.Name}");
- if (!_lpModule.LPDevice.QueryState(out string reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- public void Abort()
- {
- }
- }
- }
|