TazmoAligner.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. using System;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.Util;
  6. using Aitex.Sorter.Common;
  7. using Aitex.Core.RT.Device;
  8. using MECF.Framework.Common.Communications;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. using System.Collections.Generic;
  11. using Aitex.Core.RT.SCCore;
  12. using System.IO.Ports;
  13. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TazmoAligners
  14. {
  15. public enum TazmoState1
  16. {
  17. StandbyNoWafer = 0x100,
  18. StandbyWithWafer,
  19. OperationEndNormaly, // Normal
  20. Operating,
  21. Calibrationing = 0x106,
  22. Pause,
  23. Interlock,
  24. Initialization,
  25. StandbyDueToUninitialized = 0x110,
  26. WaferLostDuringAlignment,
  27. AlignmentOperationTimeOver,
  28. CannotDeterminTheWaferSize = 0x114,
  29. WaferNotSetToAligner = 0x115,
  30. OverTheDetectinRangeOfTheLineSensor = 0x117,
  31. SamplingOperationNotProcessed,
  32. CannotExecuteTheAlignment,
  33. CannotPerformTheInitialization,
  34. ReceivingErrorOfDIO,
  35. StepOutError,
  36. CommandExecuteError,
  37. InputValueOfLineSensorAbnormal,
  38. CannotPerformAlignerInitializationStoppedByInterlock,
  39. }
  40. public enum TazmoStatus
  41. {
  42. PossibleToOperate =0,
  43. NeedInit,
  44. Abnormal = 9,
  45. }
  46. public enum LiftStatus
  47. {
  48. Up =0,
  49. Down,
  50. Busy,
  51. Unknown =9,
  52. }
  53. public enum NotchDetectionStatus
  54. {
  55. NotComplete=0,
  56. Complete =1,
  57. Error =9,
  58. }
  59. public class TazmoAligner : BaseDevice, IDevice
  60. {
  61. public enum AlignerType
  62. {
  63. Mechnical =0,
  64. Vaccum,
  65. }
  66. public string Address
  67. {
  68. get
  69. {
  70. return "";
  71. }
  72. }
  73. public virtual bool IsConnected
  74. {
  75. get { return true; }
  76. }
  77. public virtual bool Disconnect()
  78. {
  79. return true;
  80. }
  81. public virtual bool Connect()
  82. {
  83. return true;
  84. }
  85. public const string delimiter = "\r";
  86. public int LastErrorCode { get; set; }
  87. public int Status { get; set; }
  88. public int ErrorCode { get; set; }
  89. public int ElapseTime { get; set; }
  90. public int Notch { get; set; }
  91. public bool Initalized { get; set; }
  92. private AlignerType _tazmotype;
  93. public AlignerType TazmoType { get => _tazmotype; }
  94. public bool Communication
  95. {
  96. get
  97. {
  98. return !_commErr;
  99. }
  100. }
  101. public virtual bool Error
  102. {
  103. get
  104. {
  105. return (int)TaAlignerStatus1 >= 0x111 || _commErr;
  106. }
  107. }
  108. public bool Busy { get { return _connection.IsBusy || _lstHandler.Count != 0; } }
  109. public DeviceState State
  110. {
  111. get
  112. {
  113. if (!Initalized)
  114. {
  115. return DeviceState.Unknown;
  116. }
  117. if (Error)
  118. {
  119. return DeviceState.Error;
  120. }
  121. if (Busy)
  122. return DeviceState.Busy;
  123. return DeviceState.Idle;
  124. }
  125. }
  126. public TazmoState1 TaAlignerStatus1
  127. {
  128. get;set;
  129. }
  130. public TazmoStatus TaAlignerStatus2Status
  131. {
  132. get;set;
  133. }
  134. public LiftStatus TaAlignerStatus2Lift
  135. {
  136. get;set;
  137. }
  138. public NotchDetectionStatus TaAlignerStatus2Notch
  139. {
  140. get;set;
  141. }
  142. public int TaAlignerStatus2DeviceStatus
  143. { get; set; }
  144. public int TaAlignerStatus2ErrorCode
  145. {
  146. get;set;
  147. }
  148. public int TaAlignerStatus2LastErrorCode
  149. {
  150. get;set;
  151. }
  152. public bool TaExecuteSuccss
  153. {
  154. get;set;
  155. }
  156. public virtual bool WaferOnAligner
  157. {
  158. get
  159. {
  160. return true;
  161. }
  162. }
  163. //private int _deviceAddress;
  164. public TazmoAlignerConnection Connection
  165. {
  166. get => _connection;
  167. }
  168. private TazmoAlignerConnection _connection;
  169. //private int _presetNumber;
  170. private R_TRIG _trigError = new R_TRIG();
  171. private R_TRIG _trigWarningMessage = new R_TRIG();
  172. private R_TRIG _trigCommunicationError = new R_TRIG();
  173. private R_TRIG _trigRetryConnect = new R_TRIG();
  174. private PeriodicJob _thread;
  175. private static Object _locker = new Object();
  176. private LinkedList<HandlerBase> _lstHandler = new LinkedList<HandlerBase>();
  177. private bool _enableLog = true;
  178. private bool _commErr = false;
  179. private int _defaultChuckPosition;
  180. //private bool _exceuteErr = false;
  181. //private string _addr;
  182. private DeviceTimer _timerQuery = new DeviceTimer();
  183. private string AlarmMechanicalAlignmentError = "MechanicalAlignmentError";
  184. public TazmoAligner(string module, string name)
  185. : base()
  186. {
  187. Name = name;
  188. WaferManager.Instance.SubscribeLocation(name, 1);
  189. }
  190. public bool Initialize()
  191. {
  192. string portName = SC.GetStringValue($"{Name}.Address");
  193. int bautRate = SC.GetValue<int>($"{Name}.BaudRate");
  194. int dataBits = SC.GetValue<int>($"{Name}.DataBits");
  195. Enum.TryParse(SC.GetStringValue($"{Name}.Parity"), out Parity parity);
  196. Enum.TryParse(SC.GetStringValue($"{Name}.StopBits"), out StopBits stopBits);
  197. //_deviceAddress = SC.GetValue<int>($"{Name}.DeviceAddress");
  198. _enableLog = SC.GetValue<bool>($"{Name}.EnableLogMessage");
  199. _tazmotype = (AlignerType)(SC.ContainsItem($"{Name}.AlignerType") ? SC.GetValue<int>($"{Name}.AlignerType") : 0);
  200. _defaultChuckPosition = SC.ContainsItem("Aligner.DefaultChuckPosition") ?
  201. SC.GetValue<int>("Aligner.DefaultChuckPosition") : 1;
  202. _connection = new TazmoAlignerConnection(portName, bautRate, dataBits, parity, stopBits);
  203. _connection.EnableLog(_enableLog);
  204. if (_connection.Connect())
  205. {
  206. EV.PostInfoLog(Module, $"{Module}.{Name} connected");
  207. }
  208. _thread = new PeriodicJob(100, OnTimer, $"{Module}.{Name} MonitorHandler", true);
  209. DEVICE.Register(String.Format("{0}.{1}", Name, "Init"), (out string reason, int time, object[] param) =>
  210. {
  211. bool ret = Init(out reason);
  212. if (ret)
  213. {
  214. reason = string.Format("{0} {1}", Name, "Reset Error");
  215. return true;
  216. }
  217. return false;
  218. });
  219. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerInit"), (out string reason, int time, object[] param) =>
  220. {
  221. bool ret = Init(out reason);
  222. if (ret)
  223. {
  224. reason = string.Format("{0} {1}", Name, "Reset Error");
  225. return true;
  226. }
  227. return false;
  228. });
  229. DEVICE.Register(String.Format("{0}.{1}", Name, "Home"), (out string reason, int time, object[] param) =>
  230. {
  231. bool ret = Home(out reason);
  232. if (ret)
  233. {
  234. reason = string.Format("{0} {1}", Name, "Reset Error");
  235. return true;
  236. }
  237. return false;
  238. });
  239. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerHome"), (out string reason, int time, object[] param) =>
  240. {
  241. bool ret = Home(out reason);
  242. if (ret)
  243. {
  244. reason = string.Format("{0} {1}", Name, "Reset Error");
  245. return true;
  246. }
  247. return false;
  248. });
  249. DEVICE.Register(String.Format("{0}.{1}", Name, "Reset"), (out string reason, int time, object[] param) =>
  250. {
  251. bool ret = Clear(out reason);
  252. if (ret)
  253. {
  254. reason = string.Format("{0} {1}", Name, "Reset Error");
  255. return true;
  256. }
  257. return false;
  258. });
  259. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerReset"), (out string reason, int time, object[] param) =>
  260. {
  261. bool ret = Clear(out reason);
  262. if (ret)
  263. {
  264. reason = string.Format("{0} {1}", Name, "Reset Error");
  265. return true;
  266. }
  267. return false;
  268. });
  269. DEVICE.Register(String.Format("{0}.{1}", Name, "Grip"), (out string reason, int time, object[] param) =>
  270. {
  271. bool ret = Grip(out reason);
  272. if (ret)
  273. {
  274. reason = string.Format("{0} {1}", Name, "Hold Wafer");
  275. return true;
  276. }
  277. return false;
  278. });
  279. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerGrip"), (out string reason, int time, object[] param) =>
  280. {
  281. bool ret = Grip(out reason);
  282. if (ret)
  283. {
  284. reason = string.Format("{0} {1}", Name, "Hold Wafer");
  285. return true;
  286. }
  287. return false;
  288. });
  289. DEVICE.Register(String.Format("{0}.{1}", Name, "Release"), (out string reason, int time, object[] param) =>
  290. {
  291. bool ret = Release(out reason);
  292. if (ret)
  293. {
  294. reason = string.Format("{0} {1}", Name, "Release Wafer");
  295. return true;
  296. }
  297. return false;
  298. });
  299. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerRelease"), (out string reason, int time, object[] param) =>
  300. {
  301. bool ret = Release(out reason);
  302. if (ret)
  303. {
  304. reason = string.Format("{0} {1}", Name, "Release Wafer");
  305. return true;
  306. }
  307. return false;
  308. });
  309. DEVICE.Register(String.Format("{0}.{1}", Name, "LiftUp"), (out string reason, int time, object[] param) =>
  310. {
  311. bool ret = LiftUp(out reason);
  312. if (ret)
  313. {
  314. reason = string.Format("{0} {1}", Name, "Lifter Up");
  315. return true;
  316. }
  317. return false;
  318. });
  319. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerLiftUp"), (out string reason, int time, object[] param) =>
  320. {
  321. bool ret = LiftUp(out reason);
  322. if (ret)
  323. {
  324. reason = string.Format("{0} {1}", Name, "Lifter Up");
  325. return true;
  326. }
  327. return false;
  328. });
  329. DEVICE.Register(String.Format("{0}.{1}", Name, "LiftDown"), (out string reason, int time, object[] param) =>
  330. {
  331. bool ret = LiftDown(out reason);
  332. if (ret)
  333. {
  334. reason = string.Format("{0} {1}", Name, "Lifter Down");
  335. return true;
  336. }
  337. return false;
  338. });
  339. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerLiftDown"), (out string reason, int time, object[] param) =>
  340. {
  341. bool ret = LiftDown(out reason);
  342. if (ret)
  343. {
  344. reason = string.Format("{0} {1}", Name, "Lifter Down");
  345. return true;
  346. }
  347. return false;
  348. });
  349. DEVICE.Register(String.Format("{0}.{1}", Name, "Stop"), (out string reason, int time, object[] param) =>
  350. {
  351. bool ret = Stop(out reason);
  352. if (ret)
  353. {
  354. reason = string.Format("{0} {1}", Name, "Stop Align");
  355. return true;
  356. }
  357. return false;
  358. });
  359. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerStop"), (out string reason, int time, object[] param) =>
  360. {
  361. bool ret = Stop(out reason);
  362. if (ret)
  363. {
  364. reason = string.Format("{0} {1}", Name, "Stop Align");
  365. return true;
  366. }
  367. return false;
  368. });
  369. DEVICE.Register(String.Format("{0}.{1}", Name, "Align"), (out string reason, int time, object[] param) =>
  370. {
  371. double angle = double.Parse((string)param[0]);
  372. bool ret = Align(angle, out reason);
  373. if (ret)
  374. {
  375. reason = string.Format("{0} {1}", Name, "PreAlign");
  376. return true;
  377. }
  378. return false;
  379. });
  380. DEVICE.Register(String.Format("{0}.{1}", Name, "AlignerAlign"), (out string reason, int time, object[] param) =>
  381. {
  382. double angle = double.Parse((string)param[0]);
  383. bool ret = Align(angle, out reason);
  384. if (ret)
  385. {
  386. reason = string.Format("{0} {1}", Name, "PreAlign");
  387. return true;
  388. }
  389. return false;
  390. });
  391. DATA.Subscribe($"{Name}.State", () => State);
  392. DATA.Subscribe($"{Name}.AlignerState", () => State.ToString());
  393. DATA.Subscribe($"{Name}.Busy", () => Busy);
  394. DATA.Subscribe($"{Name}.ErrorCode", () => ErrorCode);
  395. DATA.Subscribe($"{Name}.Error", () => Error);
  396. DATA.Subscribe($"{Name}.ElapseTime", () => ElapseTime);
  397. DATA.Subscribe($"{Name}.Notch", () => Notch);
  398. DATA.Subscribe($"{Name}.WaferOnAligner", () => WaferOnAligner);
  399. // string str = string.Empty;
  400. EV.Subscribe(new EventItem(0, "Event", AlarmMechanicalAlignmentError, "Aligner error", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));
  401. // _timerQuery.Start(_queryPeriod);
  402. return true;
  403. }
  404. private bool OnTimer()
  405. {
  406. try
  407. {
  408. _connection.MonitorTimeout();
  409. if (!_connection.IsConnected || _connection.IsCommunicationError)
  410. {
  411. lock (_locker)
  412. {
  413. _lstHandler.Clear();
  414. }
  415. _trigRetryConnect.CLK = !_connection.IsConnected;
  416. if (_trigRetryConnect.Q)
  417. {
  418. _connection.SetPortAddress(SC.GetStringValue($"{Name}.Address"));
  419. if (!_connection.Connect())
  420. {
  421. EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
  422. }
  423. }
  424. return true;
  425. }
  426. HandlerBase handler = null;
  427. if (!_connection.IsBusy)
  428. {
  429. lock (_locker)
  430. {
  431. if (_lstHandler.Count == 0)
  432. {
  433. //_lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  434. //_lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  435. }
  436. if (_lstHandler.Count > 0)
  437. {
  438. handler = _lstHandler.First.Value;
  439. if (handler != null) _connection.Execute(handler);
  440. _lstHandler.RemoveFirst();
  441. }
  442. }
  443. }
  444. }
  445. catch (Exception ex)
  446. {
  447. LOG.Write(ex);
  448. }
  449. return true;
  450. }
  451. public void Terminate()
  452. {
  453. }
  454. public void Monitor()
  455. {
  456. try
  457. {
  458. _connection.EnableLog(_enableLog);
  459. _trigCommunicationError.CLK = _connection.IsCommunicationError;
  460. if (_trigCommunicationError.Q)
  461. {
  462. EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
  463. }
  464. }
  465. catch (Exception ex)
  466. {
  467. LOG.Write(ex);
  468. }
  469. }
  470. public void Reset()
  471. {
  472. _trigError.RST = true;
  473. _trigWarningMessage.RST = true;
  474. _connection.SetCommunicationError(false, "");
  475. _trigCommunicationError.RST = true;
  476. _enableLog = SC.GetValue<bool>($"{Name}.EnableLogMessage");
  477. _trigRetryConnect.RST = true;
  478. }
  479. internal void NoteError(string reason)
  480. {
  481. _trigWarningMessage.CLK = true;
  482. if (_trigWarningMessage.Q)
  483. {
  484. EV.PostWarningLog(Module, $"{Module}.{Name} error, {reason}");
  485. }
  486. }
  487. #region Command
  488. public virtual bool ResetCPU(out string reason)
  489. {
  490. lock(_locker)
  491. {
  492. _lstHandler.Clear();
  493. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.CPUresetMotion,null));
  494. }
  495. reason = "";
  496. return true;
  497. }
  498. public virtual bool Init(out string reason)
  499. {
  500. lock (_locker)
  501. {
  502. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.InitializeMotion, null));
  503. if (_tazmotype == AlignerType.Vaccum)
  504. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MoveTheAlignerChuckToSpecifiedPosition, _defaultChuckPosition.ToString("0")));
  505. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  506. if(_tazmotype == AlignerType.Mechnical)
  507. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  508. }
  509. reason = "";
  510. return true;
  511. }
  512. public virtual void Pause()
  513. {
  514. lock (_locker)
  515. {
  516. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.PauseMotion, null));
  517. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  518. if (_tazmotype == AlignerType.Mechnical)
  519. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  520. }
  521. }
  522. public virtual void CancelPause()
  523. {
  524. lock (_locker)
  525. {
  526. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.CancelthepauseMotion, null));
  527. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  528. if (_tazmotype == AlignerType.Mechnical)
  529. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  530. }
  531. }
  532. public virtual bool Home(out string reason)
  533. {
  534. lock (_locker)
  535. {
  536. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MovealignertohomepositionMotion, null));
  537. if (_tazmotype == AlignerType.Mechnical)
  538. {
  539. string para1 = $"A," + "0000";
  540. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.SetalignmentangleetcSet, para1));
  541. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MovetopickpositionMotion, "A"));
  542. }
  543. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  544. if (_tazmotype == AlignerType.Mechnical)
  545. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  546. }
  547. reason = "";
  548. return true;
  549. }
  550. public virtual bool HomeForSwap(out string reason)
  551. {
  552. lock (_locker)
  553. {
  554. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MovealignertohomepositionMotion, null));
  555. //if (_tazmotype == AlignerType.Mechnical)
  556. //{
  557. // string para1 = $"A," + "0000";
  558. // _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.SetalignmentangleetcSet, para1));
  559. // _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MovetopickpositionMotion, "A"));
  560. //}
  561. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  562. if (_tazmotype == AlignerType.Mechnical)
  563. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  564. }
  565. reason = "";
  566. return true;
  567. }
  568. public virtual void MoveChuck(int position)
  569. {
  570. lock (_locker)
  571. {
  572. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MoveTheAlignerChuckToSpecifiedPosition, position.ToString("0")));
  573. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  574. if (_tazmotype == AlignerType.Mechnical)
  575. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  576. }
  577. }
  578. public virtual bool Clear(out string reason)
  579. {
  580. lock (_locker)
  581. {
  582. _lstHandler.Clear();
  583. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.CancelerrorSet, null));
  584. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  585. if (_tazmotype == AlignerType.Mechnical)
  586. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  587. }
  588. reason = "";
  589. return true;
  590. }
  591. public virtual bool Grip(out string reason)
  592. {
  593. lock (_locker)
  594. {
  595. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.ClosealignerchuckMotion, null));
  596. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  597. if (_tazmotype == AlignerType.Mechnical)
  598. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  599. }
  600. reason = "";
  601. return true;
  602. }
  603. public virtual bool Release(out string reason)
  604. {
  605. lock (_locker)
  606. {
  607. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.OpenalignerchuckMotion, null));
  608. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  609. if (_tazmotype == AlignerType.Mechnical)
  610. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  611. }
  612. reason = "";
  613. return true;
  614. }
  615. public virtual bool LiftUp(out string reason)
  616. {
  617. lock (_locker)
  618. {
  619. string para1 = $"A," +"0000";
  620. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.SetalignmentangleetcSet, para1));
  621. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MovetopickpositionMotion, "A"));
  622. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  623. if (_tazmotype == AlignerType.Mechnical)
  624. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  625. }
  626. reason = "";
  627. return true;
  628. }
  629. public virtual bool LiftDown(out string reason)
  630. {
  631. lock (_locker)
  632. {
  633. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.MovealignertohomepositionMotion, ""));
  634. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  635. if (_tazmotype == AlignerType.Mechnical)
  636. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  637. }
  638. reason = "";
  639. return true;
  640. }
  641. public virtual bool MoveToReady(out string reason)
  642. {
  643. reason = "";
  644. return true;
  645. }
  646. public virtual bool Stop(out string reason)
  647. {
  648. reason = string.Empty;
  649. reason = "";
  650. return true;
  651. }
  652. public virtual bool Align(double angle, out string reason)
  653. {
  654. lock (_locker)
  655. {
  656. int anglevalue = (int)angle * 10;
  657. string para1 = $"1," + anglevalue.ToString("0000") + ",000";
  658. if (_tazmotype == AlignerType.Mechnical)
  659. {
  660. anglevalue = (int)angle * 100;
  661. para1 = $"1," + anglevalue.ToString("00000");
  662. }
  663. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.SetalignmentangleetcSet, para1));
  664. _lstHandler.AddLast(new TwinTransactionHandler(this, TazmoCommand.SeriesofalignmentMotion, "1,5"));
  665. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  666. if (_tazmotype == AlignerType.Mechnical)
  667. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  668. }
  669. reason = "";
  670. return true;
  671. }
  672. public virtual bool QueryStatus(out string reason)
  673. {
  674. lock (_locker)
  675. {
  676. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.RequeststatusStatus, null));
  677. if (_tazmotype == AlignerType.Mechnical)
  678. _lstHandler.AddLast(new SingleTransactionHandler(this, TazmoCommand.Requeststatus2Status, null));
  679. }
  680. reason = "";
  681. return true;
  682. }
  683. #endregion
  684. }
  685. }