1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- namespace JetEfemLib.LPs
- {
- class LoadPortCloseDoorRoutine : ModuleRoutineBase, IStepRoutine
- {
- enum RoutineStep
- {
- CloseDoor,
- QueryStatus,
- End,
- }
- private int _timeout = 0;
- private LoadPortModule _lpModule;
- public LoadPortCloseDoorRoutine(LoadPortModule lpModule) : base(lpModule.Module)
- {
- _lpModule = lpModule;
- Name = "CloseDoor";
- }
- public bool Initalize()
- {
- return true;
- }
-
- public RState Start(params object[] objs)
- {
- Reset();
- _timeout = SC.GetValue<int>("EFEM.LoadPort.MotionTimeout");
- return Runner.Start(_lpModule.Module, Name);
- }
- public RState Monitor()
- {
- Runner.Run(RoutineStep.CloseDoor, CloseDoor, CheckDevice, _timeout * 1000)
- .End(RoutineStep.QueryStatus, QueryStatus, CheckDevice, _timeout * 1000);
- return Runner.Status;
- }
- bool CloseDoor()
- {
- Notify($"Start Close Door {_lpModule.LPDevice.Name}");
- string reason;
- if (!_lpModule.LPDevice.CloseDoor(out reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool CheckDevice()
- {
- return !(_lpModule.LPDevice.IsError || _lpModule.LPDevice.IsBusy);
- }
- bool QueryStatus()
- {
- Notify($"Start query status {_lpModule.LPDevice.Name}");
- string reason;
- if (!_lpModule.LPDevice.QueryState(out reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- public void Abort()
- {
-
- }
-
- }
- }
|