SwapRoutine.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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 Routine";
  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(SwapStep.WaitForSwapIdle, CheckFlipperIsIdle, _timeout)
  79. .Run(SwapStep.NotifyFlipperPrepare, NotifyFlipperOpen, CheckFlipperOpen, _timeout)
  80. .Run(SwapStep.CheckBlade1WaferIsExist, fCheckBlade1WaferIsExist, fRobotReady, _timeout)
  81. .Run(SwapStep.CheckBlade2WaferIsExist, fCheckBlade2WaferIsExist, fRobotReady, _timeout)
  82. .Run(SwapStep.CheckBeforeSwap, NullFun, fCheckBeforeSwap, _timeout)
  83. //.Run(SwapStep.SwapWafer, fSwapWafer, fWaitRobotMotion, _timeout)
  84. .Run(SwapStep.PickWafer, fPickWafer, fWaitRobotMotion, _timeout)
  85. .Run(SwapStep.PlaceWafer, fPlaceWafer, fWaitRobotMotion, _timeout)
  86. .Delay(SwapStep.TimeDelay, delaytime)
  87. .Run(SwapStep.NotifyFlipperOver, NotifyFlipperClose, CheckFlipperIsIdle, _timeout)
  88. .End(SwapStep.CheckAfterSwap, NullFun, fCheckAfterSwap, _timeout);
  89. else
  90. if(ModuleHelper.IsBuffer(Source))
  91. Runner
  92. .Run(SwapStep.CoolBufferMoveUP, fCoolBufferMoveUP, fWaitCoolBufferMoveUp, _timeout)
  93. .Run(SwapStep.CheckBlade1WaferIsExist,fCheckBlade1WaferIsExist, fRobotReady, _timeout)
  94. .Run(SwapStep.CheckBlade2WaferIsExist,fCheckBlade2WaferIsExist, fRobotReady, _timeout)
  95. .Run(SwapStep.CheckBeforeSwap,NullFun,fCheckBeforeSwap,_timeout)
  96. //.Run(SwapStep.SwapWafer,fSwapWafer, fWaitRobotMotion, _timeout)
  97. .Run(SwapStep.PickWafer,fPickWafer, fWaitRobotMotion, _timeout)
  98. .Run(SwapStep.PlaceWafer,fPlaceWafer, fWaitRobotMotion, _timeout)
  99. .Delay(SwapStep.TimeDelay, delaytime)
  100. .Run(SwapStep.CoolBufferMoveDown,fCoolBufferMoveDown, fWaitCoolBufferMoveDown, _timeout)
  101. .End(SwapStep.CheckAfterSwap,NullFun,fCheckAfterSwap,_timeout);
  102. else
  103. Runner
  104. .Run(SwapStep.CoolBufferMoveUP, fCoolBufferMoveUP, fWaitCoolBufferMoveUp, _timeout)
  105. .Run(SwapStep.CheckBlade1WaferIsExist, fCheckBlade1WaferIsExist, fRobotReady, _timeout)
  106. .Run(SwapStep.CheckBlade2WaferIsExist, fCheckBlade2WaferIsExist, fRobotReady, _timeout)
  107. .Run(SwapStep.CheckBeforeSwap, NullFun, fCheckBeforeSwap, _timeout)
  108. .Run(SwapStep.SwapWafer, fSwapWafer, fWaitRobotMotion, _timeout)
  109. //.Run(SwapStep.PickWafer,fPickWafer, fWaitRobotMotion, _timeout)
  110. //.Run(SwapStep.PlaceWafer,fPlaceWafer, fWaitRobotMotion, _timeout)
  111. .Delay(SwapStep.TimeDelay, delaytime)
  112. .Run(SwapStep.CoolBufferMoveDown, fCoolBufferMoveDown, fWaitCoolBufferMoveDown, _timeout)
  113. .End(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. else
  252. {
  253. if (OffsetX == 0 && OffsetY == 0 && OffsetZ == 0 ? robot.Swap((RobotArmEnum)_pickHand, Source.ToString(), Slot) : robot.SwapEx((RobotArmEnum)_pickHand, Source.ToString(), Slot, OffsetX, OffsetY, OffsetZ))
  254. {
  255. LogObject.Info("System", "Swap成功");
  256. return true;
  257. }
  258. else
  259. {
  260. LogObject.Error("System", "Swap失败");
  261. return false;
  262. }
  263. }
  264. return true;
  265. //this.Source, this.Slot, this._pickHand, this.OffsetX, this.OffsetY, this.OffsetZ
  266. }
  267. private bool fCheckBeforeSwap()
  268. {
  269. //this.Source, this.Slot, this._pickHand
  270. if (!CheckRobotMotionInterlock(Source, Slot, out _))
  271. {
  272. return false;
  273. }
  274. if (_pickHand == Hand.Blade1)
  275. {
  276. if (!Singleton<WaferManager>.Instance.CheckWafer(Source, Slot, WaferStatus.Normal))
  277. {
  278. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferAbsentWithoutRecord, (object)string.Format("target {0}{1:D2}", (object)Source.ToString(), (object)(Slot + 1)));
  279. return false;
  280. }
  281. if (Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 0, WaferStatus.Normal))
  282. {
  283. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferNotDetectedBeforeSend);
  284. return false;
  285. }
  286. if (CheckSeneorHasWafer(ModuleName.Robot, 0))
  287. {
  288. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferNotDetectedBeforeSend);
  289. return false;
  290. }
  291. if (!Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 1, WaferStatus.Normal))
  292. {
  293. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferDetectedBeforePick);
  294. return false;
  295. }
  296. if (CheckSensorNoWafer(ModuleName.Robot, 1))
  297. {
  298. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferDetectedBeforePick);
  299. return false;
  300. }
  301. }
  302. else
  303. {
  304. if (!Singleton<WaferManager>.Instance.CheckWafer(Source, Slot, WaferStatus.Normal))
  305. {
  306. //EV.PostMessage<EventEnum>(ModuleName.System.ToString(), EventEnum.WaferAbsentWithoutRecord, (object)string.Format("target {0}{1:D2}", (object)Source.ToString(), (object)(Slot + 1)));
  307. return false;
  308. }
  309. if (Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 1, WaferStatus.Normal))
  310. {
  311. return false;
  312. }
  313. if (this.CheckSeneorHasWafer(ModuleName.Robot, 1))
  314. {
  315. return false;
  316. }
  317. if (!Singleton<WaferManager>.Instance.CheckWafer(ModuleName.Robot, 0, WaferStatus.Normal))
  318. {
  319. return false;
  320. }
  321. if (this.CheckSensorNoWafer(ModuleName.Robot, 0))
  322. {
  323. return false;
  324. }
  325. }
  326. return true;
  327. }
  328. private bool fRobotReady() {
  329. if (robot.IsReady())
  330. {
  331. LogObject.Info("robot", "RobotReady");
  332. return true;
  333. }
  334. else
  335. {
  336. //LogObject.Error("robot", "RobotReady");
  337. return false;
  338. }
  339. }
  340. private bool fCheckBlade2WaferIsExist()
  341. {
  342. if (robot.ReadParameter(new object[3]
  343. {
  344. "CheckWaferIsPresence",
  345. 1,//blade2
  346. _existInterval
  347. }))
  348. {
  349. //机械臂2存在wafer
  350. LogObject.Info("System","Blade2存在wafer");
  351. return true;
  352. }
  353. else
  354. {
  355. //机械臂2存在wafer
  356. LogObject.Error("System", "Blade2不存在wafer");
  357. return false;
  358. }
  359. }
  360. private bool fCheckBlade1WaferIsExist()
  361. {
  362. if (robot.ReadParameter(new object[3]
  363. {
  364. "CheckWaferIsPresence",
  365. 0,//blade1
  366. _existInterval
  367. }))
  368. {
  369. //机械臂1存在wafer
  370. LogObject.Info("System", "Blade1存在wafer");
  371. return true;
  372. }
  373. else
  374. {
  375. //机械臂1存在wafer
  376. LogObject.Error("System", "Blade1不存在wafer");
  377. return false;
  378. }
  379. }
  380. private bool fWaitCoolBufferMoveUp()
  381. {
  382. if (ModuleHelper.IsCoolingBuffer(Source))
  383. {
  384. //this.robot, Hand.Blade1, this._timeout
  385. IoCoolingBuffer device = GetCoolBuffer(Source);
  386. if (!device.Error)
  387. {
  388. //检查上升的情况 并等其空闲
  389. return device.CheckMovedUp() && !device.Busy;
  390. }
  391. return false;
  392. }
  393. if (ModuleHelper.IsAligner(Source))
  394. {
  395. return true;
  396. }
  397. return true;
  398. }
  399. private bool fCoolBufferMoveUP()
  400. {
  401. if (ModuleHelper.IsCoolingBuffer(Source))
  402. {
  403. IoCoolingBuffer device = GetCoolBuffer(Source);
  404. //上升了 如果没有就命令上升
  405. if (device.CheckPinUp() || device.Move(Singleton<WaferManager>.Instance.GetWaferSize(Source, Slot), true, out _))
  406. return true;
  407. return false;
  408. }
  409. if (ModuleHelper.IsAligner(Source))
  410. {
  411. return true;
  412. }
  413. return true;
  414. }
  415. private bool CheckFlipperIsIdle()
  416. {
  417. return Singleton<RouteManager1>.Instance.GetFlipper().IsIdle;
  418. }
  419. private bool NotifyFlipperOpen()
  420. {
  421. Singleton<RouteManager1>.Instance.GetFlipper().PostMsg(FlipperMSG.PrepareTransfer);
  422. return true;
  423. }
  424. private bool NotifyFlipperClose()
  425. {
  426. Singleton<RouteManager1>.Instance.GetFlipper().PostMsg(FlipperMSG.EndTransfer);
  427. return true;
  428. }
  429. private bool CheckFlipperOpen()
  430. {
  431. return Singleton<RouteManager1>.Instance.GetFlipper().IsTransfer;
  432. }
  433. public RState Start(params object[] objs)
  434. {
  435. Reset();
  436. _IsFlipper = false;
  437. _timeout =robot.RobotCommandTimeout;
  438. _alignerdelay = SC.GetValue<int>("System.AlignerPinDownDelay");
  439. _coolingdelay = SC.GetValue<int>("System.CoolingPinDownDelay");
  440. _timeout = robot.RobotCommandTimeout * 1000;
  441. if (ModuleHelper.IsTurnOverStation(Source))
  442. _IsFlipper = true;
  443. if (!Singleton<EfemEntity>.Instance.IsOnlineMode && (ModuleHelper.IsCoolingBuffer(Source) || ModuleHelper.IsAligner(Source)))
  444. {
  445. delaytime = !ModuleHelper.IsCoolingBuffer(Source) ? _alignerdelay * 1000 : _coolingdelay * 1000;
  446. }
  447. else
  448. {
  449. delaytime = 0;
  450. }
  451. _pickHand = Hand.Blade1;
  452. if (PlaceBlade == Hand.Blade1)
  453. _pickHand = Hand.Blade2;
  454. return Runner.Start(Module, Name);
  455. }
  456. public void Abort()
  457. {
  458. }
  459. protected bool CheckRobotMotionInterlock(ModuleName chamber, int slot, out string reason)
  460. {
  461. reason = string.Empty;
  462. if (robot.RobotState == RobotStateEnum.Error)
  463. {
  464. reason = "robot is error.";
  465. return false;
  466. }
  467. if (!robot.IsReady())
  468. {
  469. reason = string.Format("robot isn't Ready.");
  470. return false;
  471. }
  472. if (chamber == ModuleName.Aligner || ModuleHelper.IsTurnOverStation(chamber))
  473. {
  474. //if (aligner.Moving)
  475. //{
  476. // reason = string.Format("aligner is moving.");
  477. // return false;
  478. //}
  479. if (robot.IsReady())
  480. return true;
  481. reason = string.Format("aligner isn't Ready.");
  482. return false;
  483. }
  484. if (ModuleHelper.IsLoadPort(chamber))
  485. {
  486. LoadPortBaseDevice device = DEVICE.GetDevice<LoadPortBaseDevice>(chamber.ToString());
  487. if (!device.IsEnableTransferWafer(out reason))
  488. {
  489. reason = string.Format($"{chamber} isn't Ready.The reason is {reason}");
  490. return false;
  491. }
  492. if (device.MapError)
  493. {
  494. reason = string.Format("{0} Map has crossed error.", (object)chamber.ToString());
  495. return false;
  496. }
  497. if (chamber.Equals(ModuleName.LP1))
  498. {
  499. if (!DeviceModel.SensorSMIF1PODOPEN.Value)
  500. {
  501. reason = string.Format("{0} SMIF1PODOPEN signal is Off.", (object)chamber.ToString());
  502. return false;
  503. }
  504. if (!DeviceModel.SensorSMIF1PODPRESENT.Value)
  505. {
  506. reason = string.Format("{0} SensorSMIF1PODPRESENT signal is Off,Foup is presence.", (object)chamber.ToString());
  507. return false;
  508. }
  509. if (!DeviceModel.SensorSMIF1READY.Value)
  510. {
  511. reason = string.Format("{0} SensorSMIF1READY signal is Off.", (object)chamber.ToString());
  512. return false;
  513. }
  514. }
  515. else if (chamber.Equals(ModuleName.LP2))
  516. {
  517. if (!DeviceModel.SensorSMIF2PODOPEN.Value)
  518. {
  519. reason = string.Format("{0} SMIF2PODOPEN signal is Off.", (object)chamber.ToString());
  520. return false;
  521. }
  522. if (!DeviceModel.SensorSMIF2PODPRESENT.Value)
  523. {
  524. reason = string.Format("{0} SensorSMIF2PODPRESENT signal is Off,Foup is not presence .", (object)chamber.ToString());
  525. return false;
  526. }
  527. if (!DeviceModel.SensorSMIF2READY.Value)
  528. {
  529. reason = string.Format("{0} SensorSMIF2READY signal is Off.", (object)chamber.ToString());
  530. return false;
  531. }
  532. }
  533. return true;
  534. }
  535. if (ModuleHelper.IsLoadLock(chamber))
  536. return DEVICE.GetDevice<LoadLockDevice>(chamber.ToString()).IsEnableTransferWafer(out reason);
  537. if (ModuleHelper.IsCoolingBuffer(chamber))
  538. {
  539. IoCoolingBuffer device = DEVICE.GetDevice<IoCoolingBuffer>(chamber.ToString());
  540. if (device.Busy)
  541. {
  542. reason = "buffer is not idle";
  543. return false;
  544. }
  545. if (device.CheckPinUp())
  546. return true;
  547. reason = "buffer pin not up position";
  548. return false;
  549. }
  550. if (ModuleHelper.IsAligner(chamber))
  551. {
  552. //PreAligner device = DEVICE.GetDevice<PreAligner>(chamber.ToString());
  553. //if (device.Busy)
  554. //{
  555. // reason = "Aligner is not Idle";
  556. // return false;
  557. //}
  558. return true;
  559. }
  560. if (ModuleHelper.IsBuffer(chamber))
  561. {
  562. return true ;
  563. }
  564. reason = "error target";
  565. return false;
  566. }
  567. protected bool CheckSensorNoWafer(ModuleName chamber, int slot)
  568. {
  569. if (SC.GetValue<bool>("System.IsSimulatorMode") || chamber != ModuleName.Robot)
  570. return Singleton<WaferManager>.Instance.CheckNoWafer(chamber, slot);
  571. return slot == 0 ? !robot.IsWaferPresenceOnBlade1 : !robot.IsWaferPresenceOnBlade2;
  572. }
  573. protected bool CheckSeneorHasWafer(ModuleName chamber, int slot)
  574. {
  575. if (SC.GetValue<bool>("System.IsSimulatorMode") || chamber != ModuleName.Robot)
  576. return Singleton<WaferManager>.Instance.CheckHasWafer(chamber, slot);
  577. return slot == 0 ? robot.IsWaferPresenceOnBlade1 : robot.IsWaferPresenceOnBlade2;
  578. }
  579. public enum SwapStep
  580. {
  581. WaitForSwapIdle,
  582. CoolBufferMoveUP,
  583. WaitCoolBufferMoveUp,
  584. CheckBlade1WaferIsExist,
  585. CheckBlade2WaferIsExist,
  586. CheckBeforeSwap,
  587. SwapWafer,
  588. PickWafer,
  589. WaitRobotMotion,
  590. PlaceWafer,
  591. CoolBufferMoveDown,
  592. WaitCoolBufferMoveDown,
  593. CheckAfterSwap,
  594. TimeDelay,
  595. NotifyFlipperPrepare,
  596. NotifyFlipperOver,
  597. }
  598. public IoCoolingBuffer GetCoolBuffer(ModuleName coolbufferName)
  599. {
  600. switch (coolbufferName)
  601. {
  602. //case ModuleName.Aligner1:
  603. // _ioCoolBuffer = aligner1;
  604. // break;
  605. //case ModuleName.Aligner2:
  606. // this._ioCoolBuffer = this.aligner2;
  607. // break;
  608. case ModuleName.CoolingBuffer1:
  609. this._ioCoolBuffer = this.buffer1;
  610. break;
  611. case ModuleName.CoolingBuffer2:
  612. this._ioCoolBuffer = this.buffer2;
  613. break;
  614. }
  615. return _ioCoolBuffer;
  616. }
  617. }
  618. }