DeviceManager.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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 MECF.Framework.Common.Equipment;
  9. using Venus_RT.Modules;
  10. using Venus_RT.Devices;
  11. using Venus_RT.Devices.EPD;
  12. using Venus_Core;
  13. using Aitex.Common.Util;
  14. using System.Reflection;
  15. namespace Venus_RT.Instances
  16. {
  17. public class DeviceEntity : DeviceEntityT<DeviceManager>
  18. {
  19. public DeviceEntity()
  20. {
  21. }
  22. }
  23. public class DeviceManager : DeviceManagerBase
  24. {
  25. private string device_model_file;
  26. private readonly string device_model_file_MF;
  27. public DeviceManager()
  28. {
  29. //switch (RtInstance.CurrentChamber)
  30. //{
  31. // case JetChamber.Venus:
  32. // device_model_file= PathManager.GetCfgDir() + RtInstance.CurrentChamber.ToString() + "\\" + "DeviceModelVenus.xml.xml";
  33. // break;
  34. // case JetChamber.Kepler2300:
  35. // case JetChamber.Kepler2200A:
  36. // case JetChamber.Kepler2200B:
  37. // device_model_file = PathManager.GetCfgDir() + RtInstance.CurrentChamber.ToString() + "\\" + "DeviceModelKepler.xml.xml";
  38. // break;
  39. //}
  40. device_model_file_MF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName_MF);
  41. }
  42. public override bool Initialize()
  43. {
  44. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  45. {
  46. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMA.ChamberType");
  47. InitPM(ModuleName.PMA, jetChamber);
  48. }
  49. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  50. {
  51. JetChamber jetChamber = (JetChamber)SC.GetValue<int>("PMB.ChamberType");
  52. InitPM(ModuleName.PMB, jetChamber);
  53. }
  54. if (ModuleHelper.IsInstalled(ModuleName.TM))
  55. InitTM(ModuleName.TM);
  56. AddCustomModuleDevice(new VenusSignalTower("System", "SignalTower"));
  57. OP.Subscribe("DeviceOperation", this.Invoke);
  58. return true;
  59. }
  60. private void InitPM(ModuleName mod,JetChamber jetChamber)
  61. {
  62. //switch (jetChamber)
  63. //{
  64. // case JetChamber.Venus:
  65. // device_model_file = PathManager.GetCfgDir() +"PM"+"\\"+ jetChamber.ToString() + "\\" + "VenusDeviceModel.xml";
  66. // break;
  67. // case JetChamber.Kepler2300:
  68. // device_model_file = PathManager.GetCfgDir() + "PM" + "\\" + jetChamber.ToString() + "\\" + "Kepler2300DeviceModel.xml";
  69. // break;
  70. // case JetChamber.Kepler2200A:
  71. // case JetChamber.Kepler2200B:
  72. // device_model_file = PathManager.GetCfgDir() + jetChamber.ToString() + "\\" + "DeviceModelKepler.xml";
  73. // break;
  74. // default:
  75. // break;
  76. //}
  77. device_model_file = PathManager.GetCfgDir() + "PM" + "\\" + jetChamber.ToString() + "\\" + $"{jetChamber.ToString()}DeviceModel.xml";
  78. Initialize(device_model_file, jetChamber.ToString(), mod, mod.ToString());
  79. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  80. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  81. {
  82. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  83. }
  84. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  85. {
  86. if(SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  87. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  88. {
  89. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  90. }
  91. else if(SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  92. {
  93. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  94. }
  95. }
  96. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  97. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  98. {
  99. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  100. {
  101. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  102. }
  103. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  104. {
  105. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  106. }
  107. }
  108. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  109. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  110. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  111. {
  112. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  113. }
  114. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  115. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  116. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  117. {
  118. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  119. }
  120. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  121. {
  122. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  123. {
  124. AddCustomModuleDevice(new SkyPump(mod));
  125. }
  126. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  127. {
  128. AddCustomModuleDevice(new EdwardsPump(mod));
  129. }
  130. }
  131. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  132. AddCustomModuleDevice(new AdixenTurboPump(mod));
  133. AddCustomModuleDevice(new PendulumValve(mod));
  134. AddCustomModuleDevice(new EPDClient(mod));
  135. //AddCustomDevice(new JetPM(mod));
  136. switch (jetChamber)
  137. {
  138. case JetChamber.Venus:
  139. AddCustomDevice(new JetVenusPM(mod));
  140. break;
  141. case JetChamber.Kepler2300:
  142. case JetChamber.Kepler2200A:
  143. case JetChamber.Kepler2200B:
  144. AddCustomDevice(new JetKepler2300PM(mod));
  145. break;
  146. }
  147. }
  148. private void InitTM(ModuleName mod)
  149. {
  150. Initialize(device_model_file_MF, mod.ToString(), mod, mod.ToString());
  151. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  152. {
  153. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  154. {
  155. AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  156. }
  157. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  158. {
  159. AddCustomModuleDevice(new EdwardsPump(ModuleName.LLA));
  160. }
  161. }
  162. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  163. {
  164. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  165. {
  166. AddCustomModuleDevice(new SkyPump(mod));
  167. }
  168. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  169. {
  170. AddCustomModuleDevice(new EdwardsPump(mod));
  171. }
  172. }
  173. //AddCustomModuleDevice(new SkyPump(mod));
  174. //AddCustomModuleDevice(new SkyPump(ModuleName.LLA));
  175. AddCustomDevice(new JetTM());
  176. }
  177. private WaferSize MapWaferSize(int value)
  178. {
  179. switch (value)
  180. {
  181. case 3: return WaferSize.WS3;
  182. case 4: return WaferSize.WS4;
  183. case 6: return WaferSize.WS6;
  184. case 8: return WaferSize.WS8;
  185. }
  186. return WaferSize.WS0;
  187. }
  188. private bool Invoke(string arg1, object[] args)
  189. {
  190. string name = (string)args[0];
  191. string func = (string)args[1];
  192. object[] param = new object[args.Length - 2];
  193. for (int i = 2; i < args.Length; i++)
  194. param[i - 2] = args[i].ToString();
  195. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  196. return true;
  197. }
  198. }
  199. }