| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 | 
							- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using CyberX8_Core;
 
- using CyberX8_RT.Devices.Metal;
 
- using CyberX8_RT.Devices.Reservoir;
 
- using MECF.Framework.Common.Persistent.Reservoirs;
 
- using MECF.Framework.Common.RecipeCenter;
 
- using MECF.Framework.Common.Routine;
 
- using MECF.Framework.Common.ToolLayout;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Reflection;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace CyberX8_RT.Modules.Metal
 
- {
 
-     public class StandardHotInitializeRoutine : RoutineBase, IRoutine
 
-     {
 
-         private enum InitializeStep
 
-         {
 
-             CheckPowerSupplierConnected,
 
-             LinmotReset,
 
-             LinmotResetWait,
 
-             WHUnclampOn,
 
-             FlowValveOn,
 
-             Delay,
 
-             ManualFlowCheck,
 
-             AutoFlowCheck,
 
-             End
 
-         }
 
-         #region 内部变量
 
-         /// <summary>
 
-         /// 持久化对象
 
-         /// </summary>
 
-         private MetalPersistentValue _persistentValue;
 
-         /// <summary>
 
-         /// 设备对象
 
-         /// </summary>
 
-         private StandardHotMetalDevice _metalDevice;
 
-         /// <summary>
 
-         /// Reservoir Recipe
 
-         /// </summary>
 
-         private ResRecipe _resRecipe;
 
-         /// <summary>
 
-         /// Cell Flow Delay Time
 
-         /// </summary>
 
-         private int _cellFlowFaultHoldOffTime = 5000;
 
-         /// <summary>
 
-         /// Cell Flow Start Low Limit
 
-         /// </summary>
 
-         private double _cellFlowStartLowLimit = 3.0;
 
-         #endregion
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="module"></param>
 
-         public StandardHotInitializeRoutine(string module) : base(module)
 
-         {
 
-         }
 
-         /// <summary>
 
-         /// 中止
 
-         /// </summary>
 
-         public void Abort()
 
-         {
 
-             Runner.Stop("Manual Abort");
 
-         }
 
-         /// <summary>
 
-         /// 监控
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public RState Monitor()
 
-         {
 
-             Runner.Run(InitializeStep.CheckPowerSupplierConnected, CheckPowerSupplierStatus, _delay_1ms)
 
-                 .Run(InitializeStep.LinmotReset, _metalDevice.ResetLinmot, _delay_1ms)
 
-                 .WaitWithStopCondition(InitializeStep.LinmotResetWait, _metalDevice.CheckLinmotRoutineEnd, _metalDevice.CheckLinmotRoutineError)
 
-                 .Run(InitializeStep.WHUnclampOn, WaferHolderUnclampOn, _delay_1ms)
 
-                 .Run(InitializeStep.FlowValveOn, () => _metalDevice.SwitchToFlow("", null), _delay_1ms)
 
-                 .Delay(InitializeStep.Delay, _cellFlowFaultHoldOffTime)
 
-                 .RunIf(InitializeStep.ManualFlowCheck, _metalDevice.IsManual, ManualFlowCheck, _delay_1ms)
 
-                 .RunIf(InitializeStep.AutoFlowCheck, _metalDevice.IsAuto, AutoFlowCheck, _delay_1ms)
 
-                 .End(InitializeStep.End, NullFun, _delay_1ms);
 
-             return Runner.Status;
 
-         }
 
-         /// <summary>
 
-         /// 检验Metal A/B 面PowerSupplier通讯状况
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckPowerSupplierStatus()
 
-         {
 
-             if (!_metalDevice.SideAPowerSupplier.IsConnected)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, "side A power is not connected");
 
-                 return false;
 
-             }
 
-             if (!_metalDevice.SideBPowerSupplier.IsConnected)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, "side B power is not connected");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// WaferHolder Unclamp on
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool WaferHolderUnclampOn()
 
-         {
 
-             return _metalDevice.WaferHolderClampOff("", null);
 
-         }
 
-         /// <summary>
 
-         /// 手动检验Flow
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool ManualFlowCheck()
 
-         {
 
-             if (_metalDevice.MetalDeviceData.CellFlow < _cellFlowStartLowLimit)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, $"Flow {_metalDevice.MetalDeviceData.CellFlow} is less than {_cellFlowStartLowLimit}");
 
-                 _metalDevice.SwitchToBypass("", null);
 
-                 _metalDevice.ClosePump("", null);
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 自动检验Flow
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool AutoFlowCheck()
 
-         {
 
-             if (_metalDevice.MetalDeviceData.CellFlow < _resRecipe.CAFlowRateErrorLow)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, $"Flow {_metalDevice.MetalDeviceData.CellFlow} is less than {_resRecipe.CAFlowRateErrorLow}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 启动
 
-         /// </summary>
 
-         /// <param name="objs"></param>
 
-         /// <returns></returns>
 
-         public RState Start(params object[] objs)
 
-         {
 
-             _persistentValue = (MetalPersistentValue)objs[0];
 
-             _metalDevice = DEVICE.GetDevice<StandardHotMetalDevice>(Module);
 
-             _cellFlowFaultHoldOffTime = SC.GetValue<int>("Metal.CellFlowFaultHoldOffTime");
 
-             _cellFlowStartLowLimit = SC.GetValue<double>("Metal.CellFlowStartLowLimit");
 
-             string reservoir = ReservoirItemManager.Instance.GetReservoirByMetal(Module.ToString());
 
-             StandardHotReservoirDevice reservoirDevice = DEVICE.GetDevice<StandardHotReservoirDevice>(reservoir);
 
-             if (reservoirDevice == null)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, $"{reservoir} device is null");
 
-                 return RState.Failed;
 
-             }
 
-             if (reservoirDevice.Recipe == null)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, $"{reservoir} current recipe is null");
 
-                 return RState.Failed;
 
-             }
 
-             if(_persistentValue.MetalWaferSize == 0)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, $"Check Metal cell wafersize first!");
 
-                 return RState.Failed;
 
-             }
 
-             _resRecipe = reservoirDevice.Recipe;
 
-             return Runner.Start(Module, "Start S&H Initialize");
 
-         }
 
-     }
 
- }
 
 
  |