InitRoutine.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.Util;
  6. using Aitex.Sorter.Common;
  7. using athosRT.Devices;
  8. using athosRT.Devices.PA;
  9. using athosRT.FSM;
  10. using athosRT.Modules.FLP;
  11. using athosRT.Modules.Robot;
  12. using athosRT.tool;
  13. using MECF.Framework.Common.Equipment;
  14. using MECF.Framework.Common.SubstrateTrackings;
  15. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  17. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
  18. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  19. using System;
  20. using System.Collections.Generic;
  21. using System.Diagnostics;
  22. using System.Linq;
  23. using System.Numerics;
  24. using System.Text;
  25. using System.Threading.Tasks;
  26. using System.Xml.Linq;
  27. using static athosRT.Modules.FLP.FlipperEntity;
  28. namespace athosRT.Modules.EFEMs.Routine
  29. {
  30. public class InitRoutine : ModuleRoutineBase, FSM.IRoutine
  31. {
  32. protected IoCoolingBuffer buffer1 = null;
  33. protected IoCoolingBuffer buffer2 = null;
  34. protected PreAligner aligner1 ;
  35. protected PreAligner aligner2 ;
  36. private SetSpeedRoutine RbSetRoutine = null;
  37. private int DeviceResetTimeout = 0;
  38. private bool _scanBuffer = true;
  39. private SCConfigItem _scRobotHomeTimeout => SC.GetConfigItem("Robot.TimeLimitRobotHome");
  40. private int _scFfuSpeed;
  41. private int _timeoutRobot = 0;
  42. private int _timeoutBuffer = 0;
  43. private RobotBaseDevice robot;
  44. private int _existInterval = SC.GetValue<int>("Robot.Robot.ExistInterval");
  45. protected static readonly bool LoadLockDoorControlByStation = Singleton<DeviceDefineManager>.Instance.GetValue<bool>("LLDoorControlByStation").GetValueOrDefault();
  46. private List<LoadPortBaseDevice> LPs;
  47. public InitRoutine(ModuleName module) : base(module)
  48. {
  49. Module = module;
  50. Name = "initRoutine";
  51. robot = DEVICE.GetDevice<RobotBaseDevice>("Robot");
  52. RbSetRoutine = new SetSpeedRoutine(module);
  53. buffer1 = DEVICE.GetDevice<IoCoolingBuffer>("CoolingBuffer1");
  54. buffer2 = DEVICE.GetDevice<IoCoolingBuffer>("CoolingBuffer2");
  55. aligner1 = DEVICE.GetDevice<PreAligner>("Aligner1");
  56. aligner2 = DEVICE.GetDevice<PreAligner>("Aligner2");
  57. DeviceResetTimeout = 1000;//1s
  58. List <ModuleName> moduleNameList = new List<ModuleName>(Singleton<DeviceManager>.Instance.LpNames);
  59. LPs = new List<LoadPortBaseDevice>();
  60. moduleNameList.ForEach((lp =>
  61. { LPs.Add(DEVICE.GetDevice<LoadPortBaseDevice>(lp.ToString())); }));
  62. }
  63. public RState Monitor()
  64. {
  65. Runner
  66. .Run((int)InitStep.DeviceReset, fDeviceReset, DeviceResetTimeout)
  67. .Run((int)InitStep.FfuSpeedSet1, fFfuSpeedSet1, fCheckFfuStatus1, _timeoutRobot)
  68. //.Run((int)InitStep.FfuSpeedSet2, fFfuSpeedSet2, fCheckFfuStatus2, _timeoutRobot)
  69. .Run((int)InitStep.RobotReset, fRobotReset, fcheckRobotState, _timeoutRobot)
  70. .Run((int)InitStep.RobotHome, fRobotHome, fWaitRobotMotion, _timeoutRobot)
  71. .Run((int)InitStep.CheckBlade1WaferIsExist, fCheckBlade1WaferIsExist, fWaitRobotMotion, _timeoutRobot)
  72. .Run((int)InitStep.CheckBlade2WaferIsExist, fCheckBlade2WaferIsExist, fWaitRobotMotion, _timeoutRobot)
  73. .Run((int)InitStep.ConfirmRobotBlade1Wafer, NullFun,fConfirmRobotBlade1Wafer, _timeoutRobot)
  74. .Run((int)InitStep.ConfirmRobotBlade2Wafer, NullFun, fConfirmRobotBlade2Wafer, _timeoutRobot)
  75. .Run((int)InitStep.HomeGripAndUngripRobotBlade1, fHomeGripAndUngripRobotBlade1, fRobotNoBusy, _timeoutRobot)
  76. .Run((int)InitStep.HomeGripAndUngripRobotBlade2, fHomeGripAndUngripRobotBlade2, fRobotNoBusy, _timeoutRobot)
  77. .Run((int)InitStep.FlipperHome,fFlipperHome,fFlipperIdle,_timeoutRobot)
  78. //.Run((int)InitStep.CooingbufferHome1, fCooingbufferHome1, fCheckCooingbufferHome1, _timeoutBuffer)
  79. //.Run((int)InitStep.CooingbufferHome2, fCooingbufferHome2, fCheckCooingbufferHome2, _timeoutBuffer)
  80. //.Run((int)InitStep.CooingbufferHome3, fAligner1Home, fCheckAligner1Home, _timeoutBuffer)
  81. //.Run((int)InitStep.CooingbufferHome4, fAligner2Home, fCheckAligner2Home, _timeoutBuffer)
  82. //.Run((int)InitStep.LoadLockCloseAtmDoor, fLoadLockCloseAtmDoor, fCheckLoadLockCloseAtmDoor, _timeoutRobot)
  83. //.Run((int)InitStep.LoadLockCloseVtmDoor, fLoadLockCloseVtmDoor, fCheckLoadLockCloseVtmDoor, _timeoutRobot)
  84. .Run((int)InitStep.LoadportAllReset, fLoadportAllReset, fCheckLoadportAllReset, _timeoutRobot)
  85. .End((int)InitStep.LoadportAllInit, fLoadportAllInit, fCheckLoadportAllInit, _timeoutRobot);
  86. return Runner.Status;
  87. }
  88. private bool fCheckLoadportAllInit()
  89. {
  90. bool flag1 = LPs.Any(lp=>lp.CurrentState == LoadPortStateEnum.Error);
  91. bool flag2 = LPs.Any(lp => { return !lp.IsHomed; });
  92. if (flag1)
  93. {
  94. LogObject.Error("LPs","LP中存在错误");
  95. return false;
  96. }
  97. if (flag2)
  98. {
  99. //LogObject.Error("LPs", "LP中非home状态");
  100. return false;
  101. }
  102. LogObject.Info("LPs", "LP已完成init");
  103. return true;
  104. }
  105. private bool fLoadportAllInit()
  106. {
  107. LPs.ForEach(lp => lp.Home(out _));
  108. LogObject.Info("LPs", "全部LP开始初始化");
  109. return true;
  110. }
  111. private bool fCheckLoadportAllReset()
  112. {
  113. bool flag = LPs.Any(lp => lp.IsBusy);
  114. if (flag)
  115. {
  116. LogObject.Error("LPs", "尚有LP未脱离busy状态");
  117. return false;
  118. }
  119. else
  120. {
  121. LogObject.Info("LPs", "全部LP脱离busy状态");
  122. return true;
  123. }
  124. }
  125. private bool fLoadportAllReset()
  126. {
  127. LPs.ForEach(LP => LP.ClearError(out _));
  128. LogObject.Info("LPs", "开始重置所有LP");
  129. return true;
  130. }
  131. private bool fCheckLoadLockCloseVtmDoor()
  132. {
  133. if (LoadLockDoorControlByStation)
  134. {
  135. bool flag = LoadLockDevice.LoadLockVtmDoorState == LoadLockDoorState.Closed;
  136. if (flag)
  137. {
  138. LogObject.Info("LoadLockDevice", "VtmDoor Close Success");
  139. return true;
  140. }
  141. else
  142. {
  143. LogObject.Error("LoadLockDevice", "VtmDoor Close Error");
  144. return false;
  145. }
  146. }
  147. return true;
  148. }
  149. private bool fLoadLockCloseVtmDoor()
  150. {
  151. if (LoadLockDoorControlByStation)
  152. {
  153. //检查LoadLockAtmDoor的状态 如果没有的话就执行关闭AtmDoor
  154. bool flag = LoadLockDevice.LoadLockVtmDoorState == LoadLockDoorState.Closed || LoadLockDevice.CloseVtmDoor(out string _);
  155. if (flag)
  156. {
  157. LogObject.Info("LoadLockDevice", "VtmDoor Close Start");
  158. return true;
  159. }
  160. else
  161. {
  162. LogObject.Error("LoadLockDevice", "VtmDoor Close can not excute!");
  163. return false;
  164. }
  165. }
  166. return true;
  167. }
  168. private bool fCheckLoadLockCloseAtmDoor()
  169. {
  170. if (LoadLockDoorControlByStation)
  171. {
  172. bool flag = LoadLockDevice.LoadLockAtmDoorState == LoadLockDoorState.Closed;
  173. if (flag)
  174. {
  175. LogObject.Info("LoadLockDevice", "AtmDoor Close Success");
  176. return true;
  177. }
  178. else
  179. {
  180. LogObject.Error("LoadLockDevice", "AtmDoor Close Error");
  181. return false;
  182. }
  183. }
  184. return true;
  185. }
  186. private bool fLoadLockCloseAtmDoor()
  187. {
  188. if (LoadLockDoorControlByStation)
  189. {
  190. //检查LoadLockAtmDoor的状态 如果没有的话就执行关闭AtmDoor
  191. bool flag = LoadLockDevice.LoadLockAtmDoorState == LoadLockDoorState.Closed || LoadLockDevice.CloseAtmDoor(out string _);
  192. if (flag)
  193. {
  194. LogObject.Info("LoadLockDevice", "AtmDoor Close Start");
  195. return true;
  196. }
  197. else
  198. {
  199. LogObject.Error("LoadLockDevice", "AtmDoor Close can not excute!");
  200. return false;
  201. }
  202. }
  203. return true;
  204. }
  205. private bool fCheckAligner2Home()
  206. {
  207. //if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBufferInstalled").GetValueOrDefault())
  208. //{
  209. // if (aligner2.Error)
  210. // {
  211. // LogObject.Error("aligner2", "home Error");
  212. // return false;
  213. // }
  214. // else if (aligner2.CheckMovedDown() && !aligner1.Busy)
  215. // {
  216. // LogObject.Info("aligner2", "Moved Down Over");
  217. // return true;
  218. // }
  219. // else
  220. // {
  221. // //LogObject.Warning("aligner2", "Moved Down Error Or Busy");
  222. // return false;
  223. // }
  224. //}
  225. if (aligner2 != null)
  226. {
  227. string reason = "";
  228. if (aligner2.Error)
  229. {
  230. LogObject.Error("aligner2", "Home failed!");
  231. return true;
  232. }
  233. else if (!aligner2.Busy)
  234. {
  235. LogObject.Info("aligner2", "Home Succeed!");
  236. return true;
  237. }
  238. else
  239. {
  240. return false;
  241. }
  242. }
  243. return true;
  244. }
  245. private bool fAligner2Home()
  246. {
  247. //if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBufferInstalled").GetValueOrDefault())
  248. //{
  249. // aligner2.Home(out _);
  250. //}
  251. if (aligner2 != null)
  252. {
  253. string reason = "";
  254. return aligner2.Home(out reason);
  255. }
  256. return true;
  257. }
  258. private bool fCheckAligner1Home()
  259. {
  260. //2023/9/6 删除相关IO 调整相关代码
  261. //if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBuffer1Installed").GetValueOrDefault())
  262. //{
  263. // if (aligner1.Error)
  264. // {
  265. // LogObject.Error("aligner1", "home Error");
  266. // return false;
  267. // }
  268. // else if (aligner1.CheckMovedDown() && !aligner1.Busy)
  269. // {
  270. // LogObject.Info("aligner1", "Moved Down Over");
  271. // return true;
  272. // }
  273. // else
  274. // {
  275. // //LogObject.Warning("aligner1", "Moved Down Error Or Busy");
  276. // return false;
  277. // }
  278. //}
  279. if (aligner1 != null)
  280. {
  281. string reason = "";
  282. if (aligner1.Error)
  283. {
  284. LogObject.Error("aligner1", "Home failed!");
  285. return true;
  286. }
  287. else if (!aligner1.Busy)
  288. {
  289. LogObject.Info("aligner1", "Home Succeed!");
  290. return true;
  291. }
  292. else
  293. {
  294. return false;
  295. }
  296. }
  297. return true;
  298. }
  299. private bool fAligner1Home()
  300. {
  301. //if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBuffer1Installed").GetValueOrDefault())
  302. //{
  303. // aligner1.Home(out _);
  304. //}
  305. if (aligner1 != null)
  306. {
  307. string reason = "";
  308. return aligner1.Home(out reason);
  309. }
  310. return true;
  311. }
  312. private bool fCheckCooingbufferHome2()
  313. {
  314. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBufferInstalled").GetValueOrDefault())
  315. {
  316. if (buffer2.Error)
  317. {
  318. LogObject.Error("Coolingbuffer2", "home Error");
  319. return false;
  320. }
  321. else if (buffer2.CheckMovedDown() && !buffer2.Busy)
  322. {
  323. LogObject.Info("Coolingbuffer2", "Moved Down Over");
  324. return true;
  325. }
  326. else
  327. {
  328. //LogObject.Warning("Coolingbuffer2", "Moved Down Error Or Busy");
  329. return false;
  330. }
  331. }
  332. return true;
  333. }
  334. private bool fCooingbufferHome2()
  335. {
  336. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBufferInstalled").GetValueOrDefault())
  337. {
  338. buffer2.Home(out _);
  339. }
  340. return true;
  341. }
  342. private bool fCheckCooingbufferHome1()
  343. {
  344. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBufferInstalled").GetValueOrDefault())
  345. {
  346. if (buffer1.Error)
  347. {
  348. LogObject.Error("Coolingbuffer1","home Error");
  349. return false;
  350. }
  351. else if (buffer1.CheckMovedDown() && !buffer1.Busy)
  352. {
  353. LogObject.Info("Coolingbuffer1", "Moved Down Over");
  354. return true;
  355. }
  356. else
  357. {
  358. //LogObject.Warning("Coolingbuffer1", "Moved Down Error Or Busy");
  359. return false;
  360. }
  361. }
  362. return true;
  363. }
  364. private bool fCooingbufferHome1()
  365. {
  366. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("CoolingBufferInstalled").GetValueOrDefault())
  367. {
  368. Trace.WriteLine("buffer1 Home");
  369. buffer1.Home(out _);
  370. }
  371. return true;
  372. }
  373. private bool fRobotNoBusy() {
  374. if (robot.IsBusy)
  375. {
  376. //LogObject.Error("robot", "检查robot状态忙");
  377. return false;
  378. }
  379. else
  380. {
  381. LogObject.Info("robot", "检查robot状态不忙");
  382. return true;
  383. }
  384. }
  385. private bool fFlipperIdle()
  386. {
  387. return Singleton<RouteManager1>.Instance.GetFlipper().State == Devices.FLP.FlipperState.Idle;
  388. }
  389. private bool fFlipperHome()
  390. {
  391. Singleton<RouteManager1>.Instance.GetFlipper().PostMsg(FlipperMSG.Home);
  392. return true;
  393. }
  394. private bool fHomeGripAndUngripRobotBlade2()
  395. {
  396. if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, (int)Hand.Blade2))
  397. {
  398. //有wafer 吸附上去
  399. if (!robot.Grip((RobotArmEnum)Hand.Blade2))
  400. {
  401. LogObject.Error("robot", "Grip失败");
  402. return false;
  403. }
  404. }
  405. //没wafer 释放掉
  406. else if (!robot.Release((RobotArmEnum)Hand.Blade2))
  407. {
  408. LogObject.Error("robot", "Release失败");
  409. return false;
  410. }
  411. return true;
  412. }
  413. private bool fHomeGripAndUngripRobotBlade1()
  414. {
  415. //Hand.Blade1, this.robot, this._timeoutRobot
  416. if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, (int)Hand.Blade1))
  417. {
  418. // "抓的动作"
  419. if (!robot.Grip((RobotArmEnum)Hand.Blade1))
  420. {
  421. LogObject.Error("robot", "Grip失败");
  422. return false;
  423. }
  424. }
  425. else if (!robot.Release((RobotArmEnum)Hand.Blade1))
  426. {
  427. LogObject.Error("robot", "Release失败");
  428. return false;
  429. }
  430. return true;
  431. }
  432. private bool fConfirmRobotBlade2Wafer()
  433. {
  434. //WaferManager是持久层 存储断电重启时wafer的状态
  435. bool flag = robot.IsWaferPresenceOnBlade2;
  436. int num = 1;
  437. if (flag)
  438. {
  439. //实际有wafer 界面没wafer
  440. if (Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, num))
  441. {
  442. //手臂上加个wafer
  443. Singleton<WaferManager>.Instance.CreateWafer(ModuleName.Robot, num, WaferStatus.Normal);
  444. }
  445. }
  446. //手臂没wafer 手上有wafer
  447. else if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, num))
  448. {
  449. //把手臂上的wafer去掉
  450. Singleton<WaferManager>.Instance.DeleteWafer(ModuleName.Robot, num);
  451. }
  452. return true;
  453. }
  454. private bool fConfirmRobotBlade1Wafer()
  455. {
  456. //这里是单对WaferManager的处理 不需check
  457. bool flag = robot.IsWaferPresenceOnBlade1;
  458. int num = 0;
  459. if (flag)
  460. {
  461. if (Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, num))
  462. {
  463. Singleton<WaferManager>.Instance.CreateWafer(ModuleName.Robot, num, WaferStatus.Normal);
  464. }
  465. }
  466. else if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, num))
  467. {
  468. Singleton<WaferManager>.Instance.DeleteWafer(ModuleName.Robot, num);
  469. }
  470. return true;
  471. }
  472. private bool fCheckBlade2WaferIsExist()
  473. {
  474. bool flag = robot.ReadParameter(new object[3] { "CheckWaferIsPresence", 1, _existInterval });
  475. if (flag)
  476. {
  477. LogObject.Info("Robot", "Check Blade2 Wafer Is Exist");
  478. return true;
  479. }
  480. else
  481. {
  482. LogObject.Error("Robot", "Check Blade2 Wafer Is not Exist");
  483. return false;
  484. }
  485. }
  486. private bool fCheckBlade1WaferIsExist()
  487. {
  488. bool flag = robot.ReadParameter(new object[3] { "CheckWaferIsPresence", 0, _existInterval });
  489. if (flag)
  490. {
  491. LogObject.Info("Robot", "Check Blade1 Wafer Is Exist");
  492. return true;
  493. }
  494. else
  495. {
  496. LogObject.Error("Robot", "Check Blade1 Wafer Is not Exist");
  497. return false;
  498. }
  499. }
  500. private bool fWaitRobotMotion()
  501. {
  502. if (robot.IsReady())
  503. {
  504. LogObject.Info("Robot","等待Robot准备完毕");
  505. return true;
  506. }
  507. return false;
  508. }
  509. private bool fRobotHome()
  510. {
  511. robot.Home(null);
  512. LogObject.Info("Robot", "RobotHome start");
  513. return true;
  514. }
  515. private bool fRobotReset()
  516. {
  517. robot.RobotReset();
  518. LogObject.Info("Robot", "RobotReset start");
  519. return true;
  520. }
  521. private bool fcheckRobotState() {
  522. RobotBaseDevice device = robot;
  523. //LogObject.Info("Robot State", $"Busy:{device.IsBusy},Robot State:{device.RobotState}");
  524. if (!device.IsBusy && device.RobotState != RobotStateEnum.Error && device.RobotState == RobotStateEnum.Idle)
  525. {
  526. LogObject.Info("Robot", "CheckRobotState end");
  527. return true;
  528. }
  529. else
  530. {
  531. //LogObject.Error("Robot", "CheckRobotState error");
  532. return false;
  533. }
  534. }
  535. private bool fFfuSpeedSet1()
  536. {
  537. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("FfuMemoBusControl").GetValueOrDefault())
  538. {
  539. string name = "FFU";
  540. Ffu device = DEVICE.GetDevice<Ffu>(name);
  541. device?.StartAndSetSpeed(_scFfuSpeed);
  542. LogObject.Info(name, "fFfuSpeedSet start");
  543. }
  544. return true;
  545. }
  546. private bool fFfuSpeedSet2()
  547. {
  548. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("FfuMemoBusControl").GetValueOrDefault())
  549. {
  550. string name = "FFU2";
  551. Ffu device = DEVICE.GetDevice<Ffu>(name);
  552. device.StartAndSetSpeed(_scFfuSpeed);
  553. LogObject.Info(name, "FfuSpeedSet start");
  554. }
  555. return true;
  556. }
  557. private bool fCheckFfuStatus1() {
  558. //return true;
  559. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("FfuMemoBusControl").GetValueOrDefault())
  560. {
  561. if (Ffu.SpeedSet1)
  562. {
  563. LogObject.Info("FFU", "FfuSpeedSet end");
  564. return true;
  565. }
  566. //LogObject.Error("FFU", "FfuSpeedSet error");
  567. return true;
  568. }
  569. return true;
  570. }
  571. private bool fCheckFfuStatus2()
  572. {
  573. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("FfuMemoBusControl").GetValueOrDefault())
  574. {
  575. if (Ffu.SpeedSet2)
  576. {
  577. LogObject.Info("FFU2", "FfuSpeedSet end");
  578. return true;
  579. }
  580. LogObject.Error("FFU2", "FfuSpeedSet error");
  581. return false;
  582. }
  583. return true;
  584. }
  585. private bool fDeviceReset()
  586. {
  587. //设备状态机重置
  588. Singleton<DeviceEntity>.Instance.PostMsg(DeviceEntityT<DeviceManager>.MSG.RESET);
  589. LogObject.Info("Device","设备重置");
  590. return true;
  591. }
  592. public RState Start(params object[] objs)
  593. {
  594. Reset();
  595. Trace.WriteLine($"检查是否更新timeout参数:{_scRobotHomeTimeout.IntValue}");
  596. _timeoutRobot = _scRobotHomeTimeout.IntValue * 1000;
  597. _timeoutBuffer = SC.GetValue<int>("Coolbuffer.DownTimeout") * 1000;
  598. RbSetRoutine.Speed = SC.GetValue<int>("Robot.Robot.SpeedLevel");
  599. // RbSetRoutine.SetRobotSpeed( RbSetRoutine.Speed);
  600. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("FfuMemoBusControl").GetValueOrDefault())
  601. _scFfuSpeed = SC.GetValue<int>("System.FFUSetSpeed");
  602. _scanBuffer = true;
  603. WaferSensorResetCreate();
  604. return Runner.Start(ModuleName.System,"initRoutine");
  605. }
  606. public void Abort()
  607. {
  608. }
  609. private void WaferSensorResetCreate()
  610. {
  611. if (!this._scanBuffer)
  612. return;
  613. if (DeviceModel.SensorPreAlignerWaferOn != null && !DeviceModel.SensorPreAlignerWaferOn.Value && Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Aligner, 0))
  614. Singleton<WaferManager>.Instance.CreateWafer(ModuleName.Aligner, 0, WaferStatus.Normal);
  615. else if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("AlignerInstalled").GetValueOrDefault())
  616. Singleton<WaferManager>.Instance.DeleteWafer(ModuleName.Aligner, 0);
  617. this._scanBuffer = false;
  618. }
  619. public enum InitStep
  620. {
  621. DeviceReset,
  622. FfuSpeedSet1,
  623. FfuSpeedSet2,
  624. RobotReset,
  625. RobotHome,
  626. CheckBlade1WaferIsExist,
  627. CheckBlade2WaferIsExist,
  628. ConfirmRobotBlade1Wafer,
  629. ConfirmRobotBlade2Wafer,
  630. HomeGripAndUngripRobotBlade1,
  631. HomeGripAndUngripRobotBlade2,
  632. FlipperHome,
  633. CooingbufferHome1,
  634. CooingbufferHome2,
  635. CooingbufferHome3,
  636. CooingbufferHome4,
  637. LoadLockCloseAtmDoor,
  638. LoadLockCloseVtmDoor,
  639. LoadportAllReset,
  640. LoadportAllInit,
  641. }
  642. }
  643. }