SwapRoutine.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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.SCCore;
  6. using Aitex.Core.Util;
  7. using Aitex.Sorter.Common;
  8. using athosRT.Devices;
  9. using athosRT.Devices.PA;
  10. using athosRT.FSM;
  11. using athosRT.tool;
  12. using MECF.Framework.Common.Equipment;
  13. using MECF.Framework.Common.SubstrateTrackings;
  14. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  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.Linq;
  22. using System.Numerics;
  23. using System.Text;
  24. using System.Threading.Tasks;
  25. using System.Xml.Linq;
  26. using static athosRT.Modules.FLP.FlipperEntity;
  27. using EV = athosRT.tool.EV;
  28. namespace athosRT.Modules.EFEMs.Routine
  29. {
  30. public class SwapRoutine : ModuleRoutineBase, FSM.IRoutine
  31. {
  32. private SCConfigItem _scSwapTimeout = (SCConfigItem)null;
  33. private int _timeout = 0;
  34. public LoadPort _lpDevice;
  35. private int _offsetXPick;
  36. private int _offsetYPick;
  37. private int _offsetZPick;
  38. private int _offsetXPlace;
  39. private int _offsetYPlace;
  40. private int _offsetZPLace;
  41. private Hand _pickHand;
  42. private int _alignerdelay = 0;
  43. private int _coolingdelay = 0;
  44. private int delaytime = 0;
  45. protected int OffsetX;
  46. protected int OffsetY;
  47. protected int OffsetZ;
  48. public ModuleName Source { get; set; }
  49. public int Slot { get; set; }
  50. public Hand PlaceBlade { get; set; }
  51. RobotBaseDevice robot;
  52. private int _existInterval = SC.GetValue<int>("Robot.Robot.ExistInterval");
  53. protected Aligner aligner = null;
  54. protected IoCoolingBuffer buffer1 = null;
  55. protected IoCoolingBuffer buffer2 = null;
  56. protected PreAligner aligner1 = null;
  57. protected PreAligner aligner2 = null;
  58. protected LoadLockDevice ll1 = null;
  59. protected LoadLockDevice ll2 = null;
  60. protected IoCoolingBuffer _ioCoolBuffer;
  61. private bool _IsFlipper = false;
  62. public SwapRoutine(ModuleName module) : base(module)
  63. {
  64. Module = module;
  65. Name = "Swap";
  66. _scSwapTimeout = SC.GetConfigItem("Robot.TimeLimitForPlaceWafer");
  67. robot = DEVICE.GetDevice<RobotBaseDevice>("Robot");
  68. aligner = DEVICE.GetDevice<Aligner>("Aligner");
  69. buffer1 = DEVICE.GetDevice<IoCoolingBuffer>("CoolingBuffer1");
  70. buffer2 = DEVICE.GetDevice<IoCoolingBuffer>("CoolingBuffer2");
  71. aligner1 = DEVICE.GetDevice<PreAligner>("Aligner1");
  72. aligner2 = DEVICE.GetDevice<PreAligner>("Aligner2");
  73. }
  74. public RState Monitor()
  75. {
  76. if (_IsFlipper)
  77. Runner
  78. .Wait((int)SwapStep.WaitForSwapIdle, CheckFlipperIsIdle, _timeout)
  79. .Run((int)SwapStep.NotifyFlipperPrepare, NotifyFlipperOpen, CheckFlipperOpen, _timeout)
  80. .Run((int)SwapStep.CheckBlade1WaferIsExist, fCheckBlade1WaferIsExist, fRobotReady, _timeout)
  81. .Run((int)SwapStep.CheckBlade2WaferIsExist, fCheckBlade2WaferIsExist, fRobotReady, _timeout)
  82. .Run((int)SwapStep.CheckBeforeSwap, NullFun, fCheckBeforeSwap, _timeout)
  83. //.Run((int)SwapStep.SwapWafer, fSwapWafer, fWaitRobotMotion, _timeout)
  84. .Run((int)SwapStep.PickWafer, fPickWafer, fWaitRobotMotion, _timeout)
  85. .Run((int)SwapStep.PlaceWafer, fPlaceWafer, fWaitRobotMotion, _timeout)
  86. .Delay((int)SwapStep.TimeDelay, delaytime)
  87. .Run((int)SwapStep.NotifyFlipperOver, NotifyFlipperClose, CheckFlipperIsIdle, _timeout)
  88. .End((int)SwapStep.CheckAfterSwap, NullFun, fCheckAfterSwap, _timeout);
  89. else
  90. if(ModuleHelper.IsBuffer(Source))
  91. Runner
  92. .Run((int)SwapStep.CoolBufferMoveUP, fCoolBufferMoveUP, fWaitCoolBufferMoveUp, _timeout)
  93. .Run((int)SwapStep.CheckBlade1WaferIsExist,fCheckBlade1WaferIsExist, fRobotReady, _timeout)
  94. .Run((int)SwapStep.CheckBlade2WaferIsExist,fCheckBlade2WaferIsExist, fRobotReady, _timeout)
  95. .Run((int)SwapStep.CheckBeforeSwap,NullFun,fCheckBeforeSwap,_timeout)
  96. //.Run((int)SwapStep.SwapWafer,fSwapWafer, fWaitRobotMotion, _timeout)
  97. .Run((int)SwapStep.PickWafer,fPickWafer, fWaitRobotMotion, _timeout)
  98. .Run((int)SwapStep.PlaceWafer,fPlaceWafer, fWaitRobotMotion, _timeout)
  99. .Delay((int)SwapStep.TimeDelay, delaytime)
  100. .Run((int)SwapStep.CoolBufferMoveDown,fCoolBufferMoveDown, fWaitCoolBufferMoveDown, _timeout)
  101. .End((int)SwapStep.CheckAfterSwap,NullFun,fCheckAfterSwap,_timeout);
  102. else
  103. Runner
  104. .Run((int)SwapStep.CoolBufferMoveUP, fCoolBufferMoveUP, fWaitCoolBufferMoveUp, _timeout)
  105. .Run((int)SwapStep.CheckBlade1WaferIsExist, fCheckBlade1WaferIsExist, fRobotReady, _timeout)
  106. .Run((int)SwapStep.CheckBlade2WaferIsExist, fCheckBlade2WaferIsExist, fRobotReady, _timeout)
  107. .Run((int)SwapStep.CheckBeforeSwap, NullFun, fCheckBeforeSwap, _timeout)
  108. .Run((int)SwapStep.SwapWafer, fSwapWafer, fWaitRobotMotion, _timeout)
  109. //.Run((int)SwapStep.PickWafer,fPickWafer, fWaitRobotMotion, _timeout)
  110. //.Run((int)SwapStep.PlaceWafer,fPlaceWafer, fWaitRobotMotion, _timeout)
  111. .Delay((int)SwapStep.TimeDelay, delaytime)
  112. .Run((int)SwapStep.CoolBufferMoveDown, fCoolBufferMoveDown, fWaitCoolBufferMoveDown, _timeout)
  113. .End((int)SwapStep.CheckAfterSwap, NullFun, fCheckAfterSwap, _timeout);
  114. return Runner.Status;
  115. }
  116. private bool fWaitCoolBufferMoveDown()
  117. {
  118. if (ModuleHelper.IsCoolingBuffer(this.Source))
  119. {
  120. IoCoolingBuffer device = GetCoolBuffer(Source);
  121. if (!device.Error)
  122. return device.CheckMovedDown() && !device.Busy;
  123. return false;
  124. }
  125. if (ModuleHelper.IsAligner(Source))
  126. {
  127. //PreAligner device = DEVICE.GetDevice<PreAligner>(Source.ToString());
  128. //if (device.Busy)
  129. //{
  130. // return false;
  131. //}
  132. return true;
  133. }
  134. return true;
  135. }
  136. private bool fCheckAfterSwap()
  137. {
  138. if (PlaceBlade == Hand.Blade1)
  139. {
  140. if (!this.CheckSensorNoWafer(ModuleName.Robot, 0))
  141. {
  142. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferDetectedAfterSend);
  143. return false;
  144. }
  145. if (!this.CheckSeneorHasWafer(ModuleName.Robot, 1))
  146. {
  147. EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferNotDetectedAfterPick);
  148. return false;
  149. }
  150. }
  151. else
  152. {
  153. if (!this.CheckSensorNoWafer(ModuleName.Robot, 1))
  154. {
  155. return false;
  156. }
  157. if (!this.CheckSeneorHasWafer(ModuleName.Robot, 0))
  158. {
  159. return false;
  160. }
  161. }
  162. return true;
  163. }
  164. private bool fCoolBufferMoveDown()
  165. {
  166. if (ModuleHelper.IsCoolingBuffer(this.Source))
  167. {
  168. IoCoolingBuffer device = GetCoolBuffer(Source);
  169. if (device.CheckPinDown() || device.Move(Singleton<WaferManager>.Instance.GetWaferSize(this.Source, this.Slot), false, out _))
  170. return true;
  171. return false;
  172. }
  173. if (ModuleHelper.IsAligner(Source))
  174. {
  175. //PreAligner device = DEVICE.GetDevice<PreAligner>(Source.ToString());
  176. //if (device.Busy)
  177. //{
  178. // return false;
  179. //}
  180. return true;
  181. }
  182. return true;
  183. }
  184. private bool fPlaceWafer()
  185. {
  186. if (!ModuleHelper.IsLoadLock(Source))
  187. {
  188. if (!ModuleHelper.IsCoolingBuffer(Source))
  189. {
  190. if (_offsetXPlace == 0 && _offsetYPlace == 0 && _offsetZPLace == 0 ? robot.Place((RobotArmEnum)PlaceBlade, Source.ToString(), Slot) : robot.PlaceEx((RobotArmEnum)_pickHand, Source.ToString(), Slot, _offsetXPlace, _offsetYPlace, _offsetZPLace))
  191. {
  192. LogObject.Info("System", "Swap place成功");
  193. return true;
  194. }
  195. else
  196. {
  197. LogObject.Error("System", "Swap place失败");
  198. return false;
  199. }
  200. }
  201. }
  202. return true;
  203. }
  204. private bool fWaitRobotMotion()
  205. {
  206. if (robot.IsError)
  207. {
  208. LogObject.Info("Robot", "Robot进入Error");
  209. return false;
  210. }
  211. return robot.IsReady();
  212. }
  213. private bool fPickWafer()
  214. {
  215. if (!ModuleHelper.IsLoadLock(Source))
  216. {
  217. if (!ModuleHelper.IsCoolingBuffer(Source))
  218. {
  219. if (_offsetXPick == 0 && _offsetYPick == 0 && _offsetZPick == 0 ? robot.Pick((RobotArmEnum)_pickHand, Source.ToString(), Slot) : robot.PickEx((RobotArmEnum)_pickHand, Source.ToString(), Slot, _offsetXPick, _offsetYPick, _offsetZPick))
  220. {
  221. LogObject.Info("System", "Swap pick成功");
  222. return true;
  223. }
  224. else
  225. {
  226. LogObject.Error("System", "Swap pick失败");
  227. return false;
  228. }
  229. }
  230. }
  231. return true;
  232. }
  233. private bool fSwapWafer()
  234. {
  235. if (!ModuleHelper.IsLoadLock(Source))
  236. {
  237. if (ModuleHelper.IsCoolingBuffer(Source) || ModuleHelper.IsAligner(Source)||ModuleHelper.IsTurnOverStation(Source))
  238. {
  239. if (OffsetX == 0 && OffsetY == 0 && OffsetZ == 0 ? robot.Swap((RobotArmEnum)_pickHand, Source.ToString(), Slot) : robot.SwapEx((RobotArmEnum)_pickHand, Source.ToString(), Slot, OffsetX, OffsetY, OffsetZ))
  240. {
  241. LogObject.Info("System", "Swap成功");
  242. return true;
  243. }
  244. else
  245. {
  246. LogObject.Error("System", "Swap失败");
  247. return false;
  248. }
  249. }
  250. }
  251. return true;
  252. //this.Source, this.Slot, this._pickHand, this.OffsetX, this.OffsetY, this.OffsetZ
  253. }
  254. private bool fCheckBeforeSwap()
  255. {
  256. //this.Source, this.Slot, this._pickHand
  257. if (!CheckRobotMotionInterlock(Source, Slot, out _))
  258. {
  259. return false;
  260. }
  261. if (_pickHand == Hand.Blade1)
  262. {
  263. if (!Singleton<WaferManager>.Instance.CheckWafer(Source, Slot, WaferStatus.Normal))
  264. {
  265. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferAbsentWithoutRecord, (object)string.Format("target {0}{1:D2}", (object)Source.ToString(), (object)(Slot + 1)));
  266. return false;
  267. }
  268. if (Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 0, WaferStatus.Normal))
  269. {
  270. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferNotDetectedBeforeSend);
  271. return false;
  272. }
  273. if (CheckSeneorHasWafer(ModuleName.Robot, 0))
  274. {
  275. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferNotDetectedBeforeSend);
  276. return false;
  277. }
  278. if (!Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 1, WaferStatus.Normal))
  279. {
  280. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferDetectedBeforePick);
  281. return false;
  282. }
  283. if (CheckSensorNoWafer(ModuleName.Robot, 1))
  284. {
  285. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferDetectedBeforePick);
  286. return false;
  287. }
  288. }
  289. else
  290. {
  291. if (!Singleton<WaferManager>.Instance.CheckWafer(Source, Slot, WaferStatus.Normal))
  292. {
  293. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferAbsentWithoutRecord, (object)string.Format("target {0}{1:D2}", (object)Source.ToString(), (object)(Slot + 1)));
  294. return false;
  295. }
  296. if (Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 1, WaferStatus.Normal))
  297. {
  298. return false;
  299. }
  300. if (this.CheckSeneorHasWafer(ModuleName.Robot, 1))
  301. {
  302. return false;
  303. }
  304. if (!Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 0, WaferStatus.Normal))
  305. {
  306. return false;
  307. }
  308. if (this.CheckSensorNoWafer(ModuleName.Robot, 0))
  309. {
  310. return false;
  311. }
  312. }
  313. return true;
  314. }
  315. private bool fRobotReady() {
  316. if (robot.IsReady())
  317. {
  318. LogObject.Info("robot", "RobotReady");
  319. return true;
  320. }
  321. else
  322. {
  323. //LogObject.Error("robot", "RobotReady");
  324. return false;
  325. }
  326. }
  327. private bool fCheckBlade2WaferIsExist()
  328. {
  329. if (robot.ReadParameter(new object[3]
  330. {
  331. "CheckWaferIsPresence",
  332. 1,//blade2
  333. _existInterval
  334. }))
  335. {
  336. //机械臂2存在wafer
  337. LogObject.Info("System","Blade2存在wafer");
  338. return true;
  339. }
  340. else
  341. {
  342. //机械臂2存在wafer
  343. LogObject.Error("System", "Blade2不存在wafer");
  344. return false;
  345. }
  346. }
  347. private bool fCheckBlade1WaferIsExist()
  348. {
  349. if (robot.ReadParameter(new object[3]
  350. {
  351. "CheckWaferIsPresence",
  352. 0,//blade1
  353. _existInterval
  354. }))
  355. {
  356. //机械臂1存在wafer
  357. LogObject.Info("System", "Blade1存在wafer");
  358. return true;
  359. }
  360. else
  361. {
  362. //机械臂1存在wafer
  363. LogObject.Error("System", "Blade1不存在wafer");
  364. return false;
  365. }
  366. }
  367. private bool fWaitCoolBufferMoveUp()
  368. {
  369. if (ModuleHelper.IsCoolingBuffer(Source))
  370. {
  371. //this.robot, Hand.Blade1, this._timeout
  372. IoCoolingBuffer device = GetCoolBuffer(Source);
  373. if (!device.Error)
  374. {
  375. //检查上升的情况 并等其空闲
  376. return device.CheckMovedUp() && !device.Busy;
  377. }
  378. return false;
  379. }
  380. if (ModuleHelper.IsAligner(Source))
  381. {
  382. return true;
  383. }
  384. return true;
  385. }
  386. private bool fCoolBufferMoveUP()
  387. {
  388. if (ModuleHelper.IsCoolingBuffer(Source))
  389. {
  390. IoCoolingBuffer device = GetCoolBuffer(Source);
  391. //上升了 如果没有就命令上升
  392. if (device.CheckPinUp() || device.Move(Singleton<WaferManager>.Instance.GetWaferSize(Source, Slot), true, out _))
  393. return true;
  394. return false;
  395. }
  396. if (ModuleHelper.IsAligner(Source))
  397. {
  398. return true;
  399. }
  400. return true;
  401. }
  402. private bool CheckFlipperIsIdle()
  403. {
  404. return Singleton<RouteManager1>.Instance.GetFlipper().IsIdle;
  405. }
  406. private bool NotifyFlipperOpen()
  407. {
  408. Singleton<RouteManager1>.Instance.GetFlipper().PostMsg(FlipperMSG.PrepareTransfer);
  409. return true;
  410. }
  411. private bool NotifyFlipperClose()
  412. {
  413. Singleton<RouteManager1>.Instance.GetFlipper().PostMsg(FlipperMSG.EndTransfer);
  414. return true;
  415. }
  416. private bool CheckFlipperOpen()
  417. {
  418. return Singleton<RouteManager1>.Instance.GetFlipper().IsTransfer;
  419. }
  420. public RState Start(params object[] objs)
  421. {
  422. Reset();
  423. _IsFlipper = false;
  424. _timeout =robot.RobotCommandTimeout;
  425. _alignerdelay = SC.GetValue<int>("System.AlignerPinDownDelay");
  426. _coolingdelay = SC.GetValue<int>("System.CoolingPinDownDelay");
  427. _timeout = robot.RobotCommandTimeout * 1000;
  428. if (ModuleHelper.IsTurnOverStation(Source))
  429. _IsFlipper = true;
  430. if (!Singleton<EfemEntity>.Instance.IsOnlineMode && (ModuleHelper.IsCoolingBuffer(Source) || ModuleHelper.IsAligner(Source)))
  431. {
  432. delaytime = !ModuleHelper.IsCoolingBuffer(Source) ? _alignerdelay * 1000 : _coolingdelay * 1000;
  433. }
  434. else
  435. {
  436. delaytime = 0;
  437. }
  438. _pickHand = Hand.Blade1;
  439. if (PlaceBlade == Hand.Blade1)
  440. _pickHand = Hand.Blade2;
  441. return Runner.Start(Module,Name);
  442. }
  443. public void Abort()
  444. {
  445. }
  446. protected bool CheckRobotMotionInterlock(ModuleName chamber, int slot, out string reason)
  447. {
  448. reason = string.Empty;
  449. if (robot.RobotState == RobotStateEnum.Error)
  450. {
  451. reason = "robot is error.";
  452. return false;
  453. }
  454. if (!robot.IsReady())
  455. {
  456. reason = string.Format("robot isn't Ready.");
  457. return false;
  458. }
  459. if (chamber == ModuleName.Aligner || ModuleHelper.IsTurnOverStation(chamber))
  460. {
  461. //if (aligner.Moving)
  462. //{
  463. // reason = string.Format("aligner is moving.");
  464. // return false;
  465. //}
  466. if (robot.IsReady())
  467. return true;
  468. reason = string.Format("aligner isn't Ready.");
  469. return false;
  470. }
  471. if (ModuleHelper.IsLoadPort(chamber))
  472. {
  473. LoadPortBaseDevice device = DEVICE.GetDevice<LoadPortBaseDevice>(chamber.ToString());
  474. if (!device.IsEnableTransferWafer(out reason))
  475. {
  476. reason = string.Format($"{chamber} isn't Ready.The reason is {reason}");
  477. return false;
  478. }
  479. if (device.MapError)
  480. {
  481. reason = string.Format("{0} Map has crossed error.", (object)chamber.ToString());
  482. return false;
  483. }
  484. if (chamber.Equals(ModuleName.LP1))
  485. {
  486. if (!DeviceModel.SensorSMIF1PODOPEN.Value)
  487. {
  488. reason = string.Format("{0} SMIF1PODOPEN signal is Off.", (object)chamber.ToString());
  489. return false;
  490. }
  491. if (!DeviceModel.SensorSMIF1PODPRESENT.Value)
  492. {
  493. reason = string.Format("{0} SensorSMIF1PODPRESENT signal is Off,Foup is presence.", (object)chamber.ToString());
  494. return false;
  495. }
  496. if (!DeviceModel.SensorSMIF1READY.Value)
  497. {
  498. reason = string.Format("{0} SensorSMIF1READY signal is Off.", (object)chamber.ToString());
  499. return false;
  500. }
  501. }
  502. else if (chamber.Equals(ModuleName.LP2))
  503. {
  504. if (!DeviceModel.SensorSMIF2PODOPEN.Value)
  505. {
  506. reason = string.Format("{0} SMIF2PODOPEN signal is Off.", (object)chamber.ToString());
  507. return false;
  508. }
  509. if (!DeviceModel.SensorSMIF2PODPRESENT.Value)
  510. {
  511. reason = string.Format("{0} SensorSMIF2PODPRESENT signal is Off,Foup is not presence .", (object)chamber.ToString());
  512. return false;
  513. }
  514. if (!DeviceModel.SensorSMIF2READY.Value)
  515. {
  516. reason = string.Format("{0} SensorSMIF2READY signal is Off.", (object)chamber.ToString());
  517. return false;
  518. }
  519. }
  520. return true;
  521. }
  522. if (ModuleHelper.IsLoadLock(chamber))
  523. return DEVICE.GetDevice<LoadLockDevice>(chamber.ToString()).IsEnableTransferWafer(out reason);
  524. if (ModuleHelper.IsCoolingBuffer(chamber))
  525. {
  526. IoCoolingBuffer device = DEVICE.GetDevice<IoCoolingBuffer>(chamber.ToString());
  527. if (device.Busy)
  528. {
  529. reason = "buffer is not idle";
  530. return false;
  531. }
  532. if (device.CheckPinUp())
  533. return true;
  534. reason = "buffer pin not up position";
  535. return false;
  536. }
  537. if (ModuleHelper.IsAligner(chamber))
  538. {
  539. //PreAligner device = DEVICE.GetDevice<PreAligner>(chamber.ToString());
  540. //if (device.Busy)
  541. //{
  542. // reason = "Aligner is not Idle";
  543. // return false;
  544. //}
  545. return true;
  546. }
  547. if (ModuleHelper.IsBuffer(chamber))
  548. {
  549. return true ;
  550. }
  551. reason = "error target";
  552. return false;
  553. }
  554. protected bool CheckSensorNoWafer(ModuleName chamber, int slot)
  555. {
  556. if (SC.GetValue<bool>("System.IsSimulatorMode") || chamber != ModuleName.Robot)
  557. return Singleton<WaferManager>.Instance.CheckNoWafer(chamber, slot);
  558. return slot == 0 ? !robot.IsWaferPresenceOnBlade1 : !robot.IsWaferPresenceOnBlade2;
  559. }
  560. protected bool CheckSeneorHasWafer(ModuleName chamber, int slot)
  561. {
  562. if (SC.GetValue<bool>("System.IsSimulatorMode") || chamber != ModuleName.Robot)
  563. return Singleton<WaferManager>.Instance.CheckHasWafer(chamber, slot);
  564. return slot == 0 ? robot.IsWaferPresenceOnBlade1 : robot.IsWaferPresenceOnBlade2;
  565. }
  566. public enum SwapStep
  567. {
  568. WaitForSwapIdle,
  569. CoolBufferMoveUP,
  570. WaitCoolBufferMoveUp,
  571. CheckBlade1WaferIsExist,
  572. CheckBlade2WaferIsExist,
  573. CheckBeforeSwap,
  574. SwapWafer,
  575. PickWafer,
  576. WaitRobotMotion,
  577. PlaceWafer,
  578. CoolBufferMoveDown,
  579. WaitCoolBufferMoveDown,
  580. CheckAfterSwap,
  581. TimeDelay,
  582. NotifyFlipperPrepare,
  583. NotifyFlipperOver,
  584. }
  585. public IoCoolingBuffer GetCoolBuffer(ModuleName coolbufferName)
  586. {
  587. switch (coolbufferName)
  588. {
  589. //case ModuleName.Aligner1:
  590. // _ioCoolBuffer = aligner1;
  591. // break;
  592. //case ModuleName.Aligner2:
  593. // this._ioCoolBuffer = this.aligner2;
  594. // break;
  595. case ModuleName.CoolingBuffer1:
  596. this._ioCoolBuffer = this.buffer1;
  597. break;
  598. case ModuleName.CoolingBuffer2:
  599. this._ioCoolBuffer = this.buffer2;
  600. break;
  601. }
  602. return _ioCoolBuffer;
  603. }
  604. }
  605. }