InitRoutine.cs 24 KB

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