DeviceManager.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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 Venus_RT.Modules;
  11. using Venus_RT.Devices;
  12. using Venus_RT.Devices.EPD;
  13. using Venus_Core;
  14. using Aitex.Common.Util;
  15. using System.Reflection;
  16. namespace Venus_RT.Instances
  17. {
  18. public class DeviceEntity : DeviceEntityT<DeviceManager>
  19. {
  20. public DeviceEntity()
  21. {
  22. }
  23. }
  24. public class DeviceManager : DeviceManagerBase
  25. {
  26. private string device_model_file;
  27. private readonly string device_model_file_MF;
  28. private readonly string device_model_file_SEMF;
  29. public DeviceManager()
  30. {
  31. //switch (RtInstance.CurrentChamber)
  32. //{
  33. // case JetChamber.Venus:
  34. // device_model_file= PathManager.GetCfgDir() + RtInstance.CurrentChamber.ToString() + "\\" + "DeviceModelVenus.xml.xml";
  35. // break;
  36. // case JetChamber.Kepler2300:
  37. // case JetChamber.Kepler2200A:
  38. // case JetChamber.Kepler2200B:
  39. // device_model_file = PathManager.GetCfgDir() + RtInstance.CurrentChamber.ToString() + "\\" + "DeviceModelKepler.xml.xml";
  40. // break;
  41. //}
  42. device_model_file_MF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\","TM", RtInstance.DeviceModelFileName_MF);
  43. device_model_file_SEMF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", "TM", RtInstance.DeviceModelFileName_SE);
  44. }
  45. public override bool Initialize()
  46. {
  47. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  48. {
  49. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMA.ChamberType");
  50. InitPM(ModuleName.PMA, jetChamber);
  51. }
  52. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  53. {
  54. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMB.ChamberType");
  55. InitPM(ModuleName.PMB, jetChamber);
  56. }
  57. if (ModuleHelper.IsInstalled(ModuleName.PMC))
  58. {
  59. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMC.ChamberType");
  60. InitPM(ModuleName.PMC, jetChamber);
  61. }
  62. if (ModuleHelper.IsInstalled(ModuleName.PMD))
  63. {
  64. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMD.ChamberType");
  65. InitPM(ModuleName.PMD, jetChamber);
  66. }
  67. if (ModuleHelper.IsInstalled(ModuleName.TM))
  68. InitTM(ModuleName.TM);
  69. if(ModuleHelper.IsInstalled(ModuleName.SETM))
  70. {
  71. InitSETM(ModuleName.SETM);
  72. }
  73. AddCustomModuleDevice(new VenusSignalTower("System", "SignalTower"));
  74. OP.Subscribe("DeviceOperation", this.Invoke);
  75. return true;
  76. }
  77. private void InitPM(ModuleName mod,JetChamber jetChamber)
  78. {
  79. //switch (jetChamber)
  80. //{
  81. // case JetChamber.Venus:
  82. // device_model_file = PathManager.GetCfgDir() +"PM"+"\\"+ jetChamber.ToString() + "\\" + "VenusDeviceModel.xml";
  83. // break;
  84. // case JetChamber.Kepler2300:
  85. // device_model_file = PathManager.GetCfgDir() + "PM" + "\\" + jetChamber.ToString() + "\\" + "Kepler2300DeviceModel.xml";
  86. // break;
  87. // case JetChamber.Kepler2200A:
  88. // case JetChamber.Kepler2200B:
  89. // device_model_file = PathManager.GetCfgDir() + jetChamber.ToString() + "\\" + "DeviceModelKepler.xml";
  90. // break;
  91. // default:
  92. // break;
  93. //}
  94. device_model_file = PathManager.GetCfgDir() + "PM" + "\\" + jetChamber.ToString() + "\\" + $"{jetChamber.ToString()}DeviceModel.xml";
  95. Initialize(device_model_file, jetChamber.ToString(), mod, mod.ToString());
  96. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  97. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  98. {
  99. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  100. }
  101. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  102. {
  103. if(SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  104. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  105. {
  106. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  107. }
  108. else if(SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  109. {
  110. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  111. }
  112. }
  113. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  114. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  115. {
  116. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  117. {
  118. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  119. }
  120. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  121. {
  122. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  123. }
  124. }
  125. if (SC.GetValue<bool>($"{mod}.InnerChiller.EnableChiller") &&
  126. SC.GetValue<int>($"{mod}.InnerChiller.CommunicationType") == (int)CommunicationType.RS232)
  127. {
  128. if (SC.GetValue<int>($"{mod}.InnerChiller.MFG") == (int)ChillerMFG.SMC)
  129. {
  130. AddCustomModuleDevice(new SMCChiller(mod, "InnerChiller"));
  131. }
  132. else if (SC.GetValue<int>($"{mod}.InnerChiller.MFG") == (int)ChillerMFG.AIRSYS)
  133. {
  134. AddCustomModuleDevice(new AIRSYSChiller(mod, "InnerChiller"));
  135. }
  136. }
  137. if (SC.GetValue<bool>($"{mod}.OuterChiller.EnableChiller") &&
  138. SC.GetValue<int>($"{mod}.OuterChiller.CommunicationType") == (int)CommunicationType.RS232)
  139. {
  140. if (SC.GetValue<int>($"{mod}.OuterChiller.MFG") == (int)ChillerMFG.SMC)
  141. {
  142. AddCustomModuleDevice(new SMCChiller(mod, "OuterChiller"));
  143. }
  144. else if (SC.GetValue<int>($"{mod}.OuterChiller.MFG") == (int)ChillerMFG.AIRSYS)
  145. {
  146. AddCustomModuleDevice(new AIRSYSChiller(mod, "OuterChiller"));
  147. }
  148. }
  149. if (SC.GetValue<bool>($"{mod}.TopChiller.EnableChiller") &&
  150. SC.GetValue<int>($"{mod}.TopChiller.CommunicationType") == (int)CommunicationType.RS232)
  151. {
  152. if (SC.GetValue<int>($"{mod}.TopChiller.MFG") == (int)ChillerMFG.SMC)
  153. {
  154. AddCustomModuleDevice(new SMCChiller(mod, "TopChiller"));
  155. }
  156. else if (SC.GetValue<int>($"{mod}.TopChiller.MFG") == (int)ChillerMFG.AIRSYS)
  157. {
  158. AddCustomModuleDevice(new AIRSYSChiller(mod, "TopChiller"));
  159. }
  160. }
  161. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  162. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  163. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  164. {
  165. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  166. }
  167. else if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  168. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  169. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.Revtech)
  170. {
  171. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.Match, MatchCommunicationType.RS232));
  172. }
  173. else if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  174. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.Ethernet&&
  175. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.Revtech)
  176. {
  177. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.Match, MatchCommunicationType.Ethernet));
  178. }
  179. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  180. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  181. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  182. {
  183. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  184. }
  185. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  186. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  187. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  188. {
  189. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.BiasMatch,MatchCommunicationType.RS232));
  190. }
  191. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  192. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet &&
  193. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  194. {
  195. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.BiasMatch, MatchCommunicationType.Ethernet));
  196. }
  197. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  198. {
  199. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  200. {
  201. AddCustomModuleDevice(new SkyPump(mod));
  202. }
  203. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  204. {
  205. AddCustomModuleDevice(new EdwardsPump(mod));
  206. }
  207. }
  208. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  209. AddCustomModuleDevice(new AdixenTurboPump(mod));
  210. AddCustomModuleDevice(new PendulumValve(mod));
  211. if (SC.GetValue<bool>($"{mod}.EPD.IsEnabled") == true)
  212. {
  213. if (SC.GetValue<int>($"{mod}.EPD.EPDType") == 0)
  214. {
  215. AddCustomModuleDevice(new EPDClient(mod));
  216. }
  217. else
  218. {
  219. AddCustomModuleDevice(new EPDDevice(mod));
  220. }
  221. }
  222. //AddCustomDevice(new JetPM(mod));
  223. switch (jetChamber)
  224. {
  225. case JetChamber.Venus:
  226. AddCustomDevice(new JetVenusPM(mod));
  227. break;
  228. case JetChamber.Kepler2300:
  229. AddCustomDevice(new JetKepler2300PM(mod));
  230. break;
  231. case JetChamber.Kepler2200A:
  232. AddCustomDevice(new JetKepler2200APM(mod));
  233. break;
  234. case JetChamber.Kepler2200B:
  235. AddCustomDevice(new JetKepler2200BPM(mod));
  236. break;
  237. case JetChamber.VenusSE:
  238. AddCustomDevice(new JetVenusSEPM(mod));
  239. break;
  240. case JetChamber.VenusDE:
  241. AddCustomDevice(new JetVenusDEPM(mod));
  242. break;
  243. }
  244. }
  245. private void InitTM(ModuleName mod)
  246. {
  247. Initialize(device_model_file_MF, mod.ToString(), mod, mod.ToString());
  248. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  249. {
  250. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  251. {
  252. AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  253. }
  254. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  255. {
  256. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLA));
  257. }
  258. }
  259. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  260. {
  261. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  262. {
  263. AddCustomModuleDevice(new SkyPump(mod));
  264. }
  265. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  266. {
  267. AddCustomModuleDevice(new EdwardsPump(mod));
  268. }
  269. }
  270. //AddCustomModuleDevice(new SkyPump(mod));
  271. //AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  272. AddCustomDevice(new JetTM());
  273. }
  274. private void InitSETM(ModuleName mod)
  275. {
  276. Initialize(device_model_file_SEMF, mod.ToString(), mod, mod.ToString());
  277. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  278. {
  279. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  280. {
  281. AddCustomModuleDevice(new SkyPump(mod));
  282. }
  283. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  284. {
  285. AddCustomModuleDevice(new EdwardsPump(mod));
  286. }
  287. }
  288. AddCustomDevice(new HongHuTM());
  289. }
  290. private WaferSize MapWaferSize(int value)
  291. {
  292. switch (value)
  293. {
  294. case 3: return WaferSize.WS3;
  295. case 4: return WaferSize.WS4;
  296. case 6: return WaferSize.WS6;
  297. case 8: return WaferSize.WS8;
  298. }
  299. return WaferSize.WS0;
  300. }
  301. private bool Invoke(string arg1, object[] args)
  302. {
  303. string name = (string)args[0];
  304. string func = (string)args[1];
  305. object[] param = new object[args.Length - 2];
  306. for (int i = 2; i < args.Length; i++)
  307. param[i - 2] = args[i].ToString();
  308. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  309. return true;
  310. }
  311. }
  312. }