DeviceManager.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 MECF.Framework.Common.Equipment;
  9. using Venus_RT.Modules;
  10. using Venus_RT.Devices;
  11. using Venus_RT.Devices.EPD;
  12. using Venus_Core;
  13. using Aitex.Common.Util;
  14. using System.Reflection;
  15. namespace Venus_RT.Instances
  16. {
  17. public class DeviceEntity : DeviceEntityT<DeviceManager>
  18. {
  19. public DeviceEntity()
  20. {
  21. }
  22. }
  23. public class DeviceManager : DeviceManagerBase
  24. {
  25. private string device_model_file;
  26. private readonly string device_model_file_MF;
  27. public DeviceManager()
  28. {
  29. //switch (RtInstance.CurrentChamber)
  30. //{
  31. // case JetChamber.Venus:
  32. // device_model_file= PathManager.GetCfgDir() + RtInstance.CurrentChamber.ToString() + "\\" + "DeviceModelVenus.xml.xml";
  33. // break;
  34. // case JetChamber.Kepler2300:
  35. // case JetChamber.Kepler2200A:
  36. // case JetChamber.Kepler2200B:
  37. // device_model_file = PathManager.GetCfgDir() + RtInstance.CurrentChamber.ToString() + "\\" + "DeviceModelKepler.xml.xml";
  38. // break;
  39. //}
  40. device_model_file_MF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName_MF);
  41. }
  42. public override bool Initialize()
  43. {
  44. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  45. {
  46. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMA.ChamberType");
  47. InitPM(ModuleName.PMA, jetChamber);
  48. }
  49. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  50. {
  51. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMB.ChamberType");
  52. InitPM(ModuleName.PMB, jetChamber);
  53. }
  54. if (ModuleHelper.IsInstalled(ModuleName.TM))
  55. InitTM(ModuleName.TM);
  56. AddCustomModuleDevice(new VenusSignalTower("System", "SignalTower"));
  57. OP.Subscribe("DeviceOperation", this.Invoke);
  58. return true;
  59. }
  60. private void InitPM(ModuleName mod,JetChamber jetChamber)
  61. {
  62. switch (jetChamber)
  63. {
  64. case JetChamber.Venus:
  65. device_model_file = PathManager.GetCfgDir() + jetChamber.ToString() + "\\" + "DeviceModelVenus.xml";
  66. break;
  67. case JetChamber.Kepler2300:
  68. case JetChamber.Kepler2200A:
  69. case JetChamber.Kepler2200B:
  70. device_model_file = PathManager.GetCfgDir() + jetChamber.ToString() + "\\" + "DeviceModelKepler.xml";
  71. break;
  72. default:
  73. break;
  74. }
  75. Initialize(device_model_file, RtInstance.SystemName, mod, mod.ToString());
  76. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  77. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  78. {
  79. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  80. }
  81. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  82. {
  83. if(SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  84. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  85. {
  86. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  87. }
  88. else if(SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  89. {
  90. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  91. }
  92. }
  93. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  94. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  95. {
  96. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  97. {
  98. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  99. }
  100. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  101. {
  102. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  103. }
  104. }
  105. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  106. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  107. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  108. {
  109. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  110. }
  111. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  112. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  113. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  114. {
  115. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  116. }
  117. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  118. {
  119. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  120. {
  121. AddCustomModuleDevice(new SkyPump(mod));
  122. }
  123. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  124. {
  125. AddCustomModuleDevice(new EdwardsPump(mod));
  126. }
  127. }
  128. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  129. AddCustomModuleDevice(new AdixenTurboPump(mod));
  130. AddCustomModuleDevice(new PendulumValve(mod));
  131. AddCustomModuleDevice(new EPDClient(mod));
  132. //AddCustomDevice(new JetPM(mod));
  133. switch (jetChamber)
  134. {
  135. case JetChamber.Venus:
  136. AddCustomDevice(new JetVenusPM(mod));
  137. break;
  138. case JetChamber.Kepler2300:
  139. case JetChamber.Kepler2200A:
  140. case JetChamber.Kepler2200B:
  141. AddCustomDevice(new JetKepler2300PM(mod));
  142. break;
  143. }
  144. }
  145. private void InitTM(ModuleName mod)
  146. {
  147. Initialize(device_model_file_MF, RtInstance.SystemName, mod, mod.ToString());
  148. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  149. {
  150. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  151. {
  152. AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  153. }
  154. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  155. {
  156. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLA));
  157. }
  158. }
  159. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  160. {
  161. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  162. {
  163. AddCustomModuleDevice(new SkyPump(mod));
  164. }
  165. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  166. {
  167. AddCustomModuleDevice(new EdwardsPump(mod));
  168. }
  169. }
  170. //AddCustomModuleDevice(new SkyPump(mod));
  171. //AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  172. AddCustomDevice(new JetTM());
  173. }
  174. private WaferSize MapWaferSize(int value)
  175. {
  176. switch (value)
  177. {
  178. case 3: return WaferSize.WS3;
  179. case 4: return WaferSize.WS4;
  180. case 6: return WaferSize.WS6;
  181. case 8: return WaferSize.WS8;
  182. }
  183. return WaferSize.WS0;
  184. }
  185. private bool Invoke(string arg1, object[] args)
  186. {
  187. string name = (string)args[0];
  188. string func = (string)args[1];
  189. object[] param = new object[args.Length - 2];
  190. for (int i = 2; i < args.Length; i++)
  191. param[i - 2] = args[i].ToString();
  192. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  193. return true;
  194. }
  195. }
  196. }