DeviceManager.cs 12 KB

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