123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.Core.Applications;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems.Rorzes;
- using MECF.Framework.RT.ModuleLibrary.AlignerModules;
- using MECF.Framework.RT.ModuleLibrary.LPModules;
- using MECF.Framework.RT.ModuleLibrary.SystemModules;
- namespace FutureEfemLib.Efems
- {
- class EfemHomeAllRoutine : ModuleRoutine, IRoutine
- {
- enum RoutineStep
- {
- HomeRobot,
- HomeOtherModules,
- }
-
- private IRoutine _homeRobotRoutine;
- private AlignerModuleBase _aligner;
- private LoadPortModuleBase _lp1;
- private LoadPortModuleBase _lp2;
- private LoadPortModuleBase _lp3;
- public EfemHomeAllRoutine(EfemModule module)
- {
- Module = ModuleName.EfemRobot.ToString();
- Name = "Home All";
- _homeRobotRoutine = new EfemHomeRoutine(module);
- _aligner = EquipmentManager.Modules[ModuleName.Aligner] as AlignerModuleBase;
- _lp1 = EquipmentManager.Modules[ModuleName.LP1] as LoadPortModuleBase;
- _lp2 = EquipmentManager.Modules[ModuleName.LP2] as LoadPortModuleBase;
- _lp3 = EquipmentManager.Modules[ModuleName.LP3] as LoadPortModuleBase;
- System.Diagnostics.Debug.Assert(_aligner!=null);
- System.Diagnostics.Debug.Assert(_lp1 != null);
- System.Diagnostics.Debug.Assert(_lp2 != null);
- System.Diagnostics.Debug.Assert(_lp3 != null);
- }
- public Result Start(params object[] objs)
- {
- Reset();
-
- Notify($"Start");
- return Result.RUN;
- }
- public Result Monitor()
- {
- try
- {
- ExecuteRoutine((int)RoutineStep.HomeRobot, _homeRobotRoutine);
- HomeOtherModules((int)RoutineStep.HomeOtherModules );
- }
- catch (RoutineBreakException)
- {
- return Result.RUN;
- }
- catch (RoutineFaildException)
- {
- return Result.FAIL;
- }
- Notify("Finished");
- return Result.DONE;
- }
- public void HomeOtherModules(int id )
- {
- Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
- {
- Notify($"Start Home all EFEM modules");
- string reason;
- if (!_aligner.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- if (!_lp1.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- if (!_lp2.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- if (!_lp3.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }, () =>
- {
- if (_aligner.IsError || _lp1.IsError || _lp2.IsError || _lp3.IsError)
- {
- return null;
- }
- if (!_aligner.IsReady || !_lp1.IsReady || !_lp2.IsReady || !_lp3.IsReady)
- return false;
- return true;
- } );
- if (ret.Item1)
- {
- if (ret.Item2 == Result.FAIL)
- {
- Stop(string.Format("Home failed."));
- throw (new RoutineFaildException());
- }
- else
- throw (new RoutineBreakException());
- }
- }
-
- public void Abort()
- {
-
- }
- }
- }
|