YaskawaNXCRobot.cs 140 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO.Ports;
  4. using System.Linq;
  5. using System.Text;
  6. using Aitex.Core.Common.DeviceData;
  7. using Aitex.Core.RT.Device;
  8. using Aitex.Core.RT.Device.Unit;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.Log;
  11. using Aitex.Core.RT.OperationCenter;
  12. using Aitex.Core.RT.SCCore;
  13. using Aitex.Core.Util;
  14. using MECF.Framework.Common.Communications;
  15. using MECF.Framework.Common.Device.Bases;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common;
  17. using Newtonsoft.Json;
  18. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  19. using MECF.Framework.Common.Equipment;
  20. using MECF.Framework.Common.SubstrateTrackings;
  21. using System.Threading;
  22. using Aitex.Core.Common;
  23. using Aitex.Core.RT.DataCenter;
  24. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  25. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  26. using EventType = Aitex.Core.RT.Event.EventType;
  27. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.YaskawaRobots
  28. {
  29. public class YaskawaNXC100Robot : RobotBaseDevice, IConnection
  30. {
  31. public int UnitNumber
  32. {
  33. get; private set;
  34. }
  35. private bool isSimulatorMode;
  36. private string _scRoot;
  37. //private string _ipaddress;
  38. public YaskawaTokenGenerator SeqnoGenerator { get; private set; }
  39. public bool IsEnableSeqNo { get; private set; }
  40. public bool IsEnableCheckSum { get; private set; }
  41. public int CurrentSeqNo { get; set; }
  42. public string PortName;
  43. private string _address;
  44. private bool _enableLog;
  45. protected YaskawaNXC100Connection _connection;
  46. private R_TRIG _trigError = new R_TRIG();
  47. private R_TRIG _trigCommunicationError = new R_TRIG();
  48. private R_TRIG _trigRetryConnect = new R_TRIG();
  49. public string Address => _address;
  50. private PeriodicJob _thread;
  51. private object _locker = new object();
  52. protected LinkedList<HandlerBase> _lstHandlers = new LinkedList<HandlerBase>();
  53. private IoSensor _diRobotReady = null; //Normal ON
  54. private IoSensor _diRobotBlade1WaferOn = null; //Off when wafer present
  55. private IoSensor _diRobotBlade2WaferOn = null;
  56. private IoSensor _diRobotError = null; //Normal ON
  57. private IoSensor _diTPinUse = null;
  58. private IoTrigger _doRobotHold = null; // Normal ON
  59. public ModuleName CurrentInteractiveModule { get; private set; }
  60. public bool IsConnected => throw new NotImplementedException();
  61. public bool IsGrippedBlade1 { get; private set; }
  62. public bool IsGrippedBlade2 { get; private set; }
  63. public bool IsPermittedInterlock1 { get; private set; }
  64. public bool IsPermittedInterlock2 { get; private set; }
  65. public bool IsPermittedInterlock3 { get; private set; }
  66. public bool IsPermittedInterlock4 { get; private set; }
  67. public bool IsPermittedInterlock5 { get; private set; }
  68. public bool IsPermittedInterlock6 { get; private set; }
  69. public bool IsPermittedInterlock7 { get; private set; }
  70. public bool IsPermittedInterlock8 { get; private set; }
  71. public float CurrentThetaPosition { get; private set; }
  72. public float CurrentExtensionPosition { get; private set; }
  73. public float CurrentArm1Position { get; private set; }
  74. public float CurrentArm2Position { get; private set; }
  75. public float CurrentZPosition { get; private set; }
  76. public float CommandThetaPosition { get; private set; }
  77. public float CommandExtensionPosition { get; private set; }
  78. public float CommandArm1Position { get; private set; }
  79. public float CommandArm2Position { get; private set; }
  80. public float CommandZPosition { get; private set; }
  81. public int SpeedLevel { get; private set; }
  82. public int SpeedLevelSetting { get; private set; }
  83. public string ReadMemorySpec { get; private set; }
  84. public string ReadTransferStation { get; private set; }
  85. public int ReadSlotNumber { get; private set; }
  86. public string ReadArmPosture { get; private set; }
  87. public RobotArmEnum ReadBladeNo { get; private set; }
  88. public YaskawaPositonEnum ReadPositionType { get; private set; }
  89. public float ReadThetaPosition { get; private set; }
  90. public float ReadExtensionPosition { get; private set; }
  91. public float ReadArm1Position { get; private set; }
  92. public float ReadArm2Position { get; private set; }
  93. public float ReadZPosition { get; private set; }
  94. public Dictionary<string, string> ReadStationItemValues { get; private set; } = new Dictionary<string, string>();
  95. public Dictionary<string, string> ReadStationItemContents { get; private set; } = new Dictionary<string, string>();
  96. public string ReadParameterType { get; private set; }
  97. public string ReadParameterNo { get; private set; }
  98. public string ReadParameterValue { get; private set; }
  99. public bool IsManipulatorBatteryLow { get; private set; }
  100. public bool IsCommandExecutionReady { get; private set; }
  101. public bool IsServoON { get; private set; }
  102. public bool IsErrorOccurred { get; private set; }
  103. public bool IsControllerBatteryLow { get; private set; }
  104. public bool IsCheckInterlockWaferPresenceOnBlade1 { get; private set; }
  105. public bool IsCheckInterlockWaferPresenceOnBlade2 { get; private set; }
  106. public bool IsCheckInterlockPAOp { get; private set; }
  107. public bool IsCheckInterlockPAWaferStatus { get; private set; }
  108. public bool IsCheckInterlockPAWaferStatusByCCD { get; private set; }
  109. public string RobotSystemVersion { get; private set; }
  110. public string RobotSoftwareVersion { get; private set; }
  111. public string ReadMappingTransferStation { get; private set; }
  112. public int ReadMappingSlotNumbers { get; private set; }
  113. public string ReadSlotMap { get; private set; }
  114. public override bool IsEnableMapWafer
  115. {
  116. get
  117. {
  118. if (WaferManager.Instance.CheckHasWafer(RobotModuleName, 0))
  119. return false;
  120. return true;
  121. }
  122. }
  123. public Dictionary<string, float> ReadMappingCalibrationResult { get; private set; }
  124. public YaskawaNXC100Robot(string module, string name, string scRoot, IoSensor[] dis, IoTrigger[] dos) : base(module, name)
  125. {
  126. Module = module;
  127. Name = name;
  128. isSimulatorMode = SC.ContainsItem("System.IsSimulatorMode") ? SC.GetValue<bool>("System.IsSimulatorMode") : false;
  129. _scRoot = scRoot;
  130. _address = SC.GetStringValue($"{_scRoot}.{Name}.Address");
  131. _enableLog = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableLogMessage");
  132. UnitNumber = SC.GetValue<int>($"{_scRoot}.{Name}.UnitNumber");
  133. IsEnableCheckSum = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableCheckSum");
  134. IsEnableSeqNo = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableSeqNo");
  135. SpeedLevelSetting = SC.GetValue<int>($"{_scRoot}.{Name}.SpeedLevel");
  136. _connection = new YaskawaNXC100Connection(this, _address);
  137. _connection.EnableLog(_enableLog);
  138. SeqnoGenerator = new YaskawaTokenGenerator($"{_scRoot}.{Name}.CommunicationToken");
  139. if (dis != null && dis.Length >= 5)
  140. {
  141. _diRobotReady = dis[0];
  142. _diRobotBlade1WaferOn = dis[1];
  143. _diRobotBlade2WaferOn = dis[2];
  144. _diRobotError = dis[3];
  145. _diTPinUse = dis[4];
  146. _diRobotError.OnSignalChanged += _diRobotError_OnSignalChanged;
  147. _diTPinUse.OnSignalChanged += _diTPinUse_OnSignalChanged;
  148. }
  149. if (dos != null && dos.Length >= 1)
  150. {
  151. _doRobotHold = dos[0];
  152. }
  153. ConnectionManager.Instance.Subscribe($"{Name}", _connection);
  154. _thread = new PeriodicJob(10, OnTimer, $"{_scRoot}.{Name} MonitorHandler", true);
  155. ReadStationItemContents.Add("00", "Upward offset");
  156. ReadStationItemContents.Add("01", "Downword offset");
  157. ReadStationItemContents.Add("02", "Grip position offset");
  158. ReadStationItemContents.Add("06", "G2/P3 offset in the extending direction");
  159. ReadStationItemContents.Add("08", "Put downward offset");
  160. ReadStationItemContents.Add("70", "Get operation Movet_grip function yes/no");
  161. ReadStationItemContents.Add("71", "Get operation rsing pattern");
  162. ReadStationItemContents.Add("80", "Put operation Move_grip function yes/no");
  163. ReadStationItemContents.Add("81", "Put operation dropping pattern");
  164. ReadStationItemContents.Add("50", "Slot Numbers");
  165. ReadStationItemContents.Add("30", "Slot pitch(Left elbow,Blade1)");
  166. ReadStationItemContents.Add("31", "Slot pitch(Left elbow,Blade2)");
  167. ReadStationItemContents.Add("32", "Slot pitch(Rigth elbow,Blade1)");
  168. ReadStationItemContents.Add("33", "Slot pitch(Right elbow,Blade2)");
  169. ResetPropertiesAndResponses();
  170. RegisterSpecialData();
  171. //RegisterAlarm();
  172. }
  173. private void RegisterAlarm()
  174. {
  175. EV.Subscribe(new EventItem("Alarm", "RobotError020", $"{Name} Error:Robot Occurred Error:Secondary power off.", EventLevel.Alarm, EventType.EventUI_Notify));
  176. EV.Subscribe(new EventItem("Alarm", "RobotError021", $"{Name} Error:Robot Occurred Error:Secondary power on.", EventLevel.Alarm, EventType.EventUI_Notify));
  177. EV.Subscribe(new EventItem("Alarm", "RobotError040", $"{Name} Error:Robot Occurred Error:In TEACH Mode.", EventLevel.Alarm, EventType.EventUI_Notify));
  178. EV.Subscribe(new EventItem("Alarm", "RobotError050", $"{Name} Error:Robot Occurred Error:Unit is in motion.", EventLevel.Alarm, EventType.EventUI_Notify));
  179. EV.Subscribe(new EventItem("Alarm", "RobotError051", $"{Name} Error:Robot Occurred Error:Unable to set pitch between slots.", EventLevel.Alarm, EventType.EventUI_Notify));
  180. EV.Subscribe(new EventItem("Alarm", "RobotError052", $"{Name} Error:Robot Occurred Error:Unable to restart motion.", EventLevel.Alarm, EventType.EventUI_Notify));
  181. EV.Subscribe(new EventItem("Alarm", "RobotError053", $"{Name} Error:Robot Occurred Error:Ready position move incomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  182. EV.Subscribe(new EventItem("Alarm", "RobotError054", $"{Name} Error:Robot Occurred Error:Alignment Ready position move incomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  183. EV.Subscribe(new EventItem("Alarm", "RobotError055", $"{Name} Error:Robot Occurred Error:Improper station type.", EventLevel.Alarm, EventType.EventUI_Notify));
  184. EV.Subscribe(new EventItem("Alarm", "RobotError058", $"{Name} Error:Robot Occurred Error:Command not supported 1-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  185. EV.Subscribe(new EventItem("Alarm", "RobotError059", $"{Name} Error:Robot Occurred Error:Invalid transfer point.", EventLevel.Alarm, EventType.EventUI_Notify));
  186. EV.Subscribe(new EventItem("Alarm", "RobotError05A", $"{Name} Error:Robot Occurred Error:Linear motion failed.", EventLevel.Alarm, EventType.EventUI_Notify));
  187. EV.Subscribe(new EventItem("Alarm", "RobotError05C", $"{Name} Error:Robot Occurred Error:Unable to reference wafer alignment result.", EventLevel.Alarm, EventType.EventUI_Notify));
  188. EV.Subscribe(new EventItem("Alarm", "RobotError05d", $"{Name} Error:Robot Occurred Error:Unable to perform arm calibration.", EventLevel.Alarm, EventType.EventUI_Notify));
  189. EV.Subscribe(new EventItem("Alarm", "RobotError05E", $"{Name} Error:Robot Occurred Error:Unable to read mapping data.", EventLevel.Alarm, EventType.EventUI_Notify));
  190. EV.Subscribe(new EventItem("Alarm", "RobotError05F", $"{Name} Error:Robot Occurred Error:Data Upload/Download in progress.", EventLevel.Alarm, EventType.EventUI_Notify));
  191. EV.Subscribe(new EventItem("Alarm", "RobotError061", $"{Name} Error:Robot Occurred Error:Unable to motion.", EventLevel.Alarm, EventType.EventUI_Notify));
  192. EV.Subscribe(new EventItem("Alarm", "RobotError064", $"{Name} Error:Robot Occurred Error:Lifter interference error.", EventLevel.Alarm, EventType.EventUI_Notify));
  193. EV.Subscribe(new EventItem("Alarm", "RobotError070", $"{Name} Error:Robot Occurred Error:Bottom slot position record incomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  194. EV.Subscribe(new EventItem("Alarm", "RobotError071", $"{Name} Error:Robot Occurred Error:Top slot position record incomplete.", EventLevel.Alarm, EventType.EventUI_Notify));
  195. EV.Subscribe(new EventItem("Alarm", "RobotError088", $"{Name} Error:Robot Occurred Error:Position generating error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  196. EV.Subscribe(new EventItem("Alarm", "RobotError089", $"{Name} Error:Robot Occurred Error:Position generating error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  197. EV.Subscribe(new EventItem("Alarm", "RobotError08A", $"{Name} Error:Robot Occurred Error:Position generating error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  198. EV.Subscribe(new EventItem("Alarm", "RobotError08b", $"{Name} Error:Robot Occurred Error:Position generating error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  199. EV.Subscribe(new EventItem("Alarm", "RobotError08C", $"{Name} Error:Robot Occurred Error:Position generating error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  200. EV.Subscribe(new EventItem("Alarm", "RobotError08d", $"{Name} Error:Robot Occurred Error:Position generating error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  201. EV.Subscribe(new EventItem("Alarm", "RobotError090", $"{Name} Error:Robot Occurred Error:Host parameter out of range.", EventLevel.Alarm, EventType.EventUI_Notify));
  202. EV.Subscribe(new EventItem("Alarm", "RobotError0A0", $"{Name} Error:Robot Occurred Error:Alignment motion error.", EventLevel.Alarm, EventType.EventUI_Notify));
  203. EV.Subscribe(new EventItem("Alarm", "RobotError0E0", $"{Name} Error:Robot Occurred Error:Teach position adjustmentoffset amount limit error.", EventLevel.Alarm, EventType.EventUI_Notify));
  204. EV.Subscribe(new EventItem("Alarm", "RobotError0F0", $"{Name} Error:Robot Occurred Error:Voltage drop warning.", EventLevel.Alarm, EventType.EventUI_Notify));
  205. EV.Subscribe(new EventItem("Alarm", "RobotError*06", $"{Name} Error:Robot Occurred Error:Amplifier Type Mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  206. EV.Subscribe(new EventItem("Alarm", "RobotError*07", $"{Name} Error:Robot Occurred Error:Encoder Type Mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  207. EV.Subscribe(new EventItem("Alarm", "RobotError*10", $"{Name} Error:Robot Occurred Error:Overflow Current.", EventLevel.Alarm, EventType.EventUI_Notify));
  208. EV.Subscribe(new EventItem("Alarm", "RobotError*30", $"{Name} Error:Robot Occurred Error:Regeneration Error Detected.", EventLevel.Alarm, EventType.EventUI_Notify));
  209. EV.Subscribe(new EventItem("Alarm", "RobotError*40", $"{Name} Error:Robot Occurred Error:Excess Voltage (converter).", EventLevel.Alarm, EventType.EventUI_Notify));
  210. EV.Subscribe(new EventItem("Alarm", "RobotError*41", $"{Name} Error:Robot Occurred Error:Insufficient Voltage.", EventLevel.Alarm, EventType.EventUI_Notify));
  211. EV.Subscribe(new EventItem("Alarm", "RobotError*45", $"{Name} Error:Robot Occurred Error:Brake circuit error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  212. EV.Subscribe(new EventItem("Alarm", "RobotError*46", $"{Name} Error:Robot Occurred Error:Converter ready signal error.", EventLevel.Alarm, EventType.EventUI_Notify));
  213. EV.Subscribe(new EventItem("Alarm", "RobotError*47", $"{Name} Error:Robot Occurred Error:Input power error.", EventLevel.Alarm, EventType.EventUI_Notify));
  214. EV.Subscribe(new EventItem("Alarm", "RobotError*48", $"{Name} Error:Robot Occurred Error:Converter main circuit chargeerror.", EventLevel.Alarm, EventType.EventUI_Notify));
  215. EV.Subscribe(new EventItem("Alarm", "RobotError*49", $"{Name} Error:Robot Occurred Error:Amplifier ready signal error.", EventLevel.Alarm, EventType.EventUI_Notify));
  216. EV.Subscribe(new EventItem("Alarm", "RobotError*51", $"{Name} Error:Robot Occurred Error:Excessive Speed.", EventLevel.Alarm, EventType.EventUI_Notify));
  217. EV.Subscribe(new EventItem("Alarm", "RobotError*71", $"{Name} Error:Robot Occurred Error:Momentary Overload (Motor).", EventLevel.Alarm, EventType.EventUI_Notify));
  218. EV.Subscribe(new EventItem("Alarm", "RobotError*72", $"{Name} Error:Robot Occurred Error:Continuous Overload (Motor).", EventLevel.Alarm, EventType.EventUI_Notify));
  219. EV.Subscribe(new EventItem("Alarm", "RobotError*78", $"{Name} Error:Robot Occurred Error:Overload (Converter).", EventLevel.Alarm, EventType.EventUI_Notify));
  220. EV.Subscribe(new EventItem("Alarm", "RobotError*7b", $"{Name} Error:Robot Occurred Error:Amplifier overheat.", EventLevel.Alarm, EventType.EventUI_Notify));
  221. EV.Subscribe(new EventItem("Alarm", "RobotError*7C", $"{Name} Error:Robot Occurred Error:Continuous Overload(Amplifier).", EventLevel.Alarm, EventType.EventUI_Notify));
  222. EV.Subscribe(new EventItem("Alarm", "RobotError*7d", $"{Name} Error:Robot Occurred Error:Momentary Overload.", EventLevel.Alarm, EventType.EventUI_Notify));
  223. EV.Subscribe(new EventItem("Alarm", "RobotError*81", $"{Name} Error:Robot Occurred Error:Absolute Encoder Back-upError.", EventLevel.Alarm, EventType.EventUI_Notify));
  224. EV.Subscribe(new EventItem("Alarm", "RobotError*83", $"{Name} Error:Robot Occurred Error:Absolute Encoder Battery.", EventLevel.Alarm, EventType.EventUI_Notify));
  225. EV.Subscribe(new EventItem("Alarm", "RobotError*84", $"{Name} Error:Robot Occurred Error:Encoder Data Error 2-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  226. EV.Subscribe(new EventItem("Alarm", "RobotError*85", $"{Name} Error:Robot Occurred Error:Encoder Excessive Speed.", EventLevel.Alarm, EventType.EventUI_Notify));
  227. EV.Subscribe(new EventItem("Alarm", "RobotError*86", $"{Name} Error:Robot Occurred Error:Encoder Overheat.", EventLevel.Alarm, EventType.EventUI_Notify));
  228. EV.Subscribe(new EventItem("Alarm", "RobotError*88", $"{Name} Error:Robot Occurred Error:Encoder error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  229. EV.Subscribe(new EventItem("Alarm", "RobotError*89", $"{Name} Error:Robot Occurred Error:Encoder Command failed.", EventLevel.Alarm, EventType.EventUI_Notify));
  230. EV.Subscribe(new EventItem("Alarm", "RobotError*8A", $"{Name} Error:Robot Occurred Error:Encoder multi-turn range.", EventLevel.Alarm, EventType.EventUI_Notify));
  231. EV.Subscribe(new EventItem("Alarm", "RobotError*8C", $"{Name} Error:Robot Occurred Error:Encoder Reset not completed.", EventLevel.Alarm, EventType.EventUI_Notify));
  232. EV.Subscribe(new EventItem("Alarm", "RobotError*98", $"{Name} Error:Robot Occurred Error:Servo parameter error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  233. EV.Subscribe(new EventItem("Alarm", "RobotError*9A", $"{Name} Error:Robot Occurred Error:Feedback Over Flow.", EventLevel.Alarm, EventType.EventUI_Notify));
  234. EV.Subscribe(new EventItem("Alarm", "RobotError*b4", $"{Name} Error:Robot Occurred Error:Servo Control Board Failure.", EventLevel.Alarm, EventType.EventUI_Notify));
  235. EV.Subscribe(new EventItem("Alarm", "RobotError*bC", $"{Name} Error:Robot Occurred Error:Encoder error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  236. EV.Subscribe(new EventItem("Alarm", "RobotError*C1", $"{Name} Error:Robot Occurred Error:Motor runaway detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  237. EV.Subscribe(new EventItem("Alarm", "RobotError*C9", $"{Name} Error:Robot Occurred Error:Encoder Communication.", EventLevel.Alarm, EventType.EventUI_Notify));
  238. EV.Subscribe(new EventItem("Alarm", "RobotError*CE", $"{Name} Error:Robot Occurred Error:Encoder error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  239. EV.Subscribe(new EventItem("Alarm", "RobotError*CF", $"{Name} Error:Robot Occurred Error:Encoder error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  240. EV.Subscribe(new EventItem("Alarm", "RobotError*d0", $"{Name} Error:Robot Occurred Error:Position deviation error.", EventLevel.Alarm, EventType.EventUI_Notify));
  241. EV.Subscribe(new EventItem("Alarm", "RobotError*d1", $"{Name} Error:Robot Occurred Error:Position deviation saturation.", EventLevel.Alarm, EventType.EventUI_Notify));
  242. EV.Subscribe(new EventItem("Alarm", "RobotError*d2", $"{Name} Error:Robot Occurred Error:Motor directive position error.", EventLevel.Alarm, EventType.EventUI_Notify));
  243. EV.Subscribe(new EventItem("Alarm", "RobotError*d4", $"{Name} Error:Robot Occurred Error:Servo Tracking Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  244. EV.Subscribe(new EventItem("Alarm", "RobotError*F1", $"{Name} Error:Robot Occurred Error:Phase loss.", EventLevel.Alarm, EventType.EventUI_Notify));
  245. EV.Subscribe(new EventItem("Alarm", "RobotErrorE*1", $"{Name} Error:Robot Occurred Error:Positioning Timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  246. EV.Subscribe(new EventItem("Alarm", "RobotErrorE*d", $"{Name} Error:Robot Occurred Error:Command not supported 1-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  247. EV.Subscribe(new EventItem("Alarm", "RobotErrorE*E", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 1-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  248. EV.Subscribe(new EventItem("Alarm", "RobotErrorE*F", $"{Name} Error:Robot Occurred Error:Servo control board responsetimeout 1..", EventLevel.Alarm, EventType.EventUI_Notify));
  249. EV.Subscribe(new EventItem("Alarm", "RobotError701", $"{Name} Error:Robot Occurred Error:ROM Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  250. EV.Subscribe(new EventItem("Alarm", "RobotError703", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 2-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  251. EV.Subscribe(new EventItem("Alarm", "RobotError704", $"{Name} Error:Robot Occurred Error:Communication Error (internal controller) 2-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  252. EV.Subscribe(new EventItem("Alarm", "RobotError705", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 2-3.", EventLevel.Alarm, EventType.EventUI_Notify));
  253. EV.Subscribe(new EventItem("Alarm", "RobotError706", $"{Name} Error:Robot Occurred Error:Servo system error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  254. EV.Subscribe(new EventItem("Alarm", "RobotError707", $"{Name} Error:Robot Occurred Error:Servo system error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  255. EV.Subscribe(new EventItem("Alarm", "RobotError709", $"{Name} Error:Robot Occurred Error:Current feedback error.", EventLevel.Alarm, EventType.EventUI_Notify));
  256. EV.Subscribe(new EventItem("Alarm", "RobotError70A", $"{Name} Error:Robot Occurred Error:Power Lost.", EventLevel.Alarm, EventType.EventUI_Notify));
  257. EV.Subscribe(new EventItem("Alarm", "RobotError70b", $"{Name} Error:Robot Occurred Error:Rush Current PreventionRelay Abnormal.", EventLevel.Alarm, EventType.EventUI_Notify));
  258. EV.Subscribe(new EventItem("Alarm", "RobotError70C", $"{Name} Error:Robot Occurred Error:Converter mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  259. EV.Subscribe(new EventItem("Alarm", "RobotError70F", $"{Name} Error:Robot Occurred Error:Servo control board response timeout 2..", EventLevel.Alarm, EventType.EventUI_Notify));
  260. EV.Subscribe(new EventItem("Alarm", "RobotError713", $"{Name} Error:Robot Occurred Error:DB error.", EventLevel.Alarm, EventType.EventUI_Notify));
  261. EV.Subscribe(new EventItem("Alarm", "RobotError714", $"{Name} Error:Robot Occurred Error:Converter charge Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  262. EV.Subscribe(new EventItem("Alarm", "RobotError715", $"{Name} Error:Robot Occurred Error:Servo OFF Status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  263. EV.Subscribe(new EventItem("Alarm", "RobotError716", $"{Name} Error:Robot Occurred Error:Servo ON Status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  264. EV.Subscribe(new EventItem("Alarm", "RobotError717", $"{Name} Error:Robot Occurred Error:Servo OFF Status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  265. EV.Subscribe(new EventItem("Alarm", "RobotError718", $"{Name} Error:Robot Occurred Error:Servo ON Status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  266. EV.Subscribe(new EventItem("Alarm", "RobotError719", $"{Name} Error:Robot Occurred Error:Servo On Abnormal.", EventLevel.Alarm, EventType.EventUI_Notify));
  267. EV.Subscribe(new EventItem("Alarm", "RobotError71A", $"{Name} Error:Robot Occurred Error:Brake circuit error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  268. EV.Subscribe(new EventItem("Alarm", "RobotError71b", $"{Name} Error:Robot Occurred Error:Brake circuit error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  269. EV.Subscribe(new EventItem("Alarm", "RobotError71C", $"{Name} Error:Robot Occurred Error:Power relay error.", EventLevel.Alarm, EventType.EventUI_Notify));
  270. EV.Subscribe(new EventItem("Alarm", "RobotError721", $"{Name} Error:Robot Occurred Error:Servo parameter error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  271. EV.Subscribe(new EventItem("Alarm", "RobotError722", $"{Name} Error:Robot Occurred Error:Servo parameter error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  272. EV.Subscribe(new EventItem("Alarm", "RobotError725", $"{Name} Error:Robot Occurred Error:Converter Overheat.", EventLevel.Alarm, EventType.EventUI_Notify));
  273. EV.Subscribe(new EventItem("Alarm", "RobotError726", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 2-4.", EventLevel.Alarm, EventType.EventUI_Notify));
  274. EV.Subscribe(new EventItem("Alarm", "RobotError727", $"{Name} Error:Robot Occurred Error:Command not supported 1-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  275. EV.Subscribe(new EventItem("Alarm", "RobotError728", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 2-5.", EventLevel.Alarm, EventType.EventUI_Notify));
  276. EV.Subscribe(new EventItem("Alarm", "RobotError729", $"{Name} Error:Robot Occurred Error:Servo system error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  277. EV.Subscribe(new EventItem("Alarm", "RobotError72A", $"{Name} Error:Robot Occurred Error:Servo system error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  278. EV.Subscribe(new EventItem("Alarm", "RobotError72b", $"{Name} Error:Robot Occurred Error:Servo parameter error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  279. EV.Subscribe(new EventItem("Alarm", "RobotError730", $"{Name} Error:Robot Occurred Error:Amp module disconnected..", EventLevel.Alarm, EventType.EventUI_Notify));
  280. EV.Subscribe(new EventItem("Alarm", "RobotError732", $"{Name} Error:Robot Occurred Error:Servo parameter error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  281. EV.Subscribe(new EventItem("Alarm", "RobotError733", $"{Name} Error:Robot Occurred Error:Servo parameter error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  282. EV.Subscribe(new EventItem("Alarm", "RobotError734", $"{Name} Error:Robot Occurred Error:Servo parameter error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  283. EV.Subscribe(new EventItem("Alarm", "RobotError735", $"{Name} Error:Robot Occurred Error:Servo parameter error 8.", EventLevel.Alarm, EventType.EventUI_Notify));
  284. EV.Subscribe(new EventItem("Alarm", "RobotError73F", $"{Name} Error:Robot Occurred Error:Undefined Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  285. EV.Subscribe(new EventItem("Alarm", "RobotError740", $"{Name} Error:Robot Occurred Error:Encoder Status Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  286. EV.Subscribe(new EventItem("Alarm", "RobotError741", $"{Name} Error:Robot Occurred Error:Servo system error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  287. EV.Subscribe(new EventItem("Alarm", "RobotError742", $"{Name} Error:Robot Occurred Error:Servo system error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  288. EV.Subscribe(new EventItem("Alarm", "RobotError743", $"{Name} Error:Robot Occurred Error:Servo system error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  289. EV.Subscribe(new EventItem("Alarm", "RobotError744", $"{Name} Error:Robot Occurred Error:Servo system error 8.", EventLevel.Alarm, EventType.EventUI_Notify));
  290. EV.Subscribe(new EventItem("Alarm", "RobotError745", $"{Name} Error:Robot Occurred Error:Servo system error 9.", EventLevel.Alarm, EventType.EventUI_Notify));
  291. EV.Subscribe(new EventItem("Alarm", "RobotError746", $"{Name} Error:Robot Occurred Error:Servo system error 10.", EventLevel.Alarm, EventType.EventUI_Notify));
  292. EV.Subscribe(new EventItem("Alarm", "RobotError74A", $"{Name} Error:Robot Occurred Error:Servo system error 11.", EventLevel.Alarm, EventType.EventUI_Notify));
  293. EV.Subscribe(new EventItem("Alarm", "RobotError74b", $"{Name} Error:Robot Occurred Error:Servo system error 12.", EventLevel.Alarm, EventType.EventUI_Notify));
  294. EV.Subscribe(new EventItem("Alarm", "RobotError74C", $"{Name} Error:Robot Occurred Error:Servo system error 13.", EventLevel.Alarm, EventType.EventUI_Notify));
  295. EV.Subscribe(new EventItem("Alarm", "RobotError74d", $"{Name} Error:Robot Occurred Error:Servo system error 14.", EventLevel.Alarm, EventType.EventUI_Notify));
  296. EV.Subscribe(new EventItem("Alarm", "RobotError7A0", $"{Name} Error:Robot Occurred Error:Communication Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  297. EV.Subscribe(new EventItem("Alarm", "RobotError7A1", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 3-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  298. EV.Subscribe(new EventItem("Alarm", "RobotError7A2", $"{Name} Error:Robot Occurred Error:Command not supported 3-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  299. EV.Subscribe(new EventItem("Alarm", "RobotError7A3", $"{Name} Error:Robot Occurred Error:Data buffer full.", EventLevel.Alarm, EventType.EventUI_Notify));
  300. EV.Subscribe(new EventItem("Alarm", "RobotError7A4", $"{Name} Error:Robot Occurred Error:Command not supported 3-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  301. EV.Subscribe(new EventItem("Alarm", "RobotError7A5", $"{Name} Error:Robot Occurred Error:Encoder data error 3-1.", EventLevel.Alarm, EventType.EventUI_Notify));
  302. EV.Subscribe(new EventItem("Alarm", "RobotError7A6", $"{Name} Error:Robot Occurred Error:Command not supported 3-3.", EventLevel.Alarm, EventType.EventUI_Notify));
  303. EV.Subscribe(new EventItem("Alarm", "RobotError7AE", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 1-2.", EventLevel.Alarm, EventType.EventUI_Notify));
  304. EV.Subscribe(new EventItem("Alarm", "RobotError7AF", $"{Name} Error:Robot Occurred Error:Communication Error(internal controller) 1-3.", EventLevel.Alarm, EventType.EventUI_Notify));
  305. EV.Subscribe(new EventItem("Alarm", "RobotError7b0", $"{Name} Error:Robot Occurred Error:CCD sensor abnormal 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  306. EV.Subscribe(new EventItem("Alarm", "RobotError7b4", $"{Name} Error:Robot Occurred Error:CCD sensor abnormal 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  307. EV.Subscribe(new EventItem("Alarm", "RobotError7b5", $"{Name} Error:Robot Occurred Error:CCD sensor abnormal 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  308. EV.Subscribe(new EventItem("Alarm", "RobotError7C0", $"{Name} Error:Robot Occurred Error:PAIF board Failure 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  309. EV.Subscribe(new EventItem("Alarm", "RobotError7C1", $"{Name} Error:Robot Occurred Error:PAIF board Failure 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  310. EV.Subscribe(new EventItem("Alarm", "RobotError7C2", $"{Name} Error:Robot Occurred Error:PAIF board Failure 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  311. EV.Subscribe(new EventItem("Alarm", "RobotError7C3", $"{Name} Error:Robot Occurred Error:CCD sensor abnormal 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  312. EV.Subscribe(new EventItem("Alarm", "RobotError7CF", $"{Name} Error:Robot Occurred Error:PAIF board disconnected.", EventLevel.Alarm, EventType.EventUI_Notify));
  313. EV.Subscribe(new EventItem("Alarm", "RobotError7d0", $"{Name} Error:Robot Occurred Error:PAIF board Failure 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  314. EV.Subscribe(new EventItem("Alarm", "RobotError7d1", $"{Name} Error:Robot Occurred Error:PAIF board Failure 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  315. EV.Subscribe(new EventItem("Alarm", "RobotError", $"{Name} Error:Robot Occurred Error:.", EventLevel.Alarm, EventType.EventUI_Notify));
  316. EV.Subscribe(new EventItem("Alarm", "RobotError900", $"{Name} Error:Robot Occurred Error:Character Interval Timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  317. EV.Subscribe(new EventItem("Alarm", "RobotError910", $"{Name} Error:Robot Occurred Error:Received Data ChecksumError.", EventLevel.Alarm, EventType.EventUI_Notify));
  318. EV.Subscribe(new EventItem("Alarm", "RobotError920", $"{Name} Error:Robot Occurred Error:Unit Number Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  319. EV.Subscribe(new EventItem("Alarm", "RobotError930", $"{Name} Error:Robot Occurred Error:Undefined CommandReceived.", EventLevel.Alarm, EventType.EventUI_Notify));
  320. EV.Subscribe(new EventItem("Alarm", "RobotError940", $"{Name} Error:Robot Occurred Error:Message Parameter Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  321. EV.Subscribe(new EventItem("Alarm", "RobotError950", $"{Name} Error:Robot Occurred Error:Receiving Time-out Error for Confirmation of Execution Completion.", EventLevel.Alarm, EventType.EventUI_Notify));
  322. EV.Subscribe(new EventItem("Alarm", "RobotError960", $"{Name} Error:Robot Occurred Error:Incorrect sequence number.", EventLevel.Alarm, EventType.EventUI_Notify));
  323. EV.Subscribe(new EventItem("Alarm", "RobotError961", $"{Name} Error:Robot Occurred Error:Duplicated message.", EventLevel.Alarm, EventType.EventUI_Notify));
  324. EV.Subscribe(new EventItem("Alarm", "RobotError970", $"{Name} Error:Robot Occurred Error:Delimiter error.", EventLevel.Alarm, EventType.EventUI_Notify));
  325. EV.Subscribe(new EventItem("Alarm", "RobotError9A1", $"{Name} Error:Robot Occurred Error:Message buffer overflow.", EventLevel.Alarm, EventType.EventUI_Notify));
  326. EV.Subscribe(new EventItem("Alarm", "RobotError9C0", $"{Name} Error:Robot Occurred Error:LAN device setting error.", EventLevel.Alarm, EventType.EventUI_Notify));
  327. EV.Subscribe(new EventItem("Alarm", "RobotError9C1", $"{Name} Error:Robot Occurred Error:IP address error.", EventLevel.Alarm, EventType.EventUI_Notify));
  328. EV.Subscribe(new EventItem("Alarm", "RobotError9C2", $"{Name} Error:Robot Occurred Error:Subnet mask error.", EventLevel.Alarm, EventType.EventUI_Notify));
  329. EV.Subscribe(new EventItem("Alarm", "RobotError9C3", $"{Name} Error:Robot Occurred Error:Default gateway error.", EventLevel.Alarm, EventType.EventUI_Notify));
  330. EV.Subscribe(new EventItem("Alarm", "RobotError9d0", $"{Name} Error:Robot Occurred Error:Ethernet receive error.", EventLevel.Alarm, EventType.EventUI_Notify));
  331. EV.Subscribe(new EventItem("Alarm", "RobotError9E0", $"{Name} Error:Robot Occurred Error:During operation themaintenance tool.", EventLevel.Alarm, EventType.EventUI_Notify));
  332. EV.Subscribe(new EventItem("Alarm", "RobotError9E1", $"{Name} Error:Robot Occurred Error:The data abnormal.", EventLevel.Alarm, EventType.EventUI_Notify));
  333. EV.Subscribe(new EventItem("Alarm", "RobotErrorA01", $"{Name} Error:Robot Occurred Error:Re-detection of a powerSupply voltage fall.", EventLevel.Alarm, EventType.EventUI_Notify));
  334. EV.Subscribe(new EventItem("Alarm", "RobotErrorA10", $"{Name} Error:Robot Occurred Error:External emergency stop.", EventLevel.Alarm, EventType.EventUI_Notify));
  335. EV.Subscribe(new EventItem("Alarm", "RobotErrorA20", $"{Name} Error:Robot Occurred Error:T.P emergency stop.", EventLevel.Alarm, EventType.EventUI_Notify));
  336. EV.Subscribe(new EventItem("Alarm", "RobotErrorA21", $"{Name} Error:Robot Occurred Error:Interlock board failure 0.", EventLevel.Alarm, EventType.EventUI_Notify));
  337. EV.Subscribe(new EventItem("Alarm", "RobotErrorA30", $"{Name} Error:Robot Occurred Error:Emergency stop.", EventLevel.Alarm, EventType.EventUI_Notify));
  338. EV.Subscribe(new EventItem("Alarm", "RobotErrorA40", $"{Name} Error:Robot Occurred Error:Controller Fan 1 Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  339. EV.Subscribe(new EventItem("Alarm", "RobotErrorA41", $"{Name} Error:Robot Occurred Error:Controller Fan 2 Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  340. EV.Subscribe(new EventItem("Alarm", "RobotErrorA42", $"{Name} Error:Robot Occurred Error:Controller Fan 3 Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  341. EV.Subscribe(new EventItem("Alarm", "RobotErrorA45", $"{Name} Error:Robot Occurred Error:Unit fan 1 error.", EventLevel.Alarm, EventType.EventUI_Notify));
  342. EV.Subscribe(new EventItem("Alarm", "RobotErrorA46", $"{Name} Error:Robot Occurred Error:Unit fan 2 error.", EventLevel.Alarm, EventType.EventUI_Notify));
  343. EV.Subscribe(new EventItem("Alarm", "RobotErrorA4F", $"{Name} Error:Robot Occurred Error:Controller Battery Alarm.", EventLevel.Alarm, EventType.EventUI_Notify));
  344. EV.Subscribe(new EventItem("Alarm", "RobotErrorAC0", $"{Name} Error:Robot Occurred Error:Safety fence signal detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  345. EV.Subscribe(new EventItem("Alarm", "RobotErrorAC9", $"{Name} Error:Robot Occurred Error:Protection stop signal.", EventLevel.Alarm, EventType.EventUI_Notify));
  346. EV.Subscribe(new EventItem("Alarm", "RobotErrorAE0", $"{Name} Error:Robot Occurred Error:HOST Mode Switching error.", EventLevel.Alarm, EventType.EventUI_Notify));
  347. EV.Subscribe(new EventItem("Alarm", "RobotErrorAE1", $"{Name} Error:Robot Occurred Error:TEACH Mode Switching Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  348. EV.Subscribe(new EventItem("Alarm", "RobotErrorAE8", $"{Name} Error:Robot Occurred Error:Deadman switch error.", EventLevel.Alarm, EventType.EventUI_Notify));
  349. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF0", $"{Name} Error:Robot Occurred Error:Interlock board failure 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  350. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF1", $"{Name} Error:Robot Occurred Error:Interlock board failure 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  351. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF2", $"{Name} Error:Robot Occurred Error:Interlock board failure 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  352. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF3", $"{Name} Error:Robot Occurred Error:Interlock board failure 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  353. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF4", $"{Name} Error:Robot Occurred Error:Interlock board failure 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  354. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF5", $"{Name} Error:Robot Occurred Error:Interlock board failure 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  355. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF6", $"{Name} Error:Robot Occurred Error:Interlock board failure 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  356. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF8", $"{Name} Error:Robot Occurred Error:Input compare error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  357. EV.Subscribe(new EventItem("Alarm", "RobotErrorAF9", $"{Name} Error:Robot Occurred Error:Input compare error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  358. EV.Subscribe(new EventItem("Alarm", "RobotErrorAFA", $"{Name} Error:Robot Occurred Error:Input compare error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  359. EV.Subscribe(new EventItem("Alarm", "RobotErrorAFb", $"{Name} Error:Robot Occurred Error:Input compare error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  360. EV.Subscribe(new EventItem("Alarm", "RobotErrorAFC", $"{Name} Error:Robot Occurred Error:Input compare error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  361. EV.Subscribe(new EventItem("Alarm", "RobotErrorAFd", $"{Name} Error:Robot Occurred Error:Input compare error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  362. EV.Subscribe(new EventItem("Alarm", "RobotErrorAFE", $"{Name} Error:Robot Occurred Error:Input compare error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  363. EV.Subscribe(new EventItem("Alarm", "RobotErrorAFF", $"{Name} Error:Robot Occurred Error:Input compare error 8.", EventLevel.Alarm, EventType.EventUI_Notify));
  364. EV.Subscribe(new EventItem("Alarm", "RobotErrorb10", $"{Name} Error:Robot Occurred Error:Axis-1 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  365. EV.Subscribe(new EventItem("Alarm", "RobotErrorb11", $"{Name} Error:Robot Occurred Error:Axis-2 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  366. EV.Subscribe(new EventItem("Alarm", "RobotErrorb12", $"{Name} Error:Robot Occurred Error:Axis-3 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  367. EV.Subscribe(new EventItem("Alarm", "RobotErrorb13", $"{Name} Error:Robot Occurred Error:Axis-4 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  368. EV.Subscribe(new EventItem("Alarm", "RobotErrorb14", $"{Name} Error:Robot Occurred Error:Axis-5 Speed Limit Detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  369. EV.Subscribe(new EventItem("Alarm", "RobotErrorb20", $"{Name} Error:Robot Occurred Error:Axis-1 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  370. EV.Subscribe(new EventItem("Alarm", "RobotErrorb21", $"{Name} Error:Robot Occurred Error:Axis-2 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  371. EV.Subscribe(new EventItem("Alarm", "RobotErrorb22", $"{Name} Error:Robot Occurred Error:Axis-3 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  372. EV.Subscribe(new EventItem("Alarm", "RobotErrorb23", $"{Name} Error:Robot Occurred Error:Axis-4 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  373. EV.Subscribe(new EventItem("Alarm", "RobotErrorb24", $"{Name} Error:Robot Occurred Error:Axis-5 Positive (+) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  374. EV.Subscribe(new EventItem("Alarm", "RobotErrorb28", $"{Name} Error:Robot Occurred Error:Axis-1 Positive (+) Direction Software-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  375. EV.Subscribe(new EventItem("Alarm", "RobotErrorb29", $"{Name} Error:Robot Occurred Error:Axis-2 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  376. EV.Subscribe(new EventItem("Alarm", "RobotErrorb2A", $"{Name} Error:Robot Occurred Error:Axis-3 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  377. EV.Subscribe(new EventItem("Alarm", "RobotErrorb2b", $"{Name} Error:Robot Occurred Error:Axis-4 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  378. EV.Subscribe(new EventItem("Alarm", "RobotErrorb2C", $"{Name} Error:Robot Occurred Error:Axis-5 Positive (+) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  379. EV.Subscribe(new EventItem("Alarm", "RobotErrorb30", $"{Name} Error:Robot Occurred Error:Axis-1 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  380. EV.Subscribe(new EventItem("Alarm", "RobotErrorb31", $"{Name} Error:Robot Occurred Error:Axis-2 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  381. EV.Subscribe(new EventItem("Alarm", "RobotErrorb32", $"{Name} Error:Robot Occurred Error:Axis-3 Negative (-) Direction Software-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  382. EV.Subscribe(new EventItem("Alarm", "RobotErrorb33", $"{Name} Error:Robot Occurred Error:Axis-4 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  383. EV.Subscribe(new EventItem("Alarm", "RobotErrorb34", $"{Name} Error:Robot Occurred Error:Axis-5 Negative (-) DirectionSoftware-limit Detection 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  384. EV.Subscribe(new EventItem("Alarm", "RobotErrorb38", $"{Name} Error:Robot Occurred Error:Axis-1 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  385. EV.Subscribe(new EventItem("Alarm", "RobotErrorb39", $"{Name} Error:Robot Occurred Error:Axis-2 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  386. EV.Subscribe(new EventItem("Alarm", "RobotErrorb3A", $"{Name} Error:Robot Occurred Error:Axis-3 Negative (-) Direction Software-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  387. EV.Subscribe(new EventItem("Alarm", "RobotErrorb3b", $"{Name} Error:Robot Occurred Error:Axis-4 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  388. EV.Subscribe(new EventItem("Alarm", "RobotErrorb3C", $"{Name} Error:Robot Occurred Error:Axis-5 Negative (-) DirectionSoftware-limit Detection 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  389. EV.Subscribe(new EventItem("Alarm", "RobotErrorb40", $"{Name} Error:Robot Occurred Error:Access Permission Signal 1Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  390. EV.Subscribe(new EventItem("Alarm", "RobotErrorb41", $"{Name} Error:Robot Occurred Error:Access Permission Signal 2Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  391. EV.Subscribe(new EventItem("Alarm", "RobotErrorb42", $"{Name} Error:Robot Occurred Error:Access Permission Signal 3Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  392. EV.Subscribe(new EventItem("Alarm", "RobotErrorb43", $"{Name} Error:Robot Occurred Error:Access Permission Signal 4Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  393. EV.Subscribe(new EventItem("Alarm", "RobotErrorb44", $"{Name} Error:Robot Occurred Error:Access Permission Signal 5 Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  394. EV.Subscribe(new EventItem("Alarm", "RobotErrorb45", $"{Name} Error:Robot Occurred Error:Access Permission Signal 6Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  395. EV.Subscribe(new EventItem("Alarm", "RobotErrorb46", $"{Name} Error:Robot Occurred Error:Access Permission Signal 7Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  396. EV.Subscribe(new EventItem("Alarm", "RobotErrorb47", $"{Name} Error:Robot Occurred Error:Access Permission Signal 8Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  397. EV.Subscribe(new EventItem("Alarm", "RobotErrorb48", $"{Name} Error:Robot Occurred Error:Access Permission Signal 9Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  398. EV.Subscribe(new EventItem("Alarm", "RobotErrorb49", $"{Name} Error:Robot Occurred Error:Access Permission Signal 10 Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  399. EV.Subscribe(new EventItem("Alarm", "RobotErrorb4A", $"{Name} Error:Robot Occurred Error:Access Permission Signal 11Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  400. EV.Subscribe(new EventItem("Alarm", "RobotErrorb4b", $"{Name} Error:Robot Occurred Error:Access Permission Signal 12Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  401. EV.Subscribe(new EventItem("Alarm", "RobotErrorb4C", $"{Name} Error:Robot Occurred Error:Access Permission Signal 13Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  402. EV.Subscribe(new EventItem("Alarm", "RobotErrorb4d", $"{Name} Error:Robot Occurred Error:Access Permission Signal 14Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  403. EV.Subscribe(new EventItem("Alarm", "RobotErrorb4E", $"{Name} Error:Robot Occurred Error:Access Permission Signal 15Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  404. EV.Subscribe(new EventItem("Alarm", "RobotErrorb4F", $"{Name} Error:Robot Occurred Error:Access Permission Signal 16Time-out Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  405. EV.Subscribe(new EventItem("Alarm", "RobotErrorb60", $"{Name} Error:Robot Occurred Error:Access Permission to P/A Stage Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  406. EV.Subscribe(new EventItem("Alarm", "RobotErrorb61", $"{Name} Error:Robot Occurred Error:Access Permission to P/AStage Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  407. EV.Subscribe(new EventItem("Alarm", "RobotErrorb62", $"{Name} Error:Robot Occurred Error:Access Permission to P/A Stage Time-out Error 3.", EventLevel.Alarm, EventType.EventUI_Notify));
  408. EV.Subscribe(new EventItem("Alarm", "RobotErrorb63", $"{Name} Error:Robot Occurred Error:Access Permission to P/A Stage Time-out Error 4.", EventLevel.Alarm, EventType.EventUI_Notify));
  409. EV.Subscribe(new EventItem("Alarm", "RobotErrorb64", $"{Name} Error:Robot Occurred Error:Access Permission to P/AStage Time-out Error 5.", EventLevel.Alarm, EventType.EventUI_Notify));
  410. EV.Subscribe(new EventItem("Alarm", "RobotErrorb65", $"{Name} Error:Robot Occurred Error:Access Permission to P/AStage Time-out Error 6.", EventLevel.Alarm, EventType.EventUI_Notify));
  411. EV.Subscribe(new EventItem("Alarm", "RobotErrorb66", $"{Name} Error:Robot Occurred Error:Access Permission to P/AStage Time-out Error 7.", EventLevel.Alarm, EventType.EventUI_Notify));
  412. EV.Subscribe(new EventItem("Alarm", "RobotErrorb68", $"{Name} Error:Robot Occurred Error:P/A motion permission timeout error.", EventLevel.Alarm, EventType.EventUI_Notify));
  413. EV.Subscribe(new EventItem("Alarm", "RobotErrorb70", $"{Name} Error:Robot Occurred Error:SS signal detection.", EventLevel.Alarm, EventType.EventUI_Notify));
  414. EV.Subscribe(new EventItem("Alarm", "RobotErrorb80", $"{Name} Error:Robot Occurred Error:Fork 1/Pre-aligner: Wafer Presence Confirmation Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  415. EV.Subscribe(new EventItem("Alarm", "RobotErrorb81", $"{Name} Error:Robot Occurred Error:Fork 1/Pre-aligner: WaferAbsence Confirmation Time- out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  416. EV.Subscribe(new EventItem("Alarm", "RobotErrorb82", $"{Name} Error:Robot Occurred Error:Fork 1/Pre-aligner: Wafer Presence Confirmation Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  417. EV.Subscribe(new EventItem("Alarm", "RobotErrorb83", $"{Name} Error:Robot Occurred Error:Fork 1/Pre-aligner: WaferAbsence Confirmation Time- out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  418. EV.Subscribe(new EventItem("Alarm", "RobotErrorb88", $"{Name} Error:Robot Occurred Error:Grip sensor Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  419. EV.Subscribe(new EventItem("Alarm", "RobotErrorb89", $"{Name} Error:Robot Occurred Error:Grip sensor Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  420. EV.Subscribe(new EventItem("Alarm", "RobotErrorb8A", $"{Name} Error:Robot Occurred Error:UnGrip sensor Time-out Error1.", EventLevel.Alarm, EventType.EventUI_Notify));
  421. EV.Subscribe(new EventItem("Alarm", "RobotErrorb8b", $"{Name} Error:Robot Occurred Error:UnGrip sensor Time-out Error2.", EventLevel.Alarm, EventType.EventUI_Notify));
  422. EV.Subscribe(new EventItem("Alarm", "RobotErrorb8F", $"{Name} Error:Robot Occurred Error:Fork 1: Plunger non-operationerror.", EventLevel.Alarm, EventType.EventUI_Notify));
  423. EV.Subscribe(new EventItem("Alarm", "RobotErrorb90", $"{Name} Error:Robot Occurred Error:Fork 2: Wafer Presence Confirmation Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  424. EV.Subscribe(new EventItem("Alarm", "RobotErrorb91", $"{Name} Error:Robot Occurred Error:Fork 2: Wafer AbsenceConfirmation Time-out Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  425. EV.Subscribe(new EventItem("Alarm", "RobotErrorb92", $"{Name} Error:Robot Occurred Error:Fork 2: Wafer PresenceConfirmation Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  426. EV.Subscribe(new EventItem("Alarm", "RobotErrorb93", $"{Name} Error:Robot Occurred Error:Fork 2: Wafer AbsenceConfirmation Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  427. EV.Subscribe(new EventItem("Alarm", "RobotErrorb98", $"{Name} Error:Robot Occurred Error:Lifter up sensor Time-outError 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  428. EV.Subscribe(new EventItem("Alarm", "RobotErrorb99", $"{Name} Error:Robot Occurred Error:Lifter up sensor Time-out Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  429. EV.Subscribe(new EventItem("Alarm", "RobotErrorb9A", $"{Name} Error:Robot Occurred Error:Lifter down sensor Time-outError 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  430. EV.Subscribe(new EventItem("Alarm", "RobotErrorb9b", $"{Name} Error:Robot Occurred Error:Lifter down sensor Time-outError 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  431. EV.Subscribe(new EventItem("Alarm", "RobotErrorb9F", $"{Name} Error:Robot Occurred Error:Fork 2: Plunger non-operationerror.", EventLevel.Alarm, EventType.EventUI_Notify));
  432. EV.Subscribe(new EventItem("Alarm", "RobotErrorbA0", $"{Name} Error:Robot Occurred Error:Fork 1/Pre-aligner: WaferAbsence Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  433. EV.Subscribe(new EventItem("Alarm", "RobotErrorbA1", $"{Name} Error:Robot Occurred Error:Fork 1: Sensor StatusMismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  434. EV.Subscribe(new EventItem("Alarm", "RobotErrorbA8", $"{Name} Error:Robot Occurred Error:Grip sensor status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  435. EV.Subscribe(new EventItem("Alarm", "RobotErrorbA9", $"{Name} Error:Robot Occurred Error:Grip sensor status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  436. EV.Subscribe(new EventItem("Alarm", "RobotErrorbAA", $"{Name} Error:Robot Occurred Error:Ungrip sensor status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  437. EV.Subscribe(new EventItem("Alarm", "RobotErrorbAb", $"{Name} Error:Robot Occurred Error:Ungrip sensor status Error 2.", EventLevel.Alarm, EventType.EventUI_Notify));
  438. EV.Subscribe(new EventItem("Alarm", "RobotErrorbAC", $"{Name} Error:Robot Occurred Error:Grip sensor status mismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  439. EV.Subscribe(new EventItem("Alarm", "RobotErrorbAd", $"{Name} Error:Robot Occurred Error:Lifter/Grip sensor statusmismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  440. EV.Subscribe(new EventItem("Alarm", "RobotErrorbb0", $"{Name} Error:Robot Occurred Error:Fork 2: Wafer Absence Error.", EventLevel.Alarm, EventType.EventUI_Notify));
  441. EV.Subscribe(new EventItem("Alarm", "RobotErrorbb1", $"{Name} Error:Robot Occurred Error:Fork 2: Sensor StatusMismatch.", EventLevel.Alarm, EventType.EventUI_Notify));
  442. EV.Subscribe(new EventItem("Alarm", "RobotErrorbb8", $"{Name} Error:Robot Occurred Error:Lifter up sensor status Error 1.", EventLevel.Alarm, EventType.EventUI_Notify));
  443. }
  444. public void NotifyAlarmByErrorCode(string errorcode)
  445. {
  446. EV.Notify($"{Name}Error{errorcode}");
  447. }
  448. private void _diTPinUse_OnSignalChanged(IoSensor arg1, bool arg2)
  449. {
  450. SetMaintenanceMode(!arg1.Value);
  451. }
  452. private void _diRobotError_OnSignalChanged(IoSensor arg1, bool arg2)
  453. {
  454. if (arg1.Value == false)
  455. {
  456. lock (_locker)
  457. {
  458. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RSTS"));
  459. }
  460. OnError("RobotError");
  461. }
  462. }
  463. private void ResetPropertiesAndResponses()
  464. {
  465. }
  466. private void RegisterSpecialData()
  467. {
  468. DATA.Subscribe($"{Module}.{Name}.CurrentArm1Position", () => CurrentArm1Position);
  469. DATA.Subscribe($"{Module}.{Name}.CurrentArm2Position", () => CurrentArm2Position);
  470. DATA.Subscribe($"{Module}.{Name}.CurrentExtensionPosition", () => CurrentExtensionPosition);
  471. DATA.Subscribe($"{Module}.{Name}.CurrentThetaPosition", () => CurrentThetaPosition);
  472. DATA.Subscribe($"{Module}.{Name}.CurrentZPosition", () => CurrentZPosition);
  473. DATA.Subscribe($"{Module}.{Name}.IsManipulatorBatteryLow", () => IsManipulatorBatteryLow);
  474. DATA.Subscribe($"{Module}.{Name}.IsCommandExecutionReady", () => IsCommandExecutionReady);
  475. DATA.Subscribe($"{Module}.{Name}.IsServoON", () => IsServoON);
  476. DATA.Subscribe($"{Module}.{Name}.IsErrorOccurred", () => IsErrorOccurred);
  477. DATA.Subscribe($"{Module}.{Name}.IsControllerBatteryLow", () => IsControllerBatteryLow);
  478. DATA.Subscribe($"{Module}.{Name}.IsWaferPresenceOnBlade1", () => IsWaferPresenceOnBlade1);
  479. DATA.Subscribe($"{Module}.{Name}.IsWaferPresenceOnBlade2", () => IsWaferPresenceOnBlade2);
  480. DATA.Subscribe($"{Module}.{Name}.ErrorCode", () => ErrorCode);
  481. DATA.Subscribe($"{Module}.{Name}.IsGrippedBlade1", () => IsGrippedBlade1);
  482. DATA.Subscribe($"{Module}.{Name}.IsGrippedBlade2", () => IsGrippedBlade2);
  483. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock1", () => IsPermittedInterlock1);
  484. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock2", () => IsPermittedInterlock2);
  485. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock3", () => IsPermittedInterlock3);
  486. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock4", () => IsPermittedInterlock4);
  487. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock5", () => IsPermittedInterlock5);
  488. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock6", () => IsPermittedInterlock6);
  489. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock7", () => IsPermittedInterlock7);
  490. DATA.Subscribe($"{Module}.{Name}.IsPermittedInterlock8", () => IsPermittedInterlock8);
  491. DATA.Subscribe($"{Module}.{Name}.RobotSpeed", () => SpeedLevelSetting.ToString());
  492. DATA.Subscribe($"{Name}.RobotSpeed", () =>
  493. {
  494. if (SpeedLevelSetting == 1) return "Fast";
  495. if (SpeedLevelSetting == 2) return "Medium";
  496. if (SpeedLevelSetting == 3) return "Slow";
  497. return SpeedLevelSetting.ToString();
  498. });
  499. OP.Subscribe("SetSpeed", InvokeSetSpeed);
  500. }
  501. protected virtual bool OnTimer()
  502. {
  503. try
  504. {
  505. if (!_connection.IsConnected || _connection.IsCommunicationError)
  506. {
  507. lock (_locker)
  508. {
  509. _lstHandlers.Clear();
  510. }
  511. _trigRetryConnect.CLK = !_connection.IsConnected;
  512. if (_trigRetryConnect.Q)
  513. {
  514. if (!_connection.Connect())
  515. {
  516. EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
  517. }
  518. else
  519. {
  520. //_lstHandler.AddLast(new RobotHirataR4QueryPinHandler(this, _deviceAddress));
  521. //_lstHandler.AddLast(new RobotHirataR4SetCommModeHandler(this, _deviceAddress, EnumRfPowerCommunicationMode.Host));
  522. }
  523. }
  524. return true;
  525. }
  526. HandlerBase handler = null;
  527. lock (_locker)
  528. {
  529. while (_lstHandlers.Count > 0 || _connection.IsBusy)
  530. {
  531. if (!_connection.IsBusy)
  532. {
  533. if (_lstHandlers.Count > 0)
  534. {
  535. handler = _lstHandlers.First.Value;
  536. ExecuteHandler(handler);
  537. _lstHandlers.RemoveFirst();
  538. }
  539. }
  540. else
  541. {
  542. _connection.MonitorTimeout();
  543. _trigCommunicationError.CLK = _connection.IsCommunicationError;
  544. if (_trigCommunicationError.Q)
  545. {
  546. _lstHandlers.Clear();
  547. //EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
  548. OnError($"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
  549. //_trigActionDone.CLK = true;
  550. }
  551. }
  552. }
  553. }
  554. }
  555. catch (Exception ex)
  556. {
  557. LOG.Write(ex);
  558. }
  559. return true;
  560. }
  561. public bool Connect()
  562. {
  563. return _connection.Connect();
  564. }
  565. public bool Disconnect()
  566. {
  567. return _connection.Disconnect();
  568. }
  569. public override bool IsReady()
  570. {
  571. //if (_diRobotReady!=null && !_diRobotReady.Value)
  572. // return false;
  573. if (_diRobotError != null && !_diRobotError.Value)
  574. return false;
  575. if (_diTPinUse != null && !_diTPinUse.Value)
  576. return false;
  577. return RobotState == RobotStateEnum.Idle && !IsBusy;
  578. }
  579. public bool ParseReadData(string _command, string rdata)
  580. {
  581. try
  582. {
  583. if (_command == "RSTS")
  584. {
  585. return (ParseRSTSStatus(rdata));
  586. }
  587. if (_command == "RSLV") //Read the speed level
  588. {
  589. return (ParseSpeedLevel(rdata));
  590. }
  591. if (_command == "RPOS") //Reference current postion
  592. {
  593. return (ParsePositionData(rdata));
  594. }
  595. if (_command == "RSTP") //Reference registered position, read the save postion for station
  596. {
  597. return (ParseRegisteredPositionData(rdata));
  598. }
  599. if (_command == "RPRM") //Reference the parameter values of the specified unit
  600. {
  601. return (ParseParameterData(rdata));
  602. }
  603. if (_command == "RMSK") //Reference the interlock information
  604. {
  605. return (ParseInterlockInfo(rdata));
  606. }
  607. if (_command == "RVER") //Reference the software version
  608. {
  609. return (ParseSoftwareVersion(rdata));
  610. }
  611. if (_command == "RMAP") //Reference the slot map
  612. {
  613. return (ParseSlotMap(rdata));
  614. }
  615. if (_command == "RMPD") //reference the mapping data
  616. {
  617. return (ParseMappingData(rdata));
  618. }
  619. if (_command == "RMCA") // Reference the mapping calibration result
  620. {
  621. return true;
  622. }
  623. if (_command == "RALN") // Reference the alignment result
  624. {
  625. return true;
  626. }
  627. if (_command == "RACA") // Reference calibration result for alignment
  628. {
  629. return true;
  630. }
  631. return true;
  632. }
  633. catch (Exception ex)
  634. {
  635. LOG.Write(ex);
  636. return true;
  637. }
  638. }
  639. public bool ParseStatus(string status)
  640. {
  641. try
  642. {
  643. int intstatus = Convert.ToInt32(status, 16);
  644. IsManipulatorBatteryLow = ((intstatus & 0x10) == 0x10);
  645. IsCommandExecutionReady = ((intstatus & 0x20) == 0x20);
  646. IsServoON = ((intstatus & 0x40) == 0x40);
  647. IsErrorOccurred = ((intstatus & 0x80) == 0x80);
  648. IsControllerBatteryLow = ((intstatus & 0x1) == 0x1);
  649. //IsWaferPresenceOnBlade1 = ((intstatus & 0x2) == 0x2);
  650. //IsWaferPresenceOnBlade2 = ((intstatus & 0x4) == 0x4);
  651. return true;
  652. }
  653. catch (Exception ex)
  654. {
  655. LOG.Write(ex);
  656. return false;
  657. }
  658. }
  659. public bool ParseRSTSStatus(string status)
  660. {
  661. try
  662. {
  663. string StsN = status.Substring(0, 2);
  664. string Ackcd = status.Substring(2, 4);
  665. ParseStatus(StsN);
  666. if (status.Length <= 6) return true;
  667. ErrorCode = status.Substring(6, 4);
  668. int intstatus = Convert.ToInt32(status.Substring(10, 4), 16);
  669. IsWaferPresenceOnBlade1 = ((intstatus & 0x1000) != 0x1000);
  670. IsWaferPresenceOnBlade2 = ((intstatus & 0x2000) != 0x2000);
  671. IsGrippedBlade1 = ((intstatus & 0x4000) != 0x4000);
  672. IsGrippedBlade2 = ((intstatus & 0x8000) != 0x8000);
  673. IsPermittedInterlock1 = ((intstatus & 0x100) == 0x100);
  674. IsPermittedInterlock2 = ((intstatus & 0x200) == 0x200);
  675. IsPermittedInterlock3 = ((intstatus & 0x400) == 0x400);
  676. IsPermittedInterlock4 = ((intstatus & 0x800) == 0x800);
  677. IsPermittedInterlock5 = ((intstatus & 0x10) == 0x10);
  678. IsPermittedInterlock6 = ((intstatus & 0x20) == 0x20);
  679. IsPermittedInterlock7 = ((intstatus & 0x40) == 0x40);
  680. IsPermittedInterlock8 = ((intstatus & 0x80) == 0x80);
  681. return true;
  682. }
  683. catch (Exception ex)
  684. {
  685. LOG.Write(ex);
  686. return true;
  687. }
  688. }
  689. public bool ParseSpeedLevel(string data)
  690. {
  691. try
  692. {
  693. string speedtag = data.Substring(6, 1);
  694. switch (speedtag)
  695. {
  696. case "H":
  697. SpeedLevel = 1;
  698. break;
  699. case "M":
  700. SpeedLevel = 2;
  701. break;
  702. case "L":
  703. SpeedLevel = 3;
  704. break;
  705. }
  706. return true;
  707. }
  708. catch (Exception ex)
  709. {
  710. LOG.Write(ex);
  711. return false;
  712. }
  713. }
  714. public bool ParsePositionData(string pdata)
  715. {
  716. try
  717. {
  718. string StsN = pdata.Substring(0, 2);
  719. string Ackcd = pdata.Substring(2, 4);
  720. ParseStatus(StsN);
  721. CurrentThetaPosition = Convert.ToInt32(pdata.Substring(6, 8)) / 100;
  722. PositionAxis1 = CurrentThetaPosition;
  723. CurrentArm1Position = Convert.ToInt32(pdata.Substring(14, 8)) / 100;
  724. PositionAxis2 = CurrentArm1Position;
  725. CurrentArm2Position = Convert.ToInt32(pdata.Substring(22, 8)) / 100;
  726. PositionAxis3 = CurrentArm2Position;
  727. CurrentZPosition = Convert.ToInt32(pdata.Substring(30, 8)) / 100;
  728. PositionAxis4 = CurrentZPosition;
  729. //if (pdata[0] == "R")
  730. //{
  731. // CommandThetaPosition = Convert.ToSingle(pdata[1]) / 1000;
  732. // CommandExtensionPosition = Convert.ToSingle(pdata[2]) / 1000;
  733. // CommandArm1Position = Convert.ToSingle(pdata[3]) / 1000;
  734. // CommandArm2Position = Convert.ToSingle(pdata[4]) / 1000;
  735. // CommandZPosition = Convert.ToSingle(pdata[5]) / 1000;
  736. // return true;
  737. //}
  738. //if (pdata[0] == "F")
  739. //{
  740. // CurrentThetaPosition = Convert.ToSingle(pdata[1]) / 1000;
  741. // PositionAxis1 = CurrentThetaPosition;
  742. // CurrentExtensionPosition = Convert.ToSingle(pdata[2]) / 1000;
  743. // PositionAxis2 = CurrentExtensionPosition;
  744. // CurrentArm1Position = Convert.ToSingle(pdata[3]) / 1000;
  745. // PositionAxis3 = CurrentArm1Position;
  746. // CurrentArm2Position = Convert.ToSingle(pdata[4]) / 1000;
  747. // PositionAxis4 = CurrentArm2Position;
  748. // CurrentZPosition = Convert.ToSingle(pdata[5]) / 1000;
  749. // PositionAxis5 = CurrentZPosition;
  750. // return true;
  751. //}
  752. return true;
  753. }
  754. catch (Exception ex)
  755. {
  756. LOG.Write(ex);
  757. return false;
  758. }
  759. }
  760. public bool ParseRegisteredPositionData(string pdata)
  761. {
  762. try
  763. {
  764. string StsN = pdata.Substring(0, 2);
  765. string Ackcd = pdata.Substring(2, 4);
  766. ParseStatus(StsN);
  767. CommandThetaPosition = Convert.ToInt32(pdata.Substring(6, 8)) / 100;
  768. CommandArm1Position = Convert.ToInt32(pdata.Substring(14, 8)) / 100;
  769. CommandArm2Position = Convert.ToInt32(pdata.Substring(22, 8)) / 100;
  770. CommandZPosition = Convert.ToInt32(pdata.Substring(30, 8)) / 100;
  771. return true;
  772. }
  773. catch (Exception ex)
  774. {
  775. LOG.Write(ex);
  776. return false;
  777. }
  778. }
  779. public bool ParseStationData(string[] pdata)
  780. {
  781. try
  782. {
  783. ReadMemorySpec = pdata[0];
  784. ReadTransferStation = pdata[1];
  785. if (ReadStationItemValues.ContainsKey(pdata[2]))
  786. ReadStationItemValues.Remove(pdata[2]);
  787. ReadStationItemValues.Add(pdata[2], pdata[3]);
  788. return true;
  789. }
  790. catch (Exception ex)
  791. {
  792. LOG.Write(ex);
  793. return false;
  794. }
  795. }
  796. public bool ParseParameterData(string pdata)
  797. {
  798. try
  799. {
  800. ReadParameterType = pdata.Substring(6, 3);
  801. ReadParameterNo = pdata.Substring(9, 4);
  802. ReadParameterValue = pdata.Substring(13, 12);
  803. return true;
  804. }
  805. catch (Exception ex)
  806. {
  807. LOG.Write(ex);
  808. return false;
  809. }
  810. }
  811. public bool ParseInterlockInfo(string pdata)
  812. {
  813. try
  814. {
  815. int intdata = Convert.ToInt16(pdata.Substring(6, 4));
  816. IsCheckInterlockWaferPresenceOnBlade1 = (intdata & 0x1) == 0;
  817. IsCheckInterlockWaferPresenceOnBlade2 = (intdata & 0x2) == 0;
  818. IsCheckInterlockPAOp = (intdata & 0x10) == 0;
  819. IsCheckInterlockPAWaferStatus = (intdata & 0x20) == 0;
  820. IsCheckInterlockPAWaferStatusByCCD = (intdata & 0x40) == 0;
  821. return true;
  822. }
  823. catch (Exception ex)
  824. {
  825. LOG.Write(ex);
  826. return false;
  827. }
  828. }
  829. public bool ParseSoftwareVersion(string pdata)
  830. {
  831. try
  832. {
  833. RobotSystemVersion = pdata.Substring(6, 4);
  834. RobotSoftwareVersion = pdata.Substring(6, 4);
  835. return true;
  836. }
  837. catch (Exception ex)
  838. {
  839. LOG.Write(ex);
  840. return false;
  841. }
  842. }
  843. public bool ParseSlotMap(string pdata)
  844. {
  845. //$,<UNo>(,<SeqNo>),<Sts>,<Ackcd>,RMAP,<TrsSt>,<Slot>,
  846. //01:<Result1>…,N:<ResultN>(,<Sum>)<CR>
  847. //• UNo : Unit number (1 byte)
  848. //• SeqNo : Sequence number (None / 2 bytes)
  849. //• Sts : Status (2 bytes)
  850. //• Ackcd : Response code (4 bytes)
  851. //• TrsSt : Transfer station (3 bytes)
  852. //• Slot : Slot number (2 bytes)
  853. //• Result* : Mapping result (2 bytes each)
  854. //• “--” : No wafer detected.
  855. //• “OK” : Wafer inserted correctly.
  856. //• “CW” : Wafer inserted incorrectly (inclined).
  857. //• “DW” : Wafer inserted incorrectly (duplicated).
  858. //Note) Responds with the number of slots of the specified transfer station.
  859. //$,1,00,0000,RMAP,C02,00,
  860. //01:OK,02:DW,03:OK,04:CW,05:CW,06:OK,07:OK,08:--,09:OK,10:OK
  861. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  862. try
  863. {
  864. string slotmapdata = pdata.Substring(6, pdata.Length - 6);
  865. int wafercount = slotmapdata.Length / 4;
  866. StringBuilder sb = new StringBuilder();
  867. for (int i = 0; i < wafercount; i++)
  868. {
  869. string value = slotmapdata.Substring(4 * i + 2, 2);
  870. switch (value)
  871. {
  872. case "--":
  873. sb.Append("0");
  874. break;
  875. case "OK":
  876. sb.Append("1");
  877. break;
  878. case "CW":
  879. sb.Append("2");
  880. break;
  881. case "DW":
  882. sb.Append("W");
  883. break;
  884. }
  885. }
  886. ReadSlotMap = sb.ToString();
  887. NotifySlotMapResult(CurrentInteractiveModule, ReadSlotMap);
  888. return true;
  889. }
  890. catch (Exception ex)
  891. {
  892. LOG.Write(ex);
  893. return false;
  894. }
  895. }
  896. public bool ParseMappingData(string pdata)
  897. {
  898. try
  899. {
  900. string mdata = pdata.Substring(6, pdata.Length - 6);
  901. int wafercount = mdata.Length / 14;
  902. List<string> lstupdata = new List<string>();
  903. List<string> lstdowndata = new List<string>();
  904. for (int i = 0; i < wafercount; i++)
  905. {
  906. lstupdata.Add(mdata.Substring(14 * i, 7));
  907. lstdowndata.Add(mdata.Substring(14 * i + 7, 7));
  908. }
  909. ReadMappingDownData = lstdowndata.ToArray();
  910. ReadMappingUpData = lstupdata.ToArray();
  911. return true;
  912. }
  913. catch (Exception ex)
  914. {
  915. LOG.Write(ex);
  916. return false;
  917. }
  918. }
  919. public bool ParseMappingCalibrationResult(string[] pdata)
  920. {
  921. try
  922. {
  923. ReadMappingTransferStation = pdata[0];
  924. ReadMappingCalibrationResult.Clear();
  925. ReadMappingCalibrationResult.Add("LowestLaySlotPosition", Convert.ToInt32(pdata[1]) / 1000);
  926. ReadMappingCalibrationResult.Add("HighestLaySlotPosition", Convert.ToInt32(pdata[2]) / 1000);
  927. ReadMappingCalibrationResult.Add("WaferWidth", Convert.ToInt32(pdata[3]) / 1000);
  928. ReadMappingCalibrationResult.Add("ThreshhholdValueofDoubleInsertion", Convert.ToInt32(pdata[4]) / 1000);
  929. ReadMappingCalibrationResult.Add("ThreshhholdValueofSlantingInsertion1", Convert.ToInt32(pdata[5]) / 1000);
  930. ReadMappingCalibrationResult.Add("ThreshhholdValueofSlantingInsertion2", Convert.ToInt32(pdata[6]) / 1000);
  931. return true;
  932. }
  933. catch (Exception ex)
  934. {
  935. LOG.Write(ex);
  936. return false;
  937. }
  938. }
  939. protected override bool fClear(object[] param)
  940. {
  941. lock (_locker)
  942. {
  943. _lstHandlers.Clear();
  944. _connection.ForceClear();
  945. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CCLR", "E"));
  946. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RSTS"));
  947. }
  948. return true;
  949. }
  950. protected override bool fStartReadData(object[] param)
  951. {
  952. if (param.Length < 1) return false;
  953. string readcommand = param[0].ToString();
  954. switch (readcommand)
  955. {
  956. case "CurrentStatus":
  957. lock (_locker)
  958. {
  959. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RSTS"));
  960. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RPOS", "FFAA"));
  961. }
  962. break;
  963. default:
  964. break;
  965. }
  966. return true;
  967. }
  968. private void ExecuteHandler(HandlerBase handler)
  969. {
  970. string commandstr = $"{UnitNumber}";
  971. if (IsEnableSeqNo)
  972. {
  973. CurrentSeqNo = SeqnoGenerator.create();
  974. commandstr += $"{CurrentSeqNo:D2}";
  975. SeqnoGenerator.release(CurrentSeqNo);
  976. }
  977. commandstr += $"{handler.SendText}";
  978. if (IsEnableCheckSum)
  979. {
  980. commandstr += "";
  981. commandstr += Checksum(Encoding.ASCII.GetBytes(commandstr));
  982. }
  983. handler.SendText = $"${commandstr}\r";
  984. _connection.Execute(handler);
  985. }
  986. private string Checksum(byte[] bytes)
  987. {
  988. int sum = 0;
  989. foreach (byte code in bytes)
  990. {
  991. sum += code;
  992. }
  993. string hex = String.Format("{0:X2}", sum % 256);
  994. return hex;
  995. }
  996. protected override bool fStartSetParameters(object[] param)
  997. {
  998. try
  999. {
  1000. string strParameter;
  1001. string setcommand = param[0].ToString();
  1002. switch (setcommand)
  1003. {
  1004. case "MotionSpeed": // SSPD Set the motion speed
  1005. string strlevel = param[1].ToString();
  1006. string strspeedtype = param[2].ToString();
  1007. string strAxis = param[3].ToString();
  1008. uint speeddata = Convert.ToUInt32(param[4]);
  1009. if (!"0123".Contains(strlevel))
  1010. {
  1011. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + strlevel);
  1012. return false;
  1013. }
  1014. if (!"HMLOB".Contains(strspeedtype))
  1015. {
  1016. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + strspeedtype);
  1017. return false;
  1018. }
  1019. if (!"SAHIZRG".Contains(strAxis))
  1020. {
  1021. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + strAxis);
  1022. return false;
  1023. }
  1024. strParameter = $"{strlevel},{strspeedtype},{strAxis}," + speeddata.ToString("D8");
  1025. lock (_locker)
  1026. {
  1027. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSPD", strParameter));
  1028. }
  1029. break;
  1030. case "TransferSpeedLevel": //SSLV Select the transfer speed level
  1031. string sslvlevel = param[1].ToString();
  1032. if (!"123".Contains(sslvlevel))
  1033. {
  1034. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sslvlevel);
  1035. return false;
  1036. }
  1037. string strSpeedLevel = "M";
  1038. switch (SpeedLevelSetting)
  1039. {
  1040. case 1:
  1041. strSpeedLevel = "H";
  1042. break;
  1043. case 2:
  1044. strSpeedLevel = "M";
  1045. break;
  1046. case 3:
  1047. strSpeedLevel = "L";
  1048. break;
  1049. default:
  1050. strSpeedLevel = "H";
  1051. break;
  1052. }
  1053. lock (_locker)
  1054. {
  1055. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSLV", strSpeedLevel));
  1056. }
  1057. if (SC.ContainsItem($"{_scRoot}.{Name}.SpeedLevel"))
  1058. {
  1059. SC.SetItemValue($"{_scRoot}.{Name}.SpeedLevel", Convert.ToInt32(sslvlevel));
  1060. SpeedLevelSetting = SC.GetValue<int>($"{_scRoot}.{Name}.SpeedLevel");
  1061. }
  1062. break;
  1063. case "RegisterTheCurrentPositionAsTransferStation": // SPOS: Register the current position as the specified transfer station
  1064. string sposMem = param[1].ToString();
  1065. string sposRmode = param[2].ToString();
  1066. string sposTrsSt = param[3].ToString();
  1067. uint sposSlot = Convert.ToUInt16(param[4]);
  1068. string sposPosture = param[5].ToString();
  1069. string sposHand = param[6].ToString();
  1070. if (!"VN".Contains(sposMem))
  1071. {
  1072. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposMem);
  1073. return false;
  1074. }
  1075. if (!"AN".Contains(sposRmode))
  1076. {
  1077. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposRmode);
  1078. return false;
  1079. }
  1080. if (sposSlot < 1 || sposSlot > 30)
  1081. {
  1082. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposSlot.ToString());
  1083. return false;
  1084. }
  1085. if (!"LR".Contains(sposPosture))
  1086. {
  1087. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposPosture);
  1088. return false;
  1089. }
  1090. if (!"12".Contains(sposHand))
  1091. {
  1092. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sposHand);
  1093. return false;
  1094. }
  1095. strParameter = $"{sposMem},{sposRmode},{sposTrsSt},{sposSlot},{sposPosture},{sposHand}";
  1096. lock (_locker)
  1097. {
  1098. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SPOS", strParameter));
  1099. }
  1100. break;
  1101. case "RegisterTheSpePostionAsTransferStation": //SABS
  1102. string sabsMem = param[1].ToString();
  1103. string sabsRmode = param[2].ToString();
  1104. string sabsTrsSt = param[3].ToString();
  1105. string sabsPosture = param[4].ToString();
  1106. string sabsHand = param[5].ToString();
  1107. Int32 sabsValue1 = Convert.ToInt32(param[6]);
  1108. Int32 sabsValue2 = Convert.ToInt32(param[7]);
  1109. Int32 sabsValue3 = Convert.ToInt32(param[8]);
  1110. Int32 sabsValue4 = Convert.ToInt32(param[9]);
  1111. Int32 sabsValue5 = Convert.ToInt32(param[10]);
  1112. if (!"VN".Contains(sabsMem))
  1113. {
  1114. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsMem);
  1115. return false;
  1116. }
  1117. if (!"AN".Contains(sabsRmode))
  1118. {
  1119. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsRmode);
  1120. return false;
  1121. }
  1122. if (!"LR".Contains(sabsPosture))
  1123. {
  1124. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsPosture);
  1125. return false;
  1126. }
  1127. if (!"12".Contains(sabsHand))
  1128. {
  1129. EV.PostAlarmLog(Name, $"Set {setcommand} with invalid parameter:" + sabsHand);
  1130. return false;
  1131. }
  1132. strParameter = $"{sabsMem},{sabsRmode},{sabsTrsSt},{sabsPosture},{sabsHand},"
  1133. + sabsValue1.ToString("D8") + "," + sabsValue2.ToString("D8") + "," + sabsValue3.ToString("D8") +
  1134. "," + sabsValue4.ToString("D8") + "," + sabsValue5.ToString("D8");
  1135. lock (_locker)
  1136. {
  1137. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SABS", strParameter));
  1138. }
  1139. break;
  1140. case "ModifyTheSpecStationPostionByOffset": //SAPS
  1141. string sapsMem = param[1].ToString();
  1142. string sapsRmode = param[2].ToString();
  1143. string sapsTrsSt = param[3].ToString();
  1144. string sapsPosture = param[4].ToString();
  1145. string sapsHand = param[5].ToString();
  1146. Int32 sapsOffsetX = Convert.ToInt32(param[6]);
  1147. Int32 sapsOffsetY = Convert.ToInt32(param[7]);
  1148. Int32 sapsOffsetZ = Convert.ToInt32(param[8]);
  1149. strParameter = $"{sapsMem},{sapsRmode},{sapsTrsSt},{sapsPosture},{sapsHand},"
  1150. + sapsOffsetX.ToString("D8") + "," + sapsOffsetY.ToString("D8") + "," + sapsOffsetZ.ToString("D8");
  1151. lock (_locker)
  1152. {
  1153. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SAPS", strParameter));
  1154. }
  1155. break;
  1156. case "DeleteTheSpecStation": //SPDL
  1157. string spdlMem = param[1].ToString();
  1158. string spdlTrsSt = param[2].ToString();
  1159. string spdlPosture = param[3].ToString();
  1160. string spdlHand = param[4].ToString();
  1161. strParameter = $"{spdlMem},{spdlTrsSt},{spdlPosture},{spdlHand}";
  1162. lock (_locker)
  1163. {
  1164. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SPDL", strParameter));
  1165. }
  1166. break;
  1167. case "RegisterThePositionDataToVolatile": //SPSV
  1168. string spsvTrsSt = param[1].ToString();
  1169. string spsvPosture = param[2].ToString();
  1170. string spsvHand = param[3].ToString();
  1171. strParameter = $"{spsvTrsSt},{spsvPosture},{spsvHand}";
  1172. lock (_locker)
  1173. {
  1174. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SPSV", strParameter));
  1175. }
  1176. break;
  1177. case "ReadThePostionDataFromVolatile": //SPLD
  1178. string spldTrsSt = param[1].ToString();
  1179. string spldPosture = param[2].ToString();
  1180. string spldHand = param[3].ToString();
  1181. strParameter = $"{spldTrsSt},{spldPosture},{spldHand}";
  1182. lock (_locker)
  1183. {
  1184. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SPLD", strParameter));
  1185. }
  1186. break;
  1187. case "SetTheStationParameters": //SSTR
  1188. string sstrMem = param[1].ToString();
  1189. string sstrTrsSt = param[2].ToString();
  1190. string sstrItem = param[3].ToString();
  1191. Int32 sstrValue = Convert.ToInt32(param[4].ToString());
  1192. strParameter = $"{sstrMem},{sstrTrsSt},{sstrItem}," + sstrValue.ToString("D8");
  1193. lock (_locker)
  1194. {
  1195. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSTR", strParameter));
  1196. }
  1197. break;
  1198. case "ChangeParameterValue": // SPRM
  1199. string sprmParaType = param[1].ToString();
  1200. int sprmParaNO = Convert.ToInt32(param[2].ToString());
  1201. Int32 sprmValue = Convert.ToInt32(param[3].ToString());
  1202. strParameter = sprmParaType + "," + sprmParaNO.ToString("D4") + "," + sprmValue.ToString("D12");
  1203. lock (_locker)
  1204. {
  1205. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SPRM", strParameter));
  1206. }
  1207. break;
  1208. case "EnableInterLock": //SMSK
  1209. int smskValid = Convert.ToInt16(param[1].ToString());
  1210. lock (_locker)
  1211. {
  1212. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SPRM", smskValid.ToString("D4")));
  1213. }
  1214. break;
  1215. case "RegisterTheCurrentPositionAsCoordinate": //SSTD
  1216. string sstdAxis = param[1].ToString();
  1217. lock (_locker)
  1218. {
  1219. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSTD", sstdAxis));
  1220. }
  1221. break;
  1222. case "ResigterTheSpecNumberAsReferencePostion": //SSTN
  1223. Int32 sstnValue1 = Convert.ToInt32(param[1]);
  1224. Int32 sstnValue2 = Convert.ToInt32(param[2]);
  1225. Int32 sstnValue3 = Convert.ToInt32(param[3]);
  1226. Int32 sstnValue4 = Convert.ToInt32(param[4]);
  1227. Int32 sstnValue5 = Convert.ToInt32(param[5]);
  1228. strParameter = sstnValue1.ToString("D12") + "," + sstnValue2.ToString("D12") + ","
  1229. + sstnValue3.ToString("D12") + "," + sstnValue4.ToString("D12") + ","
  1230. + sstnValue5.ToString("D12");
  1231. lock (_locker)
  1232. {
  1233. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSTN", strParameter));
  1234. }
  1235. break;
  1236. }
  1237. }
  1238. catch (Exception)
  1239. {
  1240. string reason = "";
  1241. if (param != null)
  1242. {
  1243. foreach (var para in param)
  1244. {
  1245. reason += para.ToString() + ",";
  1246. }
  1247. }
  1248. EV.PostAlarmLog(Name, "Set command parameter invalid:" + reason);
  1249. return false;
  1250. }
  1251. return true;
  1252. }
  1253. protected override bool fMonitorSetParamter(object[] param)
  1254. {
  1255. return true;
  1256. }
  1257. protected override bool fStartTransferWafer(object[] param)
  1258. {
  1259. return false;
  1260. }
  1261. protected override bool fStartUnGrip(object[] param)
  1262. {
  1263. lock (_locker)
  1264. {
  1265. RobotArmEnum arm = (RobotArmEnum)param[0];
  1266. switch (arm)
  1267. {
  1268. case RobotArmEnum.Lower:
  1269. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "B0"));
  1270. break;
  1271. case RobotArmEnum.Upper:
  1272. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "A0"));
  1273. break;
  1274. case RobotArmEnum.Both:
  1275. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "A0"));
  1276. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "B0"));
  1277. break;
  1278. }
  1279. }
  1280. return true;
  1281. }
  1282. protected override bool fStartGrip(object[] param)
  1283. {
  1284. lock (_locker)
  1285. {
  1286. RobotArmEnum arm = (RobotArmEnum)param[0];
  1287. switch (arm)
  1288. {
  1289. case RobotArmEnum.Lower:
  1290. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "B1"));
  1291. break;
  1292. case RobotArmEnum.Upper:
  1293. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "A1"));
  1294. break;
  1295. case RobotArmEnum.Both:
  1296. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "A1"));
  1297. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "B1"));
  1298. break;
  1299. }
  1300. }
  1301. return true;
  1302. }
  1303. protected override bool fStartInit(object[] param)
  1304. {
  1305. SpeedLevelSetting = SC.GetValue<int>($"{_scRoot}.{Name}.SpeedLevel");
  1306. string strSpeedLevel = "H";
  1307. switch (SpeedLevelSetting)
  1308. {
  1309. case 1:
  1310. strSpeedLevel = "H";
  1311. break;
  1312. case 2:
  1313. strSpeedLevel = "M";
  1314. break;
  1315. case 3:
  1316. strSpeedLevel = "L";
  1317. break;
  1318. default:
  1319. strSpeedLevel = "H";
  1320. break;
  1321. }
  1322. lock (_locker)
  1323. {
  1324. if (_doRobotHold != null)
  1325. {
  1326. _doRobotHold.SetTrigger(true, out _);
  1327. Thread.Sleep(100);
  1328. }
  1329. //_lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CCLR", "E"));
  1330. //_lstHandlers.AddLast(new NXC100RobotGripAndCheckWaferMotionHandler(this));
  1331. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "INIT", "00"));
  1332. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MHOM", "F"));
  1333. if (SpeedLevelSetting >= 1 && SpeedLevelSetting <= 3)
  1334. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSLV", strSpeedLevel));
  1335. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RSTS"));
  1336. }
  1337. return true;
  1338. }
  1339. protected override bool fStartHome(object[] param)
  1340. {
  1341. SpeedLevelSetting = SC.GetValue<int>($"{_scRoot}.{Name}.SpeedLevel");
  1342. string strSpeedLevel = "H";
  1343. switch (SpeedLevelSetting)
  1344. {
  1345. case 1:
  1346. strSpeedLevel = "H";
  1347. break;
  1348. case 2:
  1349. strSpeedLevel = "M";
  1350. break;
  1351. case 3:
  1352. strSpeedLevel = "L";
  1353. break;
  1354. default:
  1355. strSpeedLevel = "H";
  1356. break;
  1357. }
  1358. lock (_locker)
  1359. {
  1360. if (_doRobotHold != null)
  1361. {
  1362. _doRobotHold.SetTrigger(true, out _);
  1363. Thread.Sleep(100);
  1364. }
  1365. //_lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CCLR", "E"));
  1366. //_lstHandlers.AddLast(new NXC100RobotGripAndCheckWaferMotionHandler(this));
  1367. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "INIT", "00"));
  1368. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MHOM", "F"));
  1369. if (SpeedLevelSetting >= 1 && SpeedLevelSetting <= 3)
  1370. _lstHandlers.AddLast(new NXC100RobotSetHandler(this, "SSLV", strSpeedLevel));
  1371. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RSTS"));
  1372. }
  1373. return true;
  1374. }
  1375. protected override bool fStartGoTo(object[] param)
  1376. {
  1377. try
  1378. {
  1379. RobotArmEnum arm = (RobotArmEnum)param[0];
  1380. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
  1381. Blade1Target = module;
  1382. Blade2Target = module;
  1383. int slot = (int)param[2] + 1;
  1384. RobotPostionEnum postype = (RobotPostionEnum)param[3];
  1385. float x = (float)param[4];
  1386. float y = (float)param[5];
  1387. float z = (float)param[6];
  1388. float w = (float)param[7];
  1389. int intXvalue = (int)(x * 1000);
  1390. int intYvalue = (int)(y * 1000);
  1391. int intZvalue = (int)(z * 1000);
  1392. int intWvalue = (int)(w * 1000);
  1393. bool isFromOriginal = (bool)param[8];
  1394. bool isJumpToNextMotion = (bool)param[9];
  1395. string strpara = string.Empty;
  1396. if ((int)postype >= 0 && (int)postype < 10)
  1397. {
  1398. strpara = "G";
  1399. }
  1400. if ((int)postype >= 10 && (int)postype < 20)
  1401. {
  1402. strpara = "P";
  1403. }
  1404. if ((int)postype >= 20 && (int)postype < 30)
  1405. {
  1406. strpara = "E";
  1407. }
  1408. string trsSt = GetStationsName(module);
  1409. string TrsPnt = string.Empty;
  1410. if (postype == RobotPostionEnum.PickReady)
  1411. {
  1412. TrsPnt = "G1";
  1413. }
  1414. if (postype == RobotPostionEnum.PickExtendLow)
  1415. {
  1416. TrsPnt = "G2";
  1417. }
  1418. if (postype == RobotPostionEnum.PickAtWafer)
  1419. {
  1420. TrsPnt = "Gb";
  1421. }
  1422. if (postype == RobotPostionEnum.PickExtendUp)
  1423. {
  1424. TrsPnt = "G3";
  1425. }
  1426. if (postype == RobotPostionEnum.PickRetracted)
  1427. {
  1428. TrsPnt = "G4";
  1429. }
  1430. if (postype == RobotPostionEnum.PlaceReady)
  1431. {
  1432. TrsPnt = "P1";
  1433. }
  1434. if (postype == RobotPostionEnum.PlaceExtendUp)
  1435. {
  1436. TrsPnt = "P2";
  1437. }
  1438. if (postype == RobotPostionEnum.PlaceExtendAtWafer)
  1439. {
  1440. TrsPnt = "Pb";
  1441. }
  1442. if (postype == RobotPostionEnum.PlaceExtendDown)
  1443. {
  1444. TrsPnt = "P3";
  1445. }
  1446. if (postype == RobotPostionEnum.PlaceRetract)
  1447. {
  1448. TrsPnt = "P4";
  1449. }
  1450. string strCmd = string.Empty;
  1451. if (isFromOriginal)
  1452. {
  1453. strCmd = "MTRS";
  1454. }
  1455. else if (isJumpToNextMotion)
  1456. {
  1457. strCmd = "MCTR";
  1458. }
  1459. else
  1460. {
  1461. strCmd = "MPNT";
  1462. }
  1463. if (string.IsNullOrEmpty(trsSt) || string.IsNullOrEmpty(strpara) || string.IsNullOrEmpty(TrsPnt))
  1464. {
  1465. EV.PostAlarmLog("Robot", "invalid transfer paramter");
  1466. return false;
  1467. }
  1468. strpara += $",{trsSt},{slot:D2},A,{(arm == RobotArmEnum.Both ? "F" : ((int)arm + 1).ToString())}," +
  1469. $"{TrsPnt}";
  1470. if (x != 0 || y != 0 || z != 0 || w != 0)
  1471. {
  1472. string strxoffset = intXvalue >= 0 ? $"{intXvalue:D8}" : $"{intXvalue:D7}";
  1473. string stryoffset = intYvalue >= 0 ? $"{intYvalue:D8}" : $"{intYvalue:D7}";
  1474. string strzoffset = intZvalue >= 0 ? $"{intZvalue:D8}" : $"{intZvalue:D7}";
  1475. string strwoffset = intWvalue >= 0 ? $"{intWvalue:D8}" : $"{intWvalue:D7}";
  1476. strpara += $",{strxoffset},{stryoffset},{strzoffset},{strwoffset}";
  1477. }
  1478. if (strCmd == "MPNT")
  1479. strpara = TrsPnt;
  1480. lock (_locker)
  1481. {
  1482. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1483. {
  1484. ExecuteHandler(new NXC100RobotMotionHandler(this, strCmd, strpara));
  1485. }
  1486. else
  1487. {
  1488. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, strCmd, strpara));
  1489. }
  1490. }
  1491. return true;
  1492. }
  1493. catch (Exception ex)
  1494. {
  1495. LOG.Write(ex);
  1496. return false;
  1497. }
  1498. }
  1499. protected override bool fGoToComplete(object[] param)
  1500. {
  1501. try
  1502. {
  1503. RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0];
  1504. ModuleName sourcemodule = (ModuleName)Enum.Parse(typeof(ModuleName), CurrentParamter[1].ToString());
  1505. int SourceslotIndex = (int)CurrentParamter[2];
  1506. RobotPostionEnum postype = (RobotPostionEnum)CurrentParamter[3];
  1507. bool isFromOriginal = (bool)CurrentParamter[8];
  1508. bool isJumpToNextMotion = (bool)CurrentParamter[9];
  1509. switch (postype)
  1510. {
  1511. case RobotPostionEnum.PickExtendUp:
  1512. case RobotPostionEnum.PickRetracted:
  1513. if (arm == RobotArmEnum.Lower)
  1514. {
  1515. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  1516. //if (isSimulatorMode || GetWaferState(arm) == RobotArmWaferStateEnum.Present)
  1517. // WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  1518. //else
  1519. // OnError("Wafer detect error");
  1520. }
  1521. if (arm == RobotArmEnum.Upper)
  1522. {
  1523. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  1524. //if (isSimulatorMode || GetWaferState(arm) == RobotArmWaferStateEnum.Present)
  1525. // WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  1526. //else
  1527. // OnError("Wafer detect error");
  1528. }
  1529. if (arm == RobotArmEnum.Both)
  1530. {
  1531. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  1532. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  1533. //if (isSimulatorMode || GetWaferState(arm) == RobotArmWaferStateEnum.Present)
  1534. //{
  1535. // WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  1536. // WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  1537. //}
  1538. //else
  1539. // OnError("Wafer detect error");
  1540. }
  1541. break;
  1542. case RobotPostionEnum.PlaceExtendDown:
  1543. case RobotPostionEnum.PlaceRetract:
  1544. if (arm == RobotArmEnum.Lower)
  1545. {
  1546. WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, SourceslotIndex);
  1547. //if (isSimulatorMode || GetWaferState(arm) == RobotArmWaferStateEnum.Absent)
  1548. // WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, SourceslotIndex);
  1549. //else
  1550. // OnError("Wafer detect error");
  1551. }
  1552. if (arm == RobotArmEnum.Upper)
  1553. {
  1554. WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, SourceslotIndex);
  1555. //if (isSimulatorMode || GetWaferState(arm) == RobotArmWaferStateEnum.Absent)
  1556. // WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, SourceslotIndex);
  1557. //else
  1558. // OnError("Wafer detect error");
  1559. }
  1560. if (arm == RobotArmEnum.Both)
  1561. {
  1562. WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, SourceslotIndex);
  1563. WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, SourceslotIndex);
  1564. //if (isSimulatorMode || GetWaferState(arm) == RobotArmWaferStateEnum.Absent)
  1565. //{
  1566. // WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, SourceslotIndex);
  1567. // WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, SourceslotIndex);
  1568. //}
  1569. //else
  1570. // OnError("Wafer detect error");
  1571. }
  1572. break;
  1573. }
  1574. }
  1575. catch (Exception ex)
  1576. {
  1577. LOG.Write(ex);
  1578. }
  1579. return base.fGoToComplete(param);
  1580. }
  1581. protected override bool fStop(object[] param)
  1582. {
  1583. if (_doRobotHold != null)
  1584. _doRobotHold.SetTrigger(false, out _);
  1585. _lstHandlers.Clear();
  1586. _connection.ForceClear();
  1587. //ExecuteHandler(new SR100RobotMotionHandler(this, "CSTP", "E"));
  1588. return true; ;
  1589. }
  1590. protected override bool fStartMove(object[] param)
  1591. {
  1592. try
  1593. {
  1594. string strCmd = param[0].ToString();
  1595. string strpara = string.Empty;
  1596. for (int i = 1; i < param.Length; i++)
  1597. {
  1598. if (i == 1)
  1599. strpara += param[i].ToString();
  1600. else
  1601. strpara += param[i].ToString();
  1602. }
  1603. lock (_locker)
  1604. {
  1605. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, strCmd, strpara));
  1606. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RPOS", "FFAA"));
  1607. }
  1608. return true;
  1609. }
  1610. catch (Exception ex)
  1611. {
  1612. LOG.Write(ex);
  1613. return false;
  1614. }
  1615. }
  1616. private string GetStationsName(ModuleName module)
  1617. {
  1618. try
  1619. {
  1620. if (ModuleHelper.IsLoadPort(module))
  1621. {
  1622. int infopadindex = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString()).InfoPadCarrierIndex;
  1623. if (SC.ContainsItem($"CarrierInfo.{module}Station{infopadindex}"))
  1624. {
  1625. return SC.GetStringValue($"CarrierInfo.{module}Station{infopadindex}");
  1626. }
  1627. if (SC.ContainsItem($"CarrierInfo.Carrier{infopadindex}.{module}Station"))
  1628. {
  1629. return SC.GetStringValue($"CarrierInfo.Carrier{infopadindex}.{module}Station");
  1630. }
  1631. }
  1632. return SC.GetStringValue($"CarrierInfo.{module}Station");
  1633. }
  1634. catch (Exception ex)
  1635. {
  1636. LOG.Write(ex);
  1637. return null;
  1638. }
  1639. }
  1640. private int GetSlotsNumber(ModuleName module)
  1641. {
  1642. try
  1643. {
  1644. if (ModuleHelper.IsLoadPort(module))
  1645. {
  1646. return DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString()).ValidSlotsNumber;
  1647. }
  1648. return SC.GetValue<int>($"CarrierInfo.{module}SlotsNumber");
  1649. }
  1650. catch (Exception ex)
  1651. {
  1652. LOG.Write(ex);
  1653. return -1;
  1654. }
  1655. }
  1656. protected override bool fStartMapWafer(object[] param)
  1657. {
  1658. try
  1659. {
  1660. //RobotArmEnum pickarm = (RobotArmEnum)param[0];
  1661. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[0].ToString());
  1662. Blade1Target = module;
  1663. Blade2Target = module;
  1664. int slotsNumber = GetSlotsNumber(module);
  1665. if (slotsNumber == -1)
  1666. {
  1667. EV.PostAlarmLog("Robot", "Invalid mapping paramter slots number");
  1668. return false;
  1669. }
  1670. //int slot = 25;// (int)param[2];
  1671. string strpara = $"{GetStationsName(module)}FF";
  1672. if (ModuleHelper.IsLoadPort(module))
  1673. {
  1674. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString());
  1675. if (lp != null) lp.NoteTransferStart();
  1676. }
  1677. lock (_locker)
  1678. {
  1679. CurrentInteractiveModule = module;
  1680. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MMAP", strpara));
  1681. //_lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RMPD", $"{GetStationsName(module)}"));
  1682. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RMAP", strpara));
  1683. }
  1684. return true;
  1685. }
  1686. catch (Exception ex)
  1687. {
  1688. LOG.Write(ex);
  1689. return false;
  1690. }
  1691. }
  1692. protected override bool fStartSwapWafer(object[] param)
  1693. {
  1694. try
  1695. {
  1696. RobotArmEnum arm = (RobotArmEnum)param[0];
  1697. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
  1698. Blade1Target = module;
  1699. Blade2Target = module;
  1700. if (ModuleHelper.IsLoadPort(module))
  1701. {
  1702. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString());
  1703. if (lp != null)
  1704. lp.NoteTransferStart();
  1705. }
  1706. int slot = (int)param[2] + 1;
  1707. float x = 0, y = 0, z = 0, w = 0;
  1708. if (param.Length > 3)
  1709. {
  1710. x = (float)param[3];
  1711. y = (float)param[4];
  1712. z = (float)param[5];
  1713. w = (float)param[6];
  1714. }
  1715. int intXvalue = (int)(x * 1000);
  1716. int intYvalue = (int)(y * 1000);
  1717. int intZvalue = (int)(z * 1000);
  1718. int intWvalue = (int)(w * 1000);
  1719. string TrsSt = GetStationsName(module);
  1720. if (string.IsNullOrEmpty(TrsSt))
  1721. {
  1722. EV.PostAlarmLog("Robot", "Invalid Paramter.");
  1723. return false;
  1724. }
  1725. string strpara = $"{TrsSt}{slot:D2}E{hand2string(arm)}A";
  1726. lock (_locker)
  1727. {
  1728. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1729. {
  1730. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTRE", strpara));
  1731. }
  1732. else
  1733. {
  1734. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTRE", strpara));
  1735. }
  1736. }
  1737. return true;
  1738. }
  1739. catch (Exception ex)
  1740. {
  1741. LOG.Write(ex);
  1742. return false;
  1743. }
  1744. }
  1745. protected override bool fSwapComplete(object[] param)
  1746. {
  1747. RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0];
  1748. ModuleName sourcemodule;
  1749. if (!Enum.TryParse(CurrentParamter[1].ToString(), out sourcemodule)) return false;
  1750. int Sourceslotindex;
  1751. if (!int.TryParse(CurrentParamter[2].ToString(), out Sourceslotindex)) return false;
  1752. int delayCount = 0;
  1753. if (arm == RobotArmEnum.Lower)
  1754. {
  1755. while (!isSimulatorMode && !(GetWaferState(RobotArmEnum.Lower) == RobotArmWaferStateEnum.Present
  1756. && GetWaferState(RobotArmEnum.Upper) == RobotArmWaferStateEnum.Absent))
  1757. {
  1758. delayCount++;
  1759. Thread.Sleep(50);
  1760. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  1761. if (delayCount > 100)
  1762. {
  1763. OnError("Wafer detect error");
  1764. return true;
  1765. }
  1766. }
  1767. WaferManager.Instance.WaferMoved(sourcemodule, Sourceslotindex, RobotModuleName, 0);
  1768. WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex);
  1769. }
  1770. if (arm == RobotArmEnum.Upper)
  1771. {
  1772. //WaferManager.Instance.WaferMoved(sourcemodule, Sourceslotindex, RobotModuleName, 1);
  1773. //WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
  1774. delayCount = 0;
  1775. while (!isSimulatorMode && !(GetWaferState(RobotArmEnum.Upper) == RobotArmWaferStateEnum.Present &&
  1776. GetWaferState(RobotArmEnum.Lower) == RobotArmWaferStateEnum.Absent))
  1777. {
  1778. delayCount++;
  1779. Thread.Sleep(50);
  1780. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  1781. if (delayCount > 100)
  1782. {
  1783. OnError("Wafer detect error");
  1784. return true;
  1785. }
  1786. }
  1787. WaferManager.Instance.WaferMoved(sourcemodule, Sourceslotindex, RobotModuleName, 1);
  1788. WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
  1789. }
  1790. if (ModuleHelper.IsLoadPort(sourcemodule))
  1791. {
  1792. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(sourcemodule.ToString());
  1793. if (lp != null)
  1794. lp.NoteTransferStop();
  1795. }
  1796. return base.fSwapComplete(param);
  1797. }
  1798. protected bool fStartPlaceWaferForSwap(object[] param)
  1799. {
  1800. try
  1801. {
  1802. RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0] == RobotArmEnum.Lower ? RobotArmEnum.Upper : RobotArmEnum.Lower;
  1803. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
  1804. if (ModuleHelper.IsLoadPort(module))
  1805. {
  1806. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString());
  1807. if (lp != null)
  1808. lp.NoteTransferStart();
  1809. }
  1810. Blade1Target = module;
  1811. Blade2Target = module;
  1812. int slot = (int)param[2] + 1;
  1813. float x = 0, y = 0, z = 0, w = 0;
  1814. if (param.Length > 3)
  1815. {
  1816. x = (float)param[3];
  1817. y = (float)param[4];
  1818. z = (float)param[5];
  1819. w = (float)param[6];
  1820. }
  1821. int intXvalue = Convert.ToInt32(x * 100);
  1822. int intYvalue = Convert.ToInt32(y * 100);
  1823. int intZvalue = Convert.ToInt32(z * 100);
  1824. //int intWvalue = Convert.ToInt32(w * 100);
  1825. string TrsSt = GetStationsName(module);
  1826. if (string.IsNullOrEmpty(TrsSt))
  1827. {
  1828. EV.PostAlarmLog("Robot", "Invalid Parameter.");
  1829. return false;
  1830. }
  1831. string strpara = $"{TrsSt}{slot:D2}P{hand2string(arm)}A";
  1832. if (x != 0 || y != 0 || z != 0)
  1833. {
  1834. string strxoffset = intXvalue >= 0 ? $"{intXvalue:D5}" : $"{intXvalue:D4}";
  1835. string stryoffset = intYvalue >= 0 ? $"{intYvalue:D5}" : $"{intYvalue:D4}";
  1836. string strzoffset = intZvalue >= 0 ? $"{intZvalue:D5}" : $"{intZvalue:D4}";
  1837. //string strwoffset = intWvalue >= 0 ? $"{intWvalue:D8}" : $"{intWvalue:D7}";
  1838. strpara += $"{strxoffset}{stryoffset}{strzoffset}";
  1839. }
  1840. lock (_locker)
  1841. {
  1842. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1843. {
  1844. if (x != 0 || y != 0 || z != 0)
  1845. {
  1846. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTPO", strpara));
  1847. }
  1848. else
  1849. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTRP", strpara));
  1850. }
  1851. else
  1852. {
  1853. if (x != 0 || y != 0 || z != 0)
  1854. {
  1855. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTPO", strpara));
  1856. }
  1857. else
  1858. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTRP", strpara));
  1859. }
  1860. }
  1861. return true;
  1862. }
  1863. catch (Exception ex)
  1864. {
  1865. LOG.Write(ex);
  1866. return false;
  1867. }
  1868. }
  1869. protected override bool fStartPlaceWafer(object[] param)
  1870. {
  1871. try
  1872. {
  1873. RobotArmEnum arm = (RobotArmEnum)param[0];
  1874. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
  1875. if (ModuleHelper.IsLoadPort(module))
  1876. {
  1877. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString());
  1878. if (lp != null)
  1879. lp.NoteTransferStart();
  1880. }
  1881. Blade1Target = module;
  1882. Blade2Target = module;
  1883. int slot = (int)param[2] + 1;
  1884. float x = 0, y = 0, z = 0, w = 0;
  1885. if (param.Length > 3)
  1886. {
  1887. x = (float)param[3];
  1888. y = (float)param[4];
  1889. z = (float)param[5];
  1890. w = (float)param[6];
  1891. }
  1892. int intXvalue = Convert.ToInt32(x * 100);
  1893. int intYvalue = Convert.ToInt32(y * 100);
  1894. int intZvalue = Convert.ToInt32(z * 100);
  1895. //int intWvalue = Convert.ToInt32(w * 100);
  1896. string TrsSt = GetStationsName(module);
  1897. if (string.IsNullOrEmpty(TrsSt))
  1898. {
  1899. EV.PostAlarmLog("Robot", "Invalid Parameter.");
  1900. return false;
  1901. }
  1902. string strpara = $"{TrsSt}{slot:D2}P{hand2string(arm)}A";
  1903. if (x != 0 || y != 0 || z != 0)
  1904. {
  1905. string strxoffset = intXvalue >= 0 ? $"{intXvalue:D5}" : $"{intXvalue:D4}";
  1906. string stryoffset = intYvalue >= 0 ? $"{intYvalue:D5}" : $"{intYvalue:D4}";
  1907. string strzoffset = intZvalue >= 0 ? $"{intZvalue:D5}" : $"{intZvalue:D4}";
  1908. //string strwoffset = intWvalue >= 0 ? $"{intWvalue:D8}" : $"{intWvalue:D7}";
  1909. strpara += $"{strxoffset}{stryoffset}{strzoffset}";
  1910. }
  1911. lock (_locker)
  1912. {
  1913. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  1914. {
  1915. if (x != 0 || y != 0 || z != 0)
  1916. {
  1917. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTPO", strpara));
  1918. }
  1919. else
  1920. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTRP", strpara));
  1921. }
  1922. else
  1923. {
  1924. if (x != 0 || y != 0 || z != 0)
  1925. {
  1926. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTPO", strpara));
  1927. }
  1928. else
  1929. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTRP", strpara));
  1930. }
  1931. }
  1932. return true;
  1933. }
  1934. catch (Exception ex)
  1935. {
  1936. LOG.Write(ex);
  1937. return false;
  1938. }
  1939. }
  1940. protected override bool fPlaceComplete(object[] param)
  1941. {
  1942. RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0];
  1943. ModuleName sourcemodule;
  1944. if (!Enum.TryParse(CurrentParamter[1].ToString(), out sourcemodule)) return false;
  1945. int Sourceslotindex;
  1946. if (!int.TryParse(CurrentParamter[2].ToString(), out Sourceslotindex)) return false;
  1947. int delayCount = 0;
  1948. if (arm == RobotArmEnum.Lower)
  1949. {
  1950. //WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
  1951. while (!isSimulatorMode && GetWaferState(arm) != RobotArmWaferStateEnum.Absent)
  1952. {
  1953. delayCount++;
  1954. Thread.Sleep(50);
  1955. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  1956. if (delayCount > 100)
  1957. {
  1958. OnError("Wafer detect error");
  1959. return true;
  1960. }
  1961. }
  1962. WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
  1963. }
  1964. if (arm == RobotArmEnum.Upper)
  1965. {
  1966. //WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex);
  1967. delayCount = 0;
  1968. while (!isSimulatorMode && GetWaferState(arm) != RobotArmWaferStateEnum.Absent)
  1969. {
  1970. delayCount++;
  1971. Thread.Sleep(50);
  1972. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  1973. if (delayCount > 100)
  1974. {
  1975. OnError("Wafer detect error");
  1976. return true;
  1977. }
  1978. }
  1979. WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex);
  1980. }
  1981. if (arm == RobotArmEnum.Both)
  1982. {
  1983. //WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
  1984. //WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex);
  1985. while (!isSimulatorMode && GetWaferState(arm) != RobotArmWaferStateEnum.Absent)
  1986. {
  1987. delayCount++;
  1988. Thread.Sleep(50);
  1989. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  1990. if (delayCount > 100)
  1991. {
  1992. OnError("Wafer detect error");
  1993. return true;
  1994. }
  1995. }
  1996. WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
  1997. WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex + 1);
  1998. }
  1999. if (ModuleHelper.IsLoadPort(sourcemodule))
  2000. {
  2001. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(sourcemodule.ToString());
  2002. if (lp != null)
  2003. lp.NoteTransferStop();
  2004. }
  2005. return base.fPlaceComplete(param);
  2006. }
  2007. protected override bool fStartPickWafer(object[] param)
  2008. {
  2009. try
  2010. {
  2011. RobotArmEnum arm = (RobotArmEnum)param[0];
  2012. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
  2013. if (ModuleHelper.IsLoadPort(module))
  2014. {
  2015. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString());
  2016. if (lp != null)
  2017. lp.NoteTransferStart();
  2018. }
  2019. Blade1Target = module;
  2020. Blade2Target = module;
  2021. int slot = (int)param[2] + 1;
  2022. float x = 0, y = 0, z = 0, w = 0;
  2023. if (param.Length > 3)
  2024. {
  2025. x = (float)param[3];
  2026. y = (float)param[4];
  2027. z = (float)param[5];
  2028. w = (float)param[6];
  2029. }
  2030. int intXvalue = Convert.ToInt32(x * 100);
  2031. int intYvalue = Convert.ToInt32(y * 100);
  2032. int intZvalue = Convert.ToInt32(z * 100);
  2033. string TrsSt = GetStationsName(module);
  2034. if (string.IsNullOrEmpty(TrsSt))
  2035. {
  2036. EV.PostAlarmLog("Robot", "Invalid Paramter.");
  2037. return false;
  2038. }
  2039. string strpara = $"{TrsSt}{slot:D2}G{hand2string(arm)}A";
  2040. if (x != 0 || y != 0 || z != 0)
  2041. {
  2042. string strxoffset = intXvalue >= 0 ? $"{intXvalue:D5}" : $"{intXvalue:D4}";
  2043. string stryoffset = intYvalue >= 0 ? $"{intYvalue:D5}" : $"{intYvalue:D4}";
  2044. string strzoffset = intZvalue >= 0 ? $"{intZvalue:D5}" : $"{intZvalue:D4}";
  2045. //string strwoffset = intWvalue >= 0 ? $"{intWvalue:D5}" : $"{intWvalue:D4}";
  2046. strpara += $"{strxoffset}{stryoffset}{strzoffset}";
  2047. }
  2048. lock (_locker)
  2049. {
  2050. if (_lstHandlers.Count == 0 && !_connection.IsBusy)
  2051. {
  2052. if (x != 0 || y != 0 || z != 0)
  2053. {
  2054. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTGO", strpara));
  2055. }
  2056. else
  2057. {
  2058. ExecuteHandler(new NXC100RobotMotionHandler(this, "MTRG", strpara));
  2059. }
  2060. }
  2061. else
  2062. {
  2063. if (x != 0 || y != 0 || z != 0)
  2064. {
  2065. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTGO", strpara));
  2066. }
  2067. else
  2068. {
  2069. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "MTRG", strpara));
  2070. }
  2071. }
  2072. }
  2073. return true;
  2074. }
  2075. catch (Exception ex)
  2076. {
  2077. LOG.Write(ex);
  2078. return false;
  2079. }
  2080. }
  2081. protected override bool fPickComplete(object[] param)
  2082. {
  2083. RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0];
  2084. ModuleName sourcemodule;
  2085. if (!Enum.TryParse(CurrentParamter[1].ToString(), out sourcemodule)) return false;
  2086. int SourceslotIndex;
  2087. if (!int.TryParse(CurrentParamter[2].ToString(), out SourceslotIndex)) return false;
  2088. int delayCount = 0;
  2089. if (arm == RobotArmEnum.Lower)
  2090. {
  2091. //WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  2092. while (!isSimulatorMode && GetWaferState(arm) != RobotArmWaferStateEnum.Present)
  2093. {
  2094. delayCount++;
  2095. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  2096. Thread.Sleep(50);
  2097. if (delayCount > 100)
  2098. {
  2099. OnError("Wafer detect error");
  2100. return true;
  2101. }
  2102. }
  2103. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  2104. }
  2105. if (arm == RobotArmEnum.Upper)
  2106. {
  2107. //WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  2108. while (!isSimulatorMode && GetWaferState(arm) != RobotArmWaferStateEnum.Present)
  2109. {
  2110. delayCount++;
  2111. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  2112. Thread.Sleep(50);
  2113. if (delayCount > 100)
  2114. {
  2115. OnError("Wafer detect error");
  2116. return true;
  2117. }
  2118. }
  2119. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  2120. }
  2121. if (arm == RobotArmEnum.Both)
  2122. {
  2123. //WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  2124. //WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
  2125. while (!isSimulatorMode && GetWaferState(arm) != RobotArmWaferStateEnum.Present)
  2126. {
  2127. delayCount++;
  2128. LOG.Write($"{RobotModuleName} delay {delayCount} time to detect wafer");
  2129. Thread.Sleep(50);
  2130. if (delayCount > 100)
  2131. {
  2132. OnError("Wafer detect error");
  2133. return true;
  2134. }
  2135. }
  2136. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
  2137. WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex + 1, RobotModuleName, 1);
  2138. }
  2139. if (ModuleHelper.IsLoadPort(sourcemodule))
  2140. {
  2141. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(sourcemodule.ToString());
  2142. if (lp != null)
  2143. lp.NoteTransferStop();
  2144. }
  2145. return base.fPickComplete(param);
  2146. }
  2147. protected override bool fResetToReady(object[] param)
  2148. {
  2149. if (_doRobotHold != null)
  2150. _doRobotHold.SetTrigger(true, out _);
  2151. return true;
  2152. }
  2153. protected override bool fReset(object[] param)
  2154. {
  2155. if (!_connection.IsConnected || _address != SC.GetStringValue($"{_scRoot}.{Name}.Address"))
  2156. {
  2157. _address = SC.GetStringValue($"{_scRoot}.{Name}.Address");
  2158. _enableLog = SC.GetValue<bool>($"{_scRoot}.{Name}.EnableLogMessage");
  2159. _connection = new YaskawaNXC100Connection(this, _address);
  2160. _connection.EnableLog(_enableLog);
  2161. _connection.Connect();
  2162. }
  2163. lock (_locker)
  2164. {
  2165. if (_doRobotHold != null)
  2166. _doRobotHold.SetTrigger(true, out _);
  2167. _lstHandlers.Clear();
  2168. _connection.ForceClear();
  2169. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CCLR", "E"));
  2170. _lstHandlers.AddLast(new NXC100RobotReadHandler(this, "RSTS"));
  2171. }
  2172. return true;
  2173. }
  2174. protected override bool fError(object[] param)
  2175. {
  2176. return true;
  2177. }
  2178. protected override bool fStartExtendForPick(object[] param)
  2179. {
  2180. return false;
  2181. }
  2182. protected override bool fStartExtendForPlace(object[] param)
  2183. {
  2184. return false;
  2185. }
  2186. protected override bool fStartRetractFromPick(object[] param)
  2187. {
  2188. return false;
  2189. }
  2190. protected override bool fStartRetractFromPlace(object[] param)
  2191. {
  2192. return false;
  2193. }
  2194. public void CheckWaferPresentAndGrip()
  2195. {
  2196. if (GetWaferState(RobotArmEnum.Lower) == RobotArmWaferStateEnum.Present)
  2197. {
  2198. if (WaferManager.Instance.CheckNoWafer(RobotModuleName, 0))
  2199. {
  2200. EV.PostWarningLog($"{RobotModuleName}", $"System detec wafer on lower arm, will create wafer automatically.");
  2201. WaferManager.Instance.CreateWafer(RobotModuleName, 0, WaferStatus.Normal);
  2202. }
  2203. }
  2204. if (GetWaferState(RobotArmEnum.Lower) == RobotArmWaferStateEnum.Absent)
  2205. {
  2206. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "1,0,0"));
  2207. if (WaferManager.Instance.CheckHasWafer(RobotModuleName, 0))
  2208. {
  2209. EV.PostWarningLog($"{RobotModuleName}", $"System didn't detec wafer on lower arm, but it has record.");
  2210. }
  2211. }
  2212. if (GetWaferState(RobotArmEnum.Upper) == RobotArmWaferStateEnum.Present)
  2213. {
  2214. if (WaferManager.Instance.CheckNoWafer(RobotModuleName, 1))
  2215. {
  2216. EV.PostWarningLog($"{RobotModuleName}", $"System detec wafer on upper arm, will create wafer automatically.");
  2217. WaferManager.Instance.CreateWafer(RobotModuleName, 1, WaferStatus.Normal);
  2218. }
  2219. }
  2220. if (GetWaferState(RobotArmEnum.Upper) == RobotArmWaferStateEnum.Absent)
  2221. {
  2222. _lstHandlers.AddLast(new NXC100RobotMotionHandler(this, "CSOL", "2,0,0"));
  2223. if (WaferManager.Instance.CheckHasWafer(RobotModuleName, 1))
  2224. {
  2225. EV.PostWarningLog($"{RobotModuleName}", $"System didn't detec wafer on upper arm, but it has record.");
  2226. }
  2227. }
  2228. }
  2229. public override RobotArmWaferStateEnum GetWaferState(RobotArmEnum arm)
  2230. {
  2231. if (arm == RobotArmEnum.Lower)
  2232. {
  2233. if (_diRobotBlade1WaferOn != null)
  2234. {
  2235. if (_diRobotBlade1WaferOn.Value) return RobotArmWaferStateEnum.Absent;
  2236. else return RobotArmWaferStateEnum.Present;
  2237. }
  2238. return IsWaferPresenceOnBlade1 ? RobotArmWaferStateEnum.Present : RobotArmWaferStateEnum.Absent;
  2239. }
  2240. if (arm == RobotArmEnum.Upper)
  2241. {
  2242. if (_diRobotBlade2WaferOn != null)
  2243. {
  2244. if (_diRobotBlade2WaferOn.Value) return RobotArmWaferStateEnum.Absent;
  2245. else return RobotArmWaferStateEnum.Present;
  2246. }
  2247. return IsWaferPresenceOnBlade2 ? RobotArmWaferStateEnum.Present : RobotArmWaferStateEnum.Absent;
  2248. }
  2249. if (arm == RobotArmEnum.Both)
  2250. {
  2251. if (_diRobotBlade1WaferOn != null && _diRobotBlade2WaferOn != null)
  2252. {
  2253. if (_diRobotBlade2WaferOn.Value && _diRobotBlade1WaferOn.Value)
  2254. return RobotArmWaferStateEnum.Absent;
  2255. else if (!_diRobotBlade2WaferOn.Value && !_diRobotBlade1WaferOn.Value)
  2256. return RobotArmWaferStateEnum.Present;
  2257. else return RobotArmWaferStateEnum.Unknown;
  2258. }
  2259. if (IsWaferPresenceOnBlade1 && IsWaferPresenceOnBlade2)
  2260. {
  2261. return RobotArmWaferStateEnum.Present;
  2262. }
  2263. if ((!IsWaferPresenceOnBlade1) && !IsWaferPresenceOnBlade2)
  2264. {
  2265. return RobotArmWaferStateEnum.Absent;
  2266. }
  2267. }
  2268. return RobotArmWaferStateEnum.Unknown;
  2269. }
  2270. public void NoteError(string errortext)
  2271. {
  2272. OnError(errortext);
  2273. }
  2274. public void SenACK()
  2275. {
  2276. _connection.SendAck();
  2277. }
  2278. public override bool OnActionDone(object[] param)
  2279. {
  2280. Blade1Target = ModuleName.System;
  2281. Blade2Target = ModuleName.System;
  2282. IsBusy = false;
  2283. ModuleName sourcemodule;
  2284. if (CurrentParamter != null && CurrentParamter.Length > 2 && Enum.TryParse(CurrentParamter[1].ToString(), out sourcemodule))
  2285. {
  2286. if (ModuleHelper.IsLoadPort(sourcemodule))
  2287. {
  2288. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(sourcemodule.ToString());
  2289. if (lp != null)
  2290. lp.NoteTransferStop();
  2291. }
  2292. }
  2293. if (_lstHandlers.Count == 0)
  2294. {
  2295. IsBusy = false;
  2296. return base.OnActionDone(param);
  2297. }
  2298. return true;
  2299. }
  2300. public override void Terminate()
  2301. {
  2302. _thread.Stop();
  2303. if (!SC.ContainsItem($"{_scRoot}.{Name}.CloseConnectionOnShutDown") || SC.GetValue<bool>($"{_scRoot}.{Name}.CloseConnectionOnShutDown"))
  2304. {
  2305. LOG.Write("Close connection for" + RobotModuleName.ToString());
  2306. _connection.Disconnect();
  2307. }
  2308. base.Terminate();
  2309. }
  2310. public virtual string hand2string(RobotArmEnum hand)
  2311. {
  2312. string st = "";
  2313. switch (hand)
  2314. {
  2315. case RobotArmEnum.Upper:
  2316. st = "A"; //单手臂 下
  2317. break;
  2318. case RobotArmEnum.Lower:
  2319. st = "B"; //4手臂 上
  2320. break;
  2321. case RobotArmEnum.Both:
  2322. st = "W";
  2323. break;
  2324. }
  2325. return st;
  2326. }
  2327. }
  2328. //public class YaskawaTokenGenerator
  2329. //{
  2330. // private int _last = 0;
  2331. // List<int> _pool = new List<int>();
  2332. // SCConfigItem scToken = null;
  2333. // public int CurrentToken => _last;
  2334. // public YaskawaTokenGenerator(string scName)
  2335. // {
  2336. // scToken = SC.GetConfigItem(scName);
  2337. // if (scToken == null)
  2338. // _last = scToken.IntValue;
  2339. // Random r = new Random();
  2340. // _last = r.Next() % 20;
  2341. // }
  2342. // public int create()
  2343. // {
  2344. // int first = _last;
  2345. // int token = first;
  2346. // do
  2347. // {
  2348. // token = (token + 1) % 100;
  2349. // if (_pool.Contains(token))
  2350. // continue;
  2351. // _pool.Add(token);
  2352. // _last = token;
  2353. // scToken.IntValue = _last;
  2354. // return _last;
  2355. // } while (token != first);
  2356. // throw (new ExcuteFailedException("Get token failed,pool is full"));
  2357. // }
  2358. // public void release(int token)
  2359. // {
  2360. // _pool.Remove(token);
  2361. // }
  2362. // public void release()
  2363. // {
  2364. // _last = 0;
  2365. // _pool.Clear();
  2366. // }
  2367. //}
  2368. //public enum YaskawaPositonEnum
  2369. //{
  2370. // RegisteredPosition,
  2371. // ReadyPosition,
  2372. // IntermediatePosition,
  2373. // MappingStartPosition,
  2374. // MappingFinishPosition,
  2375. //}
  2376. }