| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224 | 
							- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using CyberX8_Core;
 
- using CyberX8_RT.Devices.AXIS;
 
- using CyberX8_RT.Devices.Facilities;
 
- using CyberX8_RT.Devices.SRD;
 
- using MECF.Framework.Common.Beckhoff.AxisProvider;
 
- using MECF.Framework.Common.RecipeCenter;
 
- using MECF.Framework.Common.Routine;
 
- using MECF.Framework.Common.Utilities;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Runtime.InteropServices;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows.Documents;
 
- using static CyberX8_RT.Modules.SRD.RunWaferRecipeStateMachine;
 
- namespace CyberX8_RT.Modules.SRD
 
- {
 
-     public class SRDRunWaferRecipeRoutine : RoutineBase, IRoutine
 
-     {
 
-         private enum RunStep
 
-         {
 
-             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_Diverting_WaterAboveOff,
 
-             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_ExhaustFanOn,
 
-             RunWafer_Drying_N2On, 
 
-             RunWafer_Drying_StopRotation,
 
-             RunWafer_Drying_PreWaferPresenceCheck,
 
-             RunWafer_Drying_RotationStartMotion,
 
-             RunWafer_Drying_WaferPresenceCheck,
 
-             RunWafer_Drying_PostN2Time,
 
-             RunWafer_Drying_CheckRotationFinished,
 
-             RunWafer_CheckArmHome,
 
-             End
 
-         }
 
-         #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>
 
-         /// 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重试次数
 
-         /// </summary>
 
-         private int _armRetryTimes = 0;
 
-         /// <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>
 
-         /// 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>
 
-         /// Rinse时间=Max(FrontRinseTime, BackRinseTime) 单位s
 
-         /// </summary>
 
-         private double _rinseTime;
 
-         /// <summary>
 
-         /// Rinse中另一个水阀开关状态
 
-         /// </summary>
 
-         private bool _isAnotherWaterOn;
 
-         /// <summary>
 
-         /// exhaust进入时间
 
-         /// </summary>
 
-         private int _exhaustFanTime;
 
-         /// <summary>
 
-         /// 是否正在用水
 
-         /// </summary>
 
-         private bool _isUsingWater;
 
-         /// <summary>
 
-         /// Presence Test Flag
 
-         /// </summary>
 
-         private bool _presenceTestFlag = false;
 
-         #endregion
 
-         #region 属性
 
-         /// <summary>
 
-         /// 是否正在用水
 
-         /// </summary>
 
-         public bool IsUsingWater { get { return _isUsingWater; } }
 
-         #endregion
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="module"></param>
 
-         public SRDRunWaferRecipeRoutine(string module) : base(module)
 
-         {
 
-         }
 
-         /// <summary>
 
-         /// 中止
 
-         /// </summary>
 
-         public void Abort()
 
-         {
 
-             Runner.Stop("SRD RunWaferRecipe Abort");
 
-         }
 
-         /// <summary>
 
-         /// 监控
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public RState Monitor()
 
-         {
 
-             Runner.RunIf(RunStep.RunWafer_Start, !_presenceTestFlag, RunWaferStartCheckStatus, _delay_1ms)
 
-                 .RunIf(RunStep.RunWafer_CheckFacilities, !_presenceTestFlag, CheckFacilities, _delay_1ms)
 
-                 .RunIf(RunStep.RunWafer_PreparingExhaustOff, !_presenceTestFlag, PreparingExhaustOff, _delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_WaitExhaustOff, !_presenceTestFlag, PreparingExhaustOffEndStatus, PreparingExhaustOffStopStatus, _delay_5s)
 
-                 .RunIf(RunStep.RunWafer_EngageChuckVacuum, !_presenceTestFlag, EngageChuckVacuum, _delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_CheckVacuum, !_presenceTestFlag, CheckChuckVacuumEndStatus, CheckChuckVacuumStopStatus, _delay_5s)
 
-                 .RunIf(RunStep.RunWafer_CloseTheDoor, !_presenceTestFlag, CloseDoor, _delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_CheckDoorClosed, !_presenceTestFlag, CheckDoorClosedEndStatus, CheckDoorClosedStopStatus, _delay_5s)
 
-                 .RunIf(RunStep.RunWafer_ArmToHome, !_presenceTestFlag, ArmToHome, _delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_CheckArmHome, !_presenceTestFlag, CheckArmEndStatus,CheckArmStopStatus)
 
-                 .WaitIf(RunStep.RunWafer_Diverting_CheckOtherSRD, !_presenceTestFlag, CheckOtherSRD,_delay_60s)
 
-                 .RunIf(RunStep.RunWafer_Diverting_WaterOn, !_presenceTestFlag, WaterOn,_delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_Diverting_WithFlowCheck, !_presenceTestFlag, CheckFlowEndStatus,CheckFlowStopStatus)
 
-                 .RunIf(RunStep.RunWafer_Diverting_WaterAboveOff, !_presenceTestFlag, WaterAboveOff,_delay_1ms)
 
-                 .RunIf(RunStep.RunWafer_Washing_ArmToCenter, !_presenceTestFlag, ArmToCenter, _delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_Washing_CheckArmCenter, !_presenceTestFlag, CheckArmToCenterEndStatus,CheckArmToCenterStopStatus,_delay_60s)
 
-                 .RunIf(RunStep.RunWafer_Washing_PoolingFrontSide, !_presenceTestFlag, PoolingFrontSideWaterOn,_delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_Washing_PoolingWithFlowCheck, !_presenceTestFlag, PoolingCheckFlowEndStatus,PoolingCheckFlowStopStatus)
 
-                 .RunIf(RunStep.RunWafer_Washing_StartRotation, !_presenceTestFlag, StartRotation,_delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_Washing_PreFlowCheck, !_presenceTestFlag, WashingPreFlowCheckEndStatus,WashingPreFlowCheckStopStatus)
 
-                 .RunIf(RunStep.RunWafer_Washing_Finished, !_presenceTestFlag, WashingFinished,_delay_1ms)
 
-                 .WaitWithStopConditionIf(RunStep.RunWafer_Drying_PreN2Time, !_presenceTestFlag, CheckArmMotionEndStatus,CheckArmMotionStopStatus)
 
-                 .DelayIf(RunStep.RunWafer_Drying_ExhaustFanDelay, !_presenceTestFlag, _srdRecipe.ExhaustFanDelay*1000)
 
-                 .RunIf(RunStep.RunWafer_Drying_ExhaustFanOn, !_presenceTestFlag, ExhaustFanOn,_delay_1ms)
 
-                 .DelayIf(RunStep.RunWafer_Drying_N2On, !_presenceTestFlag, _srdRecipe.BackN2DryTime*1000)
 
-                 .RunIf(RunStep.RunWafer_Drying_StopRotation, !_presenceTestFlag, StopRotation,_delay_1ms)
 
-                 //5s检验Rotation是否停止
 
-                 .Wait(RunStep.RunWafer_Drying_PreWaferPresenceCheck, CheckRotationStopEndStatus,_delay_5s)
 
-                 //Rotation开始运动至指定角度
 
-                 .Run(RunStep.RunWafer_Drying_RotationStartMotion,RotationMotion,_delay_1ms)
 
-                 //Rotation过程中Wafer Presence check
 
-                 .WaitWithStopCondition(RunStep.RunWafer_Drying_WaferPresenceCheck,RotationMotionEndStatus,RotationMotionStopStatus)
 
-                 //Rotation重新Home
 
-                 .Run(RunStep.RunWafer_Drying_PostN2Time,PostN2Time,_delay_1ms)
 
-                 //检验Rotation Home状态
 
-                 .WaitWithStopCondition(RunStep.RunWafer_Drying_CheckRotationFinished,CheckRotationHomedThenExhaust,CheckRotationHomedStopStatus)
 
-                 .Run(RunStep.RunWafer_CheckArmHome, LastCheckArmHomed,_delay_1ms)
 
-                 .End(RunStep.End, NullFun, _delay_1ms);
 
-             return Runner.Status;
 
-         }
 
-         /// <summary>
 
-         /// 启动
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool RunWaferStartCheckStatus()
 
-         {
 
-             _startTime = Environment.TickCount;
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 检查Facilities
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckFacilities()
 
-         {
 
-             if (_srdCommon.CommonData.FluidContainment)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Fluid Containment sensor is On", 0);
 
-                 return false;
 
-             }
 
-             if (!_systemFacilities.LoaderDiEnable)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Load DI Is Disable",0);
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 关闭Exhaust风机
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool PreparingExhaustOff()
 
-         {
 
-             bool result = _srdCommon.N2OffAction("", null);
 
-             if (!result)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Preparing Exhaust Off is failed", 0);
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 检验关闭Exhaust风机结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool PreparingExhaustOffEndStatus()
 
-         {
 
-             return !_srdCommon.CommonData.ExhaustOn;
 
-         }
 
-         /// <summary>
 
-         /// 检验关闭Exhaust风机停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool PreparingExhaustOffStopStatus()
 
-         {
 
-             //if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
 
-             //{
 
-             //    NotifyError(eEvent.ERR_SRD, "Waiting Exhaust Off is failed");
 
-             //    return true;
 
-             //}
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Chuck Vacuum
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool EngageChuckVacuum()
 
-         {
 
-             if (_srdCommon.IsWaferPresence)
 
-             {
 
-                 bool result = _srdCommon.ChuckVacuumOnAction("", null);
 
-                 if (!result)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Chuck Vacuum On Action is failed",0);
 
-                 }
 
-                 return result;
 
-             }
 
-             else
 
-             {
 
-                 LOG.WriteLog(eEvent.INFO_SRD, Module, "EngageChuckVacuum has been ignored");
 
-                 return true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检验ChuckVacuum结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckChuckVacuumEndStatus()
 
-         {
 
-             if (_srdCommon.IsWaferPresence)
 
-             {
 
-                 return _srdCommon.Status == RState.End && !_srdCommon.CommonData.ChuckVacuum;
 
-             }
 
-             else
 
-             {
 
-                 LOG.WriteLog(eEvent.INFO_SRD, Module, "CheckVacuum has been ignored");
 
-                 return true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检验ChuckVacuum停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckChuckVacuumStopStatus()
 
-         {
 
-             if (_srdCommon.IsWaferPresence)
 
-             {
 
-                 if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Check Vacuum is failed", 0);
 
-                     return true;
 
-                 }
 
-                 return false;
 
-             }
 
-             else
 
-             {
 
-                 return false;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Close Door
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CloseDoor()
 
-         {
 
-             if (_srdCommon.CommonData.DoorOpened)
 
-             {
 
-                 bool result = _srdCommon.DoorCloseAction("", null);
 
-                 if (!result)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Door Close Action is failed",0);
 
-                     return result;
 
-                 }
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 检验DoorClosed结束状态
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckDoorClosedEndStatus()
 
-         {
 
-             return _srdCommon.Status == RState.End && _srdCommon.CommonData.DoorClosed;
 
-         }
 
-         /// <summary>
 
-         /// 检验DoorClosed结束状态
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckDoorClosedStopStatus()
 
-         {
 
-             if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Check Door Closed is failed", 0);
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Arm To Home
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool ArmToHome()
 
-         {
 
-             _armAxis.Home(false);
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 检验Arm home结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckArmEndStatus()
 
-         {
 
-             if (_armAxis.IsHomed && _armAxis.Status == RState.End)
 
-             {
 
-                 _armRetryTimes = 0;
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 检验Arm停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckArmStopStatus()
 
-         {
 
-             if (_armAxis.Status == RState.Failed || _armAxis.Status == RState.Timeout)
 
-             {
 
-                 if (_armRetryTimes < MAX_ARM_HOME_RETRIES)
 
-                 {
 
-                     _armAxis.Home(false);
 
-                     _armRetryTimes++;
 
-                 }
 
-                 else
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, $"Arm Home Retry Home {_armRetryTimes + 1} times is over {MAX_ARM_HOME_RETRIES}",0);
 
-                     return true;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 检验另外一个SRD是否在用水
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckOtherSRD()
 
-         {            
 
-             return (_otherSrdEntity == null || !_otherSrdEntity.IsUsingWater);
 
-         }
 
-         /// <summary>
 
-         /// 打开Above water
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool WaterOn()
 
-         {
 
-             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
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Above On is failed", 0);
 
-                     }
 
-                     return result;
 
-                 }
 
-                 return true;
 
-             }
 
-             else
 
-             {
 
-                 if (_srdCommon.CommonData.WaterAbove)
 
-                 {
 
-                     bool result = _srdCommon.WaterAboveOff();
 
-                     if (result)
 
-                     {
 
-                         LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above Off");
 
-                         _isUsingWater = false;
 
-                         _enterTime = Environment.TickCount;
 
-                     }
 
-                     else
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
 
-                     }
 
-                     return result;
 
-                 }
 
-                 return true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检验流量结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckFlowEndStatus()
 
-         {
 
-             if (_srdRecipe.FrontDivertTime == 0)
 
-             {
 
-                 return true;
 
-             }
 
-             int ticks = Environment.TickCount - _enterTime;
 
-             if (ticks >= _srdRecipe.FrontDivertTime * 1000)
 
-             {
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 检验水压
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckFlowStopStatus()
 
-         {
 
-             int ticks = Environment.TickCount - _enterTime;
 
-             if (ticks <= _divertingFlowCheckTimeSpan)
 
-             {
 
-                 if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxDivertPlusPoolPressure)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice} is over {_srdRecipe.MaxDivertPlusPoolPressure}",0);
 
-                     return true;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// WaterAbove Off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool WaterAboveOff()
 
-         {
 
-             if (_srdCommon.CommonData.WaterAbove)
 
-             {
 
-                 bool result = _srdCommon.WaterAboveOff();
 
-                 _isUsingWater = false;
 
-                 if (result)
 
-                 {
 
-                     LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above off");
 
-                 }
 
-                 else
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Water Above On is failed", 0);
 
-                 }
 
-                 return result;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// Arm运动至Center
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool ArmToCenter()
 
-         {
 
-             bool result = _armAxis.PositionStation("Center");
 
-             if (!result)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Arm to Center is failed", 0);
 
-             }
 
-             return result;
 
-         }
 
-         /// <summary>
 
-         /// check Arm是否运动至Center
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckArmToCenterEndStatus()
 
-         {
 
-             return _armAxis.Status == RState.End;
 
-         }
 
-         /// <summary>
 
-         /// check Arm是否运动至Center停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckArmToCenterStopStatus()
 
-         {
 
-             if (_armAxis.Status == RState.Failed||_armAxis.Status==RState.Timeout)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Check Arm to Center is failed", 0);
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 打开Above water
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool PoolingFrontSideWaterOn()
 
-         {
 
-             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;                        
 
-                         _isUsingWater = true;
 
-                         
 
-                     }
 
-                     else
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Above On is failed",0);
 
-                     }
 
-                     return result;
 
-                 }
 
-                 return true;
 
-             }
 
-             else
 
-             {
 
-                 return true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检验Pooling流量结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool PoolingCheckFlowEndStatus()
 
-         {
 
-             if (_srdRecipe.FrontPoolTime == 0)
 
-             {
 
-                 return true;
 
-             }
 
-             int ticks = Environment.TickCount - _enterTime;
 
-             if (ticks >= _srdRecipe.FrontPoolTime * 1000)
 
-             {
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 检验Pooling流量停止状态
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool PoolingCheckFlowStopStatus()
 
-         {
 
-             int ticks = Environment.TickCount - _enterTime;
 
-             if (ticks <= _poolingFlowCheckTimeSpan)
 
-             {
 
-                 if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxWashPressure)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is over {_srdRecipe.MaxWashPressure}", 0);
 
-                     return true;
 
-                 }
 
-                 if (_totalSRDDevice.WaterPressure < _srdRecipe.MinWaterPressure)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is less {_srdRecipe.MinWaterPressure}",0);
 
-                     return true;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 开始旋转
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool StartRotation()
 
-         {
 
-             if (_srdCommon.CommonData.DoorOpened)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Door is not closed. Can't do rotation", 0);
 
-                 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)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Start Rotation is failed",0);
 
-                 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())
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
 
-                         return false;
 
-                     }
 
-                     LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above Off");
 
-                 }
 
-                 //打开WaterBelow
 
-                 if (!_srdCommon.CommonData.WaterBelow)
 
-                 {
 
-                     if (!_srdCommon.WaterBelowOn())
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Below On is failed",0);
 
-                         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())
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
 
-                         return false;
 
-                     }
 
-                     LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above On");
 
-                 }
 
-                 //关闭WaterBelow
 
-                 if (_srdCommon.CommonData.WaterBelow)
 
-                 {
 
-                     //打开WaterBelow
 
-                     if (!_srdCommon.WaterBelowOff())
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, "Water Below On is failed",0);
 
-                         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>
 
-         /// Washing PreFlow 流量结束状态
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool WashingPreFlowCheckEndStatus()
 
-         {
 
-             int ticks = Environment.TickCount - _enterTime;
 
-             if (ticks >= _rinseTime * 1000)
 
-             {
 
-                 //达到RinseTime完成Wash
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Washing PreFlow 流量停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool WashingPreFlowCheckStopStatus()
 
-         {
 
-             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)
 
-                         {
 
-                             NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
 
-                             return true;
 
-                         }
 
-                         _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)
 
-                         {
 
-                             NotifyError(eEvent.ERR_SRD, "Water Below On is failed",0);
 
-                             return true;
 
-                         }
 
-                         LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Below On");
 
-                     }
 
-                 }
 
-             }
 
-             //测水压
 
-             if (ticks > _washingFlowCheckTimeSpan)
 
-             {
 
-                 if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxWashPressure)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is over {_srdRecipe.MaxWashPressure}", 0);
 
-                     return true;
 
-                 }
 
-                 if (_totalSRDDevice.WaterPressure < _srdRecipe.MinWaterPressure)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is less {_srdRecipe.MinWaterPressure}",0);
 
-                     return true;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Washing结束
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool WashingFinished()
 
-         {
 
-             if (_srdCommon.CommonData.WaterAbove)
 
-             {
 
-                 if (!_srdCommon.WaterAboveOff())
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Water Above Off is failed",0);
 
-                     return false;
 
-                 }
 
-             }
 
-             if (_srdCommon.CommonData.WaterBelow)
 
-             {
 
-                 if (!_srdCommon.WaterBelowOff())
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Water Below Off is failed", 0);
 
-                     return false;
 
-                 }
 
-             }
 
-             _isUsingWater = false;
 
-             if (_n2Enabled)
 
-             {
 
-                 bool result = _armAxis.PositionStation("Center");
 
-                 if (!result)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Arm to Center is failed",0);
 
-                 }
 
-                 return result;
 
-             }
 
-             else
 
-             {
 
-                 bool result = _armAxis.PositionStation("Home");
 
-                 if (!result)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Arm To Home is failed", 0);
 
-                 }
 
-                 return result;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检验Arm是否运动到位
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckArmMotionEndStatus()
 
-         {
 
-             //Arm是否运动到位
 
-             if (_armAxis.Status == RState.End)
 
-             {
 
-                 //调整速度为 drySpeed
 
-                 bool result = _rotationAxis.ChangeSpeed(_drySpeed);
 
-                 if (!result)
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Change Speed to Dry Speed is failed",0);
 
-                     return false;
 
-                 }
 
-                 if (_n2Enabled)
 
-                 {
 
-                     //todo 打开N2 Above和N2 Below
 
-                 }
 
-                 _exhaustFanTime = Environment.TickCount;
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// 检验Arm是否运动到位
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckArmMotionStopStatus()
 
-         {
 
-             if (_armAxis.Status == RState.Failed||_armAxis.Status==RState.Timeout)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Arm Axis Status is in Failed", 0);
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Exhaust delay
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool ExhaustFanOn()
 
-         {
 
-             bool result = _srdCommon.N2On();
 
-             if (!result)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Exhaust On failed",0);
 
-                 return false;
 
-             }
 
-             if (_n2Enabled)
 
-             {
 
-                 //todo 关闭N2Above和N2 Below
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 停止旋转
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool StopRotation()
 
-         {
 
-             bool result = _rotationAxis.StopPositionOperation();
 
-             LOG.WriteLog(eEvent.INFO_SRD, Module, "Stop Rotation is done");
 
-             return result;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation是否停止
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckRotationStopEndStatus()
 
-         {
 
-             if (!_rotationAxis.IsRun && _rotationAxis.Status == RState.End)
 
-             {
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Rotation运行指定角度
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool RotationMotion()
 
-         {
 
-             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 (_srdCommon.CommonData.DoorOpened)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Door is not closed. Can't do rotation", 0);
 
-                 return false;
 
-             }
 
-             bool result = _rotationAxis.ProfilePosition(targetPosition, profileVelocity * SPEED_RATIO, acceleration, deceleration);
 
-             if (!result)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Start Rotation is failed",0);
 
-                 return false;
 
-             }            
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// Rotation运动结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool RotationMotionEndStatus()
 
-         {
 
-             return _rotationAxis.Status == RState.End;
 
-         }
 
-         /// <summary>
 
-         /// Rotation运动
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool RotationMotionStopStatus()
 
-         {
 
-             bool stopResult = _rotationAxis.Status == RState.Failed || _rotationAxis.Status == RState.Timeout;
 
-             if (!stopResult)
 
-             {
 
-                 if (_presenceTestEnabled && _srdCommon.IsWaferPresence)
 
-                 {
 
-                     if (_srdCommon.WaferPresence != "WellPlaced")
 
-                     {
 
-                         NotifyError(eEvent.ERR_SRD, $"Rotation Motioning wafer presence is {_srdCommon.WaferPresence}",0);
 
-                         return true;
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         /// <summary>
 
-         /// Post N2 Time(Stop rotation ,home rotation)
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool PostN2Time()
 
-         {
 
-             bool homeResult = _rotationAxis.Home(false);
 
-             if (!homeResult)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, $"{Module}.Arm is not homed", 0);
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation是否Homed,Home后关闭排风扇
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool CheckRotationHomedThenExhaust()
 
-         {
 
-             bool result = _rotationAxis.IsHomed && _rotationAxis.Status == RState.End;
 
-             if(result)
 
-             {
 
-                 //关闭排风扇
 
-                 if (_srdCommon.CommonData.ExhaustOn)
 
-                 {
 
-                     _srdCommon.N2OffAction("", null);
 
-                 }
 
-             }
 
-             return result;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation Home 停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckRotationHomedStopStatus()
 
-         {
 
-             return _rotationAxis.Status == RState.Failed || _rotationAxis.Status == RState.Timeout;
 
-         }
 
-         /// <summary>
 
-         /// 检验
 
-         /// </summary>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         private bool LastCheckArmHomed()
 
-         {
 
-             string currentLocation = _armAxis.CurrentStation;
 
-             bool armHomed = _armAxis.IsHomed;
 
-             if (!armHomed)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, $"{Module}.Arm is not homed", 0);
 
-                 return false;
 
-             }
 
-             if (!currentLocation.Contains("Home"))
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, $"{Module}.Arm is not in home station", 0);
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         
 
-         /// <summary>
 
-         /// 启动
 
-         /// </summary>
 
-         /// <param name="objs"></param>
 
-         /// <returns></returns>
 
-         public RState Start(params object[] objs)
 
-         {
 
-             _isUsingWater = false;
 
-             if (objs.Length >= 2 && (bool)objs[1])
 
-             {
 
-                 _presenceTestFlag = true;
 
-             }
 
-             else
 
-             {
 
-                 _presenceTestFlag = false;
 
-             }
 
-             _srdRecipe = (SrdRecipe)objs[0];
 
-             if (_srdRecipe == null)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "srd recipe is null", 0);
 
-                 return RState.Failed;
 
-             }
 
-             _armAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Arm");
 
-             if (!_armAxis.IsHomed)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Arm is not homed", 0);
 
-                 return RState.Failed;
 
-             }
 
-             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
 
-             if (!_rotationAxis.IsHomed)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, "Rotation is not homed",0);
 
-                 return RState.Failed;
 
-             }
 
-             _srdCommon = DEVICE.GetDevice<SrdCommonDevice>($"{Module}.Common");
 
-             _totalSRDDevice = DEVICE.GetDevice<TotalSRDDevice>("SRD");
 
-             if (_srdCommon.IsWaferPresence)
 
-             {
 
-                 if (_srdCommon.WaferPresence != "WellPlaced")
 
-                 {
 
-                     NotifyError(eEvent.ERR_SRD, "Wafer Presence is not WellPlaced", 0);
 
-                     return RState.Failed;
 
-                 }
 
-             }
 
-             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)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, $"{Module}.Rotation Provider is not exist", 0);
 
-                 return RState.Failed;
 
-             }
 
-             _armProviderAxis = BeckhoffAxisProviderManager.Instance.GetAxisProvider($"{Module}.Arm");
 
-             if (_armProviderAxis == null)
 
-             {
 
-                 NotifyError(eEvent.ERR_SRD, $"{Module}.Arm Provider is not exist",0);
 
-                 return RState.Failed;
 
-             }
 
-             _waferPresenceCheckAccelDecelPercentage = SC.GetValue<int>("SRD.WaferPresenceCheckAccelDecelPercentage");
 
-             _waferPresenceSpeedInRPMs = SC.GetValue<int>("SRD.WaferPresenceCheckSpeedInRPMs");
 
-             _waferPresenceDistance = SC.GetValue<int>("SRD.WaferPresenceCheckDistanceInDegrees");
 
-             return Runner.Start(Module, "Start Run Wafer");
 
-         }
 
-     }
 
- }
 
 
  |