123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.Utilities;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Schedulers;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.ModuleLibrary.LLModules;
- namespace JetMainframe.LLs
- {
- public class LoadLockModule : LoadLockModuleBase
- {
- public enum STATE
- {
- NotInstall,
- NotConnected,
- Idle,
- Error,
- InTransfer,
- }
- public enum MSG
- {
- Home,
- Disconnected,
- Connected,
- Reset,
- Abort,
- Error,
- InTransfer,
- TransferComplete,
- }
- public override bool IsReady
- {
- get
- {
- return FsmState == (int)STATE.Idle &&
- CheckAllMessageProcessed();
- }
- }
- public override bool IsError
- {
- get { return FsmState == (int)STATE.Error; }
- }
- public override bool IsInit
- {
- get { return false; }
- }
- public LoadLockModule(ModuleName module, int slotCount = 1) : base(slotCount)
- {
- Name = module.ToString();
- Module = module.ToString();
- IsOnline = true;
- }
- public override bool Initialize()
- {
- InitRoutine();
- InitDevice();
- InitFsm();
- InitOp();
- InitData();
- return base.Initialize();
- }
- private void InitRoutine()
- {
- }
- public void InitDevice()
- {
- }
- private void InitData()
- {
- DATA.Subscribe($"{Module}.Status", () => StringFsmStatus);
- DATA.Subscribe($"{Module}.IsOnline", () => IsOnline);
- DATA.Subscribe($"{Module}.WaferSize",
- () => WaferManager.Instance.GetWaferSize(ModuleHelper.Converter(Module), 0).ToString());
- }
- private void InitOp()
- {
- OP.Subscribe($"{Module}.SetOnline",
- (string cmd, object[] args) => IsOnline = true);
- OP.Subscribe($"{Module}.SetOffline",
- (string cmd, object[] args) => IsOnline = false);
- OP.Subscribe($"{Module}.Home",
- (string cmd, object[] args) =>
- CheckToPostMessage((int)MSG.Home));
- OP.Subscribe($"{Module}.Reset",
- (string cmd, object[] args) =>
- CheckToPostMessage((int)MSG.Reset));
- OP.Subscribe($"{Module}.Abort",
- (string cmd, object[] args) =>
- CheckToPostMessage((int)MSG.Abort));
- }
- private void InitFsm()
- {
- EnumLoop<STATE>.ForEach((item) =>
- {
- MapState((int)item, item.ToString());
- });
- EnumLoop<MSG>.ForEach((item) =>
- {
- MapMessage((int)item, item.ToString());
- });
- EnableFsm(100,
- IsInstalled
- ? STATE.Idle
- : STATE.NotInstall);
- Transition(STATE.Idle,
- MSG.Disconnected, null,
- STATE.NotConnected);
- Transition(STATE.Idle,
- MSG.InTransfer, null,
- STATE.InTransfer);
- Transition(STATE.InTransfer,
- MSG.TransferComplete, null,
- STATE.Idle);
- Transition(STATE.NotConnected,
- MSG.Connected, null,
- STATE.Idle);
- Transition(STATE.InTransfer,
- MSG.Abort, fAbort,
- STATE.Idle);
- Transition(STATE.Error,
- MSG.Reset, null,
- STATE.Idle);
- }
- #region Service Functions
- private bool fAbort(object[] param)
- {
- if (IsOnline)
- {
- EV.PostWarningLog(Module, "Can't Abort When Online");
- return false;
- }
- return true;
- }
- public override bool Home(out string reason)
- {
- reason = string.Empty;
- return true;
- }
- public override void Reset()
- {
- base.Reset();
- }
- public override bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot,
- EnumTransferType transferType, out string reason)
- {
- reason = string.Empty;
- return true;
- }
- public override bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot,
- EnumTransferType transferType, out string reason)
- {
- reason = string.Empty;
- return true;
- }
- public override bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType,
- out string reason)
- {
- reason = string.Empty;
- return true;
- }
- public override bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot,
- EnumTransferType transferType,
- out string reason)
- {
- reason = string.Empty;
- if (transferType == EnumTransferType.Pick && WaferManager.Instance.CheckNoWafer(Module, targetSlot))
- {
- reason = "target not has wafer";
- return false;
- }
- if (transferType == EnumTransferType.Place && WaferManager.Instance.CheckHasWafer(Module, targetSlot))
- {
- reason = "target already has wafer";
- return false;
- }
- if (Module == ModuleName.LLA.ToString())
- {
- return DEVICE.GetDevice<IoSensor>($"System.SensorEFEMRBNotExtendBFA").Value;
- }
- else if (Module == ModuleName.LLB.ToString())
- {
- return DEVICE.GetDevice<IoSensor>($"System.SensorEFEMRBNotExtendBFB").Value;
- }
- return true;
- }
- public override void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot,
- EnumTransferType transferType)
- {
- CheckToPostMessage(MSG.InTransfer);
- }
- public override void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot,
- EnumTransferType transferType)
- {
- if (FsmState == (int)STATE.InTransfer)
- CheckToPostMessage(MSG.TransferComplete);
- }
- #endregion
- }
- }
|