InitRoutine.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.RT.Routine;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using Aitex.Sorter.Common;
  9. using EFEM.RT.Devices;
  10. using EFEMSC;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.SubstrateTrackings;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  14. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  15. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  16. using System;
  17. namespace EFEM.RT.Routines
  18. {
  19. public class InitRoutine : CommonRoutine, IRoutine, IEfemRoutine
  20. {
  21. private enum Home
  22. {
  23. DeviceReset,
  24. FfuStart1,
  25. FfuStart2,
  26. RobotClear,
  27. RobotInit,
  28. WaitingRobotInit,
  29. RobotHome,
  30. WaitingRobotHome,
  31. RobotSet,
  32. AlignClear,
  33. AlignerInit,
  34. WaitingAlignerInit,
  35. AlignerHome,
  36. WaitingAlignerHome,
  37. AlignerMoveUp,
  38. WaitingAlignerUp,
  39. Coolingbuffer1Home,
  40. Coolingbuffer2Home,
  41. Aligner1Home,
  42. Aligner2Home,
  43. AxisClearAlarm,
  44. AxisServon,
  45. AxisServonDelay,
  46. AxisSetConfig,
  47. AxisSetConfigDelay,
  48. AxisHome,
  49. CloseAtmShutterDoor,
  50. CloseVtmShutterDoor,
  51. LoadportAClear,
  52. LoadportAHome,
  53. WaitingLoadportAHome,
  54. LoadportBClear,
  55. LoadportBHome,
  56. WaitingLoadportBHome,
  57. LoadportCClear,
  58. LoadportCHome,
  59. WaitingLoadportCHome,
  60. LoadportDClear,
  61. LoadportDHome,
  62. WaitingLoadportDHome,
  63. LoadportEClear,
  64. LoadportEHome,
  65. WaitingLoadportEHome,
  66. LoadportFClear,
  67. LoadportFHome,
  68. WaitingLoadportFHome,
  69. LoadportGClear,
  70. LoadportGHome,
  71. WaitingLoadportGHome,
  72. LoadportHClear,
  73. LoadportHHome,
  74. WaitingLoadportHHome,
  75. LoadportIClear,
  76. LoadportIHome,
  77. WaitingLoadportIHome,
  78. LoadportJClear,
  79. LoadportJHome,
  80. WaitingLoadportJHome,
  81. LoadportAllReset,
  82. LoadportAllInit,
  83. RobotBlade1Grip,
  84. RobotBlade1ConfirmWafer,
  85. RobotBlade1Release,
  86. CheckWaferPrecense,
  87. CheckBlade1WaferPrecense,
  88. CheckBlade1WaferPrecenseWait,
  89. CheckBlade2WaferPrecense,
  90. CheckBlade2WaferPrecenseWait,
  91. RobotBlade2Grip,
  92. RobotBlade2ConfirmWafer,
  93. RobotBlade2Release,
  94. QuerySignalStatus,
  95. RobotBlade1Hold,
  96. RobotBlade2Hold,
  97. FlipperHome
  98. }
  99. private SetSpeedRoutine RbSetRoutine = null;
  100. private bool _scanBuffer = true;
  101. private SCConfigItem _scRobotHomeTimeout = null;
  102. private int _scFfuSpeed;
  103. private int _timeoutRobot = 0;
  104. private int _timeoutBuffer = 0;
  105. public InitRoutine(string module, string name)
  106. {
  107. Module = module;
  108. Name = name;
  109. RbSetRoutine = new SetSpeedRoutine(module, name);
  110. }
  111. public bool Initalize()
  112. {
  113. RbSetRoutine.Initalize();
  114. _scRobotHomeTimeout = SC.GetConfigItem(SorterCommon.ScPathName.Robot_TimeLimitRobotHome);
  115. IsStopped = true;
  116. return true;
  117. }
  118. public void Terminate()
  119. {
  120. RbSetRoutine.Terminate();
  121. }
  122. public Result Start(params object[] objs)
  123. {
  124. Name = "Init";
  125. Reset();
  126. _timeoutRobot = _scRobotHomeTimeout.IntValue;
  127. _timeoutBuffer = SC.GetValue<int>(ScPathName.Coolbuffer_DownTimeout);
  128. RbSetRoutine.Speed = SC.GetValue<int>(SorterCommon.ScPathName.Robot_RobotSpeed);
  129. if (DeviceDefineManager.Instance.GetValue<bool>("FfuMemoBusControl") ?? false)
  130. {
  131. _scFfuSpeed = SC.GetValue<int>("System.FFUSetSpeed");
  132. }
  133. EV.PostMessage(ModuleName.System.ToString(), EventEnum.HomeBegins, ModuleName.System.ToString());
  134. robot = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
  135. _scanBuffer = true;
  136. WaferSensorResetCreate();
  137. IsStopped = false;
  138. return Result.RUN;
  139. }
  140. public Result Monitor()
  141. {
  142. if (IsStopped)
  143. return Result.DONE;
  144. try
  145. {
  146. DeviceReset((int)Home.DeviceReset, "Device Reset", 1, Notify, Stop);
  147. if (DeviceDefineManager.Instance.GetValue<bool>("FfuMemoBusControl") ?? false)
  148. {
  149. FfuSpeedSet((int)Home.FfuStart1, "FFU1", _scFfuSpeed, _timeoutRobot, Notify, Stop);
  150. FfuSpeedSet((int)Home.FfuStart2, "FFU2", _scFfuSpeed, _timeoutRobot, Notify, Stop);
  151. }
  152. RobotReset((int)Home.RobotClear, robot, "Robot reset", _timeoutRobot, Notify, Stop);
  153. RobotHome((int)Home.RobotHome, robot, "Robot home", Notify, Stop);
  154. WaitRobotMotion((int)Home.WaitingRobotHome, robot, "Robot homing...", _timeoutRobot, Notify, Stop);
  155. //GripRobotBlade((int)Home.RobotBlade1Hold, Hand.Blade1, robot, _timeoutRobot);
  156. //GripRobotBlade((int)Home.RobotBlade2Hold, Hand.Blade2, robot, _timeoutRobot);
  157. CheckBladeWaferIsExist((int)Home.CheckBlade1WaferPrecense, robot, Hand.Blade1, _timeoutRobot);
  158. WaitRobotMotion((int)Home.CheckBlade1WaferPrecenseWait, robot, "wait check blade1", _timeoutRobot, Notify, Stop);
  159. CheckBladeWaferIsExist((int)Home.CheckBlade2WaferPrecense, robot, Hand.Blade2, _timeoutRobot);
  160. WaitRobotMotion((int)Home.CheckBlade2WaferPrecenseWait, robot, "wait check blade2", _timeoutRobot, Notify, Stop);
  161. ConfirmRobotBladeWafer((int)Home.RobotBlade1ConfirmWafer, Hand.Blade1);
  162. ConfirmRobotBladeWafer((int)Home.RobotBlade2ConfirmWafer, Hand.Blade2);
  163. // if (NeedRobotGripAndUngrip)
  164. {
  165. HomeGripAndUngripRobotBlade((int)Home.RobotBlade1Grip, Hand.Blade1, robot, _timeoutRobot);
  166. HomeGripAndUngripRobotBlade((int)Home.RobotBlade2Grip, Hand.Blade2, robot, _timeoutRobot);
  167. }
  168. // //CheckRobotBladeWaferPrecense((int)Home.CheckWaferPrecense, robot, _timeoutRobot);
  169. //// RobotSignalStatus((int)Home.QuerySignalStatus, robot, _timeoutRobot);
  170. //HomeReleaseRobotBlade((int)Home.RobotBlade1Release, Hand.Blade1, robot, _timeoutRobot);
  171. //HomeReleaseRobotBlade((int)Home.RobotBlade2Release, Hand.Blade2, robot, _timeoutRobot);
  172. if (DeviceDefineManager.Instance.GetValue<bool>("CoolingBufferInstalled") ?? false)
  173. {
  174. if (!SC.GetValue<bool>("System.CoolingBuffer1Disable"))
  175. CooingbufferHome((int)Home.Coolingbuffer1Home, buffer1, "Cooling buffer1 moving down",
  176. _timeoutBuffer, Notify, Stop);
  177. if (!SC.GetValue<bool>("System.CoolingBuffer2Disable"))
  178. CooingbufferHome((int)Home.Coolingbuffer2Home, buffer2, "Cooling buffer2 moving down",
  179. _timeoutBuffer, Notify, Stop);
  180. if (!SC.GetValue<bool>("System.Aligner1Disable") && SC.ContainsItem("Aligner.AlignerType") && SC.GetValue<int>("Aligner.AlignerType") == 1)
  181. CooingbufferHome((int)Home.Aligner1Home, aligner1, "Aligner1 moving down",
  182. _timeoutBuffer, Notify, Stop);
  183. if (!SC.GetValue<bool>("System.Aligner2Disable") && SC.ContainsItem("Aligner.AlignerType") && SC.GetValue<int>("Aligner.AlignerType") == 1)
  184. CooingbufferHome((int)Home.Aligner2Home, aligner2, "Aligner2 moving down",
  185. _timeoutBuffer, Notify, Stop);
  186. }
  187. if (!SC.GetValue<bool>("System.FlipperDisable"))
  188. {
  189. FlipperHome((int)Home.FlipperHome, GetFlipper(), "Flipper Home...", _timeoutBuffer, Notify, Stop);
  190. }
  191. //if (LoadLockDoorControlByStation)
  192. //{
  193. // LoadLockCloseAtmDoor((int)Home.CloseAtmShutterDoor, DEVICE.GetDevice<LoadLockDevice>(ModuleName.LL1.ToString()), "Wait Atm Door Close", _timeoutRobot, Notify, Stop);
  194. // LoadLockCloseVtmDoor((int)Home.CloseVtmShutterDoor, DEVICE.GetDevice<LoadLockDevice>(ModuleName.LL1.ToString()), "Wait Vtm Door Close", _timeoutRobot, Notify, Stop);
  195. //}
  196. //if (initIndex < LoadPortQuantity)
  197. //{
  198. // LoadportReset((int)Home.LoadportAClear + initIndex * 3, DEVICE.GetDevice<LoadPortBaseDevice>($"LP{initIndex + 1}"), $"LP{initIndex + 1} reset", _timeoutRobot, Notify, Stop);
  199. // initIndex++;
  200. // return Result.RUN;
  201. //}
  202. LoadportAllReset((int)Home.LoadportAllReset, _timeoutRobot);
  203. LoadportAllInit((int)Home.LoadportAllInit, _timeoutRobot);
  204. }
  205. catch (RoutineBreakException)
  206. {
  207. return Result.RUN;
  208. }
  209. catch (RoutineFaildException)
  210. {
  211. IsStopped = true;
  212. return Result.FAIL;
  213. }
  214. EV.PostMessage(ModuleName.System.ToString(), EventEnum.HomeEnds, ModuleName.System.ToString());
  215. IsStopped = true;
  216. return Result.DONE;
  217. }
  218. public void FfuSpeedSet(int id, string name, int speed, int time, Action<string> notify, Action<string> error)
  219. {
  220. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  221. {
  222. var device = DEVICE.GetDevice<Ffu>(name);
  223. notify($"{device.Name} start and set speed");
  224. string reason = string.Empty;
  225. device.StartAndSetSpeed(speed);
  226. return true;
  227. }, () =>
  228. {
  229. var device = DEVICE.GetDevice<Ffu>(name);
  230. switch (device.Name)
  231. {
  232. case "FFU1":
  233. if (Ffu.SpeedSet1)
  234. {
  235. notify($"{device.Name} is running");
  236. return true;
  237. }
  238. break;
  239. case "FFU2":
  240. if (Ffu.SpeedSet2)
  241. {
  242. notify($"{device.Name} is running");
  243. return true;
  244. }
  245. break;
  246. }
  247. return false;
  248. }, time * 1000);
  249. if (ret.Item1)
  250. {
  251. if (ret.Item2 == Result.FAIL)
  252. {
  253. throw (new RoutineFaildException());
  254. }
  255. else if (ret.Item2 == Result.TIMEOUT) //timeout
  256. {
  257. error(String.Format("{0} timeout, than {1} seconds", name, time));
  258. throw (new RoutineFaildException());
  259. }
  260. else
  261. throw (new RoutineBreakException());
  262. }
  263. }
  264. protected void WaitRobotSet(int id, string name, IRoutine routines, Action<string> notify, Action<string> error)
  265. {
  266. Tuple<bool, Result> ret = ExecuteAndWait(id, routines);
  267. if (ret.Item1)
  268. {
  269. if (ret.Item2 == Result.FAIL)
  270. {
  271. error(name);
  272. throw (new RoutineFaildException());
  273. }
  274. else if (ret.Item2 == Result.RUN)
  275. {
  276. throw (new RoutineBreakException());
  277. }
  278. }
  279. }
  280. protected void DeviceReset(int id, string name, int time, Action<string> notify, Action<string> error)
  281. {
  282. Tuple<bool, Result> ret = Delay(id, () =>
  283. {
  284. notify(String.Format("Device reset"));
  285. Singleton<DeviceEntity>.Instance.PostMsg(DeviceEntity.MSG.RESET);
  286. return true;
  287. }, time * 1000);
  288. if (ret.Item1)
  289. {
  290. if (ret.Item2 == Result.RUN)
  291. {
  292. throw (new RoutineBreakException());
  293. }
  294. }
  295. }
  296. #region aligner
  297. public void AlignerReset(int id, Aligner device, string name, int time, Action<string> notify, Action<string> error)
  298. {
  299. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  300. {
  301. notify(String.Format("{0} clear error", device.Name));
  302. string reason = string.Empty;
  303. return device.Clear(out reason);
  304. }, () =>
  305. {
  306. if (device.Busy == false)
  307. {
  308. return true;
  309. }
  310. return false;
  311. }, time * 1000);
  312. if (ret.Item1)
  313. {
  314. if (ret.Item2 == Result.FAIL)
  315. {
  316. throw (new RoutineFaildException());
  317. }
  318. else if (ret.Item2 == Result.TIMEOUT) //timeout
  319. {
  320. error(String.Format("{0} timeout, than {1} seconds", name, time));
  321. throw (new RoutineFaildException());
  322. }
  323. else
  324. throw (new RoutineBreakException());
  325. }
  326. }
  327. public void AlignerInit(int id, Aligner device, string name, Action<string> notify, Action<string> error)
  328. {
  329. Tuple<bool, Result> ret = Execute(id, () =>
  330. {
  331. notify(String.Format("{0} Home", device.Name));
  332. string reason = string.Empty;
  333. return device.Init(out reason);
  334. });
  335. if (ret.Item1)
  336. {
  337. if (ret.Item2 == Result.FAIL)
  338. {
  339. throw (new RoutineFaildException());
  340. }
  341. }
  342. }
  343. public void AlignerHome(int id, Aligner device, string name, Action<string> notify, Action<string> error)
  344. {
  345. Tuple<bool, Result> ret = Execute(id, () =>
  346. {
  347. notify(String.Format("{0} Home", device.Name));
  348. string reason = string.Empty;
  349. return device.Home(out reason);
  350. });
  351. if (ret.Item1)
  352. {
  353. if (ret.Item2 == Result.FAIL)
  354. {
  355. throw (new RoutineFaildException());
  356. }
  357. }
  358. }
  359. public void AlignerMoveUp(int id, Aligner device, string name, Action<string> notify, Action<string> error)
  360. {
  361. Tuple<bool, Result> ret = Execute(id, () =>
  362. {
  363. notify(String.Format("{0} Lift up", device.Name));
  364. string reason = string.Empty;
  365. return device.LiftUp(out reason);
  366. });
  367. if (ret.Item1)
  368. {
  369. if (ret.Item2 == Result.FAIL)
  370. {
  371. throw (new RoutineFaildException());
  372. }
  373. }
  374. }
  375. #endregion aligner
  376. #region Loadport
  377. ///等待 Loadport
  378. public void QueryLoadportState(int id, LoadPort device, string name, int time, Action<string> notify, Action<string> error)
  379. {
  380. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  381. {
  382. notify(String.Format("{0} query state", device.Name));
  383. string reason = string.Empty;
  384. device.QueryState(out reason);
  385. return true;
  386. }, () =>
  387. {
  388. if (!device.IsBusy)
  389. {
  390. return true;
  391. }
  392. return false;
  393. }, time * 1000);
  394. if (ret.Item1)
  395. {
  396. if (ret.Item2 == Result.FAIL)
  397. {
  398. throw (new RoutineFaildException());
  399. }
  400. else if (ret.Item2 == Result.TIMEOUT) //timeout
  401. {
  402. error(String.Format("{0} query timeout, than {1} seconds", name, time));
  403. throw (new RoutineFaildException());
  404. }
  405. else
  406. throw (new RoutineBreakException());
  407. }
  408. }
  409. #endregion Loadport
  410. private void WaferSensorResetCreate()
  411. {
  412. if (!_scanBuffer) return;
  413. //var sensors = new List<bool>
  414. //{
  415. // DeviceModel.SensorCoolingStageSLOT1WaferON != null ? DeviceModel.SensorCoolingStageSLOT1WaferON.Value : true,
  416. // DeviceModel.SensorCoolingStageSLOT2WaferON != null ? DeviceModel.SensorCoolingStageSLOT2WaferON.Value : true,
  417. // DeviceModel.SensorCoolingStageSLOT3WaferON != null ? DeviceModel.SensorCoolingStageSLOT3WaferON.Value : true,
  418. // DeviceModel.SensorCoolingStageSLOT4WaferON != null ? DeviceModel.SensorCoolingStageSLOT4WaferON.Value : true,
  419. // DeviceModel.SensorCoolingStageSLOT5WaferON != null ? DeviceModel.SensorCoolingStageSLOT5WaferON.Value : true,
  420. // DeviceModel.SensorCoolingStageSLOT6WaferON != null ? DeviceModel.SensorCoolingStageSLOT6WaferON.Value : true,
  421. //};
  422. var index = 0;
  423. //foreach (var sensor in sensors)
  424. //{
  425. // if (!sensor && WaferManager.Instance.CheckNoWafer(ModuleName.CoolingBuffer1, index))
  426. // {
  427. // WaferManager.Instance.CreateWafer(ModuleName.CoolingBuffer1, index, WaferStatus.Normal);
  428. // }
  429. // else if (sensor && WaferManager.Instance.CheckHasWafer(ModuleName.CoolingBuffer1, index))
  430. // {
  431. // WaferManager.Instance.DeleteWafer(ModuleName.CoolingBuffer1, index);
  432. // }
  433. // if (!sensor && WaferManager.Instance.CheckNoWafer(ModuleName.CoolingBuffer2, index))
  434. // {
  435. // WaferManager.Instance.CreateWafer(ModuleName.CoolingBuffer2, index, WaferStatus.Normal);
  436. // }
  437. // else if (sensor && WaferManager.Instance.CheckHasWafer(ModuleName.CoolingBuffer2, index))
  438. // {
  439. // WaferManager.Instance.DeleteWafer(ModuleName.CoolingBuffer2, index);
  440. // }
  441. // index++;
  442. //}
  443. //var robotSensors = new List<bool>
  444. //{
  445. // DeviceModel.SensorRBlowerArmhavewafer != null ? DeviceModel.SensorRBlowerArmhavewafer.Value : true,
  446. // DeviceModel.SensorRBupperArmhavewafer != null ? DeviceModel.SensorRBupperArmhavewafer.Value : true,
  447. //};
  448. //index = 0;
  449. //foreach (var sensor in robotSensors)
  450. //{
  451. // if (!sensor && WaferManager.Instance.CheckNoWafer(ModuleName.Robot, index))
  452. // {
  453. // WaferManager.Instance.CreateWafer(ModuleName.Robot, index, WaferStatus.Normal);
  454. // }
  455. // else if (sensor && WaferManager.Instance.CheckHasWafer(ModuleName.Robot, index))
  456. // {
  457. // WaferManager.Instance.DeleteWafer(ModuleName.Robot, index);
  458. // }
  459. // index++;
  460. //}
  461. if (DeviceModel.SensorPreAlignerWaferOn != null && !DeviceModel.SensorPreAlignerWaferOn.Value && WaferManager.Instance.CheckNoWafer(ModuleName.Aligner, 0))
  462. {
  463. WaferManager.Instance.CreateWafer(ModuleName.Aligner, 0, WaferStatus.Normal);
  464. }
  465. else
  466. {
  467. if (DeviceDefineManager.Instance.GetValue<bool>("AlignerInstalled") ?? false)
  468. WaferManager.Instance.DeleteWafer(ModuleName.Aligner, 0);
  469. //if (SC.ContainsItem("System.Aligner1Disable") ? !SC.GetValue<bool>("System.Aligner1Disable") : false)
  470. // WaferManager.Instance.DeleteWafer(ModuleName.Aligner1, 0);
  471. //if (SC.ContainsItem("System.Aligner2Disable") ? !SC.GetValue<bool>("System.Aligner2Disable") : false)
  472. // WaferManager.Instance.DeleteWafer(ModuleName.Aligner2, 0);
  473. }
  474. //var loadLockQuantity = DeviceDefineManager.Instance.GetValue<int>("LoadLockQuantity") ?? 0;
  475. //if (loadLockQuantity > 0 && Singleton<EfemEntity>.Instance.IsOnlineMode)
  476. //{
  477. // for (int i = 1; i <= loadLockQuantity; i++)
  478. // {
  479. // var moduleName = ModuleHelper.Converter($"LL{i}");
  480. // if (WaferManager.Instance.CheckHasWafer(moduleName, 0))
  481. // {
  482. // WaferManager.Instance.DeleteWafer(moduleName, 0);
  483. // }
  484. // }
  485. //}
  486. _scanBuffer = false;
  487. }
  488. public void CooingbufferHome(int id, IoCoolingBuffer device, string name, int time, Action<string> notify, Action<string> error)
  489. {
  490. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  491. {
  492. if (device == null)
  493. {
  494. EV.PostAlarmLog("System", String.Format("{0} Device is Null", name));
  495. return false;
  496. }
  497. if (SC.GetValue<bool>($"System.{device.Name}Disable"))
  498. {
  499. EV.PostInfoLog("System", String.Format("{0} is Disable", device.Name));
  500. return true;
  501. }
  502. notify(String.Format("{0} {1}", device.Name, name));
  503. string reason = string.Empty;
  504. return device.Home(out reason);
  505. }, () =>
  506. {
  507. if (SC.GetValue<bool>($"System.{device.Name}Disable"))
  508. {
  509. //EV.PostInfoLog("System", String.Format("{0} is Disable", device.Name));
  510. return true;
  511. }
  512. if (device.Error == true)
  513. {
  514. return null;
  515. }
  516. return device.CheckMovedDown() && !device.Busy;
  517. }, time * 1000);
  518. if (ret.Item1)
  519. {
  520. if (ret.Item2 == Result.FAIL)
  521. {
  522. throw (new RoutineFaildException());
  523. }
  524. else if (ret.Item2 == Result.TIMEOUT) //timeout
  525. {
  526. error(String.Format("{0} timeout, than {1} seconds", name, time));
  527. throw (new RoutineFaildException());
  528. }
  529. else
  530. throw (new RoutineBreakException());
  531. }
  532. }
  533. protected override void Notify(string message)
  534. {
  535. EV.PostMessage(Module, EventEnum.GeneralInfo, String.Format("Home sequence :{0}", message));
  536. }
  537. /// <summary>
  538. /// prepare process failed
  539. /// </summary>
  540. /// <param name="failReason"></param>
  541. /// <param name="reactor"></param>
  542. protected override void Stop(string failReason)
  543. {
  544. string reason = String.Empty;
  545. EV.PostMessage(Module, EventEnum.HomeFailed, failReason);
  546. }
  547. }
  548. }