123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- 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 JetEfemLib.Efems
- {
- class EfemHomeAllRoutine : ModuleRoutineBase, IStepRoutine
- {
- enum RoutineStep
- {
- HomeRobot,
- HomeAligner1,
- HomeAligner2,
- HomeOtherModules,
- End,
- }
- private IStepRoutine _homeRobotRoutine;
- private AlignerModuleBase _aligner1;
- private AlignerModuleBase _aligner2;
- private LoadPortModuleBase _lp1;
- private LoadPortModuleBase _lp2;
- private bool _aligner1Installed;
- private bool _aligner2Installed;
- public EfemHomeAllRoutine(EfemModule module) : base(ModuleName.EfemRobot.ToString())
- {
- Name = "Home All";
- _homeRobotRoutine = new EfemHomeRoutine(module);
- _aligner1 = EquipmentManager.Modules[ModuleName.Aligner1] as AlignerModuleBase;
- _aligner2 = EquipmentManager.Modules[ModuleName.Aligner2] as AlignerModuleBase;
- _lp1 = EquipmentManager.Modules[ModuleName.LP1] as LoadPortModuleBase;
- _lp2 = EquipmentManager.Modules[ModuleName.LP2] as LoadPortModuleBase;
- System.Diagnostics.Debug.Assert(_aligner1 != null);
- System.Diagnostics.Debug.Assert(_aligner2 != null);
- System.Diagnostics.Debug.Assert(_lp1 != null);
- System.Diagnostics.Debug.Assert(_lp2 != null);
- _aligner1Installed = SC.GetValueOrDefault<bool>("System.SetUp.Aligner1.IsInstalled");
- _aligner2Installed = SC.GetValueOrDefault<bool>("System.SetUp.Aligner2.IsInstalled");
- }
- public RState Start(params object[] objs)
- {
- Reset();
- return Runner.Start(ModuleName.EfemRobot.ToString(), Name);
- }
- public RState Monitor()
- {
- Runner.Run(RoutineStep.HomeRobot, HomeRobot, CheckHomeRobot)
- .Run(RoutineStep.HomeAligner1, HomeAligner1, CheckHomeAligner1)
- .Run(RoutineStep.HomeAligner2, HomeAligner2, CheckHomeAligner2)
- .End(RoutineStep.End, NullFun, _delay_50ms);
- return Runner.Status;
- }
- public bool HomeRobot()
- {
- return _homeRobotRoutine.Start() == RState.Running;
- }
- bool CheckHomeRobot()
- {
- var status = _homeRobotRoutine.Monitor();
- if (status == RState.End)
- {
- return true;
- }
- else if (status == RState.Failed || status == RState.Timeout)
- {
- Runner.Stop($"Home failed.");
- return true;
- }
- return false;
- }
- public bool HomeAligner1()
- {
- if(_aligner1Installed)
- {
- Notify($"Start Home Aligner1");
- string reason;
- if (!_aligner1.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- }
- return true;
- }
- bool CheckHomeAligner1()
- {
- return _aligner1Installed ? !(_aligner1.IsError || !_aligner1.IsReady) : true;
- }
- public bool HomeAligner2()
- {
- if (_aligner2Installed)
- {
- Notify($"Start Home Aligner2");
- string reason;
- if (!_aligner2.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- }
- return true;
- }
- bool CheckHomeAligner2()
- {
- return _aligner2Installed ? !(_aligner2.IsError || !_aligner2.IsReady) : true;
- }
- public void Abort()
- {
- }
- }
- }
|