FutureEfemLoadPort.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. using System;
  2. using System.Collections;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.RT.Device;
  6. using Aitex.Core.RT.Event;
  7. using Aitex.Core.RT.Log;
  8. using Aitex.Core.RT.OperationCenter;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using Aitex.Sorter.Common;
  12. using MECF.Framework.Common.Equipment;
  13. using MECF.Framework.Common.FAServices;
  14. using MECF.Framework.Common.SubstrateTrackings;
  15. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems.Rorzes;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  17. namespace FutureEfemLib.LPs
  18. {
  19. public class FutureEfemLoadPort : LoadPort, IEfemLoadPortCallback
  20. {
  21. public enum LoadPortStates
  22. {
  23. Undefined = 0,
  24. NotInitialized = 1,
  25. Initializing = 2,
  26. Idle = 3,
  27. Mapping = 4,
  28. MappingStation = 5,
  29. Homing = 6,
  30. Faulted = 7,
  31. Clamping = 8,
  32. Docking = 9,
  33. Unclamping = 10,
  34. Undocking = 11,
  35. OpeningDoor = 12,
  36. ClosingDoor = 13,
  37. Loading = 15,
  38. Unloading = 16,
  39. ReadingCarrierID = 17,
  40. Querying = 18,
  41. ChangeAccessMode = 19,
  42. ChangeTransferState = 20,
  43. ClearError,
  44. SetIndicator,
  45. }
  46. private LoadportCassetteState _cassetteState;
  47. public override LoadportCassetteState CassetteState
  48. {
  49. get { return _cassetteState; }
  50. set { _cassetteState = value; }
  51. }
  52. private FoupClampState _clampState;
  53. public override FoupClampState ClampState
  54. {
  55. get { return _clampState; }
  56. set { _clampState = value; }
  57. }
  58. private FoupDockState _dockState;
  59. public override FoupDockState DockState
  60. {
  61. get { return _dockState; }
  62. set { _dockState = value; }
  63. }
  64. private FoupDoorState _doorState;
  65. public override FoupDoorState DoorState
  66. {
  67. get { return _doorState; }
  68. set { _doorState = value; }
  69. }
  70. public override bool IsAutoReadCarrierID
  71. {
  72. get
  73. {
  74. return SC.ContainsItem($"EFEM.LoadPort.EnableAutoCarrierIdRead") ?
  75. SC.GetValue<bool>($"EFEM.LoadPort.EnableAutoCarrierIdRead") : true;
  76. }
  77. }
  78. private RorzeEfem _efem;
  79. public override bool IsWaferProtrude { get; set; }
  80. private RD_TRIG _trigPresentAbsent = new RD_TRIG();
  81. private RD_TRIG _trigPresentAbsentDely = new RD_TRIG();
  82. private RD_TRIG _trigPlacement = new RD_TRIG();
  83. private R_TRIG _trigWaferProtrude = new R_TRIG();
  84. private LoadPortStates _loadPortState;
  85. public WaferSize WaferSize { get; set; }
  86. public string LastMapResult { get; set; }
  87. public override bool IsBusy => _loadPortState != LoadPortStates.Idle;
  88. private DeviceTimer _deviceTimer = new DeviceTimer();
  89. private int _timeDelayNotifyCassettePresent = 100; //ms
  90. public override WaferSize GetCurrentWaferSize()
  91. {
  92. return WaferSize;
  93. }
  94. //private bool _present4;
  95. //private bool _present6;
  96. private string _efemName;
  97. //private bool _indicatorPlaced;
  98. //private bool _indicatorError;
  99. //private bool _isIntialized;
  100. public bool IsError
  101. {
  102. get;
  103. set;
  104. }
  105. public FutureEfemLoadPort(string module, string name, string efem)
  106. {
  107. base.Module = module;
  108. base.Name = name;
  109. base.Display = name;
  110. base.DeviceID = "";
  111. _efemName = efem;
  112. IsMapWaferByLoadPort = false;
  113. _loadPortState = LoadPortStates.NotInitialized;
  114. }
  115. public override bool Initialize()
  116. {
  117. if (_efem == null && !string.IsNullOrEmpty(_efemName))
  118. {
  119. _efem = DEVICE.GetDevice<FutureEfem>(_efemName);
  120. _efem.SetLoadPortCallback(ModuleHelper.Converter(Module), this);
  121. }
  122. //DATA.Subscribe($"{Module}.IndicatorPlaced", () => _indicatorPlaced);
  123. //DATA.Subscribe($"{Module}.IndicatorError", () => _indicatorError);
  124. DATA.Subscribe($"{Module}.IsWaferProtrude", () => IsWaferProtrude);
  125. //DATA.Subscribe($"{Module}.IsPresent4", () => _present4);
  126. //DATA.Subscribe($"{Module}.IsPresent6", () => _present6);
  127. DATA.Subscribe($"{Module}.WaferSize", () => WaferSize.ToString());
  128. DATA.Subscribe($"{Module}.LastMapResult", () => LastMapResult);
  129. if (SC.ContainsItem("EFEM.LoadPort.TimeDelayNotifyCassettePresent"))
  130. {
  131. _timeDelayNotifyCassettePresent = SC.GetValue<int>("EFEM.LoadPort.TimeDelayNotifyCassettePresent");
  132. }
  133. return base.Initialize();
  134. }
  135. public override void Reset()
  136. {
  137. base.Reset();
  138. _trigWaferProtrude.RST = true;
  139. }
  140. public override bool IsEnableMapWafer()
  141. {
  142. return IsPlacement && !IsWaferProtrude;
  143. }
  144. public bool IsEnableMapWafer(out string reason)
  145. {
  146. if (_loadPortState != LoadPortStates.Idle)
  147. {
  148. reason = "Cassette is busy";
  149. return false;
  150. }
  151. if (!IsPlacement)
  152. {
  153. reason = "Cassette not properly placed";
  154. return false;
  155. }
  156. if (IsWaferProtrude)
  157. {
  158. reason = "Found wafer protrude";
  159. return false;
  160. }
  161. if (CassetteState != LoadportCassetteState.Normal)
  162. {
  163. reason = "Cassette is abnormal";
  164. return false;
  165. }
  166. reason = string.Empty;
  167. return true;
  168. }
  169. public override bool IsEnableTransferWafer()
  170. {
  171. return IsEnableTransferWafer(out _);
  172. }
  173. public override bool IsEnableTransferWafer(out string reason)
  174. {
  175. if (_loadPortState != LoadPortStates.Idle)
  176. {
  177. reason = "Cassette is busy";
  178. return false;
  179. }
  180. if (!IsPlacement)
  181. {
  182. reason = "No cassette present";
  183. return false;
  184. }
  185. if (IsWaferProtrude)
  186. {
  187. reason = "Found wafer protrude";
  188. return false;
  189. }
  190. if (!_isMapped)
  191. {
  192. reason = "Cassette not mapped";
  193. return false;
  194. }
  195. if (DoorState != FoupDoorState.Open)
  196. {
  197. reason = "Cassette not open";
  198. return false;
  199. }
  200. if (CassetteState != LoadportCassetteState.Normal)
  201. {
  202. reason = "Cassette is abnormal";
  203. return false;
  204. }
  205. reason = "";
  206. return true;
  207. }
  208. public virtual void NoteStatus(string data1, string data2)
  209. {
  210. uint result1 = Convert.ToUInt32(data1, 16);
  211. uint result2 = Convert.ToUInt32(data2, 16);
  212. BitArray bitData1 = new BitArray(new int[] { Convert.ToInt32(data1, 16) });
  213. BitArray bitData2 = new BitArray(new int[] { Convert.ToInt32(data2, 16) });
  214. //placement bit 0
  215. //present bit 1
  216. //access sw bit 2
  217. //clampState bit 3
  218. //doorState bit 4
  219. //dockState bit 5
  220. //wafer size 8 bit 6
  221. //wafer size 12 bit 7
  222. bool placement = (result1 & 0x00000001u) == 0x00000001u;
  223. bool present = !((result1 & 0x00000002u) == 0x00000002u);
  224. SetPresent(present);
  225. SetPlaced(placement);
  226. _isAccessSwPressed = (result1 & 0x00000004u) == 0x00000004u;
  227. _clampState = (result1 & 0x00000008u) == 0x00000008u ? FoupClampState.Close : FoupClampState.Open;
  228. _doorState = (result1 & 0x00000010u) == 0x00000010u ? FoupDoorState.Open : FoupDoorState.Close;
  229. _dockState = (result1 & 0x00000020u) == 0x00000020u ? FoupDockState.Docked : FoupDockState.Undocked;
  230. bool isWS8 = (result1 & 0x00000040u) == 0x00000040u;
  231. bool isWS12 = (result1 & 0x00000080u) == 0x00000080u;
  232. if (IsPlacement)
  233. {
  234. if (isWS8 == isWS12)
  235. {
  236. EV.PostAlarmLog(LPModuleName.ToString(), "Get WaferSize Data Abnormal , pls check config");
  237. }
  238. else if (isWS8)
  239. {
  240. WaferSize = WaferSize.WS8;
  241. CarrierManager.Instance.UpdateWaferSize(LPModuleName, 0, WaferSize);
  242. }
  243. else if (isWS12)
  244. {
  245. WaferSize = WaferSize.WS12;
  246. CarrierManager.Instance.UpdateWaferSize(LPModuleName, 0, WaferSize);
  247. }
  248. }
  249. //E84Signal.VALID = (result1 & 0x01000000u) == 0x01000000u //bit 24
  250. //E84Signal.CS_0 = (result1 & 0x02000000u) == 0x02000000u //bit 25
  251. //E84Signal.CS_1 = (result1 & 0x04000000u) == 0x04000000u //bit 26
  252. //E84Signal.TR_REQ = (result1 & 0x10000000u) == 0x10000000u //bit 28
  253. //E84Signal.BUSY = (result1 & 0x20000000u) == 0x20000000u //bit 29
  254. //E84Signal.COMPT = (result1 & 0x40000000u) == 0x40000000u //bit 30
  255. //E84Signal.CONT = (result1 & 0x80000000u) == 0x80000000u //bit 31
  256. //check presence light bit 0
  257. //check placement light bit 1
  258. //check load light bit 2
  259. //check unload light bit 3
  260. //check manual mode light bit 4
  261. //check error light bit 5
  262. //check clamp/unclamp light bit 6
  263. //check dock/undock light bit 7
  264. //check access switch light bit 8
  265. IndicatiorPresence = GetIndicatorState(bitData2[0]);
  266. IndicatiorPlacement = GetIndicatorState(bitData2[1]);
  267. IndicatiorLoad = GetIndicatorState(bitData2[2]);
  268. IndicatiorUnload = GetIndicatorState(bitData2[3]);
  269. IndicatiorManualMode = GetIndicatorState(bitData2[4]);
  270. IndicatorAlarm = GetIndicatorState(bitData2[5]);
  271. IndicatiorClampUnclamp = GetIndicatorState(bitData2[6]);
  272. IndicatiorDockUndock = GetIndicatorState(bitData2[7]);
  273. IndicatiorOpAccess = GetIndicatorState(bitData2[8]);
  274. //E84Signal.L_REQ = bitData2[24] //bit 24
  275. //E84Signal.U_REQ = bitData2[25] //bit 25
  276. //E84Signal.READY = bitData2[27] //bit 27
  277. //E84Signal.HO_AVBL = bitData2[30] //bit 30
  278. //E84Signal.ES = bitData2[31] //bit 31
  279. CassetteState = IsPlacement ? LoadportCassetteState.Normal : LoadportCassetteState.None;
  280. if (bitData2[5])
  281. {
  282. Error = true;
  283. }
  284. else
  285. {
  286. if (_loadPortState == LoadPortStates.Faulted)
  287. Error = true;
  288. else
  289. Error = false;
  290. }
  291. }
  292. /*
  293. *Report the wafer presence of all slots.
  294. 0 =No wafer
  295. 1 =Wafer presence
  296. 2 =Abnormal thickness (Wafer is thick)
  297. 3 =Cross slotted wafer
  298. 4 =Front down wafer
  299. 7 =Multiple wafers are in the same slot
  300. 8 =Abnormal thickness (Wafer is thin)
  301. */
  302. public virtual void NoteSlotMap(string slotMap)
  303. {
  304. slotMap = slotMap.Replace('3', '2');
  305. slotMap = slotMap.Replace('4', 'W');
  306. slotMap = slotMap.Replace('7', 'W');
  307. slotMap = slotMap.Replace('8', 'W');
  308. slotMap = slotMap.Replace('2', 'W');
  309. LastMapResult = slotMap;
  310. base.OnSlotMapRead(slotMap);
  311. }
  312. private IndicatorState GetIndicatorState(bool flag)
  313. {
  314. if (flag)
  315. return IndicatorState.ON;
  316. else
  317. return IndicatorState.OFF;
  318. }
  319. public void ResetData()
  320. {
  321. _isMapped = false;
  322. }
  323. public void NoteComplete()
  324. {
  325. //if(_loadPortState == LoadPortStates.Homing)
  326. // _isIntialized = true;
  327. _loadPortState = LoadPortStates.Idle;
  328. }
  329. public void NoteCancel(string error)
  330. {
  331. IsBusy = false;
  332. EV.PostAlarmLog(Module, $"{Module} is canceled since {error}");
  333. }
  334. public void NoteCarrierID(string carrierID)
  335. {
  336. base.OnCarrierIdRead(ModuleHelper.Converter(Module), Name, carrierID);
  337. }
  338. public override bool FALoad(out string reason) //map and loads
  339. {
  340. reason = "";
  341. OP.DoOperation($"{Name}.Load");
  342. return true;
  343. }
  344. public override bool FAUnload(out string reason)
  345. {
  346. reason = "";
  347. OP.DoOperation($"{Name}.Unload");
  348. return true;
  349. }
  350. public override bool Home(out string reason)
  351. {
  352. reason = string.Empty;
  353. if (_efem == null || !_efem.Connection.IsConnected)
  354. {
  355. reason = "efem not connected";
  356. return false;
  357. }
  358. _loadPortState = LoadPortStates.Homing;
  359. //_isIntialized = false;
  360. _isMapped = false;
  361. if (!_efem.HomeLoadPort(Module, out reason))
  362. {
  363. _loadPortState = LoadPortStates.Faulted;
  364. return false;
  365. }
  366. return true;
  367. }
  368. public override bool ClearError(out string reason)
  369. {
  370. reason = string.Empty;
  371. if (_efem == null || !_efem.Connection.IsConnected)
  372. {
  373. reason = "efem not connected";
  374. return false;
  375. }
  376. //_loadPortState = LoadPortStates.ClearError;
  377. //if (!_efem.ClearAlarm(Module, out reason))
  378. //{
  379. // _loadPortState = LoadPortStates.Faulted;
  380. // return false;
  381. //}
  382. return true;
  383. }
  384. public override bool Clamp(out string reason)
  385. {
  386. reason = string.Empty;
  387. if (_efem == null || !_efem.Connection.IsConnected)
  388. {
  389. reason = "efem not connected";
  390. return false;
  391. }
  392. if (!IsPlacement)
  393. {
  394. reason = "no carrier at load port";
  395. return false;
  396. }
  397. if (ClampState == FoupClampState.Close)
  398. {
  399. return true;
  400. }
  401. _loadPortState = LoadPortStates.Clamping;
  402. if (!_efem.ClampCarrier(Module, out reason))
  403. {
  404. _loadPortState = LoadPortStates.Faulted;
  405. return false;
  406. }
  407. return true;
  408. }
  409. public override bool Unclamp(out string reason)
  410. {
  411. reason = string.Empty;
  412. if (_efem == null || !_efem.Connection.IsConnected)
  413. {
  414. reason = "efem not connected";
  415. return false;
  416. }
  417. if (!IsPlacement)
  418. {
  419. reason = "no carrier at load port";
  420. return false;
  421. }
  422. //if(DoorState != FoupDoorState.Close)
  423. //{
  424. // reason = "cassette not closed";
  425. // return false;
  426. //}
  427. //if(DockState != FoupDockState.Undocked)
  428. //{
  429. // reason = "cassette not undocked";
  430. // return false;
  431. //}
  432. if (ClampState == FoupClampState.Open)
  433. {
  434. return true;
  435. }
  436. _loadPortState = LoadPortStates.Unclamping;
  437. if (!_efem.UnclampCarrier(Module, out reason))
  438. {
  439. _loadPortState = LoadPortStates.Faulted;
  440. return false;
  441. }
  442. _isMapped = false;
  443. return true;
  444. }
  445. public override bool Dock(out string reason)
  446. {
  447. reason = string.Empty;
  448. if (_efem == null || !_efem.Connection.IsConnected)
  449. {
  450. reason = "efem not connected";
  451. return false;
  452. }
  453. if (!IsPlacement)
  454. {
  455. reason = "no carrier at load port";
  456. return false;
  457. }
  458. //if (ClampState != FoupClampState.Close)
  459. //{
  460. // reason = "cassette not clamped";
  461. // return false;
  462. //}
  463. if (DockState == FoupDockState.Docked)
  464. {
  465. return true;
  466. }
  467. _loadPortState = LoadPortStates.Docking;
  468. if (!_efem.MoveCarrierPort(Module, "Dock", out reason))
  469. {
  470. _loadPortState = LoadPortStates.Faulted;
  471. return false;
  472. }
  473. return true;
  474. }
  475. public override bool Undock(out string reason)
  476. {
  477. reason = string.Empty;
  478. if (_efem == null || !_efem.Connection.IsConnected)
  479. {
  480. reason = "efem not connected";
  481. return false;
  482. }
  483. if (!IsPlacement)
  484. {
  485. reason = "no carrier at load port";
  486. return false;
  487. }
  488. //if (DoorState != FoupDoorState.Close)
  489. //{
  490. // reason = "cassette not closed";
  491. // return false;
  492. //}
  493. if (DockState == FoupDockState.Undocked)
  494. {
  495. return true;
  496. }
  497. _loadPortState = LoadPortStates.Undocking;
  498. if (!_efem.MoveCarrierPort(Module, "Undock", out reason))
  499. {
  500. _loadPortState = LoadPortStates.Faulted;
  501. return false;
  502. }
  503. _isMapped = false;
  504. return true;
  505. }
  506. public override bool OpenDoor(out string reason)
  507. {
  508. reason = string.Empty;
  509. if (_efem == null || !_efem.Connection.IsConnected)
  510. {
  511. reason = "efem not connected";
  512. return false;
  513. }
  514. if (!IsPlacement)
  515. {
  516. reason = "no carrier at load port";
  517. return false;
  518. }
  519. //if (ClampState != FoupClampState.Close)
  520. //{
  521. // reason = "cassette not clamped";
  522. // return false;
  523. //}
  524. //if (DockState != FoupDockState.Docked)
  525. //{
  526. // reason = "cassette not docked";
  527. // return false;
  528. //}
  529. if (DoorState == FoupDoorState.Open)
  530. {
  531. return true;
  532. }
  533. _loadPortState = LoadPortStates.OpeningDoor;
  534. if (!_efem.OpenCarrierDoor(Module, out reason))
  535. {
  536. _loadPortState = LoadPortStates.Faulted;
  537. return false;
  538. }
  539. return true;
  540. }
  541. public override bool CloseDoor(out string reason)
  542. {
  543. reason = string.Empty;
  544. if (_efem == null || !_efem.Connection.IsConnected)
  545. {
  546. reason = "efem not connected";
  547. return false;
  548. }
  549. if (!IsPlacement)
  550. {
  551. reason = "no carrier at load port";
  552. return false;
  553. }
  554. //if (ClampState != FoupClampState.Close)
  555. //{
  556. // reason = "cassette not clamped";
  557. // return false;
  558. //}
  559. //if (DockState != FoupDockState.Docked)
  560. //{
  561. // reason = "cassette not docked";
  562. // return false;
  563. //}
  564. if (DoorState == FoupDoorState.Close)
  565. {
  566. return true;
  567. }
  568. _loadPortState = LoadPortStates.ClosingDoor;
  569. if (!_efem.CloseCarrierDoor(Module, out reason))
  570. {
  571. _loadPortState = LoadPortStates.Faulted;
  572. return false;
  573. }
  574. _isMapped = false;
  575. return true;
  576. }
  577. public override bool ReadRfId(out string reason)
  578. {
  579. reason = string.Empty;
  580. if (_efem == null || !_efem.Connection.IsConnected)
  581. {
  582. reason = "efem not connected";
  583. return false;
  584. }
  585. if (!IsPlacement)
  586. {
  587. reason = "no carrier at load port";
  588. return false;
  589. }
  590. _loadPortState = LoadPortStates.ReadingCarrierID;
  591. if (!_efem.ReadCarrierId(Module, out string carrierId, out reason))
  592. {
  593. _loadPortState = LoadPortStates.Faulted;
  594. return false;
  595. }
  596. return true;
  597. }
  598. public override bool ChangeAccessMode(bool auto, out string reason)
  599. {
  600. reason = string.Empty;
  601. if (_efem == null || !_efem.Connection.IsConnected)
  602. {
  603. reason = "efem not connected";
  604. return false;
  605. }
  606. _loadPortState = LoadPortStates.ChangeAccessMode;
  607. if (!_efem.SetLoadPortLight(ModuleHelper.Converter(Module), IndicatorType.AccessManual, auto ? IndicatorState.OFF : IndicatorState.ON, out reason))
  608. {
  609. _loadPortState = LoadPortStates.Faulted;
  610. return false;
  611. }
  612. return true;
  613. }
  614. public override bool SetIndicator(IndicatorType light, IndicatorState state)
  615. {
  616. if (_efem == null || !_efem.Connection.IsConnected)
  617. {
  618. return false;
  619. }
  620. if (!LoadPortIndicatorLightMap.ContainsKey(light))
  621. {
  622. EV.PostWarningLog(Module, $"Not supported indicator {light}");
  623. return false;
  624. }
  625. _loadPortState = LoadPortStates.SetIndicator;
  626. if (!_efem.SetLoadPortLight(ModuleHelper.Converter(Module), light, state, out string reason))
  627. {
  628. _loadPortState = LoadPortStates.Faulted;
  629. LOG.Write(reason);
  630. return false;
  631. }
  632. return true;
  633. }
  634. public override bool QueryState(out string reason)
  635. {
  636. reason = string.Empty;
  637. if (_efem == null || !_efem.Connection.IsConnected)
  638. {
  639. reason = "efem not connected";
  640. return false;
  641. }
  642. _loadPortState = LoadPortStates.Querying;
  643. if (!_efem.GetLoadPortStatus(Module, out _cassetteState, out _clampState, out _dockState, out _doorState, out reason))
  644. {
  645. _loadPortState = LoadPortStates.Faulted;
  646. return false;
  647. }
  648. return true;
  649. }
  650. public override bool QueryWaferMap(out string reason)
  651. {
  652. reason = string.Empty;
  653. if (_efem == null || !_efem.Connection.IsConnected)
  654. {
  655. reason = "efem not connected";
  656. return false;
  657. }
  658. if (!IsPlacement)
  659. {
  660. reason = "no carrier at load port";
  661. return false;
  662. }
  663. if (_efem.CheckIsBusy(ModuleName.EfemRobot))
  664. {
  665. reason = "efem robot is busy";
  666. return false;
  667. }
  668. //if (ClampState != FoupClampState.Close)
  669. //{
  670. // reason = "cassette not clamped";
  671. // return false;
  672. //}
  673. //if (DockState != FoupDockState.Docked)
  674. //{
  675. // reason = "cassette not docked";
  676. // return false;
  677. //}
  678. if (DoorState != FoupDoorState.Open)
  679. {
  680. reason = "cassette not open";
  681. return false;
  682. }
  683. _loadPortState = LoadPortStates.Mapping;
  684. if (!_efem.MapCarrier(Module, out string slotMap, out reason))
  685. {
  686. _loadPortState = LoadPortStates.Faulted;
  687. return false;
  688. }
  689. return true;
  690. }
  691. public override bool GetMapInfo(out string reason)
  692. {
  693. reason = string.Empty;
  694. if (!IsPlacement)
  695. {
  696. reason = "no carrier at load port";
  697. return false;
  698. }
  699. _loadPortState = LoadPortStates.Querying;
  700. if (!_efem.QueryMapResult(Module, out reason, false))
  701. {
  702. _loadPortState = LoadPortStates.Faulted;
  703. return false;
  704. }
  705. return true;
  706. }
  707. public override bool Stop(out string reason)
  708. {
  709. reason = string.Empty;
  710. _loadPortState = LoadPortStates.Idle;
  711. return true;
  712. }
  713. public void CarrierProcessStartEventNotify()
  714. {
  715. EV.Notify(UniversalEvents.CarrierProcessStart, new SerializableDictionary<string, object>()
  716. {
  717. { DataVariables.PortID, Module},
  718. { DataVariables.CarrierID, _carrierId},
  719. });
  720. }
  721. public void CarrierProcessCompleteEventNotify()
  722. {
  723. EV.Notify(UniversalEvents.CarrierProcessComplete, new SerializableDictionary<string, object>()
  724. {
  725. { DataVariables.PortID, Module},
  726. { DataVariables.CarrierID, _carrierId},
  727. });
  728. }
  729. }
  730. }