DeviceManager.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. namespace Venus_RT.Instances
  14. {
  15. public class DeviceEntity : DeviceEntityT<DeviceManager>
  16. {
  17. public DeviceEntity()
  18. {
  19. }
  20. }
  21. public class DeviceManager : DeviceManagerBase
  22. {
  23. private readonly string device_model_file;
  24. private readonly string device_model_file_MF;
  25. public DeviceManager()
  26. {
  27. JetChamber jetChamber = (JetChamber)(SC.GetValue<int>("System.ChamberSelect"));
  28. if (jetChamber == JetChamber.Venus)
  29. {
  30. device_model_file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName);
  31. }
  32. else if (jetChamber == JetChamber.Kepler)
  33. {
  34. device_model_file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", "DeviceModelKepler.xml");
  35. }
  36. device_model_file_MF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName_MF);
  37. }
  38. public override bool Initialize()
  39. {
  40. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  41. InitPM(ModuleName.PMA);
  42. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  43. InitPM(ModuleName.PMB);
  44. if (ModuleHelper.IsInstalled(ModuleName.TM))
  45. InitTM(ModuleName.TM);
  46. JetChamber jetChamber = (JetChamber)(SC.GetValue<int>("System.ChamberSelect"));
  47. if (jetChamber == JetChamber.Venus)
  48. {
  49. AddCustomModuleDevice(new VenusSignalTower("System", "SignalTower"));
  50. }
  51. OP.Subscribe("DeviceOperation", this.Invoke);
  52. return true;
  53. }
  54. private void InitPM(ModuleName mod)
  55. {
  56. Initialize(device_model_file, RtInstance.SystemName, mod, mod.ToString());
  57. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  58. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  59. {
  60. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  61. }
  62. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  63. {
  64. if(SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  65. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  66. {
  67. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  68. }
  69. else if(SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  70. {
  71. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  72. }
  73. }
  74. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  75. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  76. {
  77. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  78. {
  79. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  80. }
  81. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  82. {
  83. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  84. }
  85. }
  86. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  87. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  88. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  89. {
  90. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  91. }
  92. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  93. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  94. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  95. {
  96. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  97. }
  98. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  99. {
  100. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  101. {
  102. AddCustomModuleDevice(new SkyPump(mod));
  103. }
  104. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  105. {
  106. AddCustomModuleDevice(new EdwardsPump(mod));
  107. }
  108. }
  109. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  110. AddCustomModuleDevice(new AdixenTurboPump(mod));
  111. AddCustomModuleDevice(new PendulumValve(mod));
  112. AddCustomModuleDevice(new EPDClient(mod));
  113. //AddCustomDevice(new JetPM(mod));
  114. JetChamber jetChamber = (JetChamber)(SC.GetValue<int>("System.ChamberSelect"));//Venus or Kepler
  115. switch (jetChamber)
  116. {
  117. case JetChamber.Venus:
  118. AddCustomDevice(new JetVenusPM(mod));
  119. break;
  120. case JetChamber.Kepler:
  121. AddCustomDevice(new JetKeplerPM(mod));
  122. break;
  123. }
  124. }
  125. private void InitTM(ModuleName mod)
  126. {
  127. Initialize(device_model_file_MF, RtInstance.SystemName, mod, mod.ToString());
  128. AddCustomDevice(new JetTM());
  129. }
  130. private WaferSize MapWaferSize(int value)
  131. {
  132. switch (value)
  133. {
  134. case 3: return WaferSize.WS3;
  135. case 4: return WaferSize.WS4;
  136. case 6: return WaferSize.WS6;
  137. case 8: return WaferSize.WS8;
  138. }
  139. return WaferSize.WS0;
  140. }
  141. private bool Invoke(string arg1, object[] args)
  142. {
  143. string name = (string)args[0];
  144. string func = (string)args[1];
  145. object[] param = new object[args.Length - 2];
  146. for (int i = 2; i < args.Length; i++)
  147. param[i - 2] = args[i].ToString();
  148. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  149. return true;
  150. }
  151. }
  152. }