DeviceManager.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Aitex.Core.Common;
  5. using Aitex.Core.RT.Device;
  6. using Aitex.Core.RT.OperationCenter;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.RT.Device.Custom;
  9. using MECF.Framework.Common.Equipment;
  10. using SorterRT.Modules;
  11. using VirgoRT.Devices;
  12. namespace VirgoRT.Instances
  13. {
  14. public class DeviceEntity : DeviceEntityT<DeviceManager>
  15. {
  16. public DeviceEntity()
  17. {
  18. }
  19. }
  20. public class DeviceManager : DeviceManagerBase
  21. {
  22. public WaferSize SmallPinWaferSize { get; set; }
  23. public WaferSize MediumPinWaferSize { get; set; }
  24. public WaferSize BigPinWaferSize { get; set; }
  25. private readonly string device_model_file;
  26. public DeviceManager()
  27. {
  28. device_model_file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName);
  29. }
  30. public override bool Initialize()
  31. {
  32. if (SC.GetValue<bool>("System.PMAIsInstalled"))
  33. InitPM(ModuleName.PMA);
  34. if (SC.GetValue<bool>("System.PMBIsInstalled"))
  35. InitPM(ModuleName.PMB);
  36. AddCustomModuleDevice(new VirgoSignalTower("System", "SignalTower"));
  37. OP.Subscribe("DeviceOperation", this.Invoke);
  38. return true;
  39. }
  40. private void InitPM(ModuleName mod)
  41. {
  42. Initialize(device_model_file, RtInstance.SystemName, mod, mod.ToString());
  43. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232)
  44. {
  45. if(SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  46. {
  47. AddCustomModuleDevice(new AdTecGenerator(mod, "Rf"));
  48. }
  49. else if (SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.Revtech)
  50. {
  51. AddCustomModuleDevice(new RevtechGenerator(mod, "Rf"));
  52. }
  53. }
  54. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  55. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  56. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  57. {
  58. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  59. }
  60. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  61. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.RS232 &&
  62. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  63. {
  64. AddCustomModuleDevice(new AdTecGenerator(mod, "BiasRf"));
  65. }
  66. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  67. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232 &&
  68. SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  69. {
  70. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  71. }
  72. if (SC.GetValue<bool>($"{mod}.GridChiller.EnableChiller") &&
  73. SC.GetValue<int>($"{mod}.GridChiller.CommunicationType") == (int)CommunicationType.RS232 &&
  74. SC.GetValue<int>($"{mod}.GridChiller.MFG") == (int)ChillerMFG.SMC)
  75. {
  76. AddCustomModuleDevice(new SMCChiller(mod, "GridChiller"));
  77. }
  78. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  79. SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  80. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  81. {
  82. AddCustomModuleDevice(new AdTecMatch(mod, "match"));
  83. }
  84. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  85. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.Revtech)
  86. {
  87. if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232)
  88. {
  89. AddCustomModuleDevice(new ComRevtechMatch(mod, "match", "match"));
  90. }
  91. else if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.Ethernet)
  92. {
  93. AddCustomModuleDevice(new EthernetRevtechMatch(mod, "match", "match"));
  94. }
  95. }
  96. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  97. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  98. {
  99. if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232)
  100. {
  101. AddCustomModuleDevice(new ComRevtechMatch(mod, "BiasMatch"));
  102. }
  103. else if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet)
  104. {
  105. AddCustomModuleDevice(new EthernetRevtechMatch(mod, "BiasMatch"));
  106. }
  107. }
  108. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  109. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  110. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  111. {
  112. AddCustomModuleDevice(new AdTecMatch(mod, "BiasMatch"));
  113. }
  114. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  115. {
  116. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  117. {
  118. AddCustomModuleDevice(new SkyPump(mod));
  119. }
  120. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  121. {
  122. AddCustomModuleDevice(new EdwardsPump(mod));
  123. }
  124. }
  125. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Kashiyama)
  126. AddCustomModuleDevice(new KashiyamaPump(mod));
  127. AddCustomDevice(new JetPM(mod));
  128. SmallPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.SmallWafer"));
  129. MediumPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.MidWafer"));
  130. BigPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.BigWafer"));
  131. if (SC.GetValue<bool>($"{mod}.EPD.IsEnabled") && SC.GetValue<bool>("System.SetUp.EPDInstalled"))
  132. {
  133. AddCustomModuleDevice(new EPDDevice(mod.ToString(), "EPD"));
  134. }
  135. }
  136. private WaferSize MapWaferSize(int value)
  137. {
  138. switch (value)
  139. {
  140. case 3: return WaferSize.WS3;
  141. case 4: return WaferSize.WS4;
  142. case 6: return WaferSize.WS6;
  143. case 8: return WaferSize.WS8;
  144. }
  145. return WaferSize.WS0;
  146. }
  147. private bool Invoke(string arg1, object[] args)
  148. {
  149. string name = (string)args[0];
  150. string func = (string)args[1];
  151. object[] param = new object[args.Length - 2];
  152. for (int i = 2; i < args.Length; i++)
  153. param[i - 2] = args[i].ToString();
  154. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  155. return true;
  156. }
  157. }
  158. }