Mag7RobotHandler.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. using System;
  2. using System.Text;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Sorter.Common;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.SubstrateTrackings;
  7. using System.Text.RegularExpressions;
  8. using Aitex.Core.Common;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.Log;
  11. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.MAG7
  12. {
  13. public class Mag7RobotMotionHandler : ITransferMsg
  14. {
  15. public bool background { get; protected set; }
  16. public bool evt { get { return false; } }
  17. public string deviceID { private get; set; }
  18. public string _cmd = string.Empty;
  19. public IDevice Robot { set { _robot = (Robot)value; } }
  20. protected Robot _robot;
  21. public Mag7RobotMotionHandler()
  22. {
  23. background = false;
  24. }
  25. public virtual string package(params object[] args)
  26. {
  27. return "";
  28. }
  29. public bool unpackage(string type, string[] items)
  30. {
  31. if (type.Equals(ProtocolTag.resp_tag_excute))
  32. {
  33. update(items);
  34. return true;
  35. }
  36. return !background;
  37. }
  38. protected virtual void update(string[] data)
  39. {
  40. }
  41. }
  42. public class RbHomeHandler : Mag7RobotMotionHandler
  43. {
  44. public RbHomeHandler()
  45. {
  46. background = true;
  47. }
  48. public override string package(params object[] args)
  49. {
  50. updateBefore();
  51. return "HOME ALL";
  52. }
  53. protected void updateBefore()
  54. {
  55. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  56. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  57. _robot.CmdBladeTarget = $"{_robot.Name}.A";
  58. _robot.CmdBlade1Extend = "0";
  59. _robot.CmdBlade2Extend = "0";
  60. }
  61. protected override void update(string[] data)
  62. {
  63. _robot.Initalized = true;
  64. _robot.Swap = false;
  65. }
  66. }
  67. public class RbStopHandler : Mag7RobotMotionHandler
  68. {
  69. public RbStopHandler()
  70. {
  71. background = true;
  72. }
  73. //$,<UNo>(,<SeqNo>),CSTP,<Sw>(,<Sum>)<CR>
  74. public override string package(params object[] args)
  75. {
  76. return "PAUSE";
  77. }
  78. }
  79. public class PickHandler : Mag7RobotMotionHandler
  80. {
  81. private ModuleName _chamber;
  82. private int _slot;
  83. private Hand _hand;
  84. public PickHandler()
  85. {
  86. background = true;
  87. }
  88. /// <summary>
  89. /// PICK station [SLOT slot] <<(ARM)>[(A|B|AB)]> <PAN L|R> <CW|CCW>
  90. //[[RO r_offset] [TO t_offset] [ZO z_offset]]
  91. // [ALTWAFSPD(Y | N)]
  92. // [EX NO_VIA|RE NO_VIA]
  93. // [STRT(NR | R1 | R2 | VIA)]
  94. // [(GRIP(OFF | ON)]
  95. // [ENRT [(NR | R1 | R2 | VIA)]
  96. // [(GRIP(OFF | ON)]
  97. // In MAG6 Compatibility, entering the word ARM is optional and SLOT starts with 1; in VT5 Compatibility, ARM is required and SLOT starts with 0.
  98. public override string package(params object[] args)
  99. {
  100. // PICK<CR>
  101. _chamber = (ModuleName)args[0];
  102. _slot = (int)args[1];
  103. _hand = (Hand)args[2];
  104. updateBefore();
  105. return string.Format("PICK {0} ARM {1}",
  106. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  107. Mag7RobotConvertor.hand2string(_hand));
  108. }
  109. private void updateBefore()
  110. {
  111. _robot.Blade1Target = _chamber;
  112. _robot.Blade2Target = _chamber;
  113. string arm = _hand == Hand.Blade1 ? "A" : "B";
  114. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  115. _robot.CmdBlade1Extend = _hand==Hand.Blade1 ? "1" : "0";
  116. _robot.CmdBlade2Extend = _hand == Hand.Blade1 ? "0" : "1";
  117. }
  118. protected override void update(string[] data)
  119. {
  120. if (_hand == Hand.Both)
  121. {
  122. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleHelper.Converter(_robot.Name), (int)Hand.Blade1);
  123. WaferManager.Instance.WaferMoved(_chamber, _slot + 1, ModuleHelper.Converter(_robot.Name), (int)Hand.Blade2);
  124. }
  125. else
  126. {
  127. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleHelper.Converter(_robot.Name), (int)_hand);
  128. }
  129. string arm = _hand == Hand.Blade1 ? "A" : "B";
  130. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  131. _robot.CmdBlade1Extend = "0";
  132. _robot.CmdBlade2Extend = "0";
  133. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  134. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  135. }
  136. }
  137. public class PickExtendHandler : Mag7RobotMotionHandler
  138. {
  139. private ModuleName _chamber;
  140. private int _slot;
  141. private Hand _hand;
  142. public PickExtendHandler()
  143. {
  144. background = true;
  145. }
  146. /// <summary>
  147. /// PICK station [SLOT slot] <<(ARM)>[(A|B|AB)]> <PAN L|R> <CW|CCW>
  148. //[[RO r_offset] [TO t_offset] [ZO z_offset]]
  149. // [ALTWAFSPD(Y | N)]
  150. // [EX NO_VIA|RE NO_VIA]
  151. // [STRT(NR | R1 | R2 | VIA)]
  152. // [(GRIP(OFF | ON)]
  153. // [ENRT [(NR | R1 | R2 | VIA)]
  154. // [(GRIP(OFF | ON)]
  155. // In MAG6 Compatibility, entering the word ARM is optional and SLOT starts with 1; in VT5 Compatibility, ARM is required and SLOT starts with 0.
  156. public override string package(params object[] args)
  157. {
  158. // PICK<CR>
  159. _chamber = (ModuleName)args[0];
  160. _slot = (int)args[1];
  161. _hand = (Hand)args[2];
  162. updateBefore();
  163. return string.Format("PICK {0} ARM {1} ENRT NR",
  164. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  165. Mag7RobotConvertor.hand2string(_hand));
  166. }
  167. private void updateBefore()
  168. {
  169. string arm = _hand == Hand.Blade1 ? "A" : "B";
  170. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  171. _robot.CmdBlade1Extend = _hand == Hand.Blade1 ? "1" : "0";
  172. _robot.CmdBlade2Extend = _hand == Hand.Blade1 ? "0" : "1";
  173. _robot.Blade1Target = _chamber;
  174. _robot.Blade2Target = _chamber;
  175. }
  176. }
  177. public class PickRetractHandler : Mag7RobotMotionHandler
  178. {
  179. private ModuleName _chamber;
  180. private int _slot;
  181. private Hand _hand;
  182. public PickRetractHandler()
  183. {
  184. background = true;
  185. }
  186. /// <summary>
  187. /// PICK station [SLOT slot] <<(ARM)>[(A|B|AB)]> <PAN L|R> <CW|CCW>
  188. //[[RO r_offset] [TO t_offset] [ZO z_offset]]
  189. // [ALTWAFSPD(Y | N)]
  190. // [EX NO_VIA|RE NO_VIA]
  191. // [STRT(NR | R1 | R2 | VIA)]
  192. // [(GRIP(OFF | ON)]
  193. // [ENRT [(NR | R1 | R2 | VIA)]
  194. // [(GRIP(OFF | ON)]
  195. // In MAG6 Compatibility, entering the word ARM is optional and SLOT starts with 1; in VT5 Compatibility, ARM is required and SLOT starts with 0.
  196. public override string package(params object[] args)
  197. {
  198. // PICK<CR>
  199. _chamber = (ModuleName)args[0];
  200. _slot = (int)args[1];
  201. _hand = (Hand)args[2];
  202. updateBefore();
  203. return string.Format("PICK {0} ARM {1} STRT NR",
  204. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  205. Mag7RobotConvertor.hand2string(_hand));
  206. }
  207. private void updateBefore()
  208. {
  209. string arm = _hand == Hand.Blade1 ? "A" : "B";
  210. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  211. _robot.CmdBlade1Extend ="0";
  212. _robot.CmdBlade2Extend = "0";
  213. _robot.Blade1Target = _chamber;
  214. _robot.Blade2Target = _chamber;
  215. }
  216. protected override void update(string[] data)
  217. {
  218. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  219. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  220. }
  221. }
  222. public class PlaceHandler : Mag7RobotMotionHandler
  223. {
  224. private ModuleName _chamber;
  225. private int _slot;
  226. private Hand _hand;
  227. public PlaceHandler()
  228. {
  229. background = true;
  230. }
  231. public override string package(params object[] args)
  232. {
  233. // $,<UNo>(,<SeqNo>),MTRS,<Mtn>,<TrsSt>,<Slot>,<Posture>,<Hand>,<TrsPnt>(,<OfstX>,<OfstY>,<OfstZ>)(,<Angle>)(,<Sum>)<CR>
  234. _chamber = (ModuleName)args[0];
  235. _slot = (int)args[1];
  236. _hand = (Hand)args[2];
  237. updateBefore();
  238. return string.Format("PLACE {0} ARM {1}",
  239. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  240. Mag7RobotConvertor.hand2string(_hand));
  241. }
  242. private void updateBefore()
  243. {
  244. _robot.Blade1Target = _chamber;
  245. _robot.Blade2Target = _chamber;
  246. string arm = _hand == Hand.Blade1 ? "A" : "B";
  247. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  248. _robot.CmdBlade1Extend = _hand == Hand.Blade1 ? "1" : "0";
  249. _robot.CmdBlade2Extend = _hand == Hand.Blade1 ? "0" : "1";
  250. }
  251. protected override void update(string[] data)
  252. {
  253. if (_hand == Hand.Both)
  254. {
  255. WaferManager.Instance.WaferMoved(ModuleHelper.Converter(_robot.Name), (int)Hand.Blade1, _chamber, _slot);
  256. WaferManager.Instance.WaferMoved(ModuleHelper.Converter(_robot.Name), (int)Hand.Blade2, _chamber, _slot + 1);
  257. }
  258. else
  259. {
  260. WaferManager.Instance.WaferMoved(ModuleHelper.Converter(_robot.Name), (int)_hand, _chamber, _slot);
  261. }
  262. string arm = _hand == Hand.Blade1 ? "A" : "B";
  263. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  264. _robot.CmdBlade1Extend ="0";
  265. _robot.CmdBlade2Extend ="0";
  266. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  267. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  268. }
  269. }
  270. public class PlaceExtendHandler : Mag7RobotMotionHandler
  271. {
  272. private ModuleName _chamber;
  273. private int _slot;
  274. private Hand _hand;
  275. public PlaceExtendHandler()
  276. {
  277. background = true;
  278. }
  279. public override string package(params object[] args)
  280. {
  281. // $,<UNo>(,<SeqNo>),MTRS,<Mtn>,<TrsSt>,<Slot>,<Posture>,<Hand>,<TrsPnt>(,<OfstX>,<OfstY>,<OfstZ>)(,<Angle>)(,<Sum>)<CR>
  282. _chamber = (ModuleName)args[0];
  283. _slot = (int)args[1];
  284. _hand = (Hand)args[2];
  285. updateBefore();
  286. return string.Format("PLACE {0} ARM {1} ENRT NR",
  287. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  288. Mag7RobotConvertor.hand2string(_hand));
  289. }
  290. private void updateBefore()
  291. {
  292. _robot.Blade1Target = _chamber;
  293. _robot.Blade2Target = _chamber;
  294. string arm = _hand == Hand.Blade1 ? "A" : "B";
  295. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  296. _robot.CmdBlade1Extend = _hand == Hand.Blade1 ? "1" : "0";
  297. _robot.CmdBlade2Extend = _hand == Hand.Blade1 ? "0" : "1";
  298. }
  299. protected override void update(string[] data)
  300. {
  301. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  302. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  303. }
  304. }
  305. public class PlaceRetractHandler : Mag7RobotMotionHandler
  306. {
  307. private ModuleName _chamber;
  308. private int _slot;
  309. private Hand _hand;
  310. public PlaceRetractHandler()
  311. {
  312. background = true;
  313. }
  314. public override string package(params object[] args)
  315. {
  316. // $,<UNo>(,<SeqNo>),MTRS,<Mtn>,<TrsSt>,<Slot>,<Posture>,<Hand>,<TrsPnt>(,<OfstX>,<OfstY>,<OfstZ>)(,<Angle>)(,<Sum>)<CR>
  317. _chamber = (ModuleName)args[0];
  318. _slot = (int)args[1];
  319. _hand = (Hand)args[2];
  320. updateBefore();
  321. return string.Format("PLACE {0} ARM {1} STRT NR",
  322. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  323. Mag7RobotConvertor.hand2string(_hand));
  324. }
  325. private void updateBefore()
  326. {
  327. _robot.Blade1Target = _chamber;
  328. _robot.Blade2Target = _chamber;
  329. string arm = _hand == Hand.Blade1 ? "A" : "B";
  330. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  331. _robot.CmdBlade1Extend = "0";
  332. _robot.CmdBlade2Extend = "0";
  333. }
  334. protected override void update(string[] data)
  335. {
  336. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  337. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  338. }
  339. }
  340. public class ExchangHandler : Mag7RobotMotionHandler
  341. {
  342. private ModuleName _chamber;
  343. private int _slot;
  344. private Hand _hand;
  345. public ExchangHandler()
  346. {
  347. background = true;
  348. }
  349. public override string package(params object[] args)
  350. {
  351. // Picks from designated arm and places using other arm.<CR>
  352. _chamber = (ModuleName)args[0];
  353. _slot = (int)args[1];
  354. _hand = (Hand)args[2];
  355. if (_hand == Hand.Blade1)
  356. _hand = Hand.Blade2;
  357. else
  358. _hand = Hand.Blade1;
  359. updateBefore();
  360. return string.Format("SWAP {0} {1}",
  361. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  362. Mag7RobotConvertor.hand2string(_hand));
  363. }
  364. private void updateBefore()
  365. {
  366. _robot.Blade1Target = _chamber;
  367. _robot.Blade2Target = _chamber;
  368. _robot.Swap = true;
  369. _robot.PlaceBalde = _hand;
  370. }
  371. protected override void update(string[] data)
  372. {
  373. if (_hand == Hand.Blade2)
  374. {
  375. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleHelper.Converter(_robot.Name), (int)Hand.Blade2);
  376. WaferManager.Instance.WaferMoved(ModuleHelper.Converter(_robot.Name), (int)Hand.Blade1, _chamber, _slot);
  377. }
  378. else
  379. {
  380. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleHelper.Converter(_robot.Name), (int)Hand.Blade1);
  381. WaferManager.Instance.WaferMoved(ModuleHelper.Converter(_robot.Name), (int)Hand.Blade2, _chamber, _slot);
  382. }
  383. _robot.Swap = false;
  384. _robot.Blade1Target = ModuleHelper.Converter(_robot.Name);
  385. _robot.Blade2Target = ModuleHelper.Converter(_robot.Name);
  386. }
  387. }
  388. public class GotoHandler : Mag7RobotMotionHandler
  389. {
  390. private ModuleName _chamber;
  391. private int _slot;
  392. private Hand _hand;
  393. public GotoHandler()
  394. {
  395. background = true;
  396. }
  397. public override string package(params object[] args)
  398. {
  399. // Moves to a specified station-referenced location.< CR >
  400. _chamber = (ModuleName)args[0];
  401. _slot = (int)args[1];
  402. _hand = (Hand)args[2];
  403. updateBefore();
  404. return string.Format("GOTO N {0} ARM {1} R RE Z DN",
  405. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  406. Mag7RobotConvertor.hand2string(_hand));
  407. }
  408. private void updateBefore()
  409. {
  410. _robot.Blade1Target = _chamber;
  411. _robot.Blade2Target = _chamber;
  412. string arm = _hand == Hand.Blade1 ? "A" : "B";
  413. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  414. _robot.CmdBlade1Extend = "0";
  415. _robot.CmdBlade2Extend = "0" ;
  416. }
  417. }
  418. public class ExtendHandler : Mag7RobotMotionHandler
  419. {
  420. private ModuleName _chamber;
  421. private int _slot;
  422. private Hand _hand;
  423. public ExtendHandler()
  424. {
  425. background = true;
  426. }
  427. public override string package(params object[] args)
  428. {
  429. // Moves to a specified station-referenced location.< CR >
  430. _chamber = (ModuleName)args[0];
  431. _slot = (int)args[1];
  432. _hand = (Hand)args[2];
  433. updateBefore();
  434. return string.Format("GOTO N {0} ARM {1} R EX Z DN",
  435. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  436. Mag7RobotConvertor.hand2string(_hand));
  437. }
  438. private void updateBefore()
  439. {
  440. _robot.Blade1Target = _chamber;
  441. _robot.Blade2Target = _chamber;
  442. string arm = _hand == Hand.Blade1 ? "A" : "B";
  443. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  444. _robot.CmdBlade1Extend = _hand == Hand.Blade1 ? "1" : "0";
  445. _robot.CmdBlade2Extend = _hand == Hand.Blade1 ? "0" : "1";
  446. }
  447. }
  448. public class RetractHandler : Mag7RobotMotionHandler
  449. {
  450. private ModuleName _chamber;
  451. private int _slot;
  452. private Hand _hand;
  453. public RetractHandler()
  454. {
  455. background = true;
  456. }
  457. public override string package(params object[] args)
  458. {
  459. // Moves to a specified station-referenced location.< CR >
  460. _chamber = (ModuleName)args[0];
  461. _slot = (int)args[1];
  462. _hand = (Hand)args[2];
  463. updateBefore();
  464. return string.Format("GOTO N {0} ARM {1} R RE Z DN",
  465. Mag7RobotConvertor.MapModuleSlot(_chamber, _slot),
  466. Mag7RobotConvertor.hand2string(_hand));
  467. }
  468. private void updateBefore()
  469. {
  470. _robot.Blade1Target = _chamber;
  471. _robot.Blade2Target = _chamber;
  472. string arm = _hand == Hand.Blade1 ? "A" : "B";
  473. _robot.CmdBladeTarget = $"{_chamber}.{arm}";
  474. _robot.CmdBlade1Extend = "0";
  475. _robot.CmdBlade2Extend = "0" ;
  476. }
  477. }
  478. public class RbSetSpeedHandler : Mag7RobotMotionHandler
  479. {
  480. private int _speed = 0;
  481. public RbSetSpeedHandler()
  482. {
  483. background = false;
  484. }
  485. public override string package(params object[] args)
  486. {
  487. _speed = (int)args[0];
  488. string speed = "LOSPD";
  489. switch (_speed)
  490. {
  491. case 1: //low
  492. speed = "LOSPD";
  493. break;
  494. case 2: //Medium
  495. speed = "MESPD";
  496. break;
  497. case 3: //high
  498. speed = "HISPD";
  499. break;
  500. }
  501. return string.Format(" SET LOSPD Y", speed);
  502. }
  503. }
  504. public class RbSetCommunicationHandler : Mag7RobotMotionHandler
  505. {
  506. public RbSetCommunicationHandler()
  507. {
  508. background = true;
  509. }
  510. //SET COMM [M/B (MON|PKT)] [FLOW (SEQ|BKG|BKG+|MULTI|MULTI_DEV)]
  511. //[LF(ON | OFF)]
  512. //[ECHO(ON | OFF)]
  513. //[CHECKSUM(ON | OFF)]
  514. //[ERRLVL err_level]
  515. //[DREP(AUT | REQ)]
  516. //[ERR_REP(AUT | REQ)]
  517. //[RR(ON | OFF)]
  518. public override string package(params object[] args)
  519. {
  520. return string.Format("SET COMM {0} {1} {2} {3}",
  521. "M/B PKT", // packet mode
  522. "FLOW SEQ", // sequential mode
  523. "ECHO OFF", // echo off
  524. "CHECKSUM OFF" // echo off
  525. );
  526. }
  527. }
  528. public class RbSetLoadHandler : Mag7RobotMotionHandler
  529. {
  530. public RbSetLoadHandler()
  531. {
  532. background = true;
  533. }
  534. //SET LOAD <<(ARM)>[(A | B)]> <PAN L|R> (?|ON|OFF)
  535. //RQ LOAD <<(ARM)>[(A | B)]> <PAN L|R>
  536. public override string package(params object[] args)
  537. {
  538. Hand hand = (Hand)args[0];
  539. return string.Format("SET LOAD {0} OFF", hand==Hand.Blade1?"A":"B");
  540. }
  541. }
  542. public class RbCheckLoadHandler : Mag7RobotMotionHandler
  543. {
  544. public RbCheckLoadHandler()
  545. {
  546. background = true;
  547. }
  548. //CHECK LOAD[station] [(A | B)] <PAN L|R> [[INTLCK ALL| (DIS|ENB)]| [EX_ENABLE
  549. // (DIS | ENB)] |[SBIT_SLVL_SEN(DIS | ENB)] |[VLV_SEN(DIS | ENB)]
  550. public override string package(params object[] args)
  551. {
  552. ModuleName module = (ModuleName)args[0];
  553. int slot = (int) args[1];
  554. return string.Format("CHECK LOAD {0} INTLCK ALL DIS", Mag7RobotConvertor.MapModule(module));
  555. }
  556. }
  557. public class RbRequestWaferPresentHandler : ITransferMsg
  558. {
  559. public RbRequestWaferPresentHandler()
  560. {
  561. background = true;
  562. }
  563. //RQ WAFER PRESENT <<(ARM)>[(A|B|AB)]>
  564. public IDevice Robot { get; set; }
  565. public bool background { get; }
  566. public bool evt { get; }
  567. public string package(params object[] args)
  568. {
  569. return string.Format("RQ WAFER PRESENT AB");
  570. }
  571. public bool unpackage(string type, string[] items)
  572. {
  573. //WAFER PRESENT Y N
  574. if (type.Equals(ProtocolTag.resp_tag_excute))
  575. {
  576. return true;
  577. }
  578. if (items.Length == 4)
  579. {
  580. if (items[2] == "Y")
  581. ((Robot)Robot).NotifyWaferPresent(Hand.Blade1, WaferStatus.Normal);
  582. if (items[2] == "?")
  583. ((Robot)Robot).NotifyWaferPresent(Hand.Blade1, WaferStatus.Unknown);
  584. if (items[2] == "N")
  585. ((Robot)Robot).NotifyWaferPresent(Hand.Blade1, WaferStatus.Empty);
  586. if (items[3] == "Y")
  587. ((Robot)Robot).NotifyWaferPresent(Hand.Blade2, WaferStatus.Normal);
  588. if (items[3] == "?")
  589. ((Robot)Robot).NotifyWaferPresent(Hand.Blade2, WaferStatus.Unknown);
  590. if (items[3] == "N")
  591. ((Robot)Robot).NotifyWaferPresent(Hand.Blade2, WaferStatus.Empty);
  592. }
  593. else
  594. {
  595. EV.PostWarningLog(Robot.Module, $"Request Wafer Present return unexpected feedback");
  596. return false;
  597. }
  598. return false;
  599. }
  600. }
  601. public class RBQueryStateHandler : ITransferMsg
  602. {
  603. public bool background { get; protected set; }
  604. public bool evt { get { return false; } }
  605. public string deviceID { private get; set; }
  606. public string _cmd = string.Empty;
  607. public IDevice Robot { set { _device = (Robot)value; } }
  608. protected Robot _device;
  609. public RBQueryStateHandler()
  610. {
  611. background = false;
  612. }
  613. //$,<UNo>(,<SeqNo>),RSTS(,<Sum>)<CR>
  614. public string package(params object[] args)
  615. {
  616. return ",RSTS,";
  617. }
  618. public bool unpackage(string type, string[] items)
  619. {
  620. return !background;
  621. }
  622. }
  623. public class RbEventHandler : ITransferMsg
  624. {
  625. public bool background { get { return false; } }
  626. public bool evt { get { return true; } }
  627. public string deviceID { private get; set; }
  628. public string _cmd = string.Empty;
  629. public IDevice Robot { set { _device = (Robot)value; } }
  630. protected Robot _device;
  631. public RbEventHandler()
  632. {
  633. }
  634. //$,<UNo>(,<SeqNo>),RSTS(,<Sum>)<CR>
  635. public string package(params object[] args)
  636. {
  637. return "";
  638. }
  639. public bool unpackage(string type, string[] items)
  640. {
  641. return true;
  642. }
  643. }
  644. public class RBQueryPositionHandler : ITransferMsg
  645. {
  646. public bool background { get; protected set; }
  647. public bool evt { get { return false; } }
  648. public string deviceID { private get; set; }
  649. public string _cmd = string.Empty;
  650. public IDevice Robot { set { _device = (Robot)value; } }
  651. protected Robot _device;
  652. public RBQueryPositionHandler()
  653. {
  654. background = false;
  655. }
  656. //RQ POS ABS ALL
  657. //POS ABS(A|B) rVal tVal zVal sVal wVal waVal wbVal
  658. public string package(params object[] args)
  659. {
  660. return "RQ POS ABS ALL";
  661. }
  662. public bool unpackage(string type, string[] items)
  663. {
  664. //POS ABS (A|B) rVal tVal zVal sVal wVal waVal wbVal
  665. //Radial: rVal
  666. //Theta:tVal
  667. //Z:zVal
  668. //S:sVal
  669. //W:wVal
  670. //WA:waVal
  671. //WB:wbVal
  672. if (items.Length == 9)
  673. {
  674. _device.Rotation = int.Parse(items[1]);
  675. return true;
  676. }
  677. return !background;
  678. }
  679. }
  680. }