| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386 | using Aitex.Core.RT.Device;using Aitex.Core.RT.Fsm;using Aitex.Core.RT.Log;using Aitex.Core.RT.SCCore;using Aitex.Core.Util;using Aitex.Core.Utilities;using MECF.Framework.Common.Beckhoff.AxisProvider;using MECF.Framework.Common.Equipment;using MECF.Framework.Common.RecipeCenter;using MECF.Framework.Common.Utilities;using CyberX8_Core;using CyberX8_RT.Backends;using CyberX8_RT.Devices.AXIS;using CyberX8_RT.Devices.Facilities;using CyberX8_RT.Devices.Loader;using CyberX8_RT.Devices.SRD;using System;using System.Collections.Generic;using System.Linq;using System.Reflection;using System.Text;using System.Threading;using System.Threading.Tasks;using System.Timers;using System.Windows.Threading;using Aitex.Core.RT.Routine;namespace CyberX8_RT.Modules.SRD{    /// <summary>    /// RunWafer状态机    /// </summary>    public class RunWaferRecipeStateMachine : Entity, IEntity    {        #region 常量         private const int MAX_ARM_HOME_RETRIES = 3;        /// <summary>        /// 旋转增加时长        /// </summary>        private const int ROTATION_PLUS_TIME = 10;        /// <summary>        /// ROTATION电机转速比例        /// </summary>        private const int SPEED_RATIO = 10;        #endregion        #region 内部变量        /// <summary>        /// 模块名称        /// </summary>        private string _module;        /// <summary>        /// Arm Axis        /// </summary>        private JetAxisBase _armAxis;        /// <summary>        /// Rotation Axis        /// </summary>        private JetAxisBase _rotationAxis;        /// <summary>        /// SRD Common        /// </summary>        private SrdCommonDevice _srdCommon;        /// <summary>        /// Total SRD        /// </summary>        private TotalSRDDevice _totalSRDDevice;        /// <summary>        /// 另外SRD实例         /// </summary>        private SRDEntity _otherSrdEntity;        /// <summary>        /// Loader Common        /// </summary>        private SystemFacilities _systemFacilities;        /// <summary>        /// Arm是否Home        /// </summary>        private bool _armIsHomed;        /// <summary>        /// Arm重试次数        /// </summary>        private int _armRetryTimes = 0;        /// <summary>        /// ARM正在执行Home        /// </summary>        private bool _armHoming = false;        /// <summary>        /// 是否正在用水        /// </summary>        private bool _isUsingWater = false;        /// <summary>        /// Recipe        /// </summary>        private SrdRecipe _srdRecipe;        /// <summary>        /// 记时        /// </summary>        private int _enterTime;        /// <summary>        /// Diverting Flow时长        /// </summary>        private int _divertingFlowCheckTimeSpan;        /// <summary>        /// Pooling Flow时长        /// </summary>        private int _poolingFlowCheckTimeSpan;        /// <summary>        /// Washing Flow时长        /// </summary>        private int _washingFlowCheckTimeSpan;        /// <summary>        /// SRD rotation Provider对象        /// </summary>        private BeckhoffProviderAxis _rotationProviderAxis;        /// <summary>        /// SRD arm Provider对象        /// </summary>        private BeckhoffProviderAxis _armProviderAxis;        /// <summary>        /// 转换增加的时间        /// </summary>        private int _rotationPlusSecond = ROTATION_PLUS_TIME;        /// <summary>        /// N2 Enabled        /// </summary>        private bool _n2Enabled = false;        /// <summary>        /// Dry速度        /// </summary>        private int _drySpeed;        /// <summary>        /// exhaust进入时间        /// </summary>        private int _exhaustFanTime;        /// <summary>        /// 旋转停止时间        /// </summary>        private int _rotationStopTime;        /// <summary>        /// 是否执行Rotation Stop        /// </summary>        private bool _isExecuteRotationStop;        /// <summary>        /// Wafer Presence Accel/Decel比例         /// </summary>        private int _waferPresenceCheckAccelDecelPercentage;        /// <summary>        /// Wafer Presence Speed        /// </summary>        private int _waferPresenceSpeedInRPMs;        /// <summary>        /// Wafer Presence distance        /// </summary>        private int _waferPresenceDistance;        /// <summary>        /// 状态机进入时间        /// </summary>        private int _startTime;        /// <summary>        /// Wafer Presence Test功能是否启用        /// </summary>        private bool _presenceTestEnabled;        /// <summary>        /// PresenceTest记录次数        /// </summary>        private int _presenceTestCount;        /// <summary>        /// 当前次数        /// </summary>        private int _currentCount;        /// <summary>        /// Rinse时间=Max(FrontRinseTime, BackRinseTime) 单位s        /// </summary>        private double _rinseTime;        /// <summary>        /// Rinse中另一个水阀开关状态        /// </summary>        private bool _isAnotherWaterOn;        /// <summary>        /// PresenceTest是否完成        /// </summary>        private bool _isTestComplete = true;        /// <summary>        /// Rotation是否执行Position        /// </summary>        private bool _isRotationExecutePosition = false;        /// <summary>        /// PresenceTest进入时间        /// </summary>        private int _presenceTestEnterTime;        #endregion        #region 属性        /// <summary>        /// 状态        /// </summary>        public string State { get { return ((RunWaferState)fsm.State).ToString(); } }        #endregion        /// <summary>        /// 构造函数        /// </summary>        /// <param name="name"></param>        public RunWaferRecipeStateMachine(string module)         {            _module = module;            this.fsm = new StateMachine($"{module}_RunWaferStateMachine", (int)RunWaferState.RunWafer_Complete, 10);            fsm.EnableRepeatedMsg(true);                       AnyStateTransition(RunWaferMsg.Init, EnterRunWaferStart, RunWaferState.RunWafer_Start);            AnyStateTransition(RunWaferMsg.Error, EnterError, RunWaferState.Error);            Transition(RunWaferState.RunWafer_Start, RunWaferMsg.RunWafer_Start, RunWaferStartCheckStatus, RunWaferState.RunWafer_CheckFacilities);            Transition(RunWaferState.RunWafer_CheckFacilities, FSM_MSG.TIMER, CheckFacilities, RunWaferState.RunWafer_PreparingExhaustOff);            Transition(RunWaferState.RunWafer_PreparingExhaustOff, FSM_MSG.TIMER, PreparingExhaustOff, RunWaferState.RunWafer_WaitExhaustOff);            Transition(RunWaferState.RunWafer_WaitExhaustOff, FSM_MSG.TIMER, WaitExhaustOff, RunWaferState.RunWafer_EngageChuckVacuum);            Transition(RunWaferState.RunWafer_EngageChuckVacuum, FSM_MSG.TIMER, EngageChuckVacuum, RunWaferState.RunWafer_CheckVacuum);            Transition(RunWaferState.RunWafer_CheckVacuum, FSM_MSG.TIMER, CheckVacuum, RunWaferState.RunWafer_CloseTheDoor);            Transition(RunWaferState.RunWafer_CloseTheDoor, FSM_MSG.TIMER,CloseDoor,RunWaferState.RunWafer_CheckDoorClosed);            Transition(RunWaferState.RunWafer_CheckDoorClosed, FSM_MSG.TIMER, CheckDoorClosed, RunWaferState.RunWafer_ArmToHome);            Transition(RunWaferState.RunWafer_ArmToHome, FSM_MSG.TIMER,ArmToHome, RunWaferState.RunWafer_Diverting_CheckArmHome);            Transition(RunWaferState.RunWafer_Diverting_CheckArmHome, FSM_MSG.TIMER, CheckArmHome, RunWaferState.RunWafer_Diverting_CheckOtherSRD);            Transition(RunWaferState.RunWafer_Diverting_CheckOtherSRD, FSM_MSG.TIMER, CheckOtherSRD, RunWaferState.RunWafer_Diverting_WaterOn);            Transition(RunWaferState.RunWafer_Diverting_WaterOn, FSM_MSG.TIMER, WaterOn, RunWaferState.RunWafer_Diverting_WithFlowCheck);            Transition(RunWaferState.RunWafer_Diverting_WithFlowCheck, FSM_MSG.TIMER, CheckFlow, RunWaferState.RunWafer_Washing_ArmToCenter);            Transition(RunWaferState.RunWafer_Washing_ArmToCenter, FSM_MSG.TIMER, ArmToCenter, RunWaferState.RunWafer_Washing_CheckArmCenter);            Transition(RunWaferState.RunWafer_Washing_CheckArmCenter, FSM_MSG.TIMER, CheckArmToCenter, RunWaferState.RunWafer_Washing_PoolingFrontSide);            Transition(RunWaferState.RunWafer_Washing_PoolingFrontSide, FSM_MSG.TIMER, PoolingFrontSideWaterOn, RunWaferState.RunWafer_Washing_PoolingWithFlowCheck);            Transition(RunWaferState.RunWafer_Washing_PoolingWithFlowCheck, FSM_MSG.TIMER, PoolingCheckFlow, RunWaferState.RunWafer_Washing_StartRotation);            Transition(RunWaferState.RunWafer_Washing_StartRotation, FSM_MSG.TIMER, StartRotation, RunWaferState.RunWafer_Washing_PreFlowCheck);            Transition(RunWaferState.RunWafer_Washing_PreFlowCheck, FSM_MSG.TIMER, WashingPreFlowCheck, RunWaferState.RunWafer_Washing_Finished);            Transition(RunWaferState.RunWafer_Washing_Finished, FSM_MSG.TIMER, WashingFinished, RunWaferState.RunWafer_Drying_PreN2Time);            Transition(RunWaferState.RunWafer_Drying_PreN2Time, FSM_MSG.TIMER, CheckArmMotion, RunWaferState.RunWafer_Drying_ExhaustFanDelay);            Transition(RunWaferState.RunWafer_Drying_ExhaustFanDelay, FSM_MSG.TIMER, ExhaustFanDelay, RunWaferState.RunWafer_Drying_N2On);            Transition(RunWaferState.RunWafer_Drying_N2On, FSM_MSG.TIMER, N2On, RunWaferState.RunWafer_Drying_PreWaferPresenceCheck);            Transition(RunWaferState.RunWafer_Drying_PreWaferPresenceCheck, FSM_MSG.TIMER, PreWaferPresenceCheck, RunWaferState.RunWafer_Drying_WaferPresenceCheck);            Transition(RunWaferState.RunWafer_Drying_WaferPresenceCheck, FSM_MSG.TIMER, WaferPresenceCheck, RunWaferState.RunWafer_Drying_PostN2Time);            Transition(RunWaferState.RunWafer_Drying_PostN2Time, FSM_MSG.TIMER, PostN2Time, RunWaferState.RunWafer_Drying_CheckRotationFinished);            Transition(RunWaferState.RunWafer_Drying_CheckRotationFinished, FSM_MSG.TIMER, CheckRotationFinished, RunWaferState.RunWafer_CheckArmHome);            Transition(RunWaferState.RunWafer_CheckArmHome, FSM_MSG.TIMER, LastCheckArmHomed, RunWaferState.RunWafer_Complete);            //PresenceTest            Transition(RunWaferState.RunWafer_Complete, RunWaferMsg.PreWaferPresenceCheck, RunWaferStartCheckStatus, RunWaferState.RunWafer_Drying_PreWaferPresenceCheck);            EnumLoop<RunWaferState>.ForEach((item) => { fsm.MapState((int)item, item.ToString()); });            EnumLoop<RunWaferMsg>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });        }        private bool EnterError(object param)        {                        //关闭风扇            if (_srdCommon.CommonData.ExhaustOn)            {                bool result = _srdCommon.N2OffAction("", null);                if (!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "EnterError: Exhaust Off is failed");                }            }            //关闭WaterAbove            if (_srdCommon.CommonData.WaterAbove)            {                bool result = _srdCommon.WaterAboveOff();                if (!result)                {                    LOG.WriteLog(eEvent.INFO_SRD, _module, "EnterError: Water Above Off is failed");                }            }            //关闭WaterBelow            if (_srdCommon.CommonData.WaterBelow)            {                bool result = _srdCommon.WaterBelowOff();                if (!result)                {                    LOG.WriteLog(eEvent.INFO_SRD, _module, "EnterError: Water Below Off is failed");                }            }            return true;        }        private bool EnterRunWaferStart(object param)        {            _isRotationExecutePosition = false;            return true;        }               #region 状态方法        /// <summary>        /// 启动        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool RunWaferStartCheckStatus(object param)        {                        _startTime = Environment.TickCount;            if(param!=null)            {                object[] parameters= (object[])param;                _srdRecipe=(SrdRecipe)parameters[0];            }            if(_srdRecipe==null)            {                PostMsg(RunWaferMsg.Error);                LOG.WriteLog(eEvent.ERR_SRD, _module, "srd recipe is null");                return false;            }            _armAxis = DEVICE.GetDevice<JetAxisBase>($"{_module}.Arm");            if(!_armAxis.IsHomed)            {                PostMsg(RunWaferMsg.Error);                LOG.WriteLog(eEvent.ERR_SRD, _module, "Arm is not homed");                return false;            }            _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{_module}.Rotation");            if (!_rotationAxis.IsHomed)            {                PostMsg(RunWaferMsg.Error);                LOG.WriteLog(eEvent.ERR_SRD, _module, "Rotation is not homed");                return false;            }            _srdCommon = DEVICE.GetDevice<SrdCommonDevice>($"{_module}.Common");            _totalSRDDevice = DEVICE.GetDevice<TotalSRDDevice>("SRD");            if (_srdCommon.IsWaferPresence)            {                if (_srdCommon.WaferPresence != "WellPlaced")                {                    PostMsg(RunWaferMsg.Error);                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Wafer Presence is not WellPlaced");                    return false;                }            }            else            {                LOG.WriteLog(eEvent.INFO_SRD, _module, "Wafer Presence Test has been ignored");            }                                            if(SC.ContainsItem("SRD.SRDRotationPlusSecond"))            {                _rotationPlusSecond = SC.GetValue<int>("SRD.SRDRotationPlusSecond");            }            if(SC.ContainsItem("SRD.N2Enabled"))            {                _n2Enabled = SC.GetValue<bool>("SRD.N2Enabled");            }            //Wafer Presence Test            if (SC.ContainsItem($"SRD.{_module}EnablePresenceCheckvalue"))            {                _presenceTestEnabled = SC.GetValue<bool>($"SRD.{_module}EnablePresenceCheckvalue");            }            _systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");            string otherSRD = _module == "SRD1" ? "SRD2" : "SRD1";            _otherSrdEntity = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(otherSRD);            _rotationProviderAxis = BeckhoffAxisProviderManager.Instance.GetAxisProvider($"{_module}.Rotation");            if (_rotationProviderAxis == null)            {                PostMsg(RunWaferMsg.Error);                LOG.WriteLog(eEvent.ERR_SRD, _module, $"{_module}.Rotation Provider is not exist");                return false;            }            _armProviderAxis = BeckhoffAxisProviderManager.Instance.GetAxisProvider($"{_module}.Arm");            if (_armProviderAxis == null)            {                PostMsg(RunWaferMsg.Error);                LOG.WriteLog(eEvent.ERR_SRD, _module, $"{_module}.Arm Provider is not exist");                return false;            }            _waferPresenceCheckAccelDecelPercentage = SC.GetValue<int>("SRD.WaferPresenceCheckAccelDecelPercentage");            _waferPresenceSpeedInRPMs = SC.GetValue<int>("SRD.WaferPresenceCheckSpeedInRPMs");            _waferPresenceDistance = SC.GetValue<int>("SRD.WaferPresenceCheckDistanceInDegrees");            return true;        }        /// <summary>        /// 检查Facilities        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckFacilities(object param)        {            if (_srdCommon.CommonData.FluidContainment)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Fluid Containment sensor is On");                 PostMsg(RunWaferMsg.Error);                return false;            }            if(!_systemFacilities.LoaderDiEnable)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Load DI Is Disable");                PostMsg(RunWaferMsg.Error);                return false;            }            return true;        }        /// <summary>        /// 关闭Exhaust风机        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool PreparingExhaustOff(object param)        {            bool result = _srdCommon.N2OffAction("", null);            if (!result)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Preparing Exhaust Off is failed");                PostMsg(RunWaferMsg.Error);                return false;            }                             return true;        }        /// <summary>        /// 等待Exhaust风机关闭状态        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool WaitExhaustOff(object param)        {            if (_srdCommon.Status==RState.Failed||_srdCommon.Status==RState.Timeout)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Waiting Exhaust Off is failed");                PostMsg(RunWaferMsg.Error);                return false;            }            return _srdCommon.Status == RState.End && !_srdCommon.CommonData.ExhaustOn;        }        /// <summary>        /// Chuck Vacuum        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool EngageChuckVacuum(object param)        {            if (_srdCommon.IsWaferPresence)            {                bool result = _srdCommon.ChuckVacuumOnAction("", null);                if (!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Chuck Vacuum On Action is failed");                    PostMsg(RunWaferMsg.Error);                }                return result;            }            else            {                LOG.WriteLog(eEvent.INFO_SRD, _module, "EngageChuckVacuum has been ignored");                return true;            }                                }        /// <summary>        /// 检查真空状态        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckVacuum(object param)        {            if (_srdCommon.IsWaferPresence)            {                if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Check Vacuum is failed");                    PostMsg(RunWaferMsg.Error);                    return false;                }                return _srdCommon.Status == RState.End && !_srdCommon.CommonData.ChuckVacuum;            }            else            {                LOG.WriteLog(eEvent.INFO_SRD, _module, "CheckVacuum has been ignored");                return true;            }                    }        /// <summary>        /// Close Door        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CloseDoor(object param)        {            if (_srdCommon.CommonData.DoorOpened)            {                bool result = _srdCommon.DoorCloseAction("", null);                if (!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Door Close Action is failed");                    PostMsg(RunWaferMsg.Error);                    return result;                }            }                       return true;        }        /// <summary>        /// 检验DoorClosed        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckDoorClosed(object param)        {            if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Check Door Closed is failed");                PostMsg(RunWaferMsg.Error);                return false;            }            return _srdCommon.Status == RState.End && _srdCommon.CommonData.DoorClosed;        }        /// <summary>        /// Arm To Home        /// </summary>        /// <returns></returns>        private bool ArmToHome(object param)        {            if (!_armHoming)            {                _armAxis.Home(false);                _armHoming = true;                return false;            }            else            {                if(_armAxis.Status != RState.End)                {                    return false;                }            }            _armHoming = false;            _armIsHomed = _armAxis.IsHomed;            return true;        }        /// <summary>        /// 检验ARM,发现失败,则重试        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckArmHome(object param)        {            if (_armIsHomed)            {                return true;            }            else            {                if(_armRetryTimes<MAX_ARM_HOME_RETRIES)                {                    if (!_armHoming)                    {                        LOG.WriteLog(eEvent.INFO_SRD, _module, $"Arm Home Retry Home {_armRetryTimes + 1} times");                        bool result = _armAxis.Home(false);                        if (result)                        {                            _armHoming = true;                            }                        _armRetryTimes++;                        return false;                    }                    else                    {                        if(_armAxis.IsHomed&&_armAxis.Status==RState.End)                        {                            _armRetryTimes = 0;                            _armHoming = false;                            return true;                        }                        return false;                    }                }                else                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, $"Arm Home Retry Home {_armRetryTimes + 1} times is over {MAX_ARM_HOME_RETRIES}");                    PostMsg(RunWaferMsg.Error);                    return false;                }            }        }        /// <summary>        /// 检验另外一个SRD是否在用水        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckOtherSRD(object param)        {            if (_otherSrdEntity == null)            {                return true;            }            return !_otherSrdEntity.IsUsingWater;        }        /// <summary>        /// 打开Above water        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool WaterOn(object param)        {            if (_srdRecipe.FrontDivertTime>0)            {                if(_srdRecipe.FrontDivertTime>_srdRecipe.DivertPlusPoolDelay)                {                    _divertingFlowCheckTimeSpan = _srdRecipe.DivertPlusPoolDelay * 1000;                }                else                {                    _divertingFlowCheckTimeSpan = _srdRecipe.FrontDivertTime*1000;                }                if (!_srdCommon.CommonData.WaterAbove)                {                    bool result = _srdCommon.WaterAboveOn();                    if (result)                    {                        LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Above On");                        _isUsingWater = true;                        _enterTime = Environment.TickCount;                    }                    else                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above On is failed");                        PostMsg(RunWaferMsg.Error);                    }                    return result;                }                                 return false;            }            else            {                return true;            }        }        /// <summary>        /// 检验水压        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckFlow(object param)        {            if (_srdRecipe.FrontDivertTime==0)            {                return true;            }            else            {                int ticks = Environment.TickCount - _enterTime;                if(ticks<=_divertingFlowCheckTimeSpan)                {                    if(_totalSRDDevice.WaterPressure>_srdRecipe.MaxDivertPlusPoolPressure)                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module,$"Water Pressure {_totalSRDDevice} is over {_srdRecipe.MaxDivertPlusPoolPressure}");                        PostMsg(RunWaferMsg.Error);                        return false;                    }                }                else                {                    if (ticks >= _srdRecipe.FrontDivertTime*1000)                    {                        if (_srdCommon.CommonData.WaterAbove)                        {                            bool result = _srdCommon.WaterAboveOff();                                                                           if (result)                            {                                LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Above off");                            }                            else                            {                                LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above On is failed");                                PostMsg(RunWaferMsg.Error);                            }                            return result;                        }                                          }                }            }            return false;        }        /// <summary>        /// Arm运动至Center        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool ArmToCenter(object param)        {            bool result= _armAxis.PositionStation("Center");            if(!result)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Arm to Center is failed");                PostMsg(RunWaferMsg.Error);            }            return result;        }        /// <summary>        /// check Arm是否运动至Center        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckArmToCenter(object param)        {            if (_armAxis.Status==RState.End)            {                return true;            }            else if(_armAxis.Status==RState.Failed)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Check Arm to Center is failed");                PostMsg(RunWaferMsg.Error);                return false;            }            return false;        }        /// <summary>        /// 打开Above water        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool PoolingFrontSideWaterOn(object param)        {            if (_srdRecipe.FrontPoolTime > 0)            {                if (_srdRecipe.FrontPoolTime > _srdRecipe.DivertPlusPoolDelay)                {                    _poolingFlowCheckTimeSpan = _srdRecipe.DivertPlusPoolDelay * 1000;                }                else                {                    _poolingFlowCheckTimeSpan = _srdRecipe.FrontDivertTime * 1000;                }                if (!_srdCommon.CommonData.WaterAbove)                {                    bool result = _srdCommon.WaterAboveOn();                    if (result)                    {                        LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Above On");                        _enterTime = Environment.TickCount;                        if (_isUsingWater)                        {                            _isUsingWater = true;                        }                    }                    else                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above On is failed");                        PostMsg((int)RunWaferMsg.Error);                    }                    return result;                }                return true;            }            else            {                return true;            }        }        /// <summary>        /// 检验水压        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool PoolingCheckFlow(object param)        {            if (_srdRecipe.FrontPoolTime == 0)            {                return true;            }            else            {                int ticks = Environment.TickCount - _enterTime;                if (ticks <= _poolingFlowCheckTimeSpan)                {                    if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxWashPressure)                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, $"Water Pressure {_totalSRDDevice.WaterPressure} is over {_srdRecipe.MaxWashPressure}");                        PostMsg((int)RunWaferMsg.Error);                        return false;                    }                    if (_totalSRDDevice.WaterPressure < _srdRecipe.MinWaterPressure)                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, $"Water Pressure {_totalSRDDevice.WaterPressure} is less {_srdRecipe.MinWaterPressure}");                        PostMsg((int)RunWaferMsg.Error);                        return false;                    }                }                else                {                    if (ticks >= _srdRecipe.FrontPoolTime * 1000)                    {                        return true;                    }                }            }            return false;        }        /// <summary>        /// 开始旋转        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool StartRotation(object param)        {            if (_srdCommon.CommonData.DoorOpened)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Door is not closed. Can't do rotation");                PostMsg(RunWaferMsg.Error);                return false;            }            double _scale = _rotationProviderAxis.ScaleFactor;            bool above = _srdRecipe.FrontRinseTime > _srdRecipe.BackRinseTime;            int timespan = above ? _srdRecipe.FrontRinseTime : _srdRecipe.BackRinseTime;            //rinse 目标位置             double rinsePosition = timespan * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.RinseSpeed);            //dry目标位置            double dryPosition = BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.DrySpeed) * _srdRecipe.BackN2DryTime;            //为了让 rotation 不停止,增加了旋转时间(覆盖Arm运动时间)            double plusPosition = BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.DrySpeed) * _rotationPlusSecond;            int targetPosition = (int)Math.Round((rinsePosition + dryPosition + plusPosition) * _scale, 0);            int rotationSpeed = (int)Math.Round(_scale * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.RinseSpeed),0);            _drySpeed= (int)Math.Round(_scale * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.DrySpeed * SPEED_RATIO), 0);            bool result= _rotationAxis.ProfilePosition(targetPosition, rotationSpeed * SPEED_RATIO, 0, 0);            if(!result)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Start Rotation is failed");                PostMsg(RunWaferMsg.Error);                return false;            }            LOG.WriteLog(eEvent.INFO_SRD, _module, "Start Rotation");            //如果BackRinseTime大,则先开WaterBelow后开WaterAbove                    if (_srdRecipe.BackRinseTime>_srdRecipe.FrontRinseTime)            {                _rinseTime = _srdRecipe.BackRinseTime;                //关闭WaterAbove                if (_srdCommon.CommonData.WaterAbove)                {                                        if (!_srdCommon.WaterAboveOff())                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above Off is failed");                        PostMsg((int)RunWaferMsg.Error);                        return false;                    }                    LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Above Off");                }                //打开WaterBelow                if (!_srdCommon.CommonData.WaterBelow)                {                    if (!_srdCommon.WaterBelowOn())                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Below On is failed");                        PostMsg((int)RunWaferMsg.Error);                        return false;                    }                    LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Below On");                }                 //Rinse开始时间                _enterTime = Environment.TickCount;                //另一个水阀状态变为未开(即WaterAbove)                _isAnotherWaterOn = false;                //计算水压检测滞后时间                if (_srdRecipe.BackRinseTime > _srdRecipe.FlowCheckDelay)                {                    _washingFlowCheckTimeSpan = _srdRecipe.FlowCheckDelay * 1000;                }                else                {                    _washingFlowCheckTimeSpan = _srdRecipe.BackRinseTime * 1000;                }                                return true;            }            else            {                _rinseTime = _srdRecipe.FrontRinseTime;                //如果FrontRinseTime大,则先开WaterAbove后开WaterBelow                //打开WaterAbove                if (!_srdCommon.CommonData.WaterAbove)                {                    if (!_srdCommon.WaterAboveOn())                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above Off is failed");                        PostMsg((int)RunWaferMsg.Error);                        return false;                    }                    LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Above On");                }                //关闭WaterBelow                if (_srdCommon.CommonData.WaterBelow)                {                    //打开WaterBelow                    if (!_srdCommon.WaterBelowOff())                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Below On is failed");                        PostMsg((int)RunWaferMsg.Error);                        return false;                    }                    LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Below Off");                }                //另一个水阀状态变为未开(即WaterBelow)                _isAnotherWaterOn = false;                //Rinse开始时间                _enterTime = Environment.TickCount;                //计算水压检测滞后时间                if (_srdRecipe.FrontRinseTime > _srdRecipe.FlowCheckDelay)                {                    _washingFlowCheckTimeSpan = _srdRecipe.FlowCheckDelay * 1000;                }                else                {                    _washingFlowCheckTimeSpan = _srdRecipe.BackRinseTime * 1000;                }                return true;            }        }        /// <summary>        /// 检验水压        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool WashingPreFlowCheck(object param)        {            int ticks = Environment.TickCount - _enterTime;            //打开另一个未开的水阀            if(!_isAnotherWaterOn)            {                //延迟abs(BackRinseTime - FrontRinseTime)秒打开另一个水阀                if (_srdRecipe.BackRinseTime > _srdRecipe.FrontRinseTime)                {                    //若BackRinseTime > FrontRinseTime,则延迟BackRinseTime - FrontRinseTime秒打开Water Above                    if (ticks >= _rinseTime*1000 - _srdRecipe.FrontRinseTime*1000 && !_srdCommon.CommonData.WaterAbove)                    {                        bool result = _srdCommon.WaterAboveOn();                        if (!result)                        {                            LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above Off is failed");                            PostMsg((int)RunWaferMsg.Error);                            return false;                        }                        _isAnotherWaterOn = true;                        LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Above On");                    }                }                else                {                    //若FrontRinseTime > BackRinseTime,则延迟FrontRinseTime - BackRinseTime秒打开Water Below                    if (ticks >= _rinseTime * 1000 - _srdRecipe.BackRinseTime * 1000 && !_srdCommon.CommonData.WaterBelow)                    {                        bool result = _srdCommon.WaterBelowOn();                        if (!result)                        {                            LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Below On is failed");                            PostMsg((int)RunWaferMsg.Error);                            return false;                        }                        LOG.WriteLog(eEvent.INFO_SRD, _module, "Water Below On");                    }                }            }                                if (ticks >= _rinseTime * 1000)            {                //达到RinseTime完成Wash                return true;            }            else if (ticks > _washingFlowCheckTimeSpan)            {                if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxWashPressure)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, $"Water Pressure {_totalSRDDevice.WaterPressure} is over {_srdRecipe.MaxWashPressure}");                    PostMsg((int)RunWaferMsg.Error);                    return false;                }                if (_totalSRDDevice.WaterPressure < _srdRecipe.MinWaterPressure)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, $"Water Pressure {_totalSRDDevice.WaterPressure} is less {_srdRecipe.MinWaterPressure}");                    PostMsg((int)RunWaferMsg.Error);                    return false;                }            }            else            {                return false;            }            return false;        }        /// <summary>        /// Washing结束        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool WashingFinished(object param)        {            if (_srdCommon.CommonData.WaterAbove)            {                if(!_srdCommon.WaterAboveOff())                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Above Off is failed");                    PostMsg(RunWaferMsg.Error);                    return false;                }            }            if(_srdCommon.CommonData.WaterBelow)            {                if(!_srdCommon.WaterBelowOff())                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Water Below Off is failed");                    PostMsg(RunWaferMsg.Error);                    return false;                }            }            _isUsingWater = false;            if(_n2Enabled)            {                bool result= _armAxis.PositionStation("Center");                if(!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Arm to Center is failed");                    PostMsg(RunWaferMsg.Error);                }                return result;            }            else            {                bool result= _armAxis.PositionStation("Home");                if (!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Arm To Home is failed");                    PostMsg(RunWaferMsg.Error);                }                return result;            }        }        /// <summary>        /// 检验Arm是否运动到位        /// </summary>        /// <returns></returns>        private bool CheckArmMotion(object param)        {            //Arm是否运动到位            if (_armAxis.Status==RState.End)            {                //调整速度为 drySpeed                bool result= _rotationAxis.ChangeSpeed(_drySpeed);                if(!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Change Speed to Dry Speed is failed");                    return false;                }                if(_n2Enabled)                {                    //todo 打开N2 Above和N2 Below                }                _exhaustFanTime = Environment.TickCount;                return true;            }            else if(_armAxis.Status==RState.Failed)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, "Arm Axis Status is in Failed");                PostMsg(RunWaferMsg.Error);                return false;            }            return false;        }        /// <summary>        /// Exhaust delay        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool ExhaustFanDelay(object param)        {            int ticks = Environment.TickCount - _exhaustFanTime;            if (ticks >= _srdRecipe.ExhaustFanDelay * 1000)            {                bool result = _srdCommon.N2On();                if(!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Exhaust On failed");                    PostMsg(RunWaferMsg.Error);                    return false;                }                _enterTime = Environment.TickCount;                return true;            }            return false;        }        /// <summary>        /// N2 On        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool N2On(object param)        {            if (_n2Enabled)            {                //todo 关闭N2Above和N2 Below            }                        int ticks = Environment.TickCount - _enterTime;            if(ticks > _srdRecipe.BackN2DryTime * 1000) return true;            return false;        }        /// <summary>        /// Pre WaferPresence Check        /// </summary>        /// <returns></returns>        private bool PreWaferPresenceCheck(object param)        {            if (!_isExecuteRotationStop)            {                 //停止Rotation                bool result= _rotationAxis.StopPositionOperation();                LOG.WriteLog(eEvent.INFO_SRD, _module, "Stop Rotation is done");                _rotationStopTime = Environment.TickCount;                _isExecuteRotationStop = true;                if(!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Stop Rotation is failed");                    PostMsg(RunWaferMsg.Error);                }            }            else            {                int ticks=Environment.TickCount-_rotationStopTime;                if(ticks>=5*1000)//固定时间5秒,确认Rotation是否已经停下                {                    if(!_rotationAxis.IsRun && _rotationAxis.Status == RState.End)                    {                        _isExecuteRotationStop = false;                        return true;                    }                    else                    {                        LOG.WriteLog(eEvent.ERR_SRD, _module, "SRD Rotation Stop time span is over 5 seconds");                        PostMsg(RunWaferMsg.Error);                        return false;                    }                }            }            return false;        }        /// <summary>        /// Wafer Presence Check        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool WaferPresenceCheck(object param)        {            double scale = _rotationProviderAxis.ScaleFactor;            int currentRotation = (int)Math.Round(_rotationAxis.MotionData.MotorPosition * scale, 0);            //Presence Test目标位置(单位为°)            int targetPosition = (int)Math.Round(scale * _waferPresenceDistance,0)+currentRotation;            //转速单位转换 RPM(r/min) to degree/s            double degree = BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_waferPresenceSpeedInRPMs);            //Presence Test目标转速            int profileVelocity =(int)Math.Round(scale*degree,0);            //加速度            int acceleration = (int)Math.Round(_rotationAxis.ProfileAcceleration * _waferPresenceCheckAccelDecelPercentage / 100, 0);            //减速度            int deceleration = (int)Math.Round(_rotationAxis.ProfileDeceleration * _waferPresenceCheckAccelDecelPercentage / 100, 0);            if (!_isRotationExecutePosition)            {                if (_srdCommon.CommonData.DoorOpened)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Door is not closed. Can't do rotation");                    PostMsg(RunWaferMsg.Error);                    return false;                }                bool result = _rotationAxis.ProfilePosition(targetPosition, profileVelocity * SPEED_RATIO, acceleration, deceleration);                if (!result)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Start Rotation is failed");                    PostMsg(RunWaferMsg.Error);                }                _isRotationExecutePosition = true;                if (_srdCommon.IsWaferPresence && _presenceTestEnabled)                {                    //PresenceTest记录次数=(目标位置/目标转速)*1000ms /500ms                    _presenceTestCount = (int)Math.Floor(_waferPresenceDistance / degree * 1000 / 500);                    LOG.WriteLog(eEvent.INFO_SRD, _module, $"Presence Test Count is about {_presenceTestCount} times");                    //当前test次数归零                    _currentCount = 0;                    //开始计时                    _presenceTestEnterTime = Environment.TickCount;                    _isTestComplete = false;                    LOG.WriteLog(eEvent.INFO_SRD, _module, "Presence Test Timer is started");                }                return false;            }            else            {                //PresenceTestEnable开启则进行测试                if (!_isTestComplete && _srdCommon.IsWaferPresence && _presenceTestEnabled)                {                    int ticks = Environment.TickCount - _presenceTestEnterTime;                    //500ms检测一次                    if(ticks >= 500)                    {                        if (_srdCommon.WaferPresence == "WellPlaced")                        {                            _currentCount++;                            LOG.WriteLog(eEvent.INFO_SRD, _module, $"The {_currentCount}th Presence Test is successful");                            //更新PresenceTestEnterTime                            _presenceTestEnterTime = Environment.TickCount;                            if(_currentCount >= _presenceTestCount)                            {                                //PresenceTest通过                                                        _isTestComplete = true;                                LOG.WriteLog(eEvent.INFO_SRD, _module, $"The Presence Test of {_module} is all successful");                            }                            else                            {                                return false;                            }                        }                        else                        {                            LOG.WriteLog(eEvent.ERR_SRD, _module, $"The {_currentCount + 1}th Presence Test is failed");                            LOG.WriteLog(eEvent.ERR_SRD, _module, $"The Presence Test of {_module} is failed");                            PostMsg(RunWaferMsg.Error);                            return false;                        }                    }                    else                    {                        return false;                    }                }                                if (_rotationAxis.Status!=RState.End)                {                    return false;                }            }                       return true;        }        /// <summary>        /// Post N2 Time(Stop rotation ,home rotation)        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool PostN2Time(object param)        {                       bool homeResult = _rotationAxis.Home(false);            if(!homeResult)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, $"{_module}.Arm is not homed");                PostMsg(RunWaferMsg.Error);                return false;            }            return true;        }        /// <summary>        /// 检验Rotation是否Homed        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool CheckRotationFinished(object param)        {            //关闭排风扇            if (_srdCommon.CommonData.ExhaustOn && _srdCommon.Status != RState.Running)            {                bool result1 = _srdCommon.N2OffAction("", null);                if (!result1)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, "Preparing Exhaust Off is failed");                    PostMsg(RunWaferMsg.Error);                }            }                        bool result= _rotationAxis.IsHomed && _rotationAxis.Status == RState.End;            if(_rotationAxis.Status!=RState.Running)            {                if(!_rotationAxis.IsHomed)                {                    LOG.WriteLog(eEvent.ERR_SRD, _module, $"{_module}.rotation is not homed");                }                return true;            }            return false;        }        /// <summary>        /// 检验        /// </summary>        /// <param name="param"></param>        /// <returns></returns>        private bool LastCheckArmHomed(object param)        {            string currentLocation = _armAxis.CurrentStation;            bool armHomed= _armAxis.IsHomed;            if(!armHomed)            {                LOG.WriteLog(eEvent.ERR_SRD, _module, $"{_module}.Arm is not homed");                PostMsg(RunWaferMsg.Error);                return false;            }            if (!currentLocation.Contains("Home"))            {                LOG.WriteLog(eEvent.ERR_SRD, _module, $"{_module}.Arm is not in home station");                PostMsg(RunWaferMsg.Error);                return false;            }            LOG.WriteLog(eEvent.INFO_SRD, _module, $"Run Wafer State Machine 状态 {RunWaferState.RunWafer_Start}==>{RunWaferState.RunWafer_Complete} Total Time[{Environment.TickCount - _startTime}]");            return true;        }        #endregion        /// <summary>        /// 停止         /// </summary>        public void Stop()        {                       base.Terminate();        }        public bool Check(int msg, out string reason, params object[] args)        {            reason = "";            return false;        }        #region State Msg枚举        public enum RunWaferState        {            None,            Error,            RunWafer_Start,            RunWafer_CheckFacilities,            RunWafer_PreparingExhaustOff,            RunWafer_WaitExhaustOff,            RunWafer_EngageChuckVacuum,            RunWafer_CheckVacuum,            RunWafer_CloseTheDoor,            RunWafer_CheckDoorClosed,            RunWafer_ArmToHome,            RunWafer_Diverting_CheckArmHome,            RunWafer_Diverting_CheckOtherSRD,            RunWafer_Diverting_WaterOn,            RunWafer_Diverting_WithFlowCheck,            RunWafer_Washing_ArmToCenter,            RunWafer_Washing_CheckArmCenter,            RunWafer_Washing_PoolingFrontSide,            RunWafer_Washing_PoolingWithFlowCheck,            RunWafer_Washing_StartRotation,            RunWafer_Washing_PreFlowCheck,            RunWafer_Washing_Finished,            RunWafer_Drying_PreN2Time,            RunWafer_Drying_ExhaustFanDelay,            RunWafer_Drying_N2On,            RunWafer_Drying_PreWaferPresenceCheck,            RunWafer_Drying_WaferPresenceCheck,            RunWafer_Drying_PostN2Time,            RunWafer_Drying_CheckRotationFinished,            RunWafer_CheckArmHome,            RunWafer_Complete        }        public enum RunWaferMsg        {            Init,            Error,            RunWafer_Start,            CheckFacilities,            PreparingExhaustOff,            WaitExhaustOff,            EngageChuckVacuum,            CloseTheDoor,            ArmToHome,            CheckOtherSRD,            DivertingWaterAboveOn,            ArmToCenter,            PoolingFrontWaterAboveOn,            StartRotation,            Washing_Finished,            N2On,            PreWaferPresenceCheck,            WaferPresenceCheck,            PostN2Time,            CheckArmHome,            Abort        }        #endregion    }}
 |