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. if(RtInstance.ConfigType != ConfigType.VenusDE && RtInstance.ConfigType != ConfigType.VenusSE)
  153. AddCustomModuleDevice(new KeplerSignalTower("System", "SignalTower"));
  154. OP.Subscribe("DeviceOperation", this.Invoke);
  155. return true;
  156. }
  157. private void InitPM(ModuleName mod, JetChamber jetChamber)
  158. {
  159. device_model_file = PathManager.GetCfgDir() + "PM" + "\\" + jetChamber.ToString() + "\\" + $"{jetChamber.ToString()}DeviceModel.xml";
  160. Initialize(device_model_file, jetChamber.ToString(), mod, mod.ToString());
  161. switch (jetChamber)
  162. {
  163. case JetChamber.Kepler2300:
  164. AddAdixenTurboPump(mod);
  165. AddEPD(mod);
  166. AddPendulumValve(mod);
  167. AddChiller(ChillerType.InnerChiller, mod);
  168. AddChiller(ChillerType.OuterChiller, mod);
  169. AddChiller(ChillerType.TopChiller, mod);
  170. AddMatch(mod);
  171. AddBiasMatch(mod);
  172. AddRF(mod);
  173. AddBiasRF(mod);
  174. AddDryPump(mod);
  175. AddCustomDevice(new JetKepler2300PM(mod));
  176. break;
  177. case JetChamber.Kepler2200A:
  178. AddAdixenTurboPump(mod);
  179. AddPendulumValve(mod,PressureType.Pa);
  180. AddMatch(mod);
  181. AddRF(mod);
  182. AddDryPump(mod);
  183. AddCustomDevice(new JetKepler2200APM(mod));
  184. break;
  185. case JetChamber.Kepler2200B:
  186. AddAdixenTurboPump(mod);
  187. AddPendulumValve(mod, PressureType.Pa);
  188. AddMatch(mod);
  189. AddRF(mod);
  190. AddDryPump(mod);
  191. AddRFBox(mod);
  192. AddCustomDevice(new JetKepler2200BPM(mod));
  193. break;
  194. case JetChamber.VenusSE:
  195. AddEscHighVoltage(mod);
  196. AddAdixenTurboPump(mod);
  197. AddEPD(mod);
  198. AddPendulumValve(mod);
  199. AddChiller(ChillerType.Chiller, mod);
  200. AddMatch(mod);
  201. AddBiasMatch(mod);
  202. AddRF(mod);
  203. AddBiasRF(mod);
  204. AddDryPump(mod);
  205. AddCustomDevice(new JetVenusSEPM(mod));
  206. break;
  207. case JetChamber.VenusDE:
  208. AddEscHighVoltage(mod);
  209. AddAdixenTurboPump(mod);
  210. AddEPD(mod);
  211. AddPendulumValve(mod);
  212. AddChiller(ChillerType.Chiller, mod);
  213. AddChiller(ChillerType.WallChiller, mod);
  214. AddMatch(mod);
  215. AddBiasMatch(mod);
  216. //AddRF(mod);
  217. AddBiasRF(mod);
  218. AddDryPump(mod);
  219. AddCustomDevice(new JetVenusDEPM(mod));
  220. break;
  221. }
  222. }
  223. private void AddEPD(ModuleName mod)
  224. {
  225. if (SC.GetValue<bool>($"{mod}.EPD.IsEnabled") == true)
  226. {
  227. if (SC.GetValue<int>($"{mod}.EPD.EPDType") == 0)
  228. {
  229. AddCustomModuleDevice(new EPDClient(mod));
  230. }
  231. else
  232. {
  233. AddCustomModuleDevice(new EPDDevice(mod));
  234. }
  235. }
  236. }
  237. private void AddAdixenTurboPump(ModuleName mod)
  238. {
  239. AddCustomModuleDevice(new AdixenTurboPump(mod));
  240. }
  241. private void AddPendulumValve(ModuleName mod,PressureType pressureType=PressureType.mTorr)
  242. {
  243. AddCustomModuleDevice(new PendulumValve(mod,pressureType));
  244. }
  245. private void AddChiller(ChillerType chillerType, ModuleName mod)
  246. {
  247. if (SC.GetValue<bool>($"{mod}.{chillerType}.EnableChiller") &&
  248. SC.GetValue<int>($"{mod}.{chillerType}.CommunicationType") == (int)CommunicationType.RS232)
  249. {
  250. if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.SMC)
  251. {
  252. AddCustomModuleDevice(new SMCChiller(mod, chillerType.ToString()));
  253. }
  254. else if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.AIRSYS)
  255. {
  256. AddCustomModuleDevice(new AIRSYSChiller(mod, chillerType.ToString()));
  257. }
  258. }
  259. else if (SC.GetValue<bool>($"{mod}.{chillerType}.EnableChiller") &&
  260. SC.GetValue<int>($"{mod}.{chillerType}.CommunicationType") == (int)CommunicationType.RS485 &&
  261. SC.GetValue<bool>($"{mod}.{chillerType}.ShareCOM"))
  262. {
  263. if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.SMC)
  264. {
  265. AddCustomModuleDevice(new SMCShareChiller(mod, chillerType.ToString()));
  266. }
  267. //else if (SC.GetValue<int>($"{mod}.{chillerType}.MFG") == (int)ChillerMFG.AIRSYS)
  268. //{
  269. // AddCustomModuleDevice(new AIRSYSChiller(mod, chillerType.ToString()));
  270. //}
  271. }
  272. }
  273. private void AddMatch(ModuleName mod)
  274. {
  275. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  276. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  277. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  278. {
  279. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  280. }
  281. else if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  282. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  283. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.Revtech)
  284. {
  285. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.Match, MatchCommunicationType.RS232));
  286. }
  287. else if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  288. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.Ethernet &&
  289. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.Revtech)
  290. {
  291. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.Match, MatchCommunicationType.Ethernet));
  292. }
  293. }
  294. private void AddRFBox(ModuleName mod)
  295. {
  296. if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  297. SC.GetValue<int>($"{mod}.RFBox.CommunicationType") == (int)CommunicationType.RS232 &&
  298. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.AdTec)
  299. {
  300. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.RFBox));
  301. }
  302. else if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  303. SC.GetValue<int>($"{mod}.RFBox.CommunicationType") == (int)CommunicationType.RS232 &&
  304. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.Revtech)
  305. {
  306. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.RFBox, MatchCommunicationType.RS232));
  307. }
  308. else if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  309. SC.GetValue<int>($"{mod}.RFBox.CommunicationType") == (int)CommunicationType.Ethernet &&
  310. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.Revtech)
  311. {
  312. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.RFBox, MatchCommunicationType.Ethernet));
  313. }
  314. else if (SC.GetValue<bool>($"{mod}.RFBox.EnableMatch") &&
  315. SC.GetValue<int>($"{mod}.RFBox.MFG") == (int)MatchMFG.Lz_Ethercat && startEthercatOK)
  316. {
  317. AddCustomModuleDevice(new LzMatch_Ethercat(mod, Venus_Core.VenusDevice.RFBox, v_board_id));
  318. }
  319. }
  320. private void AddBiasMatch(ModuleName mod)
  321. {
  322. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  323. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  324. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  325. {
  326. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  327. }
  328. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  329. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  330. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  331. {
  332. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.BiasMatch, MatchCommunicationType.RS232));
  333. }
  334. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  335. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet &&
  336. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  337. {
  338. AddCustomModuleDevice(new RevtechMatch(mod, Venus_Core.VenusDevice.BiasMatch, MatchCommunicationType.Ethernet));
  339. }
  340. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  341. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Lz_Ethercat && startEthercatOK)
  342. {
  343. AddCustomModuleDevice(new LzMatch_Ethercat(mod, Venus_Core.VenusDevice.BiasMatch, v_board_id));
  344. }
  345. else if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  346. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  347. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Tru)
  348. {
  349. AddCustomModuleDevice(new TruPlasmaMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  350. }
  351. }
  352. private void AddRF(ModuleName mod)
  353. {
  354. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  355. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  356. {
  357. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  358. }
  359. }
  360. private void AddBiasRF(ModuleName mod)
  361. {
  362. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  363. {
  364. if (SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  365. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  366. {
  367. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  368. }
  369. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  370. {
  371. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  372. }
  373. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Truplasma)
  374. {
  375. AddCustomModuleDevice(new TruPlasmaRF(mod, Venus_Core.VenusDevice.BiasRf));
  376. }
  377. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Truplasma_Ethercat && startEthercatOK)
  378. {
  379. AddCustomModuleDevice(new TruPlasmaRF_Ethercat(mod, Venus_Core.VenusDevice.BiasRf, v_board_id));
  380. }
  381. }
  382. }
  383. private void AddDryPump(ModuleName mod)
  384. {
  385. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  386. {
  387. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  388. {
  389. AddCustomModuleDevice(new SkyPump(mod));
  390. }
  391. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  392. {
  393. AddCustomModuleDevice(new EdwardsPump(mod));
  394. }
  395. }
  396. }
  397. private void AddEscHighVoltage(ModuleName mod)
  398. {
  399. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  400. }
  401. private void InitTM(ModuleName mod)
  402. {
  403. Initialize(device_model_file_MF, mod.ToString(), mod, mod.ToString());
  404. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  405. {
  406. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  407. {
  408. AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  409. }
  410. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  411. {
  412. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLA));
  413. }
  414. }
  415. if (SC.GetValue<int>($"LLB.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  416. {
  417. if (SC.GetValue<int>($"LLB.DryPump.MFG") == (int)DryPumpMFG.SKY)
  418. {
  419. AddCustomModuleDevice(new SkyPump(ModuleName.LLB));
  420. }
  421. else if (SC.GetValue<int>($"LLB.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  422. {
  423. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLB));
  424. }
  425. }
  426. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  427. {
  428. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  429. {
  430. AddCustomModuleDevice(new SkyPump(mod));
  431. }
  432. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  433. {
  434. AddCustomModuleDevice(new EdwardsPump(mod));
  435. }
  436. }
  437. //AddCustomModuleDevice(new SkyPump(mod));
  438. //AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  439. AddCustomDevice(new JetTM());
  440. }
  441. private void InitSETM(ModuleName mod)
  442. {
  443. Initialize(device_model_file_SEMF, mod.ToString(), mod, mod.ToString());
  444. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  445. {
  446. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  447. {
  448. AddCustomModuleDevice(new SkyPump(mod));
  449. }
  450. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  451. {
  452. AddCustomModuleDevice(new EdwardsPump(mod));
  453. }
  454. }
  455. AddCustomDevice(new HongHuTM());
  456. }
  457. private void InitDETM(ModuleName mod)
  458. {
  459. Initialize(device_model_file_DEMF, mod.ToString(), mod, mod.ToString());
  460. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  461. {
  462. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  463. {
  464. AddCustomModuleDevice(new SkyPump(mod));
  465. }
  466. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  467. {
  468. AddCustomModuleDevice(new EdwardsPump(mod));
  469. }
  470. }
  471. if (SC.GetValue<int>($"VCEA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  472. {
  473. if (SC.GetValue<int>($"VCEA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  474. {
  475. AddCustomModuleDevice(new SkyPump(ModuleName.VCEA));
  476. }
  477. else if (SC.GetValue<int>($"VCEA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  478. {
  479. AddCustomModuleDevice(new EdwardsPump(ModuleName.VCEA));
  480. }
  481. }
  482. AddCustomDevice(new HongHuDETM());
  483. }
  484. private WaferSize MapWaferSize(int value)
  485. {
  486. switch (value)
  487. {
  488. case 3: return WaferSize.WS3;
  489. case 4: return WaferSize.WS4;
  490. case 6: return WaferSize.WS6;
  491. case 8: return WaferSize.WS8;
  492. }
  493. return WaferSize.WS0;
  494. }
  495. private bool Invoke(string arg1, object[] args)
  496. {
  497. string name = (string)args[0];
  498. string func = (string)args[1];
  499. object[] param = new object[args.Length - 2];
  500. for (int i = 2; i < args.Length; i++)
  501. param[i - 2] = args[i].ToString();
  502. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  503. return true;
  504. }
  505. public void RTExitPMEvent()
  506. {
  507. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  508. {
  509. DEVICE.GetDevice<JetPMBase>("PMA")?.RTCloseEvent();
  510. }
  511. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  512. {
  513. DEVICE.GetDevice<JetPMBase>("PMB")?.RTCloseEvent();
  514. }
  515. if (ModuleHelper.IsInstalled(ModuleName.PMC))
  516. {
  517. DEVICE.GetDevice<JetPMBase>("PMC")?.RTCloseEvent();
  518. }
  519. if (ModuleHelper.IsInstalled(ModuleName.PMD))
  520. {
  521. DEVICE.GetDevice<JetPMBase>("PMD")?.RTCloseEvent();
  522. }
  523. }
  524. }
  525. }