DeviceManager.cs 6.4 KB

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