SRDRunWaferRecipeRoutine.cs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.Util;
  6. using CyberX8_Core;
  7. using CyberX8_RT.Devices.AXIS;
  8. using CyberX8_RT.Devices.Facilities;
  9. using CyberX8_RT.Devices.SRD;
  10. using MECF.Framework.Common.Beckhoff.AxisProvider;
  11. using MECF.Framework.Common.RecipeCenter;
  12. using MECF.Framework.Common.Routine;
  13. using MECF.Framework.Common.Utilities;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Runtime.InteropServices;
  18. using System.Text;
  19. using System.Threading.Tasks;
  20. using System.Windows.Documents;
  21. using static CyberX8_RT.Modules.SRD.RunWaferRecipeStateMachine;
  22. namespace CyberX8_RT.Modules.SRD
  23. {
  24. public class SRDRunWaferRecipeRoutine : RoutineBase, IRoutine
  25. {
  26. private enum RunStep
  27. {
  28. RunWafer_Start,
  29. RunWafer_CheckFacilities,
  30. RunWafer_PreparingExhaustOff,
  31. RunWafer_WaitExhaustOff,
  32. RunWafer_EngageChuckVacuum,
  33. RunWafer_CheckVacuum,
  34. RunWafer_CloseTheDoor,
  35. RunWafer_CheckDoorClosed,
  36. RunWafer_ArmToHome,
  37. RunWafer_Diverting_CheckArmHome,
  38. RunWafer_Diverting_CheckOtherSRD,
  39. RunWafer_Diverting_WaterOn,
  40. RunWafer_Diverting_WithFlowCheck,
  41. RunWafer_Diverting_WaterAboveOff,
  42. RunWafer_Washing_ArmToCenter,
  43. RunWafer_Washing_CheckArmCenter,
  44. RunWafer_Washing_PoolingFrontSide,
  45. RunWafer_Washing_PoolingWithFlowCheck,
  46. RunWafer_Washing_StartRotation,
  47. RunWafer_Washing_PreFlowCheck,
  48. RunWafer_Washing_Finished,
  49. RunWafer_Drying_PreN2Time,
  50. RunWafer_Drying_ExhaustFanDelay,
  51. RunWafer_Drying_ExhaustFanOn,
  52. RunWafer_Drying_N2On,
  53. RunWafer_Drying_StopRotation,
  54. RunWafer_Drying_PreWaferPresenceCheck,
  55. RunWafer_Drying_RotationStartMotion,
  56. RunWafer_Drying_WaferPresenceCheck,
  57. RunWafer_Drying_PostN2Time,
  58. RunWafer_Drying_CheckRotationFinished,
  59. RunWafer_CheckArmHome,
  60. End
  61. }
  62. #region 常量
  63. private const int MAX_ARM_HOME_RETRIES = 3;
  64. /// <summary>
  65. /// 旋转增加时长
  66. /// </summary>
  67. private const int ROTATION_PLUS_TIME = 10;
  68. /// <summary>
  69. /// ROTATION电机转速比例
  70. /// </summary>
  71. private const int SPEED_RATIO = 10;
  72. #endregion
  73. #region 内部变量
  74. /// <summary>
  75. /// Arm Axis
  76. /// </summary>
  77. private JetAxisBase _armAxis;
  78. /// <summary>
  79. /// Rotation Axis
  80. /// </summary>
  81. private JetAxisBase _rotationAxis;
  82. /// <summary>
  83. /// SRD Common
  84. /// </summary>
  85. private SrdCommonDevice _srdCommon;
  86. /// <summary>
  87. /// Total SRD
  88. /// </summary>
  89. private TotalSRDDevice _totalSRDDevice;
  90. /// <summary>
  91. /// 另外SRD实例
  92. /// </summary>
  93. private SRDEntity _otherSrdEntity;
  94. /// <summary>
  95. /// Loader Common
  96. /// </summary>
  97. private SystemFacilities _systemFacilities;
  98. /// <summary>
  99. /// Arm重试次数
  100. /// </summary>
  101. private int _armRetryTimes = 0;
  102. /// <summary>
  103. /// Recipe
  104. /// </summary>
  105. private SrdRecipe _srdRecipe;
  106. /// <summary>
  107. /// 记时
  108. /// </summary>
  109. private int _enterTime;
  110. /// <summary>
  111. /// Diverting Flow时长
  112. /// </summary>
  113. private int _divertingFlowCheckTimeSpan;
  114. /// <summary>
  115. /// Pooling Flow时长
  116. /// </summary>
  117. private int _poolingFlowCheckTimeSpan;
  118. /// <summary>
  119. /// Washing Flow时长
  120. /// </summary>
  121. private int _washingFlowCheckTimeSpan;
  122. /// <summary>
  123. /// SRD rotation Provider对象
  124. /// </summary>
  125. private BeckhoffProviderAxis _rotationProviderAxis;
  126. /// <summary>
  127. /// SRD arm Provider对象
  128. /// </summary>
  129. private BeckhoffProviderAxis _armProviderAxis;
  130. /// <summary>
  131. /// 转换增加的时间
  132. /// </summary>
  133. private int _rotationPlusSecond = ROTATION_PLUS_TIME;
  134. /// <summary>
  135. /// N2 Enabled
  136. /// </summary>
  137. private bool _n2Enabled = false;
  138. /// <summary>
  139. /// Dry速度
  140. /// </summary>
  141. private int _drySpeed;
  142. /// <summary>
  143. /// Wafer Presence Accel/Decel比例
  144. /// </summary>
  145. private int _waferPresenceCheckAccelDecelPercentage;
  146. /// <summary>
  147. /// Wafer Presence Speed
  148. /// </summary>
  149. private int _waferPresenceSpeedInRPMs;
  150. /// <summary>
  151. /// Wafer Presence distance
  152. /// </summary>
  153. private int _waferPresenceDistance;
  154. /// <summary>
  155. /// 状态机进入时间
  156. /// </summary>
  157. private int _startTime;
  158. /// <summary>
  159. /// Wafer Presence Test功能是否启用
  160. /// </summary>
  161. private bool _presenceTestEnabled;
  162. /// <summary>
  163. /// Rinse时间=Max(FrontRinseTime, BackRinseTime) 单位s
  164. /// </summary>
  165. private double _rinseTime;
  166. /// <summary>
  167. /// Rinse中另一个水阀开关状态
  168. /// </summary>
  169. private bool _isAnotherWaterOn;
  170. /// <summary>
  171. /// exhaust进入时间
  172. /// </summary>
  173. private int _exhaustFanTime;
  174. /// <summary>
  175. /// 是否正在用水
  176. /// </summary>
  177. private bool _isUsingWater;
  178. /// <summary>
  179. /// Presence Test Flag
  180. /// </summary>
  181. private bool _presenceTestFlag = false;
  182. #endregion
  183. #region 属性
  184. /// <summary>
  185. /// 是否正在用水
  186. /// </summary>
  187. public bool IsUsingWater { get { return _isUsingWater; } }
  188. #endregion
  189. /// <summary>
  190. /// 构造函数
  191. /// </summary>
  192. /// <param name="module"></param>
  193. public SRDRunWaferRecipeRoutine(string module) : base(module)
  194. {
  195. }
  196. /// <summary>
  197. /// 中止
  198. /// </summary>
  199. public void Abort()
  200. {
  201. Runner.Stop("SRD RunWaferRecipe Abort");
  202. }
  203. /// <summary>
  204. /// 监控
  205. /// </summary>
  206. /// <returns></returns>
  207. public RState Monitor()
  208. {
  209. Runner.RunIf(RunStep.RunWafer_Start, !_presenceTestFlag, RunWaferStartCheckStatus, _delay_1ms)
  210. .RunIf(RunStep.RunWafer_CheckFacilities, !_presenceTestFlag, CheckFacilities, _delay_1ms)
  211. .RunIf(RunStep.RunWafer_PreparingExhaustOff, !_presenceTestFlag, PreparingExhaustOff, _delay_1ms)
  212. .WaitWithStopConditionIf(RunStep.RunWafer_WaitExhaustOff, !_presenceTestFlag, PreparingExhaustOffEndStatus, PreparingExhaustOffStopStatus, _delay_5s)
  213. .RunIf(RunStep.RunWafer_EngageChuckVacuum, !_presenceTestFlag, EngageChuckVacuum, _delay_1ms)
  214. .WaitWithStopConditionIf(RunStep.RunWafer_CheckVacuum, !_presenceTestFlag, CheckChuckVacuumEndStatus, CheckChuckVacuumStopStatus, _delay_5s)
  215. .RunIf(RunStep.RunWafer_CloseTheDoor, !_presenceTestFlag, CloseDoor, _delay_1ms)
  216. .WaitWithStopConditionIf(RunStep.RunWafer_CheckDoorClosed, !_presenceTestFlag, CheckDoorClosedEndStatus, CheckDoorClosedStopStatus, _delay_5s)
  217. .RunIf(RunStep.RunWafer_ArmToHome, !_presenceTestFlag, ArmToHome, _delay_1ms)
  218. .WaitWithStopConditionIf(RunStep.RunWafer_CheckArmHome, !_presenceTestFlag, CheckArmEndStatus,CheckArmStopStatus)
  219. .WaitIf(RunStep.RunWafer_Diverting_CheckOtherSRD, !_presenceTestFlag, CheckOtherSRD,_delay_60s)
  220. .RunIf(RunStep.RunWafer_Diverting_WaterOn, !_presenceTestFlag, WaterOn,_delay_1ms)
  221. .WaitWithStopConditionIf(RunStep.RunWafer_Diverting_WithFlowCheck, !_presenceTestFlag, CheckFlowEndStatus,CheckFlowStopStatus)
  222. .RunIf(RunStep.RunWafer_Diverting_WaterAboveOff, !_presenceTestFlag, WaterAboveOff,_delay_1ms)
  223. .RunIf(RunStep.RunWafer_Washing_ArmToCenter, !_presenceTestFlag, ArmToCenter, _delay_1ms)
  224. .WaitWithStopConditionIf(RunStep.RunWafer_Washing_CheckArmCenter, !_presenceTestFlag, CheckArmToCenterEndStatus,CheckArmToCenterStopStatus,_delay_60s)
  225. .RunIf(RunStep.RunWafer_Washing_PoolingFrontSide, !_presenceTestFlag, PoolingFrontSideWaterOn,_delay_1ms)
  226. .WaitWithStopConditionIf(RunStep.RunWafer_Washing_PoolingWithFlowCheck, !_presenceTestFlag, PoolingCheckFlowEndStatus,PoolingCheckFlowStopStatus)
  227. .RunIf(RunStep.RunWafer_Washing_StartRotation, !_presenceTestFlag, StartRotation,_delay_1ms)
  228. .WaitWithStopConditionIf(RunStep.RunWafer_Washing_PreFlowCheck, !_presenceTestFlag, WashingPreFlowCheckEndStatus,WashingPreFlowCheckStopStatus)
  229. .RunIf(RunStep.RunWafer_Washing_Finished, !_presenceTestFlag, WashingFinished,_delay_1ms)
  230. .WaitWithStopConditionIf(RunStep.RunWafer_Drying_PreN2Time, !_presenceTestFlag, CheckArmMotionEndStatus,CheckArmMotionStopStatus)
  231. .DelayIf(RunStep.RunWafer_Drying_ExhaustFanDelay, !_presenceTestFlag, _srdRecipe.ExhaustFanDelay*1000)
  232. .RunIf(RunStep.RunWafer_Drying_ExhaustFanOn, !_presenceTestFlag, ExhaustFanOn,_delay_1ms)
  233. .DelayIf(RunStep.RunWafer_Drying_N2On, !_presenceTestFlag, _srdRecipe.BackN2DryTime*1000)
  234. .RunIf(RunStep.RunWafer_Drying_StopRotation, !_presenceTestFlag, StopRotation,_delay_1ms)
  235. //5s检验Rotation是否停止
  236. .Wait(RunStep.RunWafer_Drying_PreWaferPresenceCheck, CheckRotationStopEndStatus,_delay_5s)
  237. //Rotation开始运动至指定角度
  238. .Run(RunStep.RunWafer_Drying_RotationStartMotion,RotationMotion,_delay_1ms)
  239. //Rotation过程中Wafer Presence check
  240. .WaitWithStopCondition(RunStep.RunWafer_Drying_WaferPresenceCheck,RotationMotionEndStatus,RotationMotionStopStatus)
  241. //Rotation重新Home
  242. .Run(RunStep.RunWafer_Drying_PostN2Time,PostN2Time,_delay_1ms)
  243. //检验Rotation Home状态
  244. .WaitWithStopCondition(RunStep.RunWafer_Drying_CheckRotationFinished,CheckRotationHomedThenExhaust,CheckRotationHomedStopStatus)
  245. .Run(RunStep.RunWafer_CheckArmHome, LastCheckArmHomed,_delay_1ms)
  246. .End(RunStep.End, NullFun, _delay_1ms);
  247. return Runner.Status;
  248. }
  249. /// <summary>
  250. /// 启动
  251. /// </summary>
  252. /// <param name="param"></param>
  253. /// <returns></returns>
  254. private bool RunWaferStartCheckStatus()
  255. {
  256. _startTime = Environment.TickCount;
  257. return true;
  258. }
  259. /// <summary>
  260. /// 检查Facilities
  261. /// </summary>
  262. /// <param name="param"></param>
  263. /// <returns></returns>
  264. private bool CheckFacilities()
  265. {
  266. if (_srdCommon.CommonData.FluidContainment)
  267. {
  268. NotifyError(eEvent.ERR_SRD, "Fluid Containment sensor is On", 0);
  269. return false;
  270. }
  271. if (!_systemFacilities.LoaderDiEnable)
  272. {
  273. NotifyError(eEvent.ERR_SRD, "Load DI Is Disable",0);
  274. return false;
  275. }
  276. return true;
  277. }
  278. /// <summary>
  279. /// 关闭Exhaust风机
  280. /// </summary>
  281. /// <param name="param"></param>
  282. /// <returns></returns>
  283. private bool PreparingExhaustOff()
  284. {
  285. bool result = _srdCommon.ExhaustOffAction("", null);
  286. if (!result)
  287. {
  288. NotifyError(eEvent.ERR_SRD, "Preparing Exhaust Off is failed", 0);
  289. return false;
  290. }
  291. return true;
  292. }
  293. /// <summary>
  294. /// 检验关闭Exhaust风机结束状态
  295. /// </summary>
  296. /// <returns></returns>
  297. private bool PreparingExhaustOffEndStatus()
  298. {
  299. return !_srdCommon.CommonData.ExhaustOn;
  300. }
  301. /// <summary>
  302. /// 检验关闭Exhaust风机停止状态
  303. /// </summary>
  304. /// <returns></returns>
  305. private bool PreparingExhaustOffStopStatus()
  306. {
  307. //if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
  308. //{
  309. // NotifyError(eEvent.ERR_SRD, "Waiting Exhaust Off is failed");
  310. // return true;
  311. //}
  312. return false;
  313. }
  314. /// <summary>
  315. /// Chuck Vacuum
  316. /// </summary>
  317. /// <param name="param"></param>
  318. /// <returns></returns>
  319. private bool EngageChuckVacuum()
  320. {
  321. if (_srdCommon.IsWaferPresence)
  322. {
  323. bool result = _srdCommon.ChuckVacuumOnAction("", null);
  324. if (!result)
  325. {
  326. NotifyError(eEvent.ERR_SRD, "Chuck Vacuum On Action is failed",0);
  327. }
  328. return result;
  329. }
  330. else
  331. {
  332. LOG.WriteLog(eEvent.INFO_SRD, Module, "EngageChuckVacuum has been ignored");
  333. return true;
  334. }
  335. }
  336. /// <summary>
  337. /// 检验ChuckVacuum结束状态
  338. /// </summary>
  339. /// <returns></returns>
  340. private bool CheckChuckVacuumEndStatus()
  341. {
  342. if (_srdCommon.IsWaferPresence)
  343. {
  344. return _srdCommon.Status == RState.End && !_srdCommon.CommonData.ChuckVacuum;
  345. }
  346. else
  347. {
  348. LOG.WriteLog(eEvent.INFO_SRD, Module, "CheckVacuum has been ignored");
  349. return true;
  350. }
  351. }
  352. /// <summary>
  353. /// 检验ChuckVacuum停止状态
  354. /// </summary>
  355. /// <returns></returns>
  356. private bool CheckChuckVacuumStopStatus()
  357. {
  358. if (_srdCommon.IsWaferPresence)
  359. {
  360. if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
  361. {
  362. NotifyError(eEvent.ERR_SRD, "Check Vacuum is failed", 0);
  363. return true;
  364. }
  365. return false;
  366. }
  367. else
  368. {
  369. return false;
  370. }
  371. }
  372. /// <summary>
  373. /// Close Door
  374. /// </summary>
  375. /// <param name="param"></param>
  376. /// <returns></returns>
  377. private bool CloseDoor()
  378. {
  379. if (_srdCommon.CommonData.DoorOpened)
  380. {
  381. bool result = _srdCommon.DoorCloseAction("", null);
  382. if (!result)
  383. {
  384. NotifyError(eEvent.ERR_SRD, "Door Close Action is failed",0);
  385. return result;
  386. }
  387. }
  388. return true;
  389. }
  390. /// <summary>
  391. /// 检验DoorClosed结束状态
  392. /// </summary>
  393. /// <param name="param"></param>
  394. /// <returns></returns>
  395. private bool CheckDoorClosedEndStatus()
  396. {
  397. return _srdCommon.Status == RState.End && _srdCommon.CommonData.DoorClosed;
  398. }
  399. /// <summary>
  400. /// 检验DoorClosed结束状态
  401. /// </summary>
  402. /// <param name="param"></param>
  403. /// <returns></returns>
  404. private bool CheckDoorClosedStopStatus()
  405. {
  406. if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
  407. {
  408. NotifyError(eEvent.ERR_SRD, "Check Door Closed is failed", 0);
  409. return true;
  410. }
  411. return false;
  412. }
  413. /// <summary>
  414. /// Arm To Home
  415. /// </summary>
  416. /// <returns></returns>
  417. private bool ArmToHome()
  418. {
  419. _armAxis.Home(false);
  420. return true;
  421. }
  422. /// <summary>
  423. /// 检验Arm home结束状态
  424. /// </summary>
  425. /// <returns></returns>
  426. private bool CheckArmEndStatus()
  427. {
  428. if (_armAxis.IsHomed && _armAxis.Status == RState.End)
  429. {
  430. _armRetryTimes = 0;
  431. return true;
  432. }
  433. return false;
  434. }
  435. /// <summary>
  436. /// 检验Arm停止状态
  437. /// </summary>
  438. /// <returns></returns>
  439. private bool CheckArmStopStatus()
  440. {
  441. if (_armAxis.Status == RState.Failed || _armAxis.Status == RState.Timeout)
  442. {
  443. if (_armRetryTimes < MAX_ARM_HOME_RETRIES)
  444. {
  445. _armAxis.Home(false);
  446. _armRetryTimes++;
  447. }
  448. else
  449. {
  450. NotifyError(eEvent.ERR_SRD, $"Arm Home Retry Home {_armRetryTimes + 1} times is over {MAX_ARM_HOME_RETRIES}",0);
  451. return true;
  452. }
  453. }
  454. return false;
  455. }
  456. /// <summary>
  457. /// 检验另外一个SRD是否在用水
  458. /// </summary>
  459. /// <param name="param"></param>
  460. /// <returns></returns>
  461. private bool CheckOtherSRD()
  462. {
  463. return (_otherSrdEntity == null || !_otherSrdEntity.IsUsingWater);
  464. }
  465. /// <summary>
  466. /// 打开Above water
  467. /// </summary>
  468. /// <param name="param"></param>
  469. /// <returns></returns>
  470. private bool WaterOn()
  471. {
  472. if (_srdRecipe.FrontDivertTime > 0)
  473. {
  474. if (_srdRecipe.FrontDivertTime > _srdRecipe.DivertPlusPoolDelay)
  475. {
  476. _divertingFlowCheckTimeSpan = _srdRecipe.DivertPlusPoolDelay * 1000;
  477. }
  478. else
  479. {
  480. _divertingFlowCheckTimeSpan = _srdRecipe.FrontDivertTime * 1000;
  481. }
  482. if (!_srdCommon.CommonData.WaterAbove)
  483. {
  484. bool result = _srdCommon.WaterAboveOn();
  485. if (result)
  486. {
  487. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above On");
  488. _isUsingWater = true;
  489. _enterTime = Environment.TickCount;
  490. }
  491. else
  492. {
  493. NotifyError(eEvent.ERR_SRD, "Water Above On is failed", 0);
  494. }
  495. return result;
  496. }
  497. return true;
  498. }
  499. else
  500. {
  501. if (_srdCommon.CommonData.WaterAbove)
  502. {
  503. bool result = _srdCommon.WaterAboveOff();
  504. if (result)
  505. {
  506. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above Off");
  507. _isUsingWater = false;
  508. _enterTime = Environment.TickCount;
  509. }
  510. else
  511. {
  512. NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
  513. }
  514. return result;
  515. }
  516. return true;
  517. }
  518. }
  519. /// <summary>
  520. /// 检验流量结束状态
  521. /// </summary>
  522. /// <returns></returns>
  523. private bool CheckFlowEndStatus()
  524. {
  525. if (_srdRecipe.FrontDivertTime == 0)
  526. {
  527. return true;
  528. }
  529. int ticks = Environment.TickCount - _enterTime;
  530. if (ticks >= _srdRecipe.FrontDivertTime * 1000)
  531. {
  532. return true;
  533. }
  534. return false;
  535. }
  536. /// <summary>
  537. /// 检验水压
  538. /// </summary>
  539. /// <param name="param"></param>
  540. /// <returns></returns>
  541. private bool CheckFlowStopStatus()
  542. {
  543. int ticks = Environment.TickCount - _enterTime;
  544. if (ticks <= _divertingFlowCheckTimeSpan)
  545. {
  546. if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxDivertPlusPoolPressure)
  547. {
  548. NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice} is over {_srdRecipe.MaxDivertPlusPoolPressure}",0);
  549. return true;
  550. }
  551. }
  552. return false;
  553. }
  554. /// <summary>
  555. /// WaterAbove Off
  556. /// </summary>
  557. /// <returns></returns>
  558. private bool WaterAboveOff()
  559. {
  560. if (_srdCommon.CommonData.WaterAbove)
  561. {
  562. bool result = _srdCommon.WaterAboveOff();
  563. _isUsingWater = false;
  564. if (result)
  565. {
  566. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above off");
  567. }
  568. else
  569. {
  570. NotifyError(eEvent.ERR_SRD, "Water Above On is failed", 0);
  571. }
  572. return result;
  573. }
  574. return true;
  575. }
  576. /// <summary>
  577. /// Arm运动至Center
  578. /// </summary>
  579. /// <param name="param"></param>
  580. /// <returns></returns>
  581. private bool ArmToCenter()
  582. {
  583. bool result = _armAxis.PositionStation("Center");
  584. if (!result)
  585. {
  586. NotifyError(eEvent.ERR_SRD, "Arm to Center is failed", 0);
  587. }
  588. return result;
  589. }
  590. /// <summary>
  591. /// check Arm是否运动至Center
  592. /// </summary>
  593. /// <param name="param"></param>
  594. /// <returns></returns>
  595. private bool CheckArmToCenterEndStatus()
  596. {
  597. return _armAxis.Status == RState.End;
  598. }
  599. /// <summary>
  600. /// check Arm是否运动至Center停止状态
  601. /// </summary>
  602. /// <returns></returns>
  603. private bool CheckArmToCenterStopStatus()
  604. {
  605. if (_armAxis.Status == RState.Failed||_armAxis.Status==RState.Timeout)
  606. {
  607. NotifyError(eEvent.ERR_SRD, "Check Arm to Center is failed", 0);
  608. return true;
  609. }
  610. return false;
  611. }
  612. /// <summary>
  613. /// 打开Above water
  614. /// </summary>
  615. /// <param name="param"></param>
  616. /// <returns></returns>
  617. private bool PoolingFrontSideWaterOn()
  618. {
  619. if (_srdRecipe.FrontPoolTime > 0)
  620. {
  621. if (_srdRecipe.FrontPoolTime > _srdRecipe.DivertPlusPoolDelay)
  622. {
  623. _poolingFlowCheckTimeSpan = _srdRecipe.DivertPlusPoolDelay * 1000;
  624. }
  625. else
  626. {
  627. _poolingFlowCheckTimeSpan = _srdRecipe.FrontDivertTime * 1000;
  628. }
  629. if (!_srdCommon.CommonData.WaterAbove)
  630. {
  631. bool result = _srdCommon.WaterAboveOn();
  632. if (result)
  633. {
  634. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above On");
  635. _enterTime = Environment.TickCount;
  636. _isUsingWater = true;
  637. }
  638. else
  639. {
  640. NotifyError(eEvent.ERR_SRD, "Water Above On is failed",0);
  641. }
  642. return result;
  643. }
  644. return true;
  645. }
  646. else
  647. {
  648. return true;
  649. }
  650. }
  651. /// <summary>
  652. /// 检验Pooling流量结束状态
  653. /// </summary>
  654. /// <returns></returns>
  655. private bool PoolingCheckFlowEndStatus()
  656. {
  657. if (_srdRecipe.FrontPoolTime == 0)
  658. {
  659. return true;
  660. }
  661. int ticks = Environment.TickCount - _enterTime;
  662. if (ticks >= _srdRecipe.FrontPoolTime * 1000)
  663. {
  664. return true;
  665. }
  666. return false;
  667. }
  668. /// <summary>
  669. /// 检验Pooling流量停止状态
  670. /// </summary>
  671. /// <param name="param"></param>
  672. /// <returns></returns>
  673. private bool PoolingCheckFlowStopStatus()
  674. {
  675. int ticks = Environment.TickCount - _enterTime;
  676. if (ticks <= _poolingFlowCheckTimeSpan)
  677. {
  678. if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxWashPressure)
  679. {
  680. NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is over {_srdRecipe.MaxWashPressure}", 0);
  681. return true;
  682. }
  683. if (_totalSRDDevice.WaterPressure < _srdRecipe.MinWaterPressure)
  684. {
  685. NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is less {_srdRecipe.MinWaterPressure}",0);
  686. return true;
  687. }
  688. }
  689. return false;
  690. }
  691. /// <summary>
  692. /// 开始旋转
  693. /// </summary>
  694. /// <param name="param"></param>
  695. /// <returns></returns>
  696. private bool StartRotation()
  697. {
  698. if (_srdCommon.CommonData.DoorOpened)
  699. {
  700. NotifyError(eEvent.ERR_SRD, "Door is not closed. Can't do rotation", 0);
  701. return false;
  702. }
  703. double _scale = _rotationProviderAxis.ScaleFactor;
  704. bool above = _srdRecipe.FrontRinseTime > _srdRecipe.BackRinseTime;
  705. int timespan = above ? _srdRecipe.FrontRinseTime : _srdRecipe.BackRinseTime;
  706. //rinse 目标位置
  707. double rinsePosition = timespan * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.RinseSpeed);
  708. //dry目标位置
  709. double dryPosition = BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.DrySpeed) * _srdRecipe.BackN2DryTime;
  710. //为了让 rotation 不停止,增加了旋转时间(覆盖Arm运动时间)
  711. double plusPosition = BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.DrySpeed) * _rotationPlusSecond;
  712. int targetPosition = (int)Math.Round((rinsePosition + dryPosition + plusPosition) * _scale, 0);
  713. int rotationSpeed = (int)Math.Round(_scale * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.RinseSpeed), 0);
  714. _drySpeed = (int)Math.Round(_scale * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_srdRecipe.DrySpeed * SPEED_RATIO), 0);
  715. bool result = _rotationAxis.ProfilePosition(targetPosition, rotationSpeed * SPEED_RATIO, 0, 0);
  716. if (!result)
  717. {
  718. NotifyError(eEvent.ERR_SRD, "Start Rotation is failed",0);
  719. return false;
  720. }
  721. LOG.WriteLog(eEvent.INFO_SRD, Module, "Start Rotation");
  722. //如果BackRinseTime大,则先开WaterBelow后开WaterAbove
  723. if (_srdRecipe.BackRinseTime > _srdRecipe.FrontRinseTime)
  724. {
  725. _rinseTime = _srdRecipe.BackRinseTime;
  726. //关闭WaterAbove
  727. if (_srdCommon.CommonData.WaterAbove)
  728. {
  729. if (!_srdCommon.WaterAboveOff())
  730. {
  731. NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
  732. return false;
  733. }
  734. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above Off");
  735. }
  736. //打开WaterBelow
  737. if (!_srdCommon.CommonData.WaterBelow)
  738. {
  739. if (!_srdCommon.WaterBelowOn())
  740. {
  741. NotifyError(eEvent.ERR_SRD, "Water Below On is failed",0);
  742. return false;
  743. }
  744. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Below On");
  745. }
  746. //Rinse开始时间
  747. _enterTime = Environment.TickCount;
  748. //另一个水阀状态变为未开(即WaterAbove)
  749. _isAnotherWaterOn = false;
  750. //计算水压检测滞后时间
  751. if (_srdRecipe.BackRinseTime > _srdRecipe.FlowCheckDelay)
  752. {
  753. _washingFlowCheckTimeSpan = _srdRecipe.FlowCheckDelay * 1000;
  754. }
  755. else
  756. {
  757. _washingFlowCheckTimeSpan = _srdRecipe.BackRinseTime * 1000;
  758. }
  759. return true;
  760. }
  761. else
  762. {
  763. _rinseTime = _srdRecipe.FrontRinseTime;
  764. //如果FrontRinseTime大,则先开WaterAbove后开WaterBelow
  765. //打开WaterAbove
  766. if (!_srdCommon.CommonData.WaterAbove)
  767. {
  768. if (!_srdCommon.WaterAboveOn())
  769. {
  770. NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
  771. return false;
  772. }
  773. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above On");
  774. }
  775. //关闭WaterBelow
  776. if (_srdCommon.CommonData.WaterBelow)
  777. {
  778. //打开WaterBelow
  779. if (!_srdCommon.WaterBelowOff())
  780. {
  781. NotifyError(eEvent.ERR_SRD, "Water Below On is failed",0);
  782. return false;
  783. }
  784. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Below Off");
  785. }
  786. //另一个水阀状态变为未开(即WaterBelow)
  787. _isAnotherWaterOn = false;
  788. //Rinse开始时间
  789. _enterTime = Environment.TickCount;
  790. //计算水压检测滞后时间
  791. if (_srdRecipe.FrontRinseTime > _srdRecipe.FlowCheckDelay)
  792. {
  793. _washingFlowCheckTimeSpan = _srdRecipe.FlowCheckDelay * 1000;
  794. }
  795. else
  796. {
  797. _washingFlowCheckTimeSpan = _srdRecipe.BackRinseTime * 1000;
  798. }
  799. return true;
  800. }
  801. }
  802. /// <summary>
  803. /// Washing PreFlow 流量结束状态
  804. /// </summary>
  805. /// <param name="param"></param>
  806. /// <returns></returns>
  807. private bool WashingPreFlowCheckEndStatus()
  808. {
  809. int ticks = Environment.TickCount - _enterTime;
  810. if (ticks >= _rinseTime * 1000)
  811. {
  812. //达到RinseTime完成Wash
  813. return true;
  814. }
  815. return false;
  816. }
  817. /// <summary>
  818. /// Washing PreFlow 流量停止状态
  819. /// </summary>
  820. /// <returns></returns>
  821. private bool WashingPreFlowCheckStopStatus()
  822. {
  823. int ticks = Environment.TickCount - _enterTime;
  824. //打开另一个未开的水阀
  825. if (!_isAnotherWaterOn)
  826. {
  827. //延迟abs(BackRinseTime - FrontRinseTime)秒打开另一个水阀
  828. if (_srdRecipe.BackRinseTime > _srdRecipe.FrontRinseTime)
  829. {
  830. //若BackRinseTime > FrontRinseTime,则延迟BackRinseTime - FrontRinseTime秒打开Water Above
  831. if (ticks >= _rinseTime * 1000 - _srdRecipe.FrontRinseTime * 1000 && !_srdCommon.CommonData.WaterAbove)
  832. {
  833. bool result = _srdCommon.WaterAboveOn();
  834. if (!result)
  835. {
  836. NotifyError(eEvent.ERR_SRD, "Water Above Off is failed", 0);
  837. return true;
  838. }
  839. _isAnotherWaterOn = true;
  840. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Above On");
  841. }
  842. }
  843. else
  844. {
  845. //若FrontRinseTime > BackRinseTime,则延迟FrontRinseTime - BackRinseTime秒打开Water Below
  846. if (ticks >= _rinseTime * 1000 - _srdRecipe.BackRinseTime * 1000 && !_srdCommon.CommonData.WaterBelow)
  847. {
  848. bool result = _srdCommon.WaterBelowOn();
  849. if (!result)
  850. {
  851. NotifyError(eEvent.ERR_SRD, "Water Below On is failed",0);
  852. return true;
  853. }
  854. LOG.WriteLog(eEvent.INFO_SRD, Module, "Water Below On");
  855. }
  856. }
  857. }
  858. //测水压
  859. if (ticks > _washingFlowCheckTimeSpan)
  860. {
  861. if (_totalSRDDevice.WaterPressure > _srdRecipe.MaxWashPressure)
  862. {
  863. NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is over {_srdRecipe.MaxWashPressure}", 0);
  864. return true;
  865. }
  866. if (_totalSRDDevice.WaterPressure < _srdRecipe.MinWaterPressure)
  867. {
  868. NotifyError(eEvent.ERR_SRD, $"Water Pressure {_totalSRDDevice.WaterPressure} is less {_srdRecipe.MinWaterPressure}",0);
  869. return true;
  870. }
  871. }
  872. return false;
  873. }
  874. /// <summary>
  875. /// Washing结束
  876. /// </summary>
  877. /// <param name="param"></param>
  878. /// <returns></returns>
  879. private bool WashingFinished()
  880. {
  881. if (_srdCommon.CommonData.WaterAbove)
  882. {
  883. if (!_srdCommon.WaterAboveOff())
  884. {
  885. NotifyError(eEvent.ERR_SRD, "Water Above Off is failed",0);
  886. return false;
  887. }
  888. }
  889. if (_srdCommon.CommonData.WaterBelow)
  890. {
  891. if (!_srdCommon.WaterBelowOff())
  892. {
  893. NotifyError(eEvent.ERR_SRD, "Water Below Off is failed", 0);
  894. return false;
  895. }
  896. }
  897. _isUsingWater = false;
  898. if (_n2Enabled)
  899. {
  900. bool result = _armAxis.PositionStation("Center");
  901. if (!result)
  902. {
  903. NotifyError(eEvent.ERR_SRD, "Arm to Center is failed",0);
  904. }
  905. return result;
  906. }
  907. else
  908. {
  909. bool result = _armAxis.PositionStation("Home");
  910. if (!result)
  911. {
  912. NotifyError(eEvent.ERR_SRD, "Arm To Home is failed", 0);
  913. }
  914. return result;
  915. }
  916. }
  917. /// <summary>
  918. /// 检验Arm是否运动到位
  919. /// </summary>
  920. /// <returns></returns>
  921. private bool CheckArmMotionEndStatus()
  922. {
  923. //Arm是否运动到位
  924. if (_armAxis.Status == RState.End)
  925. {
  926. //调整速度为 drySpeed
  927. bool result = _rotationAxis.ChangeSpeed(_drySpeed);
  928. if (!result)
  929. {
  930. NotifyError(eEvent.ERR_SRD, "Change Speed to Dry Speed is failed",0);
  931. return false;
  932. }
  933. if (_n2Enabled)
  934. {
  935. //todo 打开N2 Above和N2 Below
  936. }
  937. _exhaustFanTime = Environment.TickCount;
  938. return true;
  939. }
  940. return false;
  941. }
  942. /// <summary>
  943. /// 检验Arm是否运动到位
  944. /// </summary>
  945. /// <returns></returns>
  946. private bool CheckArmMotionStopStatus()
  947. {
  948. if (_armAxis.Status == RState.Failed||_armAxis.Status==RState.Timeout)
  949. {
  950. NotifyError(eEvent.ERR_SRD, "Arm Axis Status is in Failed", 0);
  951. return true;
  952. }
  953. return false;
  954. }
  955. /// <summary>
  956. /// Exhaust delay
  957. /// </summary>
  958. /// <param name="param"></param>
  959. /// <returns></returns>
  960. private bool ExhaustFanOn()
  961. {
  962. bool result = _srdCommon.ExhaustOn();
  963. if (!result)
  964. {
  965. NotifyError(eEvent.ERR_SRD, "Exhaust On failed",0);
  966. return false;
  967. }
  968. if (_n2Enabled)
  969. {
  970. //todo 关闭N2Above和N2 Below
  971. }
  972. return true;
  973. }
  974. /// <summary>
  975. /// 停止旋转
  976. /// </summary>
  977. /// <returns></returns>
  978. private bool StopRotation()
  979. {
  980. bool result = _rotationAxis.StopPositionOperation();
  981. LOG.WriteLog(eEvent.INFO_SRD, Module, "Stop Rotation is done");
  982. return result;
  983. }
  984. /// <summary>
  985. /// 检验Rotation是否停止
  986. /// </summary>
  987. /// <returns></returns>
  988. private bool CheckRotationStopEndStatus()
  989. {
  990. if (!_rotationAxis.IsRun && _rotationAxis.Status == RState.End)
  991. {
  992. return true;
  993. }
  994. return false;
  995. }
  996. /// <summary>
  997. /// Rotation运行指定角度
  998. /// </summary>
  999. /// <returns></returns>
  1000. private bool RotationMotion()
  1001. {
  1002. double scale = _rotationProviderAxis.ScaleFactor;
  1003. int currentRotation = (int)Math.Round(_rotationAxis.MotionData.MotorPosition * scale, 0);
  1004. //Presence Test目标位置(单位为°)
  1005. int targetPosition = (int)Math.Round(scale * _waferPresenceDistance, 0) + currentRotation;
  1006. //转速单位转换 RPM(r/min) to degree/s
  1007. double degree = BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_waferPresenceSpeedInRPMs);
  1008. //Presence Test目标转速
  1009. int profileVelocity = (int)Math.Round(scale * degree, 0);
  1010. //加速度
  1011. int acceleration = (int)Math.Round(_rotationAxis.ProfileAcceleration * _waferPresenceCheckAccelDecelPercentage / 100, 0);
  1012. //减速度
  1013. int deceleration = (int)Math.Round(_rotationAxis.ProfileDeceleration * _waferPresenceCheckAccelDecelPercentage / 100, 0);
  1014. if (_srdCommon.CommonData.DoorOpened)
  1015. {
  1016. NotifyError(eEvent.ERR_SRD, "Door is not closed. Can't do rotation", 0);
  1017. return false;
  1018. }
  1019. bool result = _rotationAxis.ProfilePosition(targetPosition, profileVelocity * SPEED_RATIO, acceleration, deceleration);
  1020. if (!result)
  1021. {
  1022. NotifyError(eEvent.ERR_SRD, "Start Rotation is failed",0);
  1023. return false;
  1024. }
  1025. return true;
  1026. }
  1027. /// <summary>
  1028. /// Rotation运动结束状态
  1029. /// </summary>
  1030. /// <returns></returns>
  1031. private bool RotationMotionEndStatus()
  1032. {
  1033. return _rotationAxis.Status == RState.End;
  1034. }
  1035. /// <summary>
  1036. /// Rotation运动
  1037. /// </summary>
  1038. /// <returns></returns>
  1039. private bool RotationMotionStopStatus()
  1040. {
  1041. bool stopResult = _rotationAxis.Status == RState.Failed || _rotationAxis.Status == RState.Timeout;
  1042. if (!stopResult)
  1043. {
  1044. if (_presenceTestEnabled && _srdCommon.IsWaferPresence)
  1045. {
  1046. if (_srdCommon.WaferPresence != "WellPlaced")
  1047. {
  1048. NotifyError(eEvent.ERR_SRD, $"Rotation Motioning wafer presence is {_srdCommon.WaferPresence}",0);
  1049. return true;
  1050. }
  1051. }
  1052. }
  1053. else
  1054. {
  1055. return true;
  1056. }
  1057. return false;
  1058. }
  1059. /// <summary>
  1060. /// Post N2 Time(Stop rotation ,home rotation)
  1061. /// </summary>
  1062. /// <param name="param"></param>
  1063. /// <returns></returns>
  1064. private bool PostN2Time()
  1065. {
  1066. bool homeResult = _rotationAxis.Home(false);
  1067. if (!homeResult)
  1068. {
  1069. NotifyError(eEvent.ERR_SRD, $"{Module}.Arm is not homed", 0);
  1070. return false;
  1071. }
  1072. return true;
  1073. }
  1074. /// <summary>
  1075. /// 检验Rotation是否Homed,Home后关闭排风扇
  1076. /// </summary>
  1077. /// <param name="param"></param>
  1078. /// <returns></returns>
  1079. private bool CheckRotationHomedThenExhaust()
  1080. {
  1081. bool result = _rotationAxis.IsHomed && _rotationAxis.Status == RState.End;
  1082. if(result)
  1083. {
  1084. //关闭排风扇
  1085. if (_srdCommon.CommonData.ExhaustOn)
  1086. {
  1087. _srdCommon.ExhaustOffAction("", null);
  1088. }
  1089. }
  1090. return result;
  1091. }
  1092. /// <summary>
  1093. /// 检验Rotation Home 停止状态
  1094. /// </summary>
  1095. /// <returns></returns>
  1096. private bool CheckRotationHomedStopStatus()
  1097. {
  1098. return _rotationAxis.Status == RState.Failed || _rotationAxis.Status == RState.Timeout;
  1099. }
  1100. /// <summary>
  1101. /// 检验
  1102. /// </summary>
  1103. /// <param name="param"></param>
  1104. /// <returns></returns>
  1105. private bool LastCheckArmHomed()
  1106. {
  1107. string currentLocation = _armAxis.CurrentStation;
  1108. bool armHomed = _armAxis.IsHomed;
  1109. if (!armHomed)
  1110. {
  1111. NotifyError(eEvent.ERR_SRD, $"{Module}.Arm is not homed", 0);
  1112. return false;
  1113. }
  1114. if (!currentLocation.Contains("Home"))
  1115. {
  1116. NotifyError(eEvent.ERR_SRD, $"{Module}.Arm is not in home station", 0);
  1117. return false;
  1118. }
  1119. return true;
  1120. }
  1121. /// <summary>
  1122. /// 启动
  1123. /// </summary>
  1124. /// <param name="objs"></param>
  1125. /// <returns></returns>
  1126. public RState Start(params object[] objs)
  1127. {
  1128. _isUsingWater = false;
  1129. if (objs.Length >= 2 && (bool)objs[1])
  1130. {
  1131. _presenceTestFlag = true;
  1132. }
  1133. else
  1134. {
  1135. _presenceTestFlag = false;
  1136. }
  1137. _srdRecipe = (SrdRecipe)objs[0];
  1138. if (_srdRecipe == null)
  1139. {
  1140. NotifyError(eEvent.ERR_SRD, "srd recipe is null", 0);
  1141. return RState.Failed;
  1142. }
  1143. _armAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Arm");
  1144. if (!_armAxis.IsHomed)
  1145. {
  1146. NotifyError(eEvent.ERR_SRD, "Arm is not homed", 0);
  1147. return RState.Failed;
  1148. }
  1149. _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
  1150. if (!_rotationAxis.IsHomed)
  1151. {
  1152. NotifyError(eEvent.ERR_SRD, "Rotation is not homed",0);
  1153. return RState.Failed;
  1154. }
  1155. _srdCommon = DEVICE.GetDevice<SrdCommonDevice>($"{Module}.Common");
  1156. _totalSRDDevice = DEVICE.GetDevice<TotalSRDDevice>("SRD");
  1157. if (_srdCommon.IsWaferPresence)
  1158. {
  1159. if (_srdCommon.WaferPresence != "WellPlaced")
  1160. {
  1161. NotifyError(eEvent.ERR_SRD, "Wafer Presence is not WellPlaced", 0);
  1162. return RState.Failed;
  1163. }
  1164. }
  1165. else
  1166. {
  1167. LOG.WriteLog(eEvent.INFO_SRD, Module, "Wafer Presence Test has been ignored");
  1168. }
  1169. if (SC.ContainsItem("SRD.SRDRotationPlusSecond"))
  1170. {
  1171. _rotationPlusSecond = SC.GetValue<int>("SRD.SRDRotationPlusSecond");
  1172. }
  1173. if (SC.ContainsItem("SRD.N2Enabled"))
  1174. {
  1175. _n2Enabled = SC.GetValue<bool>("SRD.N2Enabled");
  1176. }
  1177. //Wafer Presence Test
  1178. if (SC.ContainsItem($"SRD.{Module}EnablePresenceCheckvalue"))
  1179. {
  1180. _presenceTestEnabled = SC.GetValue<bool>($"SRD.{Module}EnablePresenceCheckvalue");
  1181. }
  1182. _systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
  1183. string otherSRD = Module == "SRD1" ? "SRD2" : "SRD1";
  1184. _otherSrdEntity = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(otherSRD);
  1185. _rotationProviderAxis = BeckhoffAxisProviderManager.Instance.GetAxisProvider($"{Module}.Rotation");
  1186. if (_rotationProviderAxis == null)
  1187. {
  1188. NotifyError(eEvent.ERR_SRD, $"{Module}.Rotation Provider is not exist", 0);
  1189. return RState.Failed;
  1190. }
  1191. _armProviderAxis = BeckhoffAxisProviderManager.Instance.GetAxisProvider($"{Module}.Arm");
  1192. if (_armProviderAxis == null)
  1193. {
  1194. NotifyError(eEvent.ERR_SRD, $"{Module}.Arm Provider is not exist",0);
  1195. return RState.Failed;
  1196. }
  1197. _waferPresenceCheckAccelDecelPercentage = SC.GetValue<int>("SRD.WaferPresenceCheckAccelDecelPercentage");
  1198. _waferPresenceSpeedInRPMs = SC.GetValue<int>("SRD.WaferPresenceCheckSpeedInRPMs");
  1199. _waferPresenceDistance = SC.GetValue<int>("SRD.WaferPresenceCheckDistanceInDegrees");
  1200. return Runner.Start(Module, "Start Run Wafer");
  1201. }
  1202. }
  1203. }