EfemView.xaml.cs 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Input;
  10. using Aitex.Core.RT.Log;
  11. using Aitex.Core.UI.MVVM;
  12. using Aitex.Core.Util;
  13. using Aitex.Core.Utilities;
  14. using MECF.Framework.Common.Communications.Tcp.Socket.Server.APM.EventArgs;
  15. using MECF.Framework.Simulator.Core.Commons;
  16. using MECF.Framework.Simulator.Core.Driver;
  17. using MECF.Framework.Simulator.Core.LoadPorts;
  18. namespace EfemDualSimulator.Views
  19. {
  20. public partial class EfemView : UserControl
  21. {
  22. public EfemView()
  23. {
  24. InitializeComponent();
  25. this.Loaded += OnViewLoaded;
  26. }
  27. private void OnViewLoaded(object sender, RoutedEventArgs e)
  28. {
  29. if (DataContext == null)
  30. {
  31. DataContext = new EfemViewModel(13000, 0);
  32. (DataContext as TimerViewModelBase).Start();
  33. }
  34. }
  35. }
  36. class EfemViewModel : SocketDeviceViewModel
  37. {
  38. public string Title
  39. {
  40. get { return "Efem Simulator"; }
  41. }
  42. public string LP1WaferMap
  43. {
  44. get { return _sim.LP1SlotMap; }
  45. }
  46. public string LP2WaferMap
  47. {
  48. get { return _sim.LP2SlotMap; }
  49. }
  50. public string LP3WaferMap
  51. {
  52. get { return _sim.LP3SlotMap; }
  53. }
  54. public string LP1InfoPadStatus
  55. {
  56. get { return _sim.LP1InforPadState; }
  57. }
  58. public string LP2InfoPadStatus
  59. {
  60. get { return _sim.LP2InforPadState; }
  61. }
  62. public string LP3InfoPadStatus
  63. {
  64. get { return _sim.LP3InforPadState; }
  65. }
  66. private string _selectEfem = "FutureEfem2P";
  67. public string SelectEFEM { get { return _selectEfem; } set { _selectEfem = value; _sim.SelectEFEM = value; } }
  68. public ObservableCollection<string> EFEMList { get; set; }
  69. [IgnorePropertyChange]
  70. public string InfoPadSet { get; set; }
  71. public ObservableCollection<WaferItem> WaferList { get; set; }
  72. public ICommand PlaceCommand { get; set; }
  73. public ICommand RemoveCommand { get; set; }
  74. public ICommand ClearCommand { get; set; }
  75. public ICommand SetAllCommand { get; set; }
  76. public ICommand RandomCommand { get; set; }
  77. public ICommand SetInfoPadCommand { get; set; }
  78. private EfemSimulator _sim;
  79. public EfemViewModel(int port, int index) : base("EfemViewModel")
  80. {
  81. PlaceCommand = new DelegateCommand<string>(Place);
  82. RemoveCommand = new DelegateCommand<string>(Remove);
  83. ClearCommand = new DelegateCommand<string>(Clear);
  84. SetAllCommand = new DelegateCommand<string>(SetAll);
  85. RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
  86. SetInfoPadCommand = new DelegateCommand<string>(SetInfoPadStatus);
  87. _sim = new EfemSimulator(port);
  88. Init(_sim);
  89. WaferList = new ObservableCollection<WaferItem>()
  90. {
  91. new WaferItem {Display = "1", Index = 2, State = 3}
  92. };
  93. if (index == 1)
  94. {
  95. _sim.SetUpWafer("LP1");
  96. _sim.SetUpWafer("LP2");
  97. _sim.SetUpWafer("LP3");
  98. }
  99. else
  100. {
  101. _sim.SetLowWafer("LP1");
  102. _sim.SetUpWafer("LP2");
  103. _sim.SetLowWafer("LP3");
  104. }
  105. EFEMList = new ObservableCollection<string>() { "FutureEfem2P", "JetEfem", "FutureEfem3P" };
  106. SelectEFEM = EFEMList[0];
  107. }
  108. private void SetInfoPadStatus(string obj)
  109. {
  110. if (obj == "LP1")
  111. {
  112. _sim.LP1InforPadState = InfoPadSet;
  113. }
  114. if (obj == "LP2")
  115. {
  116. _sim.LP2InforPadState = InfoPadSet;
  117. }
  118. if (obj == "LP3")
  119. {
  120. _sim.LP3InforPadState = InfoPadSet;
  121. }
  122. }
  123. private void RandomGenerateWafer(string obj)
  124. {
  125. _sim.RandomWafer(obj);
  126. }
  127. private void SetAll(string obj)
  128. {
  129. _sim.SetAllWafer(obj);
  130. }
  131. private void Clear(string obj)
  132. {
  133. _sim.ClearWafer(obj);
  134. }
  135. private void Remove(string obj)
  136. {
  137. _sim.RemoveCarrier(obj);
  138. }
  139. private void Place(string obj)
  140. {
  141. _sim.PlaceCarrier(obj);
  142. }
  143. }
  144. public class EfemSimulator : SocketDeviceSimulator
  145. {
  146. public string LP1SlotMap
  147. {
  148. get { return string.Join("", _lp1slotMap); }
  149. }
  150. public string LP2SlotMap
  151. {
  152. get { return string.Join("", _lp2slotMap); }
  153. }
  154. public string LP3SlotMap
  155. {
  156. get { return string.Join("", _lp3slotMap); }
  157. }
  158. public string SelectEFEM { get; set; }
  159. //public event Action<string> WriteDeviceEvent;
  160. private bool[] _lp1SigStateData1 = new bool[32];
  161. private bool[] _lp1SigStateData2 = new bool[32];
  162. private bool[] _lp2SigStateData1 = new bool[32];
  163. private bool[] _lp2SigStateData2 = new bool[32];
  164. private bool[] _lp3SigStateData1 = new bool[32];
  165. private bool[] _lp3SigStateData2 = new bool[32];
  166. private string[] _lp1slotMap = new string[25];
  167. private string[] _lp2slotMap = new string[25];
  168. private string[] _lp3slotMap = new string[25];
  169. private string[] _stationslotMap = new string[25];
  170. public string LP1InforPadState { get; set; } = "0";
  171. public string LP2InforPadState { get; set; } = "0";
  172. public string LP3InforPadState { get; set; } = "0";
  173. public string LP1Mode { get; set; } = "MANUAL";
  174. public string LP2Mode { get; set; } = "MANUAL";
  175. public string LP3Mode { get; set; } = "MANUAL";
  176. //private LpState _lp1State;
  177. //private E84State _lp1E84State;
  178. //private SystemState _systemState;
  179. //private bool _isPlaced;
  180. //private bool _isPresent;
  181. //private int _moveTime = 5000; //
  182. private PeriodicJob _HwThread;
  183. private bool _bCommReady;
  184. public EfemSimulator(int tcpPort)
  185. : base(tcpPort, -1, "\r", ' ')
  186. {
  187. for (int i = 0; i < _lp1slotMap.Length; i++)
  188. _lp1slotMap[i] = "0";
  189. for (int i = 0; i < _lp2slotMap.Length; i++)
  190. _lp2slotMap[i] = "0";
  191. for (int i = 0; i < _lp3slotMap.Length; i++)
  192. _lp3slotMap[i] = "0";
  193. for (int i = 0; i < _stationslotMap.Length; i++)
  194. _stationslotMap[i] = "0";
  195. for (int i = 0; i < _lp1SigStateData1.Length; i++)
  196. _lp1SigStateData1[i] = false;
  197. for (int i = 0; i < _lp1SigStateData2.Length; i++)
  198. _lp1SigStateData2[i] = false;
  199. for (int i = 0; i < _lp2SigStateData1.Length; i++)
  200. _lp2SigStateData1[i] = false;
  201. for (int i = 0; i < _lp2SigStateData2.Length; i++)
  202. _lp2SigStateData2[i] = false;
  203. for (int i = 0; i < _lp3SigStateData1.Length; i++)
  204. _lp3SigStateData1[i] = false;
  205. for (int i = 0; i < _lp3SigStateData2.Length; i++)
  206. _lp3SigStateData2[i] = false;
  207. _lp1SigStateData1[0] = false; //LP Placement
  208. _lp1SigStateData1[1] = false; //Pod Present
  209. _lp1SigStateData1[2] = false; //Access SW
  210. _lp1SigStateData1[3] = false; //Pod lock
  211. _lp1SigStateData1[4] = false; //Cover close
  212. _lp1SigStateData1[5] = false; // Cover lock
  213. _lp1SigStateData1[6] = false;
  214. _lp1SigStateData1[7] = false;
  215. _lp1SigStateData1[8] = false; //Info pad A
  216. _lp1SigStateData1[9] = false; //Info pad B
  217. _lp1SigStateData1[10] = false; //Info pad C
  218. _lp1SigStateData1[11] = false; //Info pad D
  219. _lp1SigStateData1[24] = false; //VALID (E84)
  220. _lp1SigStateData1[25] = false; //CS_0 (E84)
  221. _lp1SigStateData1[26] = false; //CS_1 (E84)
  222. _lp1SigStateData1[27] = false; //Valid
  223. _lp1SigStateData1[28] = false; //TR_REQ (E84)
  224. _lp1SigStateData1[29] = false; //BUSY (E84)
  225. _lp1SigStateData1[30] = false; //COMPT (E84)
  226. _lp1SigStateData1[31] = false; //CONT (E84)
  227. _lp1SigStateData2[0] = false; //PRESENCE
  228. _lp1SigStateData2[1] = false; //PLACEMENT
  229. _lp1SigStateData2[2] = false; //LOAD
  230. _lp1SigStateData2[3] = false; //UNLOAD
  231. _lp1SigStateData2[4] = false; //MANUAL MODE
  232. _lp1SigStateData2[5] = false; //ERROR
  233. _lp1SigStateData2[6] = false; //CLAMP / UNCLAMP
  234. _lp1SigStateData2[7] = false; //DOCK/UNDOCK
  235. _lp1SigStateData2[8] = false; //ACCESS SW
  236. //A000A 41010 10001 01000
  237. _lp2SigStateData1[0] = false; //LP Placement
  238. _lp2SigStateData1[1] = false; //Pod Present
  239. _lp2SigStateData1[2] = false; //Access SW
  240. _lp2SigStateData1[3] = false; //Pod lock
  241. _lp2SigStateData1[4] = false; //Cover close
  242. _lp2SigStateData1[5] = false; // Cover lock
  243. _lp2SigStateData1[6] = false;
  244. _lp2SigStateData1[7] = false;
  245. _lp2SigStateData1[8] = false; //Info pad A
  246. _lp2SigStateData1[9] = false; //Info pad B
  247. _lp2SigStateData1[10] = false; //Info pad C
  248. _lp2SigStateData1[11] = false; //Info pad D
  249. _lp2SigStateData1[24] = false; //VALID (E84)
  250. _lp2SigStateData1[25] = false; //CS_0 (E84)
  251. _lp2SigStateData1[26] = false; //CS_1 (E84)
  252. _lp2SigStateData1[27] = false; //Valid
  253. _lp2SigStateData1[28] = false; //TR_REQ (E84)
  254. _lp2SigStateData1[29] = false; //BUSY (E84)
  255. _lp2SigStateData1[30] = false; //COMPT (E84)
  256. _lp2SigStateData1[31] = false; //CONT (E84)
  257. _lp2SigStateData2[0] = false; //PRESENCE
  258. _lp2SigStateData2[1] = false; //PLACEMENT
  259. _lp2SigStateData2[2] = false; //LOAD
  260. _lp2SigStateData2[3] = false; //UNLOAD
  261. _lp2SigStateData2[4] = false; //MANUAL MODE
  262. _lp2SigStateData2[5] = false; //ERROR
  263. _lp2SigStateData2[6] = false; //CLAMP / UNCLAMP
  264. _lp2SigStateData2[7] = false; //DOCK/UNDOCK
  265. _lp2SigStateData2[8] = false; //ACCESS SW
  266. //A000A 41010 10001 01000
  267. _lp3SigStateData1[0] = false; //LP Placement
  268. _lp3SigStateData1[1] = false; //Pod Present
  269. _lp3SigStateData1[2] = false; //Access SW
  270. _lp3SigStateData1[3] = false; //Pod lock
  271. _lp3SigStateData1[4] = false; //Cover close
  272. _lp3SigStateData1[5] = false; // Cover lock
  273. _lp3SigStateData1[6] = false;
  274. _lp3SigStateData1[7] = false;
  275. _lp3SigStateData1[8] = false; //Info pad A
  276. _lp3SigStateData1[9] = false; //Info pad B
  277. _lp3SigStateData1[10] = false; //Info pad C
  278. _lp3SigStateData1[11] = false; //Info pad D
  279. _lp3SigStateData1[24] = false; //VALID (E84)
  280. _lp3SigStateData1[25] = false; //CS_0 (E84)
  281. _lp3SigStateData1[26] = false; //CS_1 (E84)
  282. _lp3SigStateData1[27] = false; //Valid
  283. _lp3SigStateData1[28] = false; //TR_REQ (E84)
  284. _lp3SigStateData1[29] = false; //BUSY (E84)
  285. _lp3SigStateData1[30] = false; //COMPT (E84)
  286. _lp3SigStateData1[31] = false; //CONT (E84)
  287. _lp3SigStateData2[0] = false; //PRESENCE
  288. _lp3SigStateData2[1] = false; //PLACEMENT
  289. _lp3SigStateData2[2] = false; //LOAD
  290. _lp3SigStateData2[3] = false; //UNLOAD
  291. _lp3SigStateData2[4] = false; //MANUAL MODE
  292. _lp3SigStateData2[5] = false; //ERROR
  293. _lp3SigStateData2[6] = false; //CLAMP / UNCLAMP
  294. _lp3SigStateData2[7] = false; //DOCK/UNDOCK
  295. _lp3SigStateData2[8] = false; //ACCESS SW
  296. BinaryDataMode = false;
  297. }
  298. //public void ChangeSlotMap(SlotMapChangedEventArgs obj)
  299. //{
  300. // string slotMap = obj.SlotMap.Replace("'", "");
  301. // for (int i = 0; i < slotMap.Length; i++)
  302. // _slotMap[i] = slotMap.Substring(i, 1);
  303. //}
  304. public override void ClientConnected(object sender, TcpClientConnectedEventArgs e)
  305. {
  306. base.ClientConnected(sender, e);
  307. Thread.Sleep(10);
  308. OnWriteMessage("INF:READY/COMM;");
  309. LOG.Info("Send message " + "INF:READY/COMM;");
  310. _HwThread = new PeriodicJob(5000, OnSendEvent, "EfemHardware", true);
  311. }
  312. private bool OnSendEvent()
  313. {
  314. if (!_bCommReady)
  315. {
  316. OnWriteMessage("INF:READY/COMM;");
  317. }
  318. return true;
  319. }
  320. protected override void ProcessUnsplitMessage(string message)
  321. {
  322. LOG.Info("Received message " + message);
  323. string[] msg = message.Split(':');
  324. if (msg.Length < 2)
  325. return;
  326. if (!_bCommReady && message.Contains("ACK:READY/COMM"))
  327. {
  328. _bCommReady = true;
  329. }
  330. string type = msg[0];
  331. string cmd = msg[1];
  332. switch (type)
  333. {
  334. case "SET":
  335. ReceiveSetCommand(cmd);
  336. break;
  337. case "MOD":
  338. ReceiveModCommand(cmd);
  339. break;
  340. case "GET":
  341. ReceiveGetCommand(cmd);
  342. break;
  343. case "FIN":
  344. ReceiveFinCommand(cmd);
  345. break;
  346. case "MOV":
  347. ReceiveMovCommand(cmd);
  348. break;
  349. case "EVT":
  350. ReceiveEvtCommand(cmd);
  351. break;
  352. case "TCH":
  353. ReceiveTchCommand(cmd);
  354. break;
  355. default:
  356. ReceiveUnknownCommand(message);
  357. break;
  358. }
  359. }
  360. private void ReceiveMovCommand(string cmd)
  361. {
  362. bool needINF = true;
  363. string[] data = cmd.Split('/');
  364. bool needSendMap = false;
  365. switch (data[0])
  366. {
  367. case "INIT":
  368. break;
  369. case "ORGSH": //back to initial
  370. if (data[1] == "ALL")
  371. {
  372. }
  373. if (data[1] == "P1")
  374. {
  375. }
  376. if (data[1] == "P2")
  377. {
  378. }
  379. break;
  380. case "ABORG": //Force back to initial
  381. break;
  382. case "UNLOCK": //FOUP clamp: Close
  383. ReceiveCommandUNLOCK(data[1]);
  384. break;
  385. case "LOCK": //FOUP clamp: open
  386. ReceiveCommandLOCK(data[1]);
  387. break;
  388. case "DOCK": //FOUP dock:
  389. ReceiveCommandDOCK(data[1]);
  390. break;
  391. case "UNDOCK": //FOUP undock
  392. ReceiveCommandUNDOCK(data[1]);
  393. break;
  394. case "OPEN": //Door open
  395. ReceiveCommandOPEN(data[1]);
  396. break;
  397. case "CLOSE": //Door Close
  398. ReceiveCommandCLOSE(data[1]);
  399. break;
  400. case "WAFSH": //Map
  401. needSendMap = true;
  402. break;
  403. case "GOTO": //Maps and loads the FOUP.
  404. break;
  405. case "CSTID":
  406. break;
  407. default:
  408. break;
  409. }
  410. SendAck(cmd);
  411. Thread.Sleep(200);
  412. if (needINF)
  413. {
  414. if (needSendMap)
  415. {
  416. Thread.Sleep(200);
  417. SendMapEvent(data[1]);
  418. }
  419. if (data[0] == "CSTID")
  420. FeedbackCarrierID(cmd);
  421. else
  422. SendInf(cmd);
  423. }
  424. }
  425. private void ReceiveCommandCLOSE(string module)
  426. {
  427. module = module.Replace(";", "").Replace("\r", "");
  428. if (module == "P1")
  429. {
  430. if (SelectEFEM == "FutureEfem3P")
  431. {
  432. _lp1SigStateData1[3] = false;
  433. _lp1SigStateData1[4] = false;
  434. _lp1SigStateData1[5] = false;
  435. }
  436. else
  437. {
  438. _lp1SigStateData1[5] = false;
  439. _lp1SigStateData1[11] = false;
  440. }
  441. }
  442. if (module == "P2")
  443. {
  444. if (SelectEFEM == "FutureEfem3P")
  445. {
  446. _lp2SigStateData1[3] = false;
  447. _lp2SigStateData1[4] = false;
  448. _lp2SigStateData1[5] = false;
  449. }
  450. else
  451. {
  452. _lp2SigStateData1[5] = false;
  453. _lp2SigStateData1[11] = false;
  454. }
  455. }
  456. if (module == "P3")
  457. {
  458. if (SelectEFEM == "FutureEfem3P")
  459. {
  460. _lp3SigStateData1[3] = false;
  461. _lp3SigStateData1[4] = false;
  462. _lp3SigStateData1[5] = false;
  463. }
  464. else
  465. {
  466. _lp3SigStateData1[5] = false;
  467. _lp3SigStateData1[11] = false;
  468. }
  469. }
  470. }
  471. private void ReceiveCommandOPEN(string module)
  472. {
  473. module = module.Replace(";", "").Replace("\r", "");
  474. if (module == "P1")
  475. {
  476. if (SelectEFEM == "FutureEfem3P")
  477. {
  478. _lp1SigStateData1[4] = true;
  479. _lp1SigStateData1[5] = true;
  480. }
  481. else
  482. {
  483. _lp1SigStateData1[5] = true;
  484. _lp1SigStateData1[11] = true;
  485. }
  486. }
  487. if (module == "P2")
  488. {
  489. if (SelectEFEM == "FutureEfem3P")
  490. {
  491. _lp2SigStateData1[4] = true;
  492. _lp2SigStateData1[5] = true;
  493. }
  494. else
  495. {
  496. _lp2SigStateData1[5] = true;
  497. _lp2SigStateData1[11] = true;
  498. }
  499. }
  500. if (module == "P3")
  501. {
  502. if (SelectEFEM == "FutureEfem3P")
  503. {
  504. _lp3SigStateData1[4] = true;
  505. _lp3SigStateData1[5] = true;
  506. }
  507. else
  508. {
  509. _lp3SigStateData1[5] = true;
  510. _lp3SigStateData1[11] = true;
  511. }
  512. }
  513. }
  514. private void ReceiveCommandDOCK(string module)
  515. {
  516. module = module.Replace(";", "").Replace("\r", "");
  517. if (module == "P1")
  518. _lp1SigStateData1[5] = true;
  519. if (module == "P2")
  520. _lp2SigStateData1[5] = true;
  521. if (module == "P3")
  522. _lp3SigStateData1[5] = true;
  523. }
  524. private void ReceiveCommandUNDOCK(string module)
  525. {
  526. module = module.Replace(";", "").Replace("\r", "");
  527. if (module == "P1")
  528. _lp1SigStateData1[5] = false;
  529. if (module == "P2")
  530. _lp2SigStateData1[5] = false;
  531. if (module == "P3")
  532. _lp3SigStateData1[5] = false;
  533. }
  534. private void ReceiveCommandLOCK(string module)
  535. {
  536. module = module.Replace(";", "").Replace("\r", "");
  537. if (module == "P1")
  538. _lp1SigStateData1[3] = true;
  539. if (module == "P2")
  540. _lp2SigStateData1[3] = true;
  541. if (module == "P3")
  542. _lp3SigStateData1[3] = true;
  543. }
  544. private void ReceiveCommandUNLOCK(string module)
  545. {
  546. module = module.Replace(";", "").Replace("\r", "");
  547. if (module == "P1")
  548. _lp1SigStateData1[3] = false;
  549. if (module == "P2")
  550. _lp2SigStateData1[3] = false;
  551. if (module == "P3")
  552. _lp3SigStateData1[3] = false;
  553. }
  554. private void ReceiveSetCommand(string cmd)
  555. {
  556. string[] data = cmd.Split('/');
  557. switch (data[0])
  558. {
  559. case "LED":
  560. if (data[1] == "P1")
  561. {
  562. if (data[2] == "LOAD")
  563. {
  564. if (data[3] == "ON")
  565. {
  566. _lp1SigStateData2[2] = true;
  567. }
  568. else _lp1SigStateData2[2] = false;
  569. }
  570. if (data[2] == "UNLOAD")
  571. {
  572. if (data[3] == "ON")
  573. {
  574. _lp1SigStateData2[3] = true;
  575. }
  576. else _lp1SigStateData2[3] = false;
  577. }
  578. if (data[2] == "MANUAL MODE")
  579. {
  580. if (data[3] == "ON")
  581. {
  582. _lp1SigStateData2[4] = true;
  583. }
  584. else _lp1SigStateData2[4] = false;
  585. }
  586. }
  587. if (data[1] == "P2")
  588. {
  589. if (data[2] == "LOAD")
  590. {
  591. if (data[3] == "ON")
  592. {
  593. _lp2SigStateData2[2] = true;
  594. }
  595. else _lp2SigStateData2[2] = false;
  596. }
  597. if (data[2] == "UNLOAD")
  598. {
  599. if (data[3] == "ON")
  600. {
  601. _lp2SigStateData2[3] = true;
  602. }
  603. else _lp2SigStateData2[3] = false;
  604. }
  605. if (data[2] == "MANUAL MODE")
  606. {
  607. if (data[3] == "ON")
  608. {
  609. _lp2SigStateData2[4] = true;
  610. }
  611. else _lp2SigStateData2[4] = false;
  612. }
  613. }
  614. break;
  615. case "SIZE":
  616. if (data[1] == "ARM1")
  617. robotArm1Wafersize = data[2];
  618. if (data[1] == "ARM2")
  619. robotArm2Wafersize = data[2];
  620. if (data[1] == "ALIGN1")
  621. alignerwafersize = data[2];
  622. break;
  623. case "MODE":
  624. if (data[1] == "P1")
  625. LP1Mode = data[2].Remove(data[2].Length-1);
  626. else if (data[1]=="P2")
  627. LP2Mode = data[2].Remove(data[2].Length - 1);
  628. else if (data[1]=="P3")
  629. LP3Mode = data[2].Remove(data[2].Length - 1);
  630. break;
  631. }
  632. SendAck(cmd);
  633. if (cmd.Contains("FSB") || data[0]=="MODE") return;
  634. SendInf(cmd);
  635. }
  636. private void ReceiveModCommand(string cmd)
  637. {
  638. SendAck(cmd);
  639. }
  640. #region GET Command
  641. private void ReceiveGetCommand(string cmdGet)
  642. {
  643. string message = $"ACK:{cmdGet}";
  644. OnWriteMessage(message);
  645. string[] data = cmdGet.Split('/');
  646. switch (data[0])
  647. {
  648. case "MAPDT":
  649. FeedbackGetWaferMapDescendingOrder(cmdGet);
  650. break;
  651. case "ERROR":
  652. break;
  653. case "CLAMP":
  654. break;
  655. case "STATE":
  656. FeedbackGetStatus(cmdGet);
  657. break;
  658. case "MODE":
  659. FeedbackMode(cmdGet);
  660. break;
  661. case "TRANSREQ":
  662. break;
  663. case "SIGSTAT":
  664. FeedbackGetSigStatus(cmdGet);
  665. break;
  666. case "EVENT":
  667. break;
  668. case "CSTID":
  669. FeedbackCarrierID(cmdGet);
  670. break;
  671. case "SIZE":
  672. FeedbackWaferSize(cmdGet);
  673. break;
  674. case "ADPLOCK":
  675. break;
  676. case "ADPUNLOCK":
  677. break;
  678. }
  679. }
  680. private void FeedbackWaferSize(string cmdGet)
  681. {
  682. //string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", _state));
  683. string[] data = cmdGet.Replace(";", "").Split('/');
  684. string message = $"INF:{cmdGet.Replace(";", "")}/{robotArm1Wafersize};";
  685. if (message.Contains("BF1") || message.Contains("BF2") || message.Contains("BF3"))
  686. message = message.Replace("300", "NONE");
  687. if (message.Contains("STATION"))
  688. message = message.Replace("300", "NONE");
  689. OnWriteMessage(message);
  690. }
  691. private string robotArm1Wafersize = "300";
  692. private string robotArm2Wafersize = "300";
  693. private string alignerwafersize = "300";
  694. private int _cid = 0;
  695. private void FeedbackCarrierID(string cmd)
  696. {
  697. _cid++;
  698. //string message = $"INF:{cmd.Replace(";", "")}/{_cid};\r";
  699. string message = $"INF:{cmd.Replace(";", "")}/CST:C0000{_cid} TYPE:CST25_AU LOT:AZ0000{_cid} QTY:24 FLOW:033000 STATUS:HOLD PRI:3-1 PD:0418A CSRLOT: CLEAN:2021/11/14 19:57:50 EQPGRP:DUMMY STAGE:CP-TEST1 RECIPE:DUMMY EMP:N . ;\r";
  700. OnWriteMessage(message);
  701. }
  702. private void FeedbackMode(string cmd)
  703. {
  704. string[] data = cmd.Split('/');
  705. string reply = "";
  706. string lp = data[1].Replace(";", "");
  707. if (lp=="P1")
  708. {
  709. reply = LP1Mode;
  710. }
  711. else if (lp=="P2")
  712. {
  713. reply = LP2Mode;
  714. }
  715. else if (lp=="P3")
  716. {
  717. reply=LP3Mode;
  718. }
  719. string message = $"INF:{cmd.Replace(";", "")}/{reply};\r";
  720. OnWriteMessage(message);
  721. }
  722. private void FeedbackGetStatus(string cmd)
  723. {
  724. //string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", _state));
  725. string[] data = cmd.Split('/');
  726. string reply = "";
  727. if (data[1] == "TRACK;")
  728. {
  729. reply = "00000";
  730. }
  731. if (data[1] == "VER;")
  732. {
  733. reply = "01.000(2021-03-11)";
  734. }
  735. if (data[1] == "INF1;")
  736. {
  737. reply = "0.06";
  738. }
  739. string message = $"INF:{cmd.Replace(";", "")}/{reply};\r";
  740. OnWriteMessage(message);
  741. }
  742. private void FeedbackGetSigStatus(string cmd)
  743. {
  744. string message = "";
  745. string[] data = cmd.Split('/');
  746. if (data[1] == "SYSTEM;")
  747. {
  748. if (SelectEFEM == "FutureEfem3P")
  749. {
  750. message = "FFFF/FFFF";
  751. }
  752. else
  753. {
  754. message = "FFC5/FFFF";
  755. }
  756. }
  757. if (data[1] == "P1;")
  758. {
  759. message = $"{ConvertBinToHexString(_lp1SigStateData1)}/{ConvertBinToHexString(_lp1SigStateData2)}";
  760. }
  761. if (data[1] == "P2;")
  762. {
  763. message = $"{ConvertBinToHexString(_lp2SigStateData1)}/{ConvertBinToHexString(_lp2SigStateData2)}";
  764. }
  765. if (data[1] == "P3;")
  766. {
  767. message = $"{ConvertBinToHexString(_lp3SigStateData1)}/{ConvertBinToHexString(_lp3SigStateData2)}";
  768. }
  769. string datamsg = $"INF:{cmd.Replace(";", "")}/{message};\r";
  770. OnWriteMessage(datamsg);
  771. }
  772. private void FeedbackGetVersion()
  773. {
  774. }
  775. private void SendMapEvent(string module)
  776. {
  777. module = module.Replace(";", "").Replace("\r", "");
  778. var sm = _lp1slotMap.Reverse();
  779. if (module.Contains("P1"))
  780. sm = _lp1slotMap.Reverse();
  781. if (module.Contains("P2"))
  782. sm = _lp2slotMap.Reverse();
  783. if (module.Contains("P3"))
  784. sm = _lp3slotMap.Reverse();
  785. if (module.Contains("STATION"))
  786. sm = _stationslotMap.Reverse();
  787. if (module.Contains("LL"))
  788. sm = new string[] { "00000000" };
  789. if (module.Contains("BF"))
  790. sm = new string[] { "00000000" };
  791. string message = $"EVT:MAPDT/{module}/{string.Join("", sm)};\r";
  792. OnWriteMessage(message);
  793. }
  794. //25 - 1
  795. private void FeedbackGetWaferMapDescendingOrder(string cmd)
  796. {
  797. var sm = _lp1slotMap.Reverse();
  798. if (cmd.Contains("P1"))
  799. sm = _lp1slotMap.Reverse();
  800. if (cmd.Contains("P2"))
  801. sm = _lp2slotMap.Reverse();
  802. if (cmd.Contains("P3"))
  803. sm = _lp3slotMap.Reverse();
  804. if (cmd.Contains("STATION"))
  805. sm = _stationslotMap.Reverse();
  806. if (cmd.Contains("LL"))
  807. sm = new string[] { "00000000" };
  808. if (cmd.Contains("BF"))
  809. sm = new string[] { "00000000" };
  810. string message = $"INF:{cmd.Replace(";", "")}/{string.Join("", sm)};\r";
  811. OnWriteMessage(message);
  812. }
  813. //1-25
  814. private void FeedbackGetWaferCount()
  815. {
  816. }
  817. #endregion GET Command
  818. private void ReceiveFinCommand(string cmd)
  819. {
  820. SendAck(cmd);
  821. }
  822. private void ReceiveEvtCommand(string cmd)
  823. {
  824. SendAck(cmd);
  825. }
  826. private void ReceiveTchCommand(string cmd)
  827. {
  828. SendAck(cmd);
  829. }
  830. private void ReceiveUnknownCommand(string message)
  831. {
  832. //LOG.Write("LoadPort" + _loadPortNumber + " Receive Unknown message," + message);
  833. }
  834. private void SendInf(string cmd)
  835. {
  836. Thread.Sleep(1500);
  837. //string msg = _isPlaced ? "s00INF:PODON;\r" : "s00INF:PODOF;\r";
  838. string message = Encoding.ASCII.GetString(BuildMesage($"INF:{cmd}"));
  839. OnWriteMessage("INF:" + cmd);
  840. LOG.Info("Send message " + "INF:" + cmd);
  841. }
  842. private void SendAck(string cmd)
  843. {
  844. string ack = Encoding.ASCII.GetString(BuildMesage($"ACK:{cmd}"));
  845. OnWriteMessage("ACK:" + cmd);
  846. LOG.Info("Send message " + "ACK:" + cmd);
  847. }
  848. public static byte[] BuildMesage(string data)
  849. {
  850. List<byte> ret = new List<byte>();
  851. ret.Add(0x1);
  852. List<byte> cmd = new List<byte>();
  853. foreach (char c in data)
  854. {
  855. cmd.Add((byte)c);
  856. }
  857. //cmd.Add((byte)(':')); //3A
  858. cmd.Add((byte)(';')); //3B
  859. int length = cmd.Count + 4;
  860. int checksum = length;
  861. foreach (byte bvalue in cmd)
  862. {
  863. checksum += bvalue;
  864. }
  865. byte[] byteschecksum = Encoding.ASCII.GetBytes(Convert.ToString((int)((byte)(checksum & 0xFF)), 16));
  866. byte[] blength = BitConverter.GetBytes((short)length);
  867. ret.Add(blength[1]);
  868. ret.Add(blength[0]);
  869. ret.AddRange(new byte[] { 0, 0 });
  870. ret.AddRange(cmd);
  871. ret.AddRange(byteschecksum);
  872. ret.Add(0xD);
  873. return ret.ToArray();
  874. }
  875. public void PlaceCarrier(string lp)
  876. {
  877. string message = "";
  878. if (lp == "P1")
  879. {
  880. if (SelectEFEM == "FutureEfem3P")
  881. {
  882. _lp1SigStateData1[0] = true; //LP Placement
  883. _lp1SigStateData1[1] = false; //Pod Present.
  884. _lp1SigStateData1[5] = false;//true;
  885. _lp1SigStateData1[6] = true; //wafer size 8.
  886. _lp1SigStateData1[7] = false; //wafer size 12.
  887. _lp1SigStateData1[24] = false; //e84 VALID
  888. _lp1SigStateData1[25] = true; //e84 CS0
  889. _lp1SigStateData1[26] = true; //e84 CS1
  890. _lp1SigStateData1[28] = true; //e84 TR_REQ
  891. _lp1SigStateData1[29] = false; //e84 BUSY
  892. _lp1SigStateData1[30] = true; //e84 COMPT
  893. _lp1SigStateData1[31] = false; //e84 CONT
  894. _lp1SigStateData2[24] = true; //E84 L_REQ
  895. _lp1SigStateData2[25] = true; //E84 U_REQ
  896. _lp1SigStateData2[27] = true; //E84 READY
  897. _lp1SigStateData2[30] = true; //E84 HO_AVBL
  898. _lp1SigStateData2[31] = true; //E84 ES
  899. }
  900. else
  901. {
  902. _lp1SigStateData1[0] = true; //LP Placement
  903. _lp1SigStateData1[1] = false; //Pod Present.
  904. _lp1SigStateData1[6] = true; //wafer size 8.
  905. _lp1SigStateData1[7] = true; //wafer size 12.
  906. _lp1SigStateData1[8] = true;
  907. _lp1SigStateData1[9] = true;
  908. _lp1SigStateData1[11] = false;
  909. _lp1SigStateData1[24] = true; //e84 VALID
  910. _lp1SigStateData1[25] = true; //e84 CS0
  911. _lp1SigStateData1[26] = false; //e84 CS1
  912. _lp1SigStateData1[28] = true; //e84 TR_REQ
  913. _lp1SigStateData1[29] = false; //e84 BUSY
  914. _lp1SigStateData1[30] = true; //e84 COMPT
  915. _lp1SigStateData1[31] = true; //e84 CONT
  916. _lp1SigStateData2[24] = true; //E84 L_REQ
  917. _lp1SigStateData2[25] = true; //E84 U_REQ
  918. _lp1SigStateData2[27] = true; //E84 READY
  919. _lp1SigStateData2[30] = true; //E84 HO_AVBL
  920. _lp1SigStateData2[31] = true; //E84 ES
  921. }
  922. message = $"EVT:SIGSTAT/{lp}/{ConvertBinToHexString(_lp1SigStateData1)}" +
  923. $"/{ConvertBinToHexString(_lp1SigStateData2)}";
  924. }
  925. if (lp == "P2")
  926. {
  927. if (SelectEFEM == "FutureEfem3P")
  928. {
  929. _lp2SigStateData1[0] = true; //LP Placement
  930. _lp2SigStateData1[1] = false; //Pod Present
  931. _lp2SigStateData1[5] = false;//true;
  932. _lp2SigStateData1[6] = true; //wafer size 8.
  933. _lp2SigStateData1[7] = false; //wafer size 12.
  934. _lp1SigStateData1[24] = true; //e84 VALID
  935. _lp1SigStateData1[25] = true; //e84 CS0
  936. _lp1SigStateData1[26] = true; //e84 CS1
  937. _lp1SigStateData1[28] = true; //e84 TR_REQ
  938. _lp1SigStateData1[29] = true; //e84 BUSY
  939. _lp1SigStateData1[30] = true; //e84 COMPT
  940. _lp1SigStateData1[31] = true; //e84 CONT
  941. _lp1SigStateData2[24] = true; //E84 L_REQ
  942. _lp1SigStateData2[25] = true; //E84 U_REQ
  943. _lp1SigStateData2[27] = true; //E84 READY
  944. _lp1SigStateData2[30] = true; //E84 HO_AVBL
  945. _lp1SigStateData2[31] = true; //E84 ES
  946. }
  947. else
  948. {
  949. _lp2SigStateData1[0] = true; //LP Placement
  950. _lp2SigStateData1[1] = false; //Pod Present.
  951. _lp2SigStateData1[6] = true; //wafer size 8.
  952. _lp2SigStateData1[7] = true; //wafer size 12.
  953. _lp2SigStateData1[8] = true;
  954. _lp2SigStateData1[9] = true;
  955. _lp2SigStateData1[11] = false;
  956. _lp2SigStateData1[24] = true; //e84 VALID
  957. _lp2SigStateData1[25] = true; //e84 CS0
  958. _lp2SigStateData1[26] = true; //e84 CS1
  959. _lp2SigStateData1[28] = true; //e84 TR_REQ
  960. _lp2SigStateData1[29] = true; //e84 BUSY
  961. _lp2SigStateData1[30] = true; //e84 COMPT
  962. _lp2SigStateData1[31] = true; //e84 CONT
  963. _lp2SigStateData2[24] = true; //E84 L_REQ
  964. _lp2SigStateData2[25] = true; //E84 U_REQ
  965. _lp2SigStateData2[27] = true; //E84 READY
  966. _lp2SigStateData2[30] = true; //E84 HO_AVBL
  967. _lp2SigStateData2[31] = true; //E84 ES
  968. }
  969. message = $"EVT:SIGSTAT/{lp}/{ConvertBinToHexString(_lp2SigStateData1)}" +
  970. $"/{ConvertBinToHexString(_lp2SigStateData2)}";
  971. }
  972. if (lp == "P3")
  973. {
  974. if (SelectEFEM == "FutureEfem3P")
  975. {
  976. _lp3SigStateData1[0] = true; //LP Placement
  977. _lp3SigStateData1[1] = false; //Pod Present
  978. _lp3SigStateData1[5] = false;//true;
  979. _lp3SigStateData1[6] = false; //wafer size 8.
  980. _lp3SigStateData1[7] = true; //wafer size 12.
  981. _lp2SigStateData1[24] = true; //e84 VALID
  982. _lp2SigStateData1[25] = true; //e84 CS0
  983. _lp2SigStateData1[26] = true; //e84 CS1
  984. _lp2SigStateData1[28] = true; //e84 TR_REQ
  985. _lp2SigStateData1[29] = true; //e84 BUSY
  986. _lp2SigStateData1[30] = true; //e84 COMPT
  987. _lp2SigStateData1[31] = true; //e84 CONT
  988. _lp2SigStateData2[24] = true; //E84 L_REQ
  989. _lp2SigStateData2[25] = true; //E84 U_REQ
  990. _lp2SigStateData2[27] = true; //E84 READY
  991. _lp2SigStateData2[30] = true; //E84 HO_AVBL
  992. _lp2SigStateData2[31] = true; //E84 ES
  993. }
  994. else
  995. {
  996. _lp3SigStateData1[0] = true; //LP Placement
  997. _lp3SigStateData1[1] = false; //Pod Present
  998. _lp3SigStateData1[6] = false; //wafer size 8.
  999. _lp3SigStateData1[7] = true; //wafer size 12.
  1000. _lp3SigStateData1[24] = true; //e84 VALID
  1001. _lp3SigStateData1[25] = true; //e84 CS0
  1002. _lp3SigStateData1[26] = true; //e84 CS1
  1003. _lp3SigStateData1[28] = true; //e84 TR_REQ
  1004. _lp3SigStateData1[29] = true; //e84 BUSY
  1005. _lp3SigStateData1[30] = true; //e84 COMPT
  1006. _lp3SigStateData1[31] = true; //e84 CONT
  1007. _lp3SigStateData2[24] = true; //E84 L_REQ
  1008. _lp3SigStateData2[25] = true; //E84 U_REQ
  1009. _lp3SigStateData2[27] = true; //E84 READY
  1010. _lp3SigStateData2[30] = true; //E84 HO_AVBL
  1011. _lp3SigStateData2[31] = true; //E84 ES
  1012. }
  1013. message = $"EVT:SIGSTAT/{lp}/{ConvertBinToHexString(_lp3SigStateData1)}" +
  1014. $"/{ConvertBinToHexString(_lp3SigStateData2)}";
  1015. }
  1016. OnWriteMessage(message + ";\r");
  1017. }
  1018. private string ConvertBinToHexString(bool[] data)
  1019. {
  1020. uint intdata = 0;
  1021. for (int i = 0; i < data.Length; i++)
  1022. {
  1023. intdata += data[i] ? (uint)Math.Pow(2, i) : 0;
  1024. }
  1025. return intdata.ToString("X8");
  1026. }
  1027. public void RemoveCarrier(string lp)
  1028. {
  1029. string message = "";
  1030. if (lp == "P1")
  1031. {
  1032. _lp1SigStateData1[0] = false; //LP Placement
  1033. _lp1SigStateData1[1] = true; //Pod Present.
  1034. _lp1SigStateData1[24] = false; //e84 VALID
  1035. _lp1SigStateData1[25] = false; //e84 CS0
  1036. _lp1SigStateData1[26] = false; //e84 CS1
  1037. _lp1SigStateData1[28] = false; //e84 TR_REQ
  1038. _lp1SigStateData1[29] = false; //e84 BUSY
  1039. _lp1SigStateData1[30] = false; //e84 COMPT
  1040. _lp1SigStateData1[31] = false; //e84 CONT
  1041. _lp1SigStateData2[24] = false; //E84 L_REQ
  1042. _lp1SigStateData2[25] = false; //E84 U_REQ
  1043. _lp1SigStateData2[27] = false; //E84 READY
  1044. _lp1SigStateData2[30] = false; //E84 HO_AVBL
  1045. _lp1SigStateData2[31] = false; //E84 ES
  1046. message = $"EVT:SIGSTAT/{lp}/{ConvertBinToHexString(_lp1SigStateData1)}" +
  1047. $"/{ConvertBinToHexString(_lp1SigStateData2)}";
  1048. }
  1049. if (lp == "P2")
  1050. {
  1051. _lp2SigStateData1[0] = false; //LP Placement
  1052. _lp2SigStateData1[1] = true; //Pod Present
  1053. _lp2SigStateData1[24] = false; //e84 VALID
  1054. _lp2SigStateData1[25] = false; //e84 CS0
  1055. _lp2SigStateData1[26] = false; //e84 CS1
  1056. _lp2SigStateData1[28] = false; //e84 TR_REQ
  1057. _lp2SigStateData1[29] = false; //e84 BUSY
  1058. _lp2SigStateData1[30] = false; //e84 COMPT
  1059. _lp2SigStateData1[31] = false; //e84 CONT
  1060. _lp2SigStateData2[24] = false; //E84 L_REQ
  1061. _lp2SigStateData2[25] = false; //E84 U_REQ
  1062. _lp2SigStateData2[27] = false; //E84 READY
  1063. _lp2SigStateData2[30] = false; //E84 HO_AVBL
  1064. _lp2SigStateData2[31] = false; //E84 ES
  1065. message = $"EVT:SIGSTAT/{lp}/{ConvertBinToHexString(_lp2SigStateData1)}" +
  1066. $"/{ConvertBinToHexString(_lp2SigStateData2)}";
  1067. }
  1068. if (lp == "P3")
  1069. {
  1070. _lp3SigStateData1[0] = false; //LP Placement
  1071. _lp3SigStateData1[1] = true; //Pod Present
  1072. _lp3SigStateData1[24] = false; //e84 VALID
  1073. _lp3SigStateData1[25] = false; //e84 CS0
  1074. _lp3SigStateData1[26] = false; //e84 CS1
  1075. _lp3SigStateData1[28] = false; //e84 TR_REQ
  1076. _lp3SigStateData1[29] = false; //e84 BUSY
  1077. _lp3SigStateData1[30] = false; //e84 COMPT
  1078. _lp3SigStateData1[31] = false; //e84 CONT
  1079. _lp3SigStateData2[24] = false; //E84 L_REQ
  1080. _lp3SigStateData2[25] = false; //E84 U_REQ
  1081. _lp3SigStateData2[27] = false; //E84 READY
  1082. _lp3SigStateData2[30] = false; //E84 HO_AVBL
  1083. _lp3SigStateData2[31] = false; //E84 ES
  1084. message = $"EVT:SIGSTAT/{lp}/{ConvertBinToHexString(_lp3SigStateData1)}" +
  1085. $"/{ConvertBinToHexString(_lp3SigStateData2)}";
  1086. }
  1087. OnWriteMessage(message + ";\r");
  1088. }
  1089. public void ClearWafer(string lp)
  1090. {
  1091. if (lp == "LP1")
  1092. {
  1093. for (int i = 0; i < _lp1slotMap.Length; i++)
  1094. {
  1095. _lp1slotMap[i] = "0";
  1096. }
  1097. }
  1098. if (lp == "LP2")
  1099. {
  1100. for (int i = 0; i < _lp2slotMap.Length; i++)
  1101. {
  1102. _lp2slotMap[i] = "0";
  1103. }
  1104. }
  1105. if (lp == "LP3")
  1106. {
  1107. for (int i = 0; i < _lp3slotMap.Length; i++)
  1108. {
  1109. _lp3slotMap[i] = "0";
  1110. }
  1111. }
  1112. }
  1113. public void SetAllWafer(string lp)
  1114. {
  1115. if (lp == "LP1")
  1116. {
  1117. for (int i = 0; i < _lp1slotMap.Length; i++)
  1118. {
  1119. _lp1slotMap[i] = "1";
  1120. }
  1121. }
  1122. if (lp == "LP2")
  1123. {
  1124. for (int i = 0; i < _lp2slotMap.Length; i++)
  1125. {
  1126. _lp2slotMap[i] = "1";
  1127. }
  1128. }
  1129. if (lp == "LP3")
  1130. {
  1131. for (int i = 0; i < _lp3slotMap.Length; i++)
  1132. {
  1133. _lp3slotMap[i] = "1";
  1134. }
  1135. }
  1136. }
  1137. public void SetUpWafer(string lp)
  1138. {
  1139. if (lp == "LP1")
  1140. {
  1141. for (int i = 0; i < _lp1slotMap.Length; i++)
  1142. {
  1143. _lp1slotMap[i] = i > 15 ? "1" : "0";
  1144. }
  1145. }
  1146. if (lp == "LP2")
  1147. {
  1148. for (int i = 0; i < _lp2slotMap.Length; i++)
  1149. {
  1150. _lp2slotMap[i] = i > 15 ? "1" : "0";
  1151. }
  1152. }
  1153. if (lp == "LP3")
  1154. {
  1155. for (int i = 0; i < _lp3slotMap.Length; i++)
  1156. {
  1157. _lp3slotMap[i] = i > 15 ? "1" : "0";
  1158. }
  1159. }
  1160. }
  1161. public void SetLowWafer(string lp)
  1162. {
  1163. if (lp == "LP1")
  1164. {
  1165. for (int i = 0; i < _lp1slotMap.Length; i++)
  1166. {
  1167. _lp1slotMap[i] = i < 10 ? "1" : "0";
  1168. }
  1169. }
  1170. if (lp == "LP2")
  1171. {
  1172. for (int i = 0; i < _lp2slotMap.Length; i++)
  1173. {
  1174. _lp2slotMap[i] = i < 10 ? "1" : "0";
  1175. }
  1176. }
  1177. if (lp == "LP3")
  1178. {
  1179. for (int i = 0; i < _lp3slotMap.Length; i++)
  1180. {
  1181. _lp3slotMap[i] = i < 10 ? "1" : "0";
  1182. }
  1183. }
  1184. }
  1185. public void RandomWafer(string lp)
  1186. {
  1187. Random _rd = new Random();
  1188. if (lp == "LP1")
  1189. {
  1190. for (int i = 0; i < _lp1slotMap.Length; i++)
  1191. {
  1192. _lp1slotMap[i] = _rd.Next(0, 10) < 6 ? "0" : "1";
  1193. }
  1194. }
  1195. if (lp == "LP2")
  1196. {
  1197. for (int i = 0; i < _lp2slotMap.Length; i++)
  1198. {
  1199. _lp2slotMap[i] = _rd.Next(0, 10) < 6 ? "0" : "1";
  1200. }
  1201. }
  1202. if (lp == "LP3")
  1203. {
  1204. for (int i = 0; i < _lp3slotMap.Length; i++)
  1205. {
  1206. _lp3slotMap[i] = _rd.Next(0, 10) < 6 ? "0" : "1";
  1207. }
  1208. }
  1209. }
  1210. public class LpState
  1211. {
  1212. public bool IsPlacement { get; set; }
  1213. public bool IsPresent { get; set; }
  1214. public bool IsAccessSwPressed { get; set; }
  1215. public bool ClampState { get; set; }//close=1
  1216. public bool DoorState { get; set; }//open=1
  1217. public bool DockState { get; set; }//docked=1
  1218. public bool IndicatiorPresence { get; set; }//ON=1
  1219. public bool IndicatiorPlacement { get; set; }//ON=1
  1220. public bool IndicatiorLoad { get; set; }//ON=1
  1221. public bool IndicatiorUnload { get; set; }//ON=1
  1222. public bool IndicatiorManualMode { get; set; }//ON=1
  1223. public bool IndicatorAlarm { get; set; }//ON=1
  1224. public bool IndicatiorClampUnclamp { get; set; }//ON=1
  1225. public bool IndicatiorDockUndock { get; set; }//ON=1
  1226. public bool IndicatiorOpAccess { get; set; }//ON=1
  1227. }
  1228. public class E84State
  1229. {
  1230. public bool DiValid { get; set; }//ON=1
  1231. public bool DiCS0 { get; set; }//ON=1
  1232. public bool DiCS1 { get; set; }//ON=1
  1233. public bool DiTrReq { get; set; }//ON=1
  1234. public bool DiBusy { get; set; }//ON=1
  1235. public bool DiCompt { get; set; }//ON=1
  1236. public bool DiCont { get; set; }//ON=1
  1237. public bool DoLoadReq { get; set; }//ON=1
  1238. public bool DoUnloadReq { get; set; }//ON=1
  1239. public bool DoReady { get; set; }//ON=1
  1240. public bool DoHOAvbl { get; set; }//ON=1
  1241. public bool DoES { get; set; }//ON=1
  1242. }
  1243. public class SystemState
  1244. {
  1245. public bool VacuumsSourcePressure1 { get; set; }//Normal=1
  1246. public bool VacuumsSourcePressure2 { get; set; }//Normal=1
  1247. public bool CompressedAirPressure1 { get; set; }//Normal=1
  1248. public bool CompressedAirPressure2 { get; set; }//Normal=1
  1249. public bool DifferentialPressureSensorSetting1 { get; set; }//Normal=1
  1250. public bool DifferentialPressureSensorSetting2 { get; set; }//Normal=1
  1251. public bool FFUAlarm { get; set; }//Normal=1
  1252. public bool IonizerAlarm { get; set; }//Normal=1
  1253. public bool ModeSwitch { get; set; }//RUN=1
  1254. public bool DriverPower { get; set; }//Normal=1
  1255. public bool DoorOpenCloseStatus { get; set; }//close=1
  1256. public bool AreaSensorBarInterlock { get; set; }//Normal=1
  1257. public bool LightRed { get; set; }//ON=1
  1258. public bool LightYellow { get; set; }//ON=1
  1259. public bool LightGreen { get; set; }//ON=1
  1260. public bool LightBlue { get; set; }//ON=1
  1261. public bool LightWhite { get; set; }//ON=1
  1262. public bool FlashRed { get; set; }//Flash=1
  1263. public bool FlashYellow { get; set; }//Flash=1
  1264. public bool FlashGreen { get; set; }//Flash=1
  1265. public bool FlashBlue { get; set; }//Flash=1
  1266. public bool FlashWhite { get; set; }//Flash=1
  1267. public bool Buzzer1 { get; set; }//ON=1
  1268. public bool Buzzer2 { get; set; }//ON=1
  1269. }
  1270. }
  1271. }