DeviceManager.cs 30 KB

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