using System; using System.Diagnostics; using Aitex.Core.RT.Device; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using MECF.Framework.Common.Equipment; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners; namespace JetEfemLib.Buffers { public class BufferCoolingRoutine : ModuleRoutineBase, IStepRoutine { enum RoutineStep { Cooling, End, } private int _timeout = 3600; public float _coolingValue = 0.0f; public bool _coolingTypeIsTime = true; private Stopwatch _swTimer = new Stopwatch(); public int ElapsedTime { get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; } } public BufferCoolingRoutine(ModuleName module) : base(module.ToString()) { Name = "Cooling"; } public bool Initalize() { return true; } public void Init(bool coolingTypeIsTime,float coolingTime) { _coolingTypeIsTime = coolingTypeIsTime; _coolingValue = coolingTime; } public RState Start(params object[] objs) { Reset(); _swTimer.Restart(); return Runner.Start(Module, Name); } public RState Monitor() { Runner.Delay(RoutineStep.Cooling, (int)_coolingValue * 1000) .End(RoutineStep.End, NullFun, _delay_50ms); return Runner.Status; } public void Abort() { Notify("Abort"); _swTimer.Stop(); } } }