12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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 LoadPortHomeRoutine : ModuleRoutineBase, IStepRoutine
- {
- enum RoutineStep
- {
- ClearError,
- Home,
- QueryStatus,
- End,
- }
- private int _timeout = 0;
- private LoadPortModule _lpModule;
- public LoadPortHomeRoutine(LoadPortModule lpModule) : base(lpModule.Module)
- {
- _lpModule = lpModule;
- Name = "Home";
- }
- public bool Initalize()
- {
- return true;
- }
- public RState Start(params object[] objs)
- {
- Reset();
- _timeout = SC.GetValue<int>("EFEM.LoadPort.HomeTimeout");
- return Runner.Start(_lpModule.Module, Name);
- }
- public RState Monitor()
- {
- Runner.Run(RoutineStep.Home, Home, CheckDevice, _timeout * 1000)
- .End(RoutineStep.QueryStatus, QueryStatus, CheckDevice, _timeout * 1000);
- return Runner.Status;
- }
- bool Home()
- {
- string reason;
- if(!_lpModule.LPDevice.Home(out reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- bool CheckDevice()
- {
- return !(_lpModule.LPDevice.IsError || _lpModule.LPDevice.IsBusy);
- }
- bool QueryStatus()
- {
- string reason;
- if (!_lpModule.LPDevice.QueryState(out reason))
- {
- Stop(reason);
- return false;
- }
- return true;
- }
- public void Abort()
- {
- }
- }
- }
|