DeviceManager.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. if (SC.GetValue<int>($"{mod}.match.AdTecSourceMatchModel") == 0)
  83. {
  84. AddCustomModuleDevice(new AdTecMatch(mod, "match"));
  85. }
  86. else if (SC.GetValue<int>($"{mod}.match.AdTecSourceMatchModel") == 1)
  87. {
  88. AddCustomModuleDevice(new AdTecMatchAMVG(mod, "match"));
  89. }
  90. }
  91. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  92. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.Revtech)
  93. {
  94. if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232)
  95. {
  96. AddCustomModuleDevice(new ComRevtechMatch(mod, "match", "match"));
  97. }
  98. else if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.Ethernet)
  99. {
  100. AddCustomModuleDevice(new EthernetRevtechMatch(mod, "match", "match"));
  101. }
  102. }
  103. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  104. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  105. {
  106. if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232)
  107. {
  108. AddCustomModuleDevice(new ComRevtechMatch(mod, "BiasMatch"));
  109. }
  110. else if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet)
  111. {
  112. AddCustomModuleDevice(new EthernetRevtechMatch(mod, "BiasMatch"));
  113. }
  114. }
  115. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  116. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  117. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  118. {
  119. if (SC.GetValue<int>($"{mod}.BiasMatch.AdTecBiasMatchModel") == 0)
  120. {
  121. AddCustomModuleDevice(new AdTecMatch(mod, "BiasMatch"));
  122. }
  123. else if (SC.GetValue<int>($"{mod}.BiasMatch.AdTecBiasMatchModel") == 1)
  124. {
  125. AddCustomModuleDevice(new AdTecMatchAMVG(mod, "BiasMatch"));
  126. }
  127. }
  128. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  129. {
  130. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  131. {
  132. AddCustomModuleDevice(new SkyPump(mod));
  133. }
  134. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  135. {
  136. AddCustomModuleDevice(new EdwardsPump(mod));
  137. }
  138. }
  139. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Kashiyama)
  140. AddCustomModuleDevice(new KashiyamaPump(mod));
  141. AddCustomDevice(new JetPM(mod));
  142. SmallPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.SmallWafer"));
  143. MediumPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.MidWafer"));
  144. BigPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.BigWafer"));
  145. if (SC.GetValue<bool>($"{mod}.EPD.IsEnabled") && SC.GetValue<bool>("System.SetUp.EPDInstalled"))
  146. {
  147. AddCustomModuleDevice(new EPDDevice(mod.ToString(), "EPD"));
  148. }
  149. }
  150. private WaferSize MapWaferSize(int value)
  151. {
  152. switch (value)
  153. {
  154. case 3: return WaferSize.WS3;
  155. case 4: return WaferSize.WS4;
  156. case 6: return WaferSize.WS6;
  157. case 8: return WaferSize.WS8;
  158. }
  159. return WaferSize.WS0;
  160. }
  161. private bool Invoke(string arg1, object[] args)
  162. {
  163. string name = (string)args[0];
  164. string func = (string)args[1];
  165. object[] param = new object[args.Length - 2];
  166. for (int i = 2; i < args.Length; i++)
  167. param[i - 2] = args[i].ToString();
  168. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  169. return true;
  170. }
  171. }
  172. }