YaskawaAligner.cs 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using MECF.Framework.Common.Communications;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.SubstrateTrackings;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.AlignersBase;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.YaskawaRobots;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Diagnostics;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.YaskawaAligner
  20. {
  21. public class YaskawaAligner : AlignerBaseDevice, IConnection
  22. {
  23. public YaskawaAligner(string module, string name, string scRoot, IoSensor[] dis, IoTrigger[] dos, int alignerType = 0) : base(module, name)
  24. {
  25. isSimulatorMode = SC.ContainsItem("System.IsSimulatorMode") ? SC.GetValue<bool>("System.IsSimulatorMode") : false;
  26. _scRoot = scRoot;
  27. _address = SC.GetStringValue($"{_scRoot}.{Name}.Address");
  28. _enableLog = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableLogMessage");
  29. UnitNumber = SC.GetValue<int>($"{_scRoot}.{Name}.UnitNumber");
  30. IsEnableCheckSum = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableCheckSum");
  31. IsEnableSeqNo = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableSeqNo");
  32. AlignerType = alignerType; //1=Vacuum 0=Mechnical
  33. _connection = new YaskawaAlignerConnection(this, _address);
  34. _connection.EnableLog(_enableLog);
  35. SeqnoGenerator = new YaskawaTokenGenerator($"{_scRoot}.{Name}.CommunicationToken");
  36. if (dis != null && dis.Length >= 1)
  37. _diPreAlignerWaferOn = dis[0];
  38. if (dis != null && dis.Length >= 2)
  39. _diPreAlignerReady = dis[1];
  40. if (dis != null && dis.Length >= 3)
  41. {
  42. _diPreAlignerError = dis[2];
  43. if (_diPreAlignerError != null)
  44. _diPreAlignerError.OnSignalChanged += _diPreAlignerError_OnSignalChanged;
  45. }
  46. if (dis != null && dis.Length >= 4)
  47. {
  48. _diTPinUse = dis[3];
  49. if (_diTPinUse != null)
  50. _diTPinUse.OnSignalChanged += _diTPinUse_OnSignalChanged;
  51. }
  52. if (dos != null && dos.Length >= 1)
  53. {
  54. _doPreAlignerHold = dos[0];
  55. if (_doPreAlignerHold != null)
  56. _doPreAlignerHold.SetTrigger(true, out _);
  57. }
  58. ConnectionManager.Instance.Subscribe($"{Name}", this);
  59. _thread = new PeriodicJob(100, OnTimer, $"{_scRoot}.{Name} MonitorHandler", true);
  60. ResetPropertiesAndResponses();
  61. RegisterSpecialData();
  62. RegisterAlarm();
  63. }
  64. private void RegisterAlarm()
  65. {
  66. EV.Subscribe(new EventItem("Alarm", $"{Name}Error020", $"{Name} Aligner Occurred Error:Secondary power off.", EventLevel.Alarm, EventType.EventUI_Notify));
  67. EV.Subscribe(new EventItem("Alarm", $"{Name}Error021", $"{Name} Aligner Occurred Error:Secondary power on.", EventLevel.Alarm, EventType.EventUI_Notify));
  68. EV.Subscribe(new EventItem("Alarm", $"{Name}Error040", $"{Name} Aligner Occurred Error:In TEACH Mode.", EventLevel.Alarm, EventType.EventUI_Notify));
  69. EV.Subscribe(new EventItem("Alarm", $"{Name}Error050", $"{Name} Aligner Occurred Error:Unit is in motion.", EventLevel.Alarm, EventType.EventUI_Notify));
  70. EV.Subscribe(new EventItem("Alarm", $"{Name}Error051", $"{Name} Aligner Occurred Error:Unable to set pitch between slots.", EventLevel.Alarm, EventType.EventUI_Notify));
  71. EV.Subscribe(new EventItem("Alarm", $"{Name}Error052", $"{Name} Aligner Occurred Error:Unable to restart motion.", EventLevel.Alarm, EventType.EventUI_Notify));
  72. EV.Subscribe(new EventItem("Alarm", $"{Name}Error053", $"{Name} Aligner Occurred Error:Ready position moveincomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  73. EV.Subscribe(new EventItem("Alarm", $"{Name}Error054", $"{Name} Aligner Occurred Error:Alignment Ready position move incomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  74. EV.Subscribe(new EventItem("Alarm", $"{Name}Error055", $"{Name} Aligner Occurred Error:Improper station type.", EventLevel.Alarm, EventType.EventUI_Notify));
  75. EV.Subscribe(new EventItem("Alarm", $"{Name}Error058", $"{Name} Aligner Occurred Error:Command not supported 1-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  76. EV.Subscribe(new EventItem("Alarm", $"{Name}Error059", $"{Name} Aligner Occurred Error:Invalid transfer point.", EventLevel.Alarm, EventType.EventUI_Notify));
  77. EV.Subscribe(new EventItem("Alarm", $"{Name}Error05A", $"{Name} Aligner Occurred Error:Linear motion failed.", EventLevel.Alarm, EventType.EventUI_Notify));
  78. EV.Subscribe(new EventItem("Alarm", $"{Name}Error05C", $"{Name} Aligner Occurred Error:Unable to reference waferalignment result.", EventLevel.Alarm, EventType.EventUI_Notify));
  79. EV.Subscribe(new EventItem("Alarm", $"{Name}Error05D", $"{Name} Aligner Occurred Error:Unable to perform armcalibration.", EventLevel.Alarm, EventType.EventUI_Notify));
  80. EV.Subscribe(new EventItem("Alarm", $"{Name}Error05E", $"{Name} Aligner Occurred Error:Unable to read mapping data.", EventLevel.Alarm, EventType.EventUI_Notify));
  81. EV.Subscribe(new EventItem("Alarm", $"{Name}Error05F", $"{Name} Aligner Occurred Error:Data Upload/Download inprogress.", EventLevel.Alarm, EventType.EventUI_Notify));
  82. EV.Subscribe(new EventItem("Alarm", $"{Name}Error061", $"{Name} Aligner Occurred Error:Unable to motion.", EventLevel.Alarm, EventType.EventUI_Notify));
  83. EV.Subscribe(new EventItem("Alarm", $"{Name}Error064", $"{Name} Aligner Occurred Error:Lifter interference error.", EventLevel.Alarm, EventType.EventUI_Notify));
  84. EV.Subscribe(new EventItem("Alarm", $"{Name}Error070", $"{Name} Aligner Occurred Error:Bottom slot position recordincomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  85. EV.Subscribe(new EventItem("Alarm", $"{Name}Error071", $"{Name} Aligner Occurred Error:Top slot position record incomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  86. EV.Subscribe(new EventItem("Alarm", $"{Name}Error088", $"{Name} Aligner Occurred Error:Position generating error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  87. EV.Subscribe(new EventItem("Alarm", $"{Name}Error089", $"{Name} Aligner Occurred Error:Position generating error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  88. EV.Subscribe(new EventItem("Alarm", $"{Name}Error08A", $"{Name} Aligner Occurred Error:Position generating error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  89. EV.Subscribe(new EventItem("Alarm", $"{Name}Error08B", $"{Name} Aligner Occurred Error:Position generating error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  90. EV.Subscribe(new EventItem("Alarm", $"{Name}Error08C", $"{Name} Aligner Occurred Error:Position generating error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  91. EV.Subscribe(new EventItem("Alarm", $"{Name}Error08D", $"{Name} Aligner Occurred Error:Position generating error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  92. EV.Subscribe(new EventItem("Alarm", $"{Name}Error090", $"{Name} Aligner Occurred Error:Host parameter out of range.", EventLevel.Alarm, EventType.EventUI_Notify));
  93. EV.Subscribe(new EventItem("Alarm", $"{Name}Error0A0", $"{Name} Aligner Occurred Error:Alignment motion error.", EventLevel.Alarm, EventType.EventUI_Notify));
  94. EV.Subscribe(new EventItem("Alarm", $"{Name}Error0E0", $"{Name} Aligner Occurred Error:Teach position adjustmentoffset amount limit error.", EventLevel.Alarm, EventType.EventUI_Notify));
  95. EV.Subscribe(new EventItem("Alarm", $"{Name}Error0F0", $"{Name} Aligner Occurred Error:Voltage drop warning.", EventLevel.Alarm, EventType.EventUI_Notify));
  96. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*06", $"{Name} Aligner Occurred Error:Amplifier Type Mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  97. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*07", $"{Name} Aligner Occurred Error:Encoder Type Mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  98. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*10", $"{Name} Aligner Occurred Error:Overflow Current.", EventLevel.Alarm, EventType.EventUI_Notify));
  99. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*30", $"{Name} Aligner Occurred Error:Regeneration Error Detected.", EventLevel.Alarm, EventType.EventUI_Notify));
  100. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*40", $"{Name} Aligner Occurred Error:Excess Voltage (converter).", EventLevel.Alarm, EventType.EventUI_Notify));
  101. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*41", $"{Name} Aligner Occurred Error:Insufficient Voltage.", EventLevel.Alarm, EventType.EventUI_Notify));
  102. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*45", $"{Name} Aligner Occurred Error:Brake circuit error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  103. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*46", $"{Name} Aligner Occurred Error:Converter ready signal error.", EventLevel.Alarm, EventType.EventUI_Notify));
  104. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*47", $"{Name} Aligner Occurred Error:Input power error.", EventLevel.Alarm, EventType.EventUI_Notify));
  105. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*48", $"{Name} Aligner Occurred Error:Converter main circuit chargeerror.", EventLevel.Alarm, EventType.EventUI_Notify));
  106. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*49", $"{Name} Aligner Occurred Error:Amplifier ready signal error.", EventLevel.Alarm, EventType.EventUI_Notify));
  107. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*51", $"{Name} Aligner Occurred Error:Excessive Speed.", EventLevel.Alarm, EventType.EventUI_Notify));
  108. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*71", $"{Name} Aligner Occurred Error:Momentary Overload (Motor).", EventLevel.Alarm, EventType.EventUI_Notify));
  109. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*72", $"{Name} Aligner Occurred Error:Continuous Overload (Motor).", EventLevel.Alarm, EventType.EventUI_Notify));
  110. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*78", $"{Name} Aligner Occurred Error:Overload (Converter).", EventLevel.Alarm, EventType.EventUI_Notify));
  111. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*7B", $"{Name} Aligner Occurred Error:Amplifier overheat.", EventLevel.Alarm, EventType.EventUI_Notify));
  112. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*7C", $"{Name} Aligner Occurred Error:Continuous Overload(Amplifier).", EventLevel.Alarm, EventType.EventUI_Notify));
  113. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*7D", $"{Name} Aligner Occurred Error:Momentary Overload.", EventLevel.Alarm, EventType.EventUI_Notify));
  114. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*81", $"{Name} Aligner Occurred Error:Absolute Encoder Back-upError.", EventLevel.Alarm, EventType.EventUI_Notify));
  115. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*83", $"{Name} Aligner Occurred Error:Absolute Encoder Battery.", EventLevel.Alarm, EventType.EventUI_Notify));
  116. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*84", $"{Name} Aligner Occurred Error:Encoder Data Error 2-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  117. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*85", $"{Name} Aligner Occurred Error:Encoder Excessive Speed.", EventLevel.Alarm, EventType.EventUI_Notify));
  118. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*86", $"{Name} Aligner Occurred Error:Encoder Overheat.", EventLevel.Alarm, EventType.EventUI_Notify));
  119. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*88", $"{Name} Aligner Occurred Error:Encoder error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  120. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*89", $"{Name} Aligner Occurred Error:Encoder Command failed.", EventLevel.Alarm, EventType.EventUI_Notify));
  121. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*8A", $"{Name} Aligner Occurred Error:Encoder multi-turn range.", EventLevel.Alarm, EventType.EventUI_Notify));
  122. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*8C", $"{Name} Aligner Occurred Error:Encoder Reset not completed.", EventLevel.Alarm, EventType.EventUI_Notify));
  123. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*98", $"{Name} Aligner Occurred Error:Servo parameter error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  124. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*9A", $"{Name} Aligner Occurred Error:Feedback Over Flow.", EventLevel.Alarm, EventType.EventUI_Notify));
  125. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*B4", $"{Name} Aligner Occurred Error:Servo Control Board Failure.", EventLevel.Alarm, EventType.EventUI_Notify));
  126. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*BC", $"{Name} Aligner Occurred Error:Encoder error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  127. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*C1", $"{Name} Aligner Occurred Error:Motor runaway detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  128. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*C9", $"{Name} Aligner Occurred Error:Encoder Communication.", EventLevel.Alarm, EventType.EventUI_Notify));
  129. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*CE", $"{Name} Aligner Occurred Error:Encoder error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  130. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*CF", $"{Name} Aligner Occurred Error:Encoder error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  131. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*D0", $"{Name} Aligner Occurred Error:Position deviation error.", EventLevel.Alarm, EventType.EventUI_Notify));
  132. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*D1", $"{Name} Aligner Occurred Error:Position deviation saturation.", EventLevel.Alarm, EventType.EventUI_Notify));
  133. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*D2", $"{Name} Aligner Occurred Error:Motor directive position error.", EventLevel.Alarm, EventType.EventUI_Notify));
  134. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*D4", $"{Name} Aligner Occurred Error:Servo Tracking Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  135. EV.Subscribe(new EventItem("Alarm", $"{Name}Error*F1", $"{Name} Aligner Occurred Error:Phase loss.", EventLevel.Alarm, EventType.EventUI_Notify));
  136. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorE*1", $"{Name} Aligner Occurred Error:Positioning Timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  137. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorE*D", $"{Name} Aligner Occurred Error:Command not supported 1-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  138. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorE*E", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 1-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  139. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorE*F", $"{Name} Aligner Occurred Error:Servo control board responsetimeout 1..", EventLevel.Alarm, EventType.EventUI_Notify));
  140. EV.Subscribe(new EventItem("Alarm", $"{Name}Error701", $"{Name} Aligner Occurred Error:ROM Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  141. EV.Subscribe(new EventItem("Alarm", $"{Name}Error703", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 2-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  142. EV.Subscribe(new EventItem("Alarm", $"{Name}Error704", $"{Name} Aligner Occurred Error:Communication Error (internal controller) 2-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  143. EV.Subscribe(new EventItem("Alarm", $"{Name}Error705", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 2-3.", EventLevel.Alarm, EventType.EventUI_Notify));
  144. EV.Subscribe(new EventItem("Alarm", $"{Name}Error706", $"{Name} Aligner Occurred Error:Servo system error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  145. EV.Subscribe(new EventItem("Alarm", $"{Name}Error707", $"{Name} Aligner Occurred Error:Servo system error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  146. EV.Subscribe(new EventItem("Alarm", $"{Name}Error709", $"{Name} Aligner Occurred Error:Current feedback error.", EventLevel.Alarm, EventType.EventUI_Notify));
  147. EV.Subscribe(new EventItem("Alarm", $"{Name}Error70A", $"{Name} Aligner Occurred Error:Power Lost.", EventLevel.Alarm, EventType.EventUI_Notify));
  148. EV.Subscribe(new EventItem("Alarm", $"{Name}Error70B", $"{Name} Aligner Occurred Error:Rush Current PreventionRelay Abnormal.", EventLevel.Alarm, EventType.EventUI_Notify));
  149. EV.Subscribe(new EventItem("Alarm", $"{Name}Error70C", $"{Name} Aligner Occurred Error:Converter mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  150. EV.Subscribe(new EventItem("Alarm", $"{Name}Error70F", $"{Name} Aligner Occurred Error:Servo control board response timeout 2..", EventLevel.Alarm, EventType.EventUI_Notify));
  151. EV.Subscribe(new EventItem("Alarm", $"{Name}Error713", $"{Name} Aligner Occurred Error:DB error.", EventLevel.Alarm, EventType.EventUI_Notify));
  152. EV.Subscribe(new EventItem("Alarm", $"{Name}Error714", $"{Name} Aligner Occurred Error:Converter charge Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  153. EV.Subscribe(new EventItem("Alarm", $"{Name}Error715", $"{Name} Aligner Occurred Error:Servo OFF Status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  154. EV.Subscribe(new EventItem("Alarm", $"{Name}Error716", $"{Name} Aligner Occurred Error:Servo ON Status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  155. EV.Subscribe(new EventItem("Alarm", $"{Name}Error717", $"{Name} Aligner Occurred Error:Servo OFF Status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  156. EV.Subscribe(new EventItem("Alarm", $"{Name}Error718", $"{Name} Aligner Occurred Error:Servo ON Status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  157. EV.Subscribe(new EventItem("Alarm", $"{Name}Error719", $"{Name} Aligner Occurred Error:Servo On Abnormal.", EventLevel.Alarm, EventType.EventUI_Notify));
  158. EV.Subscribe(new EventItem("Alarm", $"{Name}Error71A", $"{Name} Aligner Occurred Error:Brake circuit error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  159. EV.Subscribe(new EventItem("Alarm", $"{Name}Error71B", $"{Name} Aligner Occurred Error:Brake circuit error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  160. EV.Subscribe(new EventItem("Alarm", $"{Name}Error71C", $"{Name} Aligner Occurred Error:Power relay error.", EventLevel.Alarm, EventType.EventUI_Notify));
  161. EV.Subscribe(new EventItem("Alarm", $"{Name}Error721", $"{Name} Aligner Occurred Error:Servo parameter error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  162. EV.Subscribe(new EventItem("Alarm", $"{Name}Error722", $"{Name} Aligner Occurred Error:Servo parameter error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  163. EV.Subscribe(new EventItem("Alarm", $"{Name}Error725", $"{Name} Aligner Occurred Error:Converter Overheat.", EventLevel.Alarm, EventType.EventUI_Notify));
  164. EV.Subscribe(new EventItem("Alarm", $"{Name}Error726", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 2-4.", EventLevel.Alarm, EventType.EventUI_Notify));
  165. EV.Subscribe(new EventItem("Alarm", $"{Name}Error727", $"{Name} Aligner Occurred Error:Command not supported 1-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  166. EV.Subscribe(new EventItem("Alarm", $"{Name}Error728", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 2-5.", EventLevel.Alarm, EventType.EventUI_Notify));
  167. EV.Subscribe(new EventItem("Alarm", $"{Name}Error729", $"{Name} Aligner Occurred Error:Servo system error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  168. EV.Subscribe(new EventItem("Alarm", $"{Name}Error72A", $"{Name} Aligner Occurred Error:Servo system error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  169. EV.Subscribe(new EventItem("Alarm", $"{Name}Error72B", $"{Name} Aligner Occurred Error:Servo parameter error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  170. EV.Subscribe(new EventItem("Alarm", $"{Name}Error730", $"{Name} Aligner Occurred Error:Amp module disconnected..", EventLevel.Alarm, EventType.EventUI_Notify));
  171. EV.Subscribe(new EventItem("Alarm", $"{Name}Error732", $"{Name} Aligner Occurred Error:Servo parameter error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  172. EV.Subscribe(new EventItem("Alarm", $"{Name}Error733", $"{Name} Aligner Occurred Error:Servo parameter error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  173. EV.Subscribe(new EventItem("Alarm", $"{Name}Error734", $"{Name} Aligner Occurred Error:Servo parameter error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  174. EV.Subscribe(new EventItem("Alarm", $"{Name}Error735", $"{Name} Aligner Occurred Error:Servo parameter error 8.", EventLevel.Alarm, EventType.EventUI_Notify));
  175. EV.Subscribe(new EventItem("Alarm", $"{Name}Error73F", $"{Name} Aligner Occurred Error:Undefined Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  176. EV.Subscribe(new EventItem("Alarm", $"{Name}Error740", $"{Name} Aligner Occurred Error:Encoder Status Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  177. EV.Subscribe(new EventItem("Alarm", $"{Name}Error741", $"{Name} Aligner Occurred Error:Servo system error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  178. EV.Subscribe(new EventItem("Alarm", $"{Name}Error742", $"{Name} Aligner Occurred Error:Servo system error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  179. EV.Subscribe(new EventItem("Alarm", $"{Name}Error743", $"{Name} Aligner Occurred Error:Servo system error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  180. EV.Subscribe(new EventItem("Alarm", $"{Name}Error744", $"{Name} Aligner Occurred Error:Servo system error 8.", EventLevel.Alarm, EventType.EventUI_Notify));
  181. EV.Subscribe(new EventItem("Alarm", $"{Name}Error745", $"{Name} Aligner Occurred Error:Servo system error 9.", EventLevel.Alarm, EventType.EventUI_Notify));
  182. EV.Subscribe(new EventItem("Alarm", $"{Name}Error746", $"{Name} Aligner Occurred Error:Servo system error 10.", EventLevel.Alarm, EventType.EventUI_Notify));
  183. EV.Subscribe(new EventItem("Alarm", $"{Name}Error74A", $"{Name} Aligner Occurred Error:Servo system error 11.", EventLevel.Alarm, EventType.EventUI_Notify));
  184. EV.Subscribe(new EventItem("Alarm", $"{Name}Error74B", $"{Name} Aligner Occurred Error:Servo system error 12.", EventLevel.Alarm, EventType.EventUI_Notify));
  185. EV.Subscribe(new EventItem("Alarm", $"{Name}Error74C", $"{Name} Aligner Occurred Error:Servo system error 13.", EventLevel.Alarm, EventType.EventUI_Notify));
  186. EV.Subscribe(new EventItem("Alarm", $"{Name}Error74D", $"{Name} Aligner Occurred Error:Servo system error 14.", EventLevel.Alarm, EventType.EventUI_Notify));
  187. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A0", $"{Name} Aligner Occurred Error:Communication Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  188. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A1", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 3-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  189. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A2", $"{Name} Aligner Occurred Error:Command not supported 3-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  190. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A3", $"{Name} Aligner Occurred Error:Data buffer full.", EventLevel.Alarm, EventType.EventUI_Notify));
  191. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A4", $"{Name} Aligner Occurred Error:Command not supported 3-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  192. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A5", $"{Name} Aligner Occurred Error:Encoder data error 3-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  193. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7A6", $"{Name} Aligner Occurred Error:Command not supported 3-3.", EventLevel.Alarm, EventType.EventUI_Notify));
  194. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7AE", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 1-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  195. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7AF", $"{Name} Aligner Occurred Error:Communication Error(internal controller) 1-3.", EventLevel.Alarm, EventType.EventUI_Notify));
  196. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7B0", $"{Name} Aligner Occurred Error:CCD sensor abnormal 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  197. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7B4", $"{Name} Aligner Occurred Error:CCD sensor abnormal 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  198. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7B5", $"{Name} Aligner Occurred Error:CCD sensor abnormal 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  199. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7C0", $"{Name} Aligner Occurred Error:PAIF board Failure 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  200. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7C1", $"{Name} Aligner Occurred Error:PAIF board Failure 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  201. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7C2", $"{Name} Aligner Occurred Error:PAIF board Failure 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  202. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7C3", $"{Name} Aligner Occurred Error:CCD sensor abnormal 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  203. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7CF", $"{Name} Aligner Occurred Error:PAIF board disconnected.", EventLevel.Alarm, EventType.EventUI_Notify));
  204. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7D0", $"{Name} Aligner Occurred Error:PAIF board Failure 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  205. EV.Subscribe(new EventItem("Alarm", $"{Name}Error7D1", $"{Name} Aligner Occurred Error:PAIF board Failure 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  206. EV.Subscribe(new EventItem("Alarm", $"{Name}Error900", $"{Name} Aligner Occurred Error:Character Interval Timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  207. EV.Subscribe(new EventItem("Alarm", $"{Name}Error910", $"{Name} Aligner Occurred Error:Received Data ChecksumError.", EventLevel.Alarm, EventType.EventUI_Notify));
  208. EV.Subscribe(new EventItem("Alarm", $"{Name}Error920", $"{Name} Aligner Occurred Error:Unit Number Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  209. EV.Subscribe(new EventItem("Alarm", $"{Name}Error930", $"{Name} Aligner Occurred Error:Undefined CommandReceived.", EventLevel.Alarm, EventType.EventUI_Notify));
  210. EV.Subscribe(new EventItem("Alarm", $"{Name}Error940", $"{Name} Aligner Occurred Error:Message Parameter Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  211. EV.Subscribe(new EventItem("Alarm", $"{Name}Error950", $"{Name} Aligner Occurred Error:Receiving Time-out Error for Confirmation of Execution Completion.", EventLevel.Alarm, EventType.EventUI_Notify));
  212. EV.Subscribe(new EventItem("Alarm", $"{Name}Error960", $"{Name} Aligner Occurred Error:Incorrect sequence number.", EventLevel.Alarm, EventType.EventUI_Notify));
  213. EV.Subscribe(new EventItem("Alarm", $"{Name}Error961", $"{Name} Aligner Occurred Error:Duplicated message.", EventLevel.Alarm, EventType.EventUI_Notify));
  214. EV.Subscribe(new EventItem("Alarm", $"{Name}Error970", $"{Name} Aligner Occurred Error:Delimiter error.", EventLevel.Alarm, EventType.EventUI_Notify));
  215. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9A1", $"{Name} Aligner Occurred Error:Message buffer overflow.", EventLevel.Alarm, EventType.EventUI_Notify));
  216. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9C0", $"{Name} Aligner Occurred Error:LAN device setting error.", EventLevel.Alarm, EventType.EventUI_Notify));
  217. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9C1", $"{Name} Aligner Occurred Error:IP address error.", EventLevel.Alarm, EventType.EventUI_Notify));
  218. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9C2", $"{Name} Aligner Occurred Error:Subnet mask error.", EventLevel.Alarm, EventType.EventUI_Notify));
  219. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9C3", $"{Name} Aligner Occurred Error:Default gateway error.", EventLevel.Alarm, EventType.EventUI_Notify));
  220. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9D0", $"{Name} Aligner Occurred Error:Ethernet receive error.", EventLevel.Alarm, EventType.EventUI_Notify));
  221. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9E0", $"{Name} Aligner Occurred Error:During operation themaintenance tool.", EventLevel.Alarm, EventType.EventUI_Notify));
  222. EV.Subscribe(new EventItem("Alarm", $"{Name}Error9E1", $"{Name} Aligner Occurred Error:The data abnormal.", EventLevel.Alarm, EventType.EventUI_Notify));
  223. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA01", $"{Name} Aligner Occurred Error:Re-detection of a powerSupply voltage fall.", EventLevel.Alarm, EventType.EventUI_Notify));
  224. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA10", $"{Name} Aligner Occurred Error:External emergency stop.", EventLevel.Alarm, EventType.EventUI_Notify));
  225. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA20", $"{Name} Aligner Occurred Error:T.P emergency stop.", EventLevel.Alarm, EventType.EventUI_Notify));
  226. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA21", $"{Name} Aligner Occurred Error:Interlock board failure 0.", EventLevel.Alarm, EventType.EventUI_Notify));
  227. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA30", $"{Name} Aligner Occurred Error:Emergency stop.", EventLevel.Alarm, EventType.EventUI_Notify));
  228. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA40", $"{Name} Aligner Occurred Error:Controller Fan 1 Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  229. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA41", $"{Name} Aligner Occurred Error:Controller Fan 2 Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  230. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA42", $"{Name} Aligner Occurred Error:Controller Fan 3 Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  231. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA45", $"{Name} Aligner Occurred Error:Unit fan 1 error.", EventLevel.Alarm, EventType.EventUI_Notify));
  232. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA46", $"{Name} Aligner Occurred Error:Unit fan 2 error.", EventLevel.Alarm, EventType.EventUI_Notify));
  233. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorA4F", $"{Name} Aligner Occurred Error:Controller Battery Alarm.", EventLevel.Alarm, EventType.EventUI_Notify));
  234. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAC0", $"{Name} Aligner Occurred Error:Safety fence signal detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  235. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAC9", $"{Name} Aligner Occurred Error:Protection stop signal.", EventLevel.Alarm, EventType.EventUI_Notify));
  236. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAE0", $"{Name} Aligner Occurred Error:HOST Mode Switching error.", EventLevel.Alarm, EventType.EventUI_Notify));
  237. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAE1", $"{Name} Aligner Occurred Error:TEACH Mode Switching Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  238. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAE8", $"{Name} Aligner Occurred Error:Deadman switch error.", EventLevel.Alarm, EventType.EventUI_Notify));
  239. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF0", $"{Name} Aligner Occurred Error:Interlock board failure 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  240. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF1", $"{Name} Aligner Occurred Error:Interlock board failure 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  241. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF2", $"{Name} Aligner Occurred Error:Interlock board failure 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  242. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF3", $"{Name} Aligner Occurred Error:Interlock board failure 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  243. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF4", $"{Name} Aligner Occurred Error:Interlock board failure 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  244. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF5", $"{Name} Aligner Occurred Error:Interlock board failure 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  245. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF6", $"{Name} Aligner Occurred Error:Interlock board failure 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  246. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF8", $"{Name} Aligner Occurred Error:Input compare error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  247. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAF9", $"{Name} Aligner Occurred Error:Input compare error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  248. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAFA", $"{Name} Aligner Occurred Error:Input compare error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  249. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAFB", $"{Name} Aligner Occurred Error:Input compare error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  250. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAFC", $"{Name} Aligner Occurred Error:Input compare error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  251. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAFD", $"{Name} Aligner Occurred Error:Input compare error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  252. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAFE", $"{Name} Aligner Occurred Error:Input compare error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  253. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorAFF", $"{Name} Aligner Occurred Error:Input compare error 8.", EventLevel.Alarm, EventType.EventUI_Notify));
  254. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB10", $"{Name} Aligner Occurred Error:Axis-1 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  255. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB11", $"{Name} Aligner Occurred Error:Axis-2 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  256. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB12", $"{Name} Aligner Occurred Error:Axis-3 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  257. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB13", $"{Name} Aligner Occurred Error:Axis-4 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  258. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB14", $"{Name} Aligner Occurred Error:Axis-5 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  259. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB20", $"{Name} Aligner Occurred Error:Axis-1 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  260. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB21", $"{Name} Aligner Occurred Error:Axis-2 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  261. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB22", $"{Name} Aligner Occurred Error:Axis-3 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  262. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB23", $"{Name} Aligner Occurred Error:Axis-4 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  263. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB24", $"{Name} Aligner Occurred Error:Axis-5 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  264. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB28", $"{Name} Aligner Occurred Error:Axis-1 Positive (+) Direction Software-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  265. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB29", $"{Name} Aligner Occurred Error:Axis-2 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  266. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB2A", $"{Name} Aligner Occurred Error:Axis-3 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  267. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB2B", $"{Name} Aligner Occurred Error:Axis-4 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  268. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB2C", $"{Name} Aligner Occurred Error:Axis-5 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  269. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB30", $"{Name} Aligner Occurred Error:Axis-1 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  270. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB31", $"{Name} Aligner Occurred Error:Axis-2 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  271. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB32", $"{Name} Aligner Occurred Error:Axis-3 Negative (-) Direction Software-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  272. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB33", $"{Name} Aligner Occurred Error:Axis-4 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  273. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB34", $"{Name} Aligner Occurred Error:Axis-5 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  274. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB38", $"{Name} Aligner Occurred Error:Axis-1 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  275. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB39", $"{Name} Aligner Occurred Error:Axis-2 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  276. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB3A", $"{Name} Aligner Occurred Error:Axis-3 Negative (-) Direction Software-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  277. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB3B", $"{Name} Aligner Occurred Error:Axis-4 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  278. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB3C", $"{Name} Aligner Occurred Error:Axis-5 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  279. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB40", $"{Name} Aligner Occurred Error:Access Permission Signal 1Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  280. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB41", $"{Name} Aligner Occurred Error:Access Permission Signal 2Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  281. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB42", $"{Name} Aligner Occurred Error:Access Permission Signal 3Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  282. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB43", $"{Name} Aligner Occurred Error:Access Permission Signal 4Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  283. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB44", $"{Name} Aligner Occurred Error:Access Permission Signal 5 Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  284. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB45", $"{Name} Aligner Occurred Error:Access Permission Signal 6Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  285. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB46", $"{Name} Aligner Occurred Error:Access Permission Signal 7Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  286. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB47", $"{Name} Aligner Occurred Error:Access Permission Signal 8Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  287. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB48", $"{Name} Aligner Occurred Error:Access Permission Signal 9Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  288. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB49", $"{Name} Aligner Occurred Error:Access Permission Signal 10 Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  289. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB4A", $"{Name} Aligner Occurred Error:Access Permission Signal 11Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  290. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB4B", $"{Name} Aligner Occurred Error:Access Permission Signal 12Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  291. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB4C", $"{Name} Aligner Occurred Error:Access Permission Signal 13Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  292. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB4D", $"{Name} Aligner Occurred Error:Access Permission Signal 14Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  293. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB4E", $"{Name} Aligner Occurred Error:Access Permission Signal 15Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  294. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB4F", $"{Name} Aligner Occurred Error:Access Permission Signal 16Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  295. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB60", $"{Name} Aligner Occurred Error:Access Permission to P/A Stage Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  296. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB61", $"{Name} Aligner Occurred Error:Access Permission to P/AStage Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  297. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB62", $"{Name} Aligner Occurred Error:Access Permission to P/A Stage Time-out Error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  298. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB63", $"{Name} Aligner Occurred Error:Access Permission to P/A Stage Time-out Error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  299. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB64", $"{Name} Aligner Occurred Error:Access Permission to P/AStage Time-out Error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  300. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB65", $"{Name} Aligner Occurred Error:Access Permission to P/AStage Time-out Error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  301. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB66", $"{Name} Aligner Occurred Error:Access Permission to P/AStage Time-out Error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  302. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB68", $"{Name} Aligner Occurred Error:P/A motion permission timeout error.", EventLevel.Alarm, EventType.EventUI_Notify));
  303. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB70", $"{Name} Aligner Occurred Error:SS signal detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  304. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB80", $"{Name} Aligner Occurred Error:Fork 1/Pre-aligner: Wafer Presence Confirmation Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  305. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB81", $"{Name} Aligner Occurred Error:Fork 1/Pre-aligner: WaferAbsence Confirmation Time- out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  306. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB82", $"{Name} Aligner Occurred Error:Fork 1/Pre-aligner: Wafer Presence Confirmation Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  307. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB83", $"{Name} Aligner Occurred Error:Fork 1/Pre-aligner: WaferAbsence Confirmation Time- out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  308. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB88", $"{Name} Aligner Occurred Error:Grip sensor Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  309. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB89", $"{Name} Aligner Occurred Error:Grip sensor Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  310. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB8A", $"{Name} Aligner Occurred Error:UnGrip sensor Time-out Error1.", EventLevel.Alarm, EventType.EventUI_Notify));
  311. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB8B", $"{Name} Aligner Occurred Error:UnGrip sensor Time-out Error2.", EventLevel.Alarm, EventType.EventUI_Notify));
  312. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB8F", $"{Name} Aligner Occurred Error:Fork 1: Plunger non-operationerror.", EventLevel.Alarm, EventType.EventUI_Notify));
  313. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB90", $"{Name} Aligner Occurred Error:Fork 2: Wafer Presence Confirmation Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  314. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB91", $"{Name} Aligner Occurred Error:Fork 2: Wafer AbsenceConfirmation Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  315. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB92", $"{Name} Aligner Occurred Error:Fork 2: Wafer PresenceConfirmation Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  316. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB93", $"{Name} Aligner Occurred Error:Fork 2: Wafer AbsenceConfirmation Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  317. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB98", $"{Name} Aligner Occurred Error:Lifter up sensor Time-outError 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  318. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB99", $"{Name} Aligner Occurred Error:Lifter up sensor Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  319. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB9A", $"{Name} Aligner Occurred Error:Lifter down sensor Time-outError 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  320. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB9B", $"{Name} Aligner Occurred Error:Lifter down sensor Time-outError 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  321. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorB9F", $"{Name} Aligner Occurred Error:Fork 2: Plunger non-operationerror.", EventLevel.Alarm, EventType.EventUI_Notify));
  322. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBA0", $"{Name} Aligner Occurred Error:Fork 1/Pre-aligner: WaferAbsence Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  323. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBA1", $"{Name} Aligner Occurred Error:Fork 1: Sensor StatusMismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  324. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBA8", $"{Name} Aligner Occurred Error:Grip sensor status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  325. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBA9", $"{Name} Aligner Occurred Error:Grip sensor status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  326. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBAA", $"{Name} Aligner Occurred Error:Ungrip sensor status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  327. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBAB", $"{Name} Aligner Occurred Error:Ungrip sensor status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  328. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBAC", $"{Name} Aligner Occurred Error:Grip sensor status mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  329. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBAD", $"{Name} Aligner Occurred Error:Lifter/Grip sensor statusmismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  330. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBB0", $"{Name} Aligner Occurred Error:Fork 2: Wafer Absence Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  331. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBB1", $"{Name} Aligner Occurred Error:Fork 2: Sensor StatusMismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  332. EV.Subscribe(new EventItem("Alarm", $"{Name}ErrorBB8", $"{Name} Aligner Occurred Error:Lifter up sensor status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  333. }
  334. public void CheckWaferPresentAndGrip()
  335. {
  336. if (IsWaferPresent(0))
  337. {
  338. if (WaferManager.Instance.CheckNoWafer(RobotModuleName, 0))
  339. {
  340. WaferManager.Instance.CreateWafer(RobotModuleName, 0, WaferStatus.Normal);
  341. EV.PostWarningLog($"{RobotModuleName}", $"System detec wafer on aligner, will create wafer automatically.");
  342. }
  343. //if(AlignerType == 1) // Vacuum Type
  344. //{
  345. // IsNeedRelease = true;
  346. //}
  347. }
  348. else
  349. {
  350. //_lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", "1,0,0"));
  351. if (WaferManager.Instance.CheckHasWafer(RobotModuleName, 0))
  352. {
  353. EV.PostWarningLog($"{RobotModuleName}", $"System didn't detec wafer on aligner, but it has record.");
  354. }
  355. IsNeedRelease = false;
  356. }
  357. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", "1,0,0"));
  358. }
  359. private void _diTPinUse_OnSignalChanged(IoSensor arg1, bool arg2)
  360. {
  361. if (!arg2)
  362. SetMaintenanceMode(true);
  363. else
  364. SetMaintenanceMode(false);
  365. }
  366. private void _diPreAlignerError_OnSignalChanged(IoSensor arg1, bool arg2)
  367. {
  368. if (!arg2)
  369. OnError("Aligner error signal");
  370. }
  371. private void RegisterSpecialData()
  372. {
  373. DATA.Subscribe($"{Module}.{Name}.CurrentArm1Position", () => CurrentArm1Position);
  374. DATA.Subscribe($"{Module}.{Name}.CurrentArm2Position", () => CurrentArm2Position);
  375. DATA.Subscribe($"{Module}.{Name}.CurrentExtensionPosition", () => CurrentExtensionPosition);
  376. DATA.Subscribe($"{Module}.{Name}.CurrentThetaPosition", () => CurrentThetaPosition);
  377. DATA.Subscribe($"{Module}.{Name}.CurrentZPosition", () => CurrentZPosition);
  378. DATA.Subscribe($"{Module}.{Name}.IsManipulatorBatteryLow", () => IsManipulatorBatteryLow);
  379. DATA.Subscribe($"{Module}.{Name}.IsCommandExecutionReady", () => IsCommandExecutionReady);
  380. DATA.Subscribe($"{Module}.{Name}.IsServoON", () => IsServoON);
  381. DATA.Subscribe($"{Module}.{Name}.IsErrorOccurred", () => IsErrorOccurred);
  382. DATA.Subscribe($"{Module}.{Name}.IsControllerBatteryLow", () => IsControllerBatteryLow);
  383. DATA.Subscribe($"{Module}.{Name}.IsWaferPresenceOnFromVacuumSensorOrGripSensor", () => IsWaferPresenceOnFromVacuumSensorOrGripSensor);
  384. DATA.Subscribe($"{Module}.{Name}.IsWaferPresenceOnFromCCDSensor", () => IsWaferPresenceOnFromCCDSensor);
  385. DATA.Subscribe($"{Module}.{Name}.ErrorCode", () => ErrorCode);
  386. DATA.Subscribe($"{Module}.{Name}.IsWaferHoldOnChuck", () => IsWaferHoldOnChuck);
  387. //DATA.Subscribe($"{Module}.{Name}.IsGrippedBlade2", () => IsGrippedBlade2);
  388. DATA.Subscribe($"{Module}.{Name}.IsCheckInterlockWaferPresenceAbsent", () => IsCheckInterlockWaferPresenceAbsent);
  389. DATA.Subscribe($"{Module}.{Name}.IsCheckInterlockManipulatorOperation", () => IsCheckInterlockManipulatorOperation);
  390. }
  391. private void ResetPropertiesAndResponses()
  392. {
  393. }
  394. private Stopwatch _timerMonitorIdle = new Stopwatch();
  395. private R_TRIG _trigIdle = new R_TRIG();
  396. private bool OnTimer()
  397. {
  398. try
  399. {
  400. if (!_connection.IsConnected || _connection.IsCommunicationError)
  401. {
  402. lock (_locker)
  403. {
  404. if (_lstHandlers.Count != 0)
  405. {
  406. _lstHandlers.Clear();
  407. OnError("CommunicationError");
  408. }
  409. }
  410. _trigRetryConnect.CLK = !_connection.IsConnected;
  411. if (_trigRetryConnect.Q)
  412. {
  413. if (!_connection.Connect())
  414. {
  415. EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
  416. }
  417. else
  418. {
  419. //_lstHandler.AddLast(new RobotHirataR4QueryPinHandler(this, _deviceAddress));
  420. //_lstHandler.AddLast(new RobotHirataR4SetCommModeHandler(this, _deviceAddress, EnumRfPowerCommunicationMode.Host));
  421. }
  422. }
  423. return true;
  424. }
  425. HandlerBase handler = null;
  426. _trigIdle.CLK = !_connection.IsBusy && _lstHandlers.Count == 0;
  427. if (_trigIdle.Q)
  428. {
  429. _timerMonitorIdle.Restart();
  430. }
  431. if (!_trigIdle.M)
  432. {
  433. _timerMonitorIdle.Stop();
  434. }
  435. if (_timerMonitorIdle.IsRunning && _timerMonitorIdle.Elapsed > TimeSpan.FromSeconds(5))
  436. {
  437. _timerMonitorIdle.Stop();
  438. IsBusy = false;
  439. }
  440. lock (_locker)
  441. {
  442. if (!_connection.IsBusy)
  443. {
  444. if (_lstHandlers.Count > 0)
  445. {
  446. handler = _lstHandlers.First.Value;
  447. ExecuteHandler(handler);
  448. _lstHandlers.RemoveFirst();
  449. }
  450. else
  451. {
  452. }
  453. }
  454. else
  455. {
  456. _connection.MonitorTimeout();
  457. _trigCommunicationError.CLK = _connection.IsCommunicationError;
  458. if (_trigCommunicationError.Q)
  459. {
  460. _lstHandlers.Clear();
  461. //EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
  462. OnError($"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
  463. //_trigActionDone.CLK = true;
  464. }
  465. }
  466. }
  467. }
  468. catch (Exception ex)
  469. {
  470. LOG.Write(ex);
  471. }
  472. return true;
  473. }
  474. private void ExecuteHandler(HandlerBase handler)
  475. {
  476. string commandstr = $",{UnitNumber}";
  477. if (IsEnableSeqNo)
  478. {
  479. CurrentSeqNo = SeqnoGenerator.create();
  480. commandstr += $",{CurrentSeqNo:D2}";
  481. SeqnoGenerator.release(CurrentSeqNo);
  482. }
  483. commandstr += $",{handler.SendText}";
  484. if (IsEnableCheckSum)
  485. {
  486. commandstr += ",";
  487. commandstr += Checksum(Encoding.ASCII.GetBytes(commandstr));
  488. }
  489. handler.SendText = $"${commandstr}\r";
  490. _connection.Execute(handler);
  491. }
  492. private string Checksum(byte[] bytes)
  493. {
  494. int sum = 0;
  495. foreach (byte code in bytes)
  496. {
  497. sum += code;
  498. }
  499. string hex = String.Format("{0:X2}", sum % 256);
  500. return hex;
  501. }
  502. public int UnitNumber
  503. {
  504. get; private set;
  505. }
  506. private bool isSimulatorMode;
  507. private string _scRoot;
  508. //private string _ipaddress;
  509. public YaskawaTokenGenerator SeqnoGenerator { get; private set; }
  510. public bool IsEnableSeqNo { get; private set; }
  511. public bool IsEnableCheckSum { get; private set; }
  512. public string AlignerSystemVersion { get; private set; }
  513. public string AlignerSoftwareVersion { get; private set; }
  514. public int CurrentSeqNo { get; set; }
  515. public int AlignerType { get; private set; } //0= Edge grip, 1=Vacuum
  516. public string PortName;
  517. private string _address;
  518. private bool _enableLog;
  519. private YaskawaAlignerConnection _connection;
  520. private R_TRIG _trigError = new R_TRIG();
  521. private R_TRIG _trigCommunicationError = new R_TRIG();
  522. private R_TRIG _trigRetryConnect = new R_TRIG();
  523. public string Address => _address;
  524. private PeriodicJob _thread;
  525. private object _locker = new object();
  526. private LinkedList<HandlerBase> _lstHandlers = new LinkedList<HandlerBase>();
  527. private IoSensor _diPreAlignerWaferOn = null;
  528. private IoSensor _diPreAlignerReady = null;
  529. private IoSensor _diPreAlignerError = null;
  530. private IoSensor _diTPinUse = null;
  531. private IoTrigger _doPreAlignerHold = null;
  532. public ModuleName CurrentInteractiveModule { get; private set; }
  533. public bool IsConnected => _connection.IsConnected;
  534. public bool IsWaferPresenceOnFromVacuumSensorOrGripSensor { get; private set; }
  535. public bool IsWaferPresenceOnFromCCDSensor { get; private set; }
  536. public bool IsWaferHoldOnChuck { get; private set; }
  537. //public bool IsGrippedBlade2 { get; private set; }
  538. public bool IsGripSensorOnEnd { get; private set; }
  539. public bool IsUngripSensorOnEnd { get; private set; }
  540. public bool IsLifterUpperSensorOnEnd { get; private set; }
  541. public bool IsLifterDownSensorOnEnd { get; private set; }
  542. public bool IsLifterSolenoidOnUp { get; private set; }
  543. public bool IsPermittedInterlock6 { get; private set; }
  544. public bool IsPermittedInterlock7 { get; private set; }
  545. public bool IsPermittedInterlock8 { get; private set; }
  546. public float CurrentThetaPosition { get; private set; }
  547. public float CurrentExtensionPosition { get; private set; }
  548. public float CurrentArm1Position { get; private set; }
  549. public float CurrentArm2Position { get; private set; }
  550. public float CurrentZPosition { get; private set; }
  551. public float CommandThetaPosition { get; private set; }
  552. public float CommandExtensionPosition { get; private set; }
  553. public float CommandArm1Position { get; private set; }
  554. public float CommandArm2Position { get; private set; }
  555. public float CommandZPosition { get; private set; }
  556. public int SpeedLevel { get; private set; }
  557. public string ReadMemorySpec { get; private set; }
  558. public string ReadTransferStation { get; private set; }
  559. public int ReadSlotNumber { get; private set; }
  560. public string ReadArmPosture { get; private set; }
  561. public YaskawaPositonEnum ReadPositionType { get; private set; }
  562. public float ReadThetaPosition { get; private set; }
  563. public float ReadExtensionPosition { get; private set; }
  564. public float ReadArm1Position { get; private set; }
  565. public float ReadArm2Position { get; private set; }
  566. public float ReadZPosition { get; private set; }
  567. public Dictionary<string, string> ReadStationItemValues { get; private set; } = new Dictionary<string, string>();
  568. public Dictionary<string, string> ReadStationItemContents { get; private set; } = new Dictionary<string, string>();
  569. public string ReadParameterType { get; private set; }
  570. public string ReadParameterNo { get; private set; }
  571. public string ReadParameterValue { get; private set; }
  572. public bool IsManipulatorBatteryLow { get; private set; }
  573. public bool IsCommandExecutionReady { get; private set; }
  574. public bool IsServoON { get; private set; }
  575. public bool IsErrorOccurred { get; private set; }
  576. public bool IsControllerBatteryLow { get; private set; }
  577. public bool IsCheckInterlockWaferPresenceAbsent { get; private set; }
  578. //public bool IsCheckInterlockWaferPresenceOnBlade2 { get; private set; }
  579. //public bool IsCheckInterlockPAOp { get; private set; }
  580. //public bool IsCheckInterlockPAWaferStatus { get; private set; }
  581. public bool IsCheckInterlockManipulatorOperation { get; private set; }
  582. private Stopwatch _timerAction = new Stopwatch();
  583. public bool Connect()
  584. {
  585. return _connection.Connect();
  586. }
  587. public bool Disconnect()
  588. {
  589. return _connection.Disconnect();
  590. }
  591. public override bool IsReady()
  592. {
  593. //if (_diPreAlignerReady != null && !_diPreAlignerReady.Value)
  594. // return false;
  595. //if (_diPreAlignerError != null && !_diPreAlignerError.Value)
  596. // return false;
  597. //if (_diTPinUse != null && !_diTPinUse.Value)
  598. // return false;
  599. return base.IsReady();
  600. }
  601. protected override bool fStartLiftup(object[] param)
  602. {
  603. lock (_locker)
  604. {
  605. string strpara = "2,1,0";
  606. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", strpara));
  607. }
  608. _timerAction.Restart();
  609. return true;
  610. }
  611. protected override bool fMonitorLiftup(object[] param)
  612. {
  613. IsBusy = false;
  614. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  615. {
  616. OnError("LiftUpTimeout");
  617. _timerAction.Stop();
  618. }
  619. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  620. {
  621. _timerAction.Stop();
  622. return true;
  623. }
  624. return false;
  625. }
  626. protected override bool fStartLiftdown(object[] param)
  627. {
  628. lock (_locker)
  629. {
  630. string strpara = "2,0,0";
  631. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", strpara));
  632. }
  633. _timerAction.Restart();
  634. return true;
  635. }
  636. protected override bool fMonitorLiftdown(object[] param)
  637. {
  638. IsBusy = false;
  639. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  640. {
  641. OnError("LiftDownTimeout");
  642. _timerAction.Stop();
  643. }
  644. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  645. {
  646. _timerAction.Stop();
  647. return true;
  648. }
  649. return false;
  650. }
  651. protected override bool fStartAlign(object[] param)
  652. {
  653. double aligneangle = (double)param[0];
  654. while (aligneangle >= 360)
  655. {
  656. aligneangle -= 360;
  657. }
  658. while (aligneangle < 0)
  659. {
  660. aligneangle += 360;
  661. }
  662. int intangle = (int)(aligneangle * 1000);
  663. CurrentNotch = aligneangle;
  664. lock (_locker)
  665. {
  666. string strpara = $"0,{intangle:D8}";
  667. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "MALN", strpara));
  668. if (AlignerType == 1)
  669. {
  670. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", "1,0,0"));
  671. if (AlignerType == 1) // Vacuum Type
  672. {
  673. IsNeedRelease = false;
  674. }
  675. }
  676. }
  677. _timerAction.Restart();
  678. return true;
  679. }
  680. protected override bool fMonitorAligning(object[] param)
  681. {
  682. //IsBusy = false;
  683. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  684. {
  685. OnError("AlignmentTimeout");
  686. _timerAction.Stop();
  687. }
  688. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  689. {
  690. _timerAction.Stop();
  691. EV.PostInfoLog(Name, "Monitor alignment finished");
  692. IsBusy = false;
  693. OnActionDone(null);
  694. return true;
  695. }
  696. return false;
  697. }
  698. protected override bool fStop(object[] param)
  699. {
  700. lock (_locker)
  701. {
  702. _lstHandlers.Clear();
  703. _connection.ForceClear();
  704. //ExecuteHandler(new YaskawaAlignerMotionHandler(this, "CSTP", "E"));
  705. }
  706. return true;
  707. }
  708. protected override bool FsmAbort(object[] param)
  709. {
  710. lock (_locker)
  711. {
  712. _lstHandlers.Clear();
  713. _connection.ForceClear();
  714. ExecuteHandler(new YaskawaAlignerMotionHandler(this, "CSTP", "H"));
  715. }
  716. return true;
  717. }
  718. protected override bool fClear(object[] param)
  719. {
  720. lock (_locker)
  721. {
  722. ExecuteHandler(new YaskawaAlignerMotionHandler(this, "CCLR", "E"));
  723. }
  724. return true;
  725. }
  726. protected override bool fStartReadData(object[] param)
  727. {
  728. if (param.Length < 1) return false;
  729. string readcommand = param[0].ToString();
  730. switch (readcommand)
  731. {
  732. case "CurrentStatus":
  733. lock (_locker)
  734. {
  735. _lstHandlers.AddLast(new YaskawaAlignerReadHandler(this, "RSTS"));
  736. _lstHandlers.AddLast(new YaskawaAlignerReadHandler(this, "RPOS", "F"));
  737. _lstHandlers.AddLast(new YaskawaAlignerReadHandler(this, "RPOS", "R"));
  738. }
  739. break;
  740. default:
  741. break;
  742. }
  743. _timerAction.Restart();
  744. return true;
  745. }
  746. protected override bool fMonitorReadData(object[] param)
  747. {
  748. IsBusy = false;
  749. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  750. {
  751. OnError("ReadDataTimeout");
  752. _timerAction.Stop();
  753. }
  754. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  755. {
  756. _timerAction.Stop();
  757. return true;
  758. }
  759. return false;
  760. }
  761. protected override bool fStartSetParameters(object[] param)
  762. {
  763. try
  764. {
  765. string strParameter;
  766. string setcommand = param[0].ToString();
  767. switch (setcommand)
  768. {
  769. case "MotionSpeed": // SSPD Set the motion speed
  770. string strlevel = param[1].ToString();
  771. string strspeedtype = param[2].ToString();
  772. string strAxis = param[3].ToString();
  773. uint speeddata = Convert.ToUInt32(param[4]);
  774. if (!"0123".Contains(strlevel))
  775. {
  776. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + strlevel);
  777. return false;
  778. }
  779. if (!"HMLOB".Contains(strspeedtype))
  780. {
  781. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + strspeedtype);
  782. return false;
  783. }
  784. if (!"SAHIZRG".Contains(strAxis))
  785. {
  786. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + strAxis);
  787. return false;
  788. }
  789. strParameter = $"{strlevel},{strspeedtype},{strAxis}," + speeddata.ToString("D8");
  790. lock (_locker)
  791. {
  792. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SSPD", strParameter));
  793. }
  794. break;
  795. case "TransferSpeedLevel": //SSLV Select the transfer speed level
  796. string sslvlevel = param[1].ToString();
  797. if (!"123".Contains(sslvlevel))
  798. {
  799. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sslvlevel);
  800. return false;
  801. }
  802. lock (_locker)
  803. {
  804. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SSLV", sslvlevel));
  805. }
  806. break;
  807. case "RegisterTheCurrentPositionAsTransferStation": // SPOS: Register the current position as the specified transfer station
  808. string sposMem = param[1].ToString();
  809. string sposRmode = param[2].ToString();
  810. string sposTrsSt = param[3].ToString();
  811. uint sposSlot = Convert.ToUInt16(param[4]);
  812. string sposPosture = param[5].ToString();
  813. string sposHand = param[6].ToString();
  814. if (!"VN".Contains(sposMem))
  815. {
  816. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposMem);
  817. return false;
  818. }
  819. if (!"AN".Contains(sposRmode))
  820. {
  821. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposRmode);
  822. return false;
  823. }
  824. if (sposSlot < 1 || sposSlot > 30)
  825. {
  826. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposSlot.ToString());
  827. return false;
  828. }
  829. if (!"LR".Contains(sposPosture))
  830. {
  831. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposPosture);
  832. return false;
  833. }
  834. if (!"12".Contains(sposHand))
  835. {
  836. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposHand);
  837. return false;
  838. }
  839. strParameter = $"{sposMem},{sposRmode},{sposTrsSt},{sposSlot},{sposPosture},{sposHand}";
  840. lock (_locker)
  841. {
  842. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SPOS", strParameter));
  843. }
  844. break;
  845. case "RegisterTheSpePostionAsTransferStation": //SABS
  846. string sabsMem = param[1].ToString();
  847. string sabsRmode = param[2].ToString();
  848. string sabsTrsSt = param[3].ToString();
  849. string sabsPosture = param[4].ToString();
  850. string sabsHand = param[5].ToString();
  851. Int32 sabsValue1 = Convert.ToInt32(param[6]);
  852. Int32 sabsValue2 = Convert.ToInt32(param[7]);
  853. Int32 sabsValue3 = Convert.ToInt32(param[8]);
  854. Int32 sabsValue4 = Convert.ToInt32(param[9]);
  855. Int32 sabsValue5 = Convert.ToInt32(param[10]);
  856. if (!"VN".Contains(sabsMem))
  857. {
  858. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsMem);
  859. return false;
  860. }
  861. if (!"AN".Contains(sabsRmode))
  862. {
  863. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsRmode);
  864. return false;
  865. }
  866. if (!"LR".Contains(sabsPosture))
  867. {
  868. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsPosture);
  869. return false;
  870. }
  871. if (!"12".Contains(sabsHand))
  872. {
  873. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsHand);
  874. return false;
  875. }
  876. strParameter = $"{sabsMem},{sabsRmode},{sabsTrsSt},{sabsPosture},{sabsHand},"
  877. + sabsValue1.ToString("D8") + "," + sabsValue2.ToString("D8") + "," + sabsValue3.ToString("D8") +
  878. "," + sabsValue4.ToString("D8") + "," + sabsValue5.ToString("D8");
  879. lock (_locker)
  880. {
  881. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SABS", strParameter));
  882. }
  883. break;
  884. case "ModifyTheSpecStationPostionByOffset": //SAPS
  885. string sapsMem = param[1].ToString();
  886. string sapsRmode = param[2].ToString();
  887. string sapsTrsSt = param[3].ToString();
  888. string sapsPosture = param[4].ToString();
  889. string sapsHand = param[5].ToString();
  890. Int32 sapsOffsetX = Convert.ToInt32(param[6]);
  891. Int32 sapsOffsetY = Convert.ToInt32(param[7]);
  892. Int32 sapsOffsetZ = Convert.ToInt32(param[8]);
  893. strParameter = $"{sapsMem},{sapsRmode},{sapsTrsSt},{sapsPosture},{sapsHand},"
  894. + sapsOffsetX.ToString("D8") + "," + sapsOffsetY.ToString("D8") + "," + sapsOffsetZ.ToString("D8");
  895. lock (_locker)
  896. {
  897. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SAPS", strParameter));
  898. }
  899. break;
  900. case "DeleteTheSpecStation": //SPDL
  901. string spdlMem = param[1].ToString();
  902. string spdlTrsSt = param[2].ToString();
  903. string spdlPosture = param[3].ToString();
  904. string spdlHand = param[4].ToString();
  905. strParameter = $"{spdlMem},{spdlTrsSt},{spdlPosture},{spdlHand}";
  906. lock (_locker)
  907. {
  908. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SPDL", strParameter));
  909. }
  910. break;
  911. case "RegisterThePositionDataToVolatile": //SPSV
  912. string spsvTrsSt = param[1].ToString();
  913. string spsvPosture = param[2].ToString();
  914. string spsvHand = param[3].ToString();
  915. strParameter = $"{spsvTrsSt},{spsvPosture},{spsvHand}";
  916. lock (_locker)
  917. {
  918. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SPSV", strParameter));
  919. }
  920. break;
  921. case "ReadThePostionDataFromVolatile": //SPLD
  922. string spldTrsSt = param[1].ToString();
  923. string spldPosture = param[2].ToString();
  924. string spldHand = param[3].ToString();
  925. strParameter = $"{spldTrsSt},{spldPosture},{spldHand}";
  926. lock (_locker)
  927. {
  928. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SPLD", strParameter));
  929. }
  930. break;
  931. case "SetTheStationParameters": //SSTR
  932. string sstrMem = param[1].ToString();
  933. string sstrTrsSt = param[2].ToString();
  934. string sstrItem = param[3].ToString();
  935. Int32 sstrValue = Convert.ToInt32(param[4].ToString());
  936. strParameter = $"{sstrMem},{sstrTrsSt},{sstrItem}," + sstrValue.ToString("D8");
  937. lock (_locker)
  938. {
  939. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SSTR", strParameter));
  940. }
  941. break;
  942. case "ChangeParameterValue": // SPRM
  943. string sprmParaType = param[1].ToString();
  944. int sprmParaNO = Convert.ToInt32(param[2].ToString());
  945. Int32 sprmValue = Convert.ToInt32(param[3].ToString());
  946. strParameter = sprmParaType + "," + sprmParaNO.ToString("D4") + "," + sprmValue.ToString("D12");
  947. lock (_locker)
  948. {
  949. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SPRM", strParameter));
  950. }
  951. break;
  952. case "EnableInterLock": //SMSK
  953. int smskValid = Convert.ToInt16(param[1].ToString());
  954. lock (_locker)
  955. {
  956. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SPRM", smskValid.ToString("D4")));
  957. }
  958. break;
  959. case "RegisterTheCurrentPositionAsCoordinate": //SSTD
  960. string sstdAxis = param[1].ToString();
  961. lock (_locker)
  962. {
  963. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SSTD", sstdAxis));
  964. }
  965. break;
  966. case "ResigterTheSpecNumberAsReferencePostion": //SSTN
  967. Int32 sstnValue1 = Convert.ToInt32(param[1]);
  968. Int32 sstnValue2 = Convert.ToInt32(param[2]);
  969. Int32 sstnValue3 = Convert.ToInt32(param[3]);
  970. Int32 sstnValue4 = Convert.ToInt32(param[4]);
  971. Int32 sstnValue5 = Convert.ToInt32(param[5]);
  972. strParameter = sstnValue1.ToString("D12") + "," + sstnValue2.ToString("D12") + ","
  973. + sstnValue3.ToString("D12") + "," + sstnValue4.ToString("D12") + ","
  974. + sstnValue5.ToString("D12");
  975. lock (_locker)
  976. {
  977. _lstHandlers.AddLast(new YaskawaAlignerSetHandler(this, "SSTN", strParameter));
  978. }
  979. break;
  980. }
  981. }
  982. catch (Exception)
  983. {
  984. string reason = "";
  985. if (param != null)
  986. {
  987. foreach (var para in param)
  988. {
  989. reason += para.ToString() + ",";
  990. }
  991. }
  992. EV.PostAlarmLog(Name, "Set command parameter invalid:" + reason);
  993. return false;
  994. }
  995. _timerAction.Restart();
  996. return true;
  997. }
  998. protected override bool fMonitorSetParamter(object[] param)
  999. {
  1000. IsBusy = false;
  1001. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  1002. {
  1003. OnError("SetDataTimeout");
  1004. _timerAction.Stop();
  1005. }
  1006. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1007. {
  1008. _timerAction.Stop();
  1009. return true;
  1010. }
  1011. return false;
  1012. }
  1013. protected override bool fStartUnGrip(object[] param)
  1014. {
  1015. lock (_locker)
  1016. {
  1017. string strpara = "1,0,0";
  1018. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", strpara));
  1019. if (AlignerType == 1) // Vacuum Type
  1020. {
  1021. IsNeedRelease = false;
  1022. }
  1023. }
  1024. _timerAction.Restart();
  1025. return true;
  1026. }
  1027. protected override bool fMonitorUnGrip(object[] param)
  1028. {
  1029. IsBusy = false;
  1030. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  1031. {
  1032. OnError("UngripTimeout");
  1033. _timerAction.Stop();
  1034. }
  1035. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1036. {
  1037. _timerAction.Stop();
  1038. return true;
  1039. }
  1040. return false;
  1041. }
  1042. protected override bool fStartGrip(object[] param)
  1043. {
  1044. lock (_locker)
  1045. {
  1046. string strpara = "1,1,0";
  1047. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "CSOL", strpara));
  1048. if (AlignerType == 1) // Vacuum Type
  1049. {
  1050. IsNeedRelease = true;
  1051. }
  1052. }
  1053. _timerAction.Restart();
  1054. return true;
  1055. }
  1056. protected override bool fMonitorGrip(object[] param)
  1057. {
  1058. IsBusy = false;
  1059. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignWafer))
  1060. {
  1061. OnError("GripTimeout");
  1062. _timerAction.Stop();
  1063. }
  1064. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1065. {
  1066. _timerAction.Stop();
  1067. return true;
  1068. }
  1069. return false;
  1070. }
  1071. protected override bool fResetToReady(object[] param)
  1072. {
  1073. if (!_connection.IsConnected)
  1074. {
  1075. _connection.Connect();
  1076. }
  1077. return true;
  1078. }
  1079. public void ResetError()
  1080. {
  1081. lock (_locker)
  1082. {
  1083. _lstHandlers.AddFirst(new YaskawaAlignerMotionHandler(this, "CCLR", "E"));
  1084. }
  1085. }
  1086. protected override bool fReset(object[] param)
  1087. {
  1088. _lstHandlers.Clear();
  1089. _connection.ForceClear();
  1090. if (!_connection.IsConnected)
  1091. {
  1092. _connection.Connect();
  1093. }
  1094. lock (_locker)
  1095. {
  1096. ExecuteHandler(new YaskawaAlignerMotionHandler(this, "CCLR", "E"));
  1097. }
  1098. _timerAction.Restart();
  1099. return true;
  1100. }
  1101. protected override bool fMonitorReset(object[] param)
  1102. {
  1103. IsBusy = false;
  1104. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignerHome))
  1105. {
  1106. OnError("ResetTimeout");
  1107. if (_diPreAlignerReady != null && !_diPreAlignerReady.Value)
  1108. {
  1109. EV.PostAlarmLog("Aligner", $"Aligner ready signal off");
  1110. }
  1111. if (_diPreAlignerError != null && !_diPreAlignerError.Value)
  1112. {
  1113. EV.PostAlarmLog("Aligner", $"Aligner error signal off");
  1114. }
  1115. if (_diTPinUse != null && !_diTPinUse.Value)
  1116. {
  1117. EV.PostAlarmLog("Aligner", $"Aligner TP in use signal off");
  1118. }
  1119. if (!_connection.IsConnected)
  1120. {
  1121. EV.PostAlarmLog("Aligner", $"Aligner no connection");
  1122. }
  1123. _timerAction.Stop();
  1124. }
  1125. if (!_connection.IsConnected)
  1126. {
  1127. _address = SC.GetStringValue($"{_scRoot}.{Name}.Address");
  1128. _enableLog = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableLogMessage");
  1129. UnitNumber = SC.GetValue<int>($"{_scRoot}.{Name}.UnitNumber");
  1130. IsEnableCheckSum = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableCheckSum");
  1131. IsEnableSeqNo = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableSeqNo");
  1132. _connection = new YaskawaAlignerConnection(this, _address);
  1133. _connection.EnableLog(_enableLog);
  1134. _connection.Connect();
  1135. }
  1136. if (_diPreAlignerReady != null && !_diPreAlignerReady.Value)
  1137. return false;
  1138. if (_diPreAlignerError != null && !_diPreAlignerError.Value)
  1139. return false;
  1140. if (_diTPinUse != null && !_diTPinUse.Value)
  1141. return false;
  1142. if (!_connection.IsConnected)
  1143. return false;
  1144. _timerAction.Stop();
  1145. return true;
  1146. }
  1147. public override bool IsNeedRelease
  1148. {
  1149. //get
  1150. //{
  1151. //if (AlignerType == 1)
  1152. // return true;
  1153. //if (SC.ContainsItem($"{_scRoot}.{Name}.NeedReleaseBeforePick") && SC.GetValue<bool>($"{_scRoot}.{Name}.NeedReleaseBeforePick"))
  1154. // return true;
  1155. get; set;
  1156. //}
  1157. }
  1158. protected override bool fStartInit(object[] param)
  1159. {
  1160. CurrentNotch = 0;
  1161. _connection.ForceClear();
  1162. lock (_locker)
  1163. {
  1164. string strpara = "1,1,G";
  1165. if (AlignerType == 1) //Vacuum Type
  1166. strpara = "1,1,N";
  1167. _lstHandlers.AddLast(new YaskawaAlignerMotionHandler(this, "INIT", strpara));
  1168. _lstHandlers.AddLast(new YaskawaAlignerGripAndDetectHandler(this));
  1169. }
  1170. return true;
  1171. }
  1172. protected override bool fMonitorInit(object[] param)
  1173. {
  1174. IsBusy = false;
  1175. if (_timerAction.IsRunning && _timerAction.Elapsed > TimeSpan.FromSeconds(TimeLimitAlignerHome))
  1176. {
  1177. OnError("InitTimeout");
  1178. _timerAction.Stop();
  1179. }
  1180. if (_diPreAlignerReady != null && !_diPreAlignerReady.Value)
  1181. return false;
  1182. if (_diPreAlignerError != null && !_diPreAlignerError.Value)
  1183. return false;
  1184. if (_diTPinUse != null && !_diTPinUse.Value)
  1185. return false;
  1186. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1187. {
  1188. _timerAction.Stop();
  1189. return true;
  1190. }
  1191. return false;
  1192. }
  1193. protected override bool fError(object[] param)
  1194. {
  1195. return true;
  1196. }
  1197. public bool ParseStatus(string status)
  1198. {
  1199. try
  1200. {
  1201. //int intstatus = Convert.ToInt32(status,16);
  1202. int intstatus = Convert.ToInt32("02", 16);
  1203. IsManipulatorBatteryLow = ((intstatus & 0x10) == 0x10);
  1204. IsCommandExecutionReady = ((intstatus & 0x20) == 0x20);
  1205. IsServoON = ((intstatus & 0x40) == 0x40);
  1206. IsErrorOccurred = ((intstatus & 0x80) == 0x80);
  1207. IsControllerBatteryLow = ((intstatus & 0x1) == 0x1);
  1208. IsWaferPresenceOnFromVacuumSensorOrGripSensor = ((intstatus & 0x2) == 0x2);
  1209. IsWaferPresenceOnFromCCDSensor = ((intstatus & 0x4) == 0x4);
  1210. return true;
  1211. }
  1212. catch (Exception ex)
  1213. {
  1214. LOG.Write(ex);
  1215. return false;
  1216. }
  1217. }
  1218. public bool ParseReadData(string _command, string[] rdata)
  1219. {
  1220. try
  1221. {
  1222. if (_command == "RSTS")
  1223. {
  1224. return (rdata.Length == 2 && ParseRSTSStatus(rdata));
  1225. }
  1226. if (_command == "RSLV") //Read the speed level
  1227. {
  1228. return (rdata.Length == 1 && ParseSpeedLevel(rdata[0]));
  1229. }
  1230. if (_command == "RPOS") //Reference current postion
  1231. {
  1232. return (rdata.Length > 1 && ParsePositionData(rdata));
  1233. }
  1234. if (_command == "RSTR") //Reference station item value
  1235. {
  1236. return (rdata.Length == 4 && ParseStationData(rdata));
  1237. }
  1238. if (_command == "RPRM") //Reference the parameter values of the specified unit
  1239. {
  1240. return (rdata.Length == 3 && ParseParameterData(rdata));
  1241. }
  1242. if (_command == "RMSK") //Reference the interlock information
  1243. {
  1244. return (rdata.Length == 1 && ParseInterlockInfo(rdata));
  1245. }
  1246. if (_command == "RVER") //Reference the software version
  1247. {
  1248. return (rdata.Length == 2 && ParseSoftwareVersion(rdata));
  1249. }
  1250. if (_command == "RALN") // Reference the alignment result
  1251. {
  1252. return true;
  1253. }
  1254. if (_command == "RACA") // Reference calibration result for alignment
  1255. {
  1256. return true;
  1257. }
  1258. return true;
  1259. }
  1260. catch (Exception ex)
  1261. {
  1262. LOG.Write(ex);
  1263. return false;
  1264. }
  1265. }
  1266. public bool ParseSpeedLevel(string speedlevel)
  1267. {
  1268. try
  1269. {
  1270. int level = Convert.ToInt32(speedlevel);
  1271. if (level < 1 || level > 3) return false;
  1272. SpeedLevel = level;
  1273. return true;
  1274. }
  1275. catch (Exception ex)
  1276. {
  1277. LOG.Write(ex);
  1278. return false;
  1279. }
  1280. }
  1281. public bool ParsePositionData(string[] pdata)
  1282. {
  1283. try
  1284. {
  1285. if (pdata[0] == "R")
  1286. {
  1287. if (pdata.Length >= 2)
  1288. CommandThetaPosition = Convert.ToInt32(pdata[1]) / 1000;
  1289. if (pdata.Length >= 3)
  1290. CommandExtensionPosition = Convert.ToInt32(pdata[2]) / 1000;
  1291. if (pdata.Length >= 4)
  1292. CommandArm1Position = Convert.ToInt32(pdata[3]) / 1000;
  1293. if (pdata.Length >= 5)
  1294. CommandArm2Position = Convert.ToInt32(pdata[4]) / 1000;
  1295. if (pdata.Length >= 6)
  1296. CommandZPosition = Convert.ToInt32(pdata[5]) / 1000;
  1297. return true;
  1298. }
  1299. if (pdata[0] == "F")
  1300. {
  1301. if (pdata.Length >= 2)
  1302. {
  1303. CurrentThetaPosition = Convert.ToInt32(pdata[1]) / 1000;
  1304. PositionAxis1 = CurrentThetaPosition;
  1305. }
  1306. if (pdata.Length >= 3)
  1307. {
  1308. CurrentExtensionPosition = Convert.ToInt32(pdata[2]) / 1000;
  1309. PositionAxis2 = CurrentExtensionPosition;
  1310. }
  1311. if (pdata.Length >= 4)
  1312. {
  1313. CurrentArm1Position = Convert.ToInt32(pdata[3]) / 1000;
  1314. PositionAxis3 = CurrentArm1Position;
  1315. }
  1316. if (pdata.Length >= 5)
  1317. {
  1318. CurrentArm2Position = Convert.ToInt32(pdata[4]) / 1000;
  1319. PositionAxis4 = CurrentArm2Position;
  1320. }
  1321. if (pdata.Length >= 6)
  1322. {
  1323. CurrentZPosition = Convert.ToInt32(pdata[5]) / 1000;
  1324. PositionAxis5 = CurrentZPosition;
  1325. }
  1326. return true;
  1327. }
  1328. return false;
  1329. }
  1330. catch (Exception ex)
  1331. {
  1332. LOG.Write(ex);
  1333. return false;
  1334. }
  1335. }
  1336. public bool ParseStationData(string[] pdata)
  1337. {
  1338. try
  1339. {
  1340. ReadMemorySpec = pdata[0];
  1341. ReadTransferStation = pdata[1];
  1342. if (ReadStationItemValues.ContainsKey(pdata[2]))
  1343. ReadStationItemValues.Remove(pdata[2]);
  1344. ReadStationItemValues.Add(pdata[2], pdata[3]);
  1345. return true;
  1346. }
  1347. catch (Exception ex)
  1348. {
  1349. LOG.Write(ex);
  1350. return false;
  1351. }
  1352. }
  1353. public bool ParseParameterData(string[] pdata)
  1354. {
  1355. try
  1356. {
  1357. ReadParameterType = pdata[0];
  1358. ReadParameterNo = pdata[1];
  1359. ReadParameterValue = pdata[2];
  1360. return true;
  1361. }
  1362. catch (Exception ex)
  1363. {
  1364. LOG.Write(ex);
  1365. return false;
  1366. }
  1367. }
  1368. public bool ParseInterlockInfo(string[] pdata)
  1369. {
  1370. try
  1371. {
  1372. int intdata = Convert.ToInt16(pdata[0]);
  1373. IsCheckInterlockWaferPresenceAbsent = (intdata & 0x1) == 0;
  1374. IsCheckInterlockManipulatorOperation = (intdata & 0x1000) == 0;
  1375. return true;
  1376. }
  1377. catch (Exception ex)
  1378. {
  1379. LOG.Write(ex);
  1380. return false;
  1381. }
  1382. }
  1383. public bool ParseSoftwareVersion(string[] pdata)
  1384. {
  1385. try
  1386. {
  1387. AlignerSystemVersion = pdata[0];
  1388. AlignerSoftwareVersion = pdata[1];
  1389. return true;
  1390. }
  1391. catch (Exception ex)
  1392. {
  1393. LOG.Write(ex);
  1394. return false;
  1395. }
  1396. }
  1397. public bool ParseRSTSStatus(string[] status)
  1398. {
  1399. try
  1400. {
  1401. ErrorCode = status[0];
  1402. int intstatus = Convert.ToInt32(status[1]);
  1403. IsWaferPresenceOnFromVacuumSensorOrGripSensor = ((intstatus & 0x1) == 0x1);
  1404. IsWaferPresenceOnFromCCDSensor = ((intstatus & 0x2) == 0x2);
  1405. IsWaferHoldOnChuck = ((intstatus & 0x4) == 0x4);
  1406. //IsGrippedBlade2 = ((intstatus & 0x8) == 0x8);
  1407. IsGripSensorOnEnd = ((intstatus & 0x10) == 0x10);
  1408. IsUngripSensorOnEnd = ((intstatus & 0x20) == 0x20);
  1409. IsLifterUpperSensorOnEnd = ((intstatus & 0x100) == 0x100);
  1410. IsLifterDownSensorOnEnd = ((intstatus & 0x200) == 0x200);
  1411. IsLifterSolenoidOnUp = ((intstatus & 0x400) == 0x400);
  1412. return true;
  1413. }
  1414. catch (Exception ex)
  1415. {
  1416. LOG.Write(ex);
  1417. return false;
  1418. }
  1419. }
  1420. public void SenACK()
  1421. {
  1422. //_connection.SendAck();
  1423. }
  1424. public override bool OnActionDone(object[] param)
  1425. {
  1426. IsBusy = false;
  1427. //if (_lstHandlers.Count == 0)
  1428. //{
  1429. // IsBusy = false;
  1430. // return base.OnActionDone(param);
  1431. //}
  1432. return true;
  1433. }
  1434. private bool _isSimulatorMode
  1435. {
  1436. get
  1437. {
  1438. if (SC.ContainsItem("System.IsSimulatorMode"))
  1439. {
  1440. return SC.GetValue<bool>("System.IsSimulatorMode");
  1441. }
  1442. return false;
  1443. }
  1444. }
  1445. public override bool IsWaferPresent(int slotindex)
  1446. {
  1447. if (_isSimulatorMode)
  1448. return base.IsWaferPresent(slotindex);
  1449. if (_diPreAlignerWaferOn != null)
  1450. return !_diPreAlignerWaferOn.Value;
  1451. return base.IsWaferPresent(slotindex);
  1452. //return IsWaferPresenceOnFromCCDSensor || IsWaferPresenceOnFromVacuumSensorOrGripSensor;
  1453. }
  1454. public override void Terminate()
  1455. {
  1456. _thread.Stop();
  1457. if (!SC.ContainsItem($"{_scRoot}.{Name}.CloseConnectionOnShutDown") || SC.GetValue<bool>($"{_scRoot}.{Name}.CloseConnectionOnShutDown"))
  1458. {
  1459. LOG.Write($"Close connection for {RobotModuleName}");
  1460. _connection.Disconnect();
  1461. }
  1462. base.Terminate();
  1463. }
  1464. public void NotifyAlarmByErrorCode(string errorcode)
  1465. {
  1466. EV.Notify($"{Name}Error{errorcode}");
  1467. }
  1468. }
  1469. }