DeviceManager.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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. using Venus_RT.Devices.AdLinkEthercat;
  17. using System.Windows;
  18. using Aitex.Core.RT.Log;
  19. using Venus_RT.Devices.TM;
  20. namespace Venus_RT.Instances
  21. {
  22. public class DeviceEntity : DeviceEntityT<DeviceManager>
  23. {
  24. public DeviceEntity()
  25. {
  26. }
  27. }
  28. public class DeviceManager : DeviceManagerBase
  29. {
  30. private string device_model_file;
  31. private readonly string device_model_file_MF;
  32. private readonly string device_model_file_SEMF;
  33. private readonly string device_model_file_DEMF;
  34. Int32 v_board_id = -1;
  35. Int32 v_StartAxisID = 0;
  36. Int32 BUS_No = 0;
  37. private bool startEthercatOK;
  38. public DeviceManager()
  39. {
  40. device_model_file_MF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", "TM", RtInstance.DeviceModelFileName_MF);
  41. device_model_file_SEMF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", "TM", RtInstance.DeviceModelFileName_SE);
  42. device_model_file_DEMF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", "TM", RtInstance.DeviceModelFileName_DE);
  43. }
  44. public bool InitEthercat()
  45. {
  46. Int32 boardID_InBits = 0;
  47. Int32 mode = 0;
  48. Int32 ret = 0;
  49. Int32 card_name = 0;
  50. Int32 tamp = 0;
  51. Int32 StartAxisID = 0;
  52. Int32 TotalAxisNum = 0;
  53. // Card(Board) initial
  54. ret = APS168.APS_initial(ref boardID_InBits, mode);
  55. if (ret == 0)
  56. {
  57. for (int i = 0; i < 16; i++)
  58. {
  59. tamp = (boardID_InBits >> i) & 1;
  60. if (tamp == 1)
  61. {
  62. ret = APS168.APS_get_card_name(i, ref card_name);
  63. if ((card_name >= (Int32)APS_Define.DEVICE_NAME_EM_2P00)
  64. && (card_name <= (Int32)APS_Define.DEVICE_NAME_EM_FA00))
  65. {
  66. ret = APS168.APS_get_first_axisId(i, ref StartAxisID, ref TotalAxisNum);
  67. //v_card_name = card_name;
  68. v_board_id = i;
  69. v_StartAxisID = StartAxisID;
  70. LOG.Write(eEvent.EV_DEVICE_INFO, ModuleName.System, "Ethercat Initial Success!");
  71. break;
  72. }
  73. }
  74. }
  75. if (v_board_id == -1)
  76. {
  77. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.System, $"Ethercat Board Id search Fail!");
  78. }
  79. else
  80. {
  81. LOG.Write(eEvent.EV_DEVICE_INFO, ModuleName.System, "Ethercat Board Id search Success!");
  82. return true;
  83. }
  84. }
  85. else
  86. {
  87. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.System, $"Ethercat Initial Fail!");
  88. }
  89. return false;
  90. }
  91. public bool StarteEthercat()
  92. {
  93. Int32 ret = 0;
  94. Int32 Board_ID = v_board_id;
  95. ret = APS168.APS_start_field_bus(Board_ID, BUS_No, v_StartAxisID);
  96. if (ret != 0)
  97. {
  98. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.System, $"Ethercat Start field bus Fail");
  99. return false;
  100. }
  101. else
  102. {
  103. LOG.Write(eEvent.EV_DEVICE_INFO, ModuleName.System, $"Ethercat Start field bus Success");
  104. return true;
  105. }
  106. }
  107. public override bool Initialize()
  108. {
  109. if (SC.GetValue<bool>("System.IsEnableEthercat"))
  110. {
  111. if (InitEthercat())
  112. {
  113. if (StarteEthercat())
  114. {
  115. startEthercatOK = true;
  116. }
  117. }
  118. }
  119. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  120. {
  121. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMA.ChamberType");
  122. InitPM(ModuleName.PMA, jetChamber);
  123. }
  124. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  125. {
  126. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMB.ChamberType");
  127. InitPM(ModuleName.PMB, jetChamber);
  128. }
  129. if (ModuleHelper.IsInstalled(ModuleName.PMC))
  130. {
  131. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMC.ChamberType");
  132. InitPM(ModuleName.PMC, jetChamber);
  133. }
  134. if (ModuleHelper.IsInstalled(ModuleName.PMD))
  135. {
  136. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMD.ChamberType");
  137. InitPM(ModuleName.PMD, jetChamber);
  138. }
  139. if (ModuleHelper.IsInstalled(ModuleName.TM))
  140. {
  141. if (RtInstance.ConfigType == ConfigType.Kepler2200 || RtInstance.ConfigType == ConfigType.Kepler2300)
  142. InitTM(ModuleName.TM);
  143. if (RtInstance.ConfigType == ConfigType.VenusSE)
  144. {
  145. InitSETM(ModuleName.TM);
  146. }
  147. if (RtInstance.ConfigType == ConfigType.VenusDE)
  148. {
  149. InitDETM(ModuleName.TM);
  150. }
  151. }
  152. AddCustomModuleDevice(new KeplerSignalTower("System", "SignalTower"));
  153. OP.Subscribe("DeviceOperation", this.Invoke);
  154. return true;
  155. }
  156. private void InitPM(ModuleName mod, JetChamber jetChamber)
  157. {
  158. device_model_file = PathManager.GetCfgDir() + "PM" + "\\" + jetChamber.ToString() + "\\" + $"{jetChamber.ToString()}DeviceModel.xml";
  159. Initialize(device_model_file, jetChamber.ToString(), mod, mod.ToString());
  160. switch (jetChamber)
  161. {
  162. case JetChamber.Kepler2300:
  163. AddAdixenTurboPump(mod);
  164. AddEPD(mod);
  165. AddPendulumValve(mod);
  166. AddChiller(ChillerType.InnerChiller, mod);
  167. AddChiller(ChillerType.OuterChiller, mod);
  168. AddChiller(ChillerType.TopChiller, mod);
  169. AddMatch(mod);
  170. AddBiasMatch(mod);
  171. AddRF(mod);
  172. AddBiasRF(mod);
  173. AddDryPump(mod);
  174. AddCustomDevice(new JetKepler2300PM(mod));
  175. break;
  176. case JetChamber.Kepler2200A:
  177. AddAdixenTurboPump(mod);
  178. AddPendulumValve(mod,PressureType.Pa);
  179. AddMatch(mod);
  180. AddRF(mod);
  181. AddDryPump(mod);
  182. AddCustomDevice(new JetKepler2200APM(mod));
  183. break;
  184. case JetChamber.Kepler2200B:
  185. AddAdixenTurboPump(mod);
  186. AddPendulumValve(mod, PressureType.Pa);
  187. AddMatch(mod);
  188. AddRF(mod);
  189. AddDryPump(mod);
  190. AddRFBox(mod);
  191. AddCustomDevice(new JetKepler2200BPM(mod));
  192. break;
  193. case JetChamber.VenusSE:
  194. AddEscHighVoltage(mod);
  195. AddAdixenTurboPump(mod);
  196. AddEPD(mod);
  197. AddPendulumValve(mod);
  198. AddChiller(ChillerType.Chiller, mod);
  199. AddMatch(mod);
  200. AddBiasMatch(mod);
  201. AddRF(mod);
  202. AddBiasRF(mod);
  203. AddDryPump(mod);
  204. AddCustomDevice(new JetVenusSEPM(mod));
  205. break;
  206. case JetChamber.VenusDE:
  207. AddEscHighVoltage(mod);
  208. AddAdixenTurboPump(mod);
  209. AddEPD(mod);
  210. AddPendulumValve(mod);
  211. AddChiller(ChillerType.Chiller, mod);
  212. AddChiller(ChillerType.WallChiller, mod);
  213. AddMatch(mod);
  214. AddBiasMatch(mod);
  215. //AddRF(mod);
  216. AddBiasRF(mod);
  217. AddDryPump(mod);
  218. AddCustomDevice(new JetVenusDEPM(mod));
  219. break;
  220. }
  221. }
  222. private void AddEPD(ModuleName mod)
  223. {
  224. if (SC.GetValue<bool>($"{mod}.EPD.IsEnabled") == true)
  225. {
  226. if (SC.GetValue<int>($"{mod}.EPD.EPDType") == 0)
  227. {
  228. AddCustomModuleDevice(new EPDClient(mod));
  229. }
  230. else
  231. {
  232. AddCustomModuleDevice(new EPDDevice(mod));
  233. }
  234. }
  235. }
  236. private void AddAdixenTurboPump(ModuleName mod)
  237. {
  238. AddCustomModuleDevice(new AdixenTurboPump(mod));
  239. }
  240. private void AddPendulumValve(ModuleName mod,PressureType pressureType=PressureType.mTorr)
  241. {
  242. AddCustomModuleDevice(new PendulumValve(mod,pressureType));
  243. }
  244. private void AddChiller(ChillerType chillerType, ModuleName mod)
  245. {
  246. if (SC.GetValue<bool>($"{mod}.{chillerType}.EnableChiller") &&
  247. SC.GetValue<int>($"{mod}.{chillerType}.CommunicationType") == (int)CommunicationType.RS232)
  248. {
  249. if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.SMC)
  250. {
  251. AddCustomModuleDevice(new SMCChiller(mod, chillerType.ToString()));
  252. }
  253. else if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.AIRSYS)
  254. {
  255. AddCustomModuleDevice(new AIRSYSChiller(mod, chillerType.ToString()));
  256. }
  257. }
  258. else if (SC.GetValue<bool>($"{mod}.{chillerType}.EnableChiller") &&
  259. SC.GetValue<int>($"{mod}.{chillerType}.CommunicationType") == (int)CommunicationType.RS485 &&
  260. SC.GetValue<bool>($"{mod}.{chillerType}.ShareCOM"))
  261. {
  262. if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.SMC)
  263. {
  264. AddCustomModuleDevice(new SMCShareChiller(mod, chillerType.ToString()));
  265. }
  266. //else if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.AIRSYS)
  267. //{
  268. // AddCustomModuleDevice(new AIRSYSChiller(mod, chillerType.ToString()));
  269. //}
  270. }
  271. }
  272. private void AddMatch(ModuleName mod)
  273. {
  274. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  275. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  276. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  277. {
  278. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  279. }
  280. else if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  281. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  282. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.Revtech)
  283. {
  284. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.Match, MatchCommunicationType.RS232));
  285. }
  286. else if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  287. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.Ethernet &&
  288. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.Revtech)
  289. {
  290. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.Match, MatchCommunicationType.Ethernet));
  291. }
  292. }
  293. private void AddRFBox(ModuleName mod)
  294. {
  295. if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  296. SC.GetValue<int>($"{mod}.RFBox.CommunicationType") == (int)CommunicationType.RS232 &&
  297. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.AdTec)
  298. {
  299. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.RFBox));
  300. }
  301. else if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  302. SC.GetValue<int>($"{mod}.RFBox.CommunicationType") == (int)CommunicationType.RS232 &&
  303. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.Revtech)
  304. {
  305. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.RFBox, MatchCommunicationType.RS232));
  306. }
  307. else if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  308. SC.GetValue<int>($"{mod}.RFBox.CommunicationType") == (int)CommunicationType.Ethernet &&
  309. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.Revtech)
  310. {
  311. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.RFBox, MatchCommunicationType.Ethernet));
  312. }
  313. else if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  314. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.Lz_Ethercat && startEthercatOK)
  315. {
  316. AddCustomModuleDevice(new LzMatch_Ethercat(mod, Venus_Core.VenusDevice.RFBox, v_board_id));
  317. }
  318. }
  319. private void AddBiasMatch(ModuleName mod)
  320. {
  321. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  322. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  323. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  324. {
  325. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  326. }
  327. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  328. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  329. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  330. {
  331. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.BiasMatch, MatchCommunicationType.RS232));
  332. }
  333. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  334. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet &&
  335. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  336. {
  337. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.BiasMatch, MatchCommunicationType.Ethernet));
  338. }
  339. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  340. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Lz_Ethercat && startEthercatOK)
  341. {
  342. AddCustomModuleDevice(new LzMatch_Ethercat(mod, Venus_Core.VenusDevice.BiasMatch, v_board_id));
  343. }
  344. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  345. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  346. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Tru)
  347. {
  348. AddCustomModuleDevice(new TruPlasmaMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  349. }
  350. }
  351. private void AddRF(ModuleName mod)
  352. {
  353. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  354. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  355. {
  356. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  357. }
  358. }
  359. private void AddBiasRF(ModuleName mod)
  360. {
  361. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  362. {
  363. if (SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  364. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  365. {
  366. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  367. }
  368. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  369. {
  370. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  371. }
  372. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Truplasma)
  373. {
  374. AddCustomModuleDevice(new TruPlasmaRF(mod, Venus_Core.VenusDevice.BiasRf));
  375. }
  376. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Truplasma_Ethercat && startEthercatOK)
  377. {
  378. AddCustomModuleDevice(new TruPlasmaRF_Ethercat(mod, Venus_Core.VenusDevice.BiasRf, v_board_id));
  379. }
  380. }
  381. }
  382. private void AddDryPump(ModuleName mod)
  383. {
  384. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  385. {
  386. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  387. {
  388. AddCustomModuleDevice(new SkyPump(mod));
  389. }
  390. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  391. {
  392. AddCustomModuleDevice(new EdwardsPump(mod));
  393. }
  394. }
  395. }
  396. private void AddEscHighVoltage(ModuleName mod)
  397. {
  398. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  399. }
  400. private void InitTM(ModuleName mod)
  401. {
  402. Initialize(device_model_file_MF, mod.ToString(), mod, mod.ToString());
  403. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  404. {
  405. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  406. {
  407. AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  408. }
  409. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  410. {
  411. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLA));
  412. }
  413. }
  414. if (SC.GetValue<int>($"LLB.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  415. {
  416. if (SC.GetValue<int>($"LLB.DryPump.MFG") == (int)DryPumpMFG.SKY)
  417. {
  418. AddCustomModuleDevice(new SkyPump(ModuleName.LLB));
  419. }
  420. else if (SC.GetValue<int>($"LLB.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  421. {
  422. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLB));
  423. }
  424. }
  425. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  426. {
  427. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  428. {
  429. AddCustomModuleDevice(new SkyPump(mod));
  430. }
  431. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  432. {
  433. AddCustomModuleDevice(new EdwardsPump(mod));
  434. }
  435. }
  436. //AddCustomModuleDevice(new SkyPump(mod));
  437. //AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  438. AddCustomDevice(new JetTM());
  439. }
  440. private void InitSETM(ModuleName mod)
  441. {
  442. Initialize(device_model_file_SEMF, mod.ToString(), mod, mod.ToString());
  443. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  444. {
  445. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  446. {
  447. AddCustomModuleDevice(new SkyPump(mod));
  448. }
  449. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  450. {
  451. AddCustomModuleDevice(new EdwardsPump(mod));
  452. }
  453. }
  454. AddCustomDevice(new HongHuTM());
  455. }
  456. private void InitDETM(ModuleName mod)
  457. {
  458. Initialize(device_model_file_DEMF, mod.ToString(), mod, mod.ToString());
  459. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  460. {
  461. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  462. {
  463. AddCustomModuleDevice(new SkyPump(mod));
  464. }
  465. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  466. {
  467. AddCustomModuleDevice(new EdwardsPump(mod));
  468. }
  469. }
  470. if (SC.GetValue<int>($"VCEA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  471. {
  472. if (SC.GetValue<int>($"VCEA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  473. {
  474. AddCustomModuleDevice(new SkyPump(ModuleName.VCEA));
  475. }
  476. else if (SC.GetValue<int>($"VCEA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  477. {
  478. AddCustomModuleDevice(new EdwardsPump(ModuleName.VCEA));
  479. }
  480. }
  481. AddCustomDevice(new HongHuDETM());
  482. }
  483. private WaferSize MapWaferSize(int value)
  484. {
  485. switch (value)
  486. {
  487. case 3: return WaferSize.WS3;
  488. case 4: return WaferSize.WS4;
  489. case 6: return WaferSize.WS6;
  490. case 8: return WaferSize.WS8;
  491. }
  492. return WaferSize.WS0;
  493. }
  494. private bool Invoke(string arg1, object[] args)
  495. {
  496. string name = (string)args[0];
  497. string func = (string)args[1];
  498. object[] param = new object[args.Length - 2];
  499. for (int i = 2; i < args.Length; i++)
  500. param[i - 2] = args[i].ToString();
  501. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  502. return true;
  503. }
  504. public void RTExitPMEvent()
  505. {
  506. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  507. {
  508. DEVICE.GetDevice<JetPMBase>("PMA")?.RTCloseEvent();
  509. }
  510. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  511. {
  512. DEVICE.GetDevice<JetPMBase>("PMB")?.RTCloseEvent();
  513. }
  514. if (ModuleHelper.IsInstalled(ModuleName.PMC))
  515. {
  516. DEVICE.GetDevice<JetPMBase>("PMC")?.RTCloseEvent();
  517. }
  518. if (ModuleHelper.IsInstalled(ModuleName.PMD))
  519. {
  520. DEVICE.GetDevice<JetPMBase>("PMD")?.RTCloseEvent();
  521. }
  522. }
  523. }
  524. }