123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Venus_RT.Devices;
- using MECF.Framework.Common.Routine;
- using MECF.Framework.Common.Equipment;
- using Venus_Core;
- using Aitex.Core.RT.Log;
- using Venus_RT.Modules.PMs;
- using Aitex.Sorter.Common;
- namespace Venus_RT.Modules.TM
- {
- class MFHomeRoutine : ModuleRoutineBase, IRoutine
- {
- private enum HomeStep
- {
- kLidDelay,
- kRobot,
- kRobotDelay,
- kSlitDoor,
- kSlitDoorDelay,
- kPump,
- kPumpDelay,
- //kATMSwitch,
- kEnd,
- }
- private int _robotHomingTimeout = 120*1000;
- private int _slitDoorHomingTimeout = 20 * 1000;
- private int _pumpHomingTimeout = 120 * 1000;
- //private int _pumpDownHomingTimeout = 600 * 1000;
- private bool _TMHomeRBFlag = false;
- private readonly JetTM _JetTM;
- private readonly ITransferRobot _robot;
- private readonly MFPumpRoutine _pumpDownRoutine;
- public int currentStepNo;
- public MFHomeRoutine(JetTM jetTM, ITransferRobot robot, MFPumpRoutine pumpDownRoutine) : base(ModuleName.TM)
- {
- _JetTM = jetTM;
- _robot = robot;
- _pumpDownRoutine= pumpDownRoutine;
- Name = "TM Home";
- }
- public RState Start(params object[] objs)
- {
- if (objs.Length>0 && objs[0].ToString() == "TMRobot")
- _TMHomeRBFlag = true;
- currentStepNo = 0;
- if (!_JetTM.CheckLidClosed(Module))
- {
- Stop($"TM Lid Not Closed");
- return RState.Failed;
- }
- Reset();
- _robotHomingTimeout = SC.GetValue<int>($"{Module}.HomeTimeout") * 1000;
-
- return Runner.Start(Module, Name);
- }
- public RState Monitor()
- {
- Runner.Delay(HomeStep.kLidDelay, 500)
- .Run(HomeStep.kRobot, HomeRobot, CheckRobotReady, _robotHomingTimeout)
- .Delay(HomeStep.kRobotDelay, 500)
- .Run(HomeStep.kSlitDoor, HomeSlitDoor, CheckSlitDoorReady, _slitDoorHomingTimeout)
- .Delay(HomeStep.kSlitDoorDelay, 500)
- .Run(HomeStep.kPump, HomePump, CheckPumpReady, _pumpHomingTimeout)
- .Delay(HomeStep.kPumpDelay, 500)
- //.Run(HomeStep.kATMSwitch, HomePumpDown, CheckATMSwitchReady, _pumpDownHomingTimeout)
- .End(HomeStep.kEnd, NullFun, _delay_50ms);
- return Runner.Status;
- }
- private bool HomeRobot()
- {
- currentStepNo = 1;
- return _robot.Home();
- }
- private bool CheckRobotReady()
- {
- return _robot.Status == RState.End;
- }
- private bool HomeSlitDoor()
- {
- _JetTM.HomeSlitDoor();
- currentStepNo = 2;
- return _JetTM.CloseAllSlitDoor();
- }
- private bool CheckSlitDoorReady()
- {
- if (_JetTM.AllPMSlitDoorClosed && _JetTM.IsLLASlitDoorClosed && _JetTM.IsLLBSlitDoorClosed)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- private bool HomePump()
- {
- if (RouteManager.IsATMMode || _TMHomeRBFlag)
- return true;
- currentStepNo = 3;
- if ((bool)_JetTM.TMPumpIsRunning)
- {
- return true;
- }
- return true;
- //return _JetTM.TurnTMPump(true);
- }
- private bool CheckPumpReady()
- {
- if (RouteManager.IsATMMode || _TMHomeRBFlag)
- return true;
- if ((bool)_JetTM.TMPumpIsRunning)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- //private bool HomePumpDown()
- //{
- // if (RouteManager.IsATMMode || _TMHomeRBFlag)
- // return true;
- // currentStepNo = 4;
- // return _pumpDownRoutine.Start() == RState.Running;
- //}
- //private bool CheckATMSwitchReady()
- //{
- // if (RouteManager.IsATMMode || _TMHomeRBFlag)
- // return true;
- // var status = _pumpDownRoutine.Monitor();
- // if (_JetTM.IsTMVac && status == RState.End)
- // {
- // _JetTM.TurnSoftPumpValve(ModuleName.TM, false);
- // _JetTM.TurnFastPumpValve(ModuleName.TM, false);
- // return true;
- // }
- // else
- // {
- // //_pumpDownRoutine.Monitor();
- // return false;
- // }
- //}
- public void Abort()
- {
- }
- }
- }
|